From aaf798428b9306ceb66d3587e184d9dba20aba60 Mon Sep 17 00:00:00 2001 From: Christ Date: Wed, 8 Jul 2026 04:07:03 +0800 Subject: [PATCH] feat: improve login renewal and risk verification --- docs/login-renewal-risk-control-plan.md | 114 ++++ frontend/components/AccountList.tsx | 15 +- internal/adapter/adapter.go | 51 +- internal/adapter/adapter_test.go | 45 +- internal/browser/cookierenew.go | 59 ++ internal/engine/account.go | 140 ++++- internal/engine/account_extra_test.go | 20 +- internal/engine/engine_test.go | 26 +- .../webui/static/assets/index-Bzj0nqFG.js | 502 ++++++++++++++++++ .../webui/static/assets/index-CjhArDrm.css | 1 + internal/webui/static/index.html | 4 +- internal/xianyu/mtop/client.go | 55 +- internal/xianyu/mtop/client_test.go | 2 +- internal/xianyu/mtop/login_status.go | 136 +++++ internal/xianyu/mtop/login_status_test.go | 72 +++ internal/xianyu/mtop/token.go | 24 +- internal/xianyu/qrlogin/client.go | 59 +- internal/xianyu/qrlogin/client_test.go | 58 ++ internal/xianyu/qrlogin/face_verification.go | 350 ++++++++++++ internal/xianyu/renew/service.go | 337 ++++++++++++ internal/xianyu/renew/service_test.go | 122 +++++ 21 files changed, 2067 insertions(+), 125 deletions(-) create mode 100644 docs/login-renewal-risk-control-plan.md create mode 100644 internal/browser/cookierenew.go create mode 100644 internal/webui/static/assets/index-Bzj0nqFG.js create mode 100644 internal/webui/static/assets/index-CjhArDrm.css create mode 100644 internal/xianyu/mtop/login_status.go create mode 100644 internal/xianyu/mtop/login_status_test.go create mode 100644 internal/xianyu/qrlogin/face_verification.go create mode 100644 internal/xianyu/renew/service.go create mode 100644 internal/xianyu/renew/service_test.go diff --git a/docs/login-renewal-risk-control-plan.md b/docs/login-renewal-risk-control-plan.md new file mode 100644 index 0000000..6d20e50 --- /dev/null +++ b/docs/login-renewal-risk-control-plan.md @@ -0,0 +1,114 @@ +# 登录续期与风控能力补齐计划 + +## 目标 + +参考 `zhinianboke/xianyu-auto-reply` 的实现,把当前项目缺少的登录态续期、MTOP 风控识别、扫码人脸验证能力补齐。改造重点是提升账号长期在线能力和风控状态的可恢复性,同时保持 `xianyu-go` 现有单进程架构清晰、可测试、可回滚。 + +## 非目标 + +- 不实现绕过人脸识别。人脸验证必须由用户在手机端完成。 +- 不把浏览器截图作为主验证方式。截图仅保留为兜底调试手段。 +- 不在第一版引入跨服务架构;续期和验证能力仍在当前 Go 进程内闭环。 +- 不默认把已禁用账号自动启用,避免用户明确停用的账号被后台恢复上线。 + +## 阶段 1:扫码人脸验证 API 链路 + +修改 `internal/xianyu/qrlogin`: + +- 在扫码 `query.do` 返回 `iframeRedirect=true` 时保留响应 Cookie。 +- 跟随 `iframeRedirectUrl` 到 `normal_validate.htm`。 +- 从 HTML 提取 `htoken` 和 `verify_modes.htm` 下一跳链接。 +- 请求 `verify_modes.htm` 并落到 `identity_verify.htm`。 +- 从 `identity_verify.htm` 中提取 `new Qrcode({ text: "..." })` 的二维码内容。 +- 后端渲染二维码为 `face_qr_url`,返回给前端展示。 +- 轮询 `photoVerify/check.do?htoken=...`。 +- 当返回 `code=3` 时访问返回的 `ivCheckLogin.htm`,收集最终 Cookie 和 `unb`。 + +前端修改: + +- `verification_required` 状态优先展示 `face_qr_url`。 +- 文案改为提示用户用手机闲鱼扫描二维码完成人脸验证。 +- `verification_screenshot` 仅作为旧兜底,不再作为主体验。 + +测试: + +- 提取 `htoken`、`verify_modes`、人脸二维码内容的纯函数测试。 +- `photoVerify/check.do` 成功后 session 转为 `success` 的 HTTP mock 测试。 + +## 阶段 2:Cookie 接口续期服务 + +新增 `internal/xianyu/renew`: + +- 实现 `hasLogin.do`、`silentHasLogin.do`、`setLoginSettings.do` 三段续期。 +- 每一步合并 `Set-Cookie`,后续请求使用合并后的 Cookie。 +- 只有 `setLoginSettings.do` 返回有效 `Set-Cookie` 时,判定长登录续期成功。 +- 返回续期方式、更新字段、最终 Cookie、步骤详情。 +- 所有响应读取必须有大小上限。 + +测试: + +- 多个 `Set-Cookie` 合并顺序。 +- 接口续期成功、失败、部分 Cookie 更新。 +- `setLoginSettings.do` 未返回 Cookie 时不误判成功。 + +## 阶段 3:登录态检查与 MTOP 风控分类 + +新增或扩展 `internal/xianyu/mtop`: + +- 实现 `mtop.taobao.idlemessage.pc.loginuser.get` 登录态检查。 +- 识别 `TOKEN_EXOIRED`、`TOKEN_EXPIRED`、`TOKEN_EMPTY`、`SESSION_EXPIRED`。 +- 识别 `FAIL_SYS_USER_VALIDATE`、`RGV587`、`punish`、`captcha`、`x5secdata`。 +- 对风控错误返回带验证 URL 的结构化错误,避免上层只能靠字符串判断。 + +测试: + +- 各类 ret 的分类。 +- 风控 URL 提取。 +- 登录态接口返回 Cookie 时正确合并。 + +## 阶段 4:运行时恢复顺序接入 + +修改 `internal/engine/account.go`: + +当前流程: + +`RefreshToken -> WS -> 连续失败 -> PasswordLogin -> 慢重试` + +目标流程: + +`RefreshToken -> API Renew -> Browser Renew -> PasswordLogin -> 慢重试/人工验证` + +规则: + +- token 刷新遇到 token/session 问题时先尝试接口续期。 +- 接口续期成功后保存 Cookie、清 token 缓存、重新获取 token。 +- 接口续期失败但 Cookie 有更新时也保存,避免丢服务端新字段。 +- 浏览器续期作为第二层恢复。 +- 密码登录作为最后自动恢复手段。 +- 风控类错误进入 `verification_required`,降频重试并发通知。 + +## 阶段 5:重连退避和多账号保护 + +- 网络错误和认证错误使用不同退避。 +- 增加 0-30% 随机抖动,降低多账号同时重连冲击。 +- 短连接继续清 token 缓存。 +- 频繁短连接时进入明确状态,避免无意义快速重连。 + +## 验证命令 + +每阶段至少运行对应包测试。完整收尾运行: + +```bash +go test ./... +go vet ./... +make lint +cd frontend && npm test -- --run && npm run build +``` + +## 实施记录 + +- 已完成扫码人脸验证 API 链路:后端提取 `htoken`、`verify_modes`、人脸二维码内容并轮询 `photoVerify/check.do`,前端优先展示 `face_qr_url`;截图只保留为兜底。 +- 已完成 Cookie 接口续期服务:`hasLogin.do -> silentHasLogin.do -> setLoginSettings.do` 串行合并 `Set-Cookie`,所有响应读取有大小上限。 +- 已完成 MTOP 风控分类:token 过期、session 失效、`FAIL_SYS_USER_VALIDATE`、`RGV587`、`punish/captcha/x5secdata` 等状态被结构化识别。 +- 已完成运行时恢复顺序:`RefreshToken -> API Renew -> Browser Renew -> PasswordLogin -> 慢重试/人工验证`,Cookie 更新后会清理旧 token 缓存。 +- 已完成多账号保护:重连退避加入 0-30% 抖动,降低多账号同时重连造成的风控压力。 diff --git a/frontend/components/AccountList.tsx b/frontend/components/AccountList.tsx index 8a6ea9b..c0ac38f 100644 --- a/frontend/components/AccountList.tsx +++ b/frontend/components/AccountList.tsx @@ -41,6 +41,7 @@ const AccountList: React.FC = () => { const [qrStatus, setQrStatus] = useState('pending'); const [verificationUrl, setVerificationUrl] = useState(''); const [verificationScreenshot, setVerificationScreenshot] = useState(''); + const [faceQrUrl, setFaceQrUrl] = useState(''); const [qrSessionId, setQrSessionId] = useState(''); const [qrReauthTarget, setQrReauthTarget] = useState(null); const [activeModal, setActiveModal] = useState(null); @@ -326,6 +327,7 @@ const AccountList: React.FC = () => { setQrSessionId(''); setVerificationUrl(''); setVerificationScreenshot(''); + setFaceQrUrl(''); try { const res = await generateQRLogin(); if (res.success && res.qr_code_url && res.session_id) { @@ -358,6 +360,9 @@ const AccountList: React.FC = () => { } else if (statusRes.status === 'verification_required') { setQrStatus('verification'); setVerificationUrl(statusRes.verification_url || ''); + if (statusRes.face_qr_url) { + setFaceQrUrl(statusRes.face_qr_url); + } if (statusRes.verification_screenshot) { setVerificationScreenshot(statusRes.verification_screenshot); } @@ -610,16 +615,20 @@ const AccountList: React.FC = () => {
需要安全验证 - 程序已在后台打开验证页面,请用手机完成验证,验证通过后将自动登录。 + {faceQrUrl + ? '请用手机闲鱼扫描下方二维码完成人脸验证,验证通过后将自动登录。' + : '正在准备验证二维码,请保持页面打开。'} - {verificationScreenshot ? ( + {faceQrUrl ? ( + 人脸验证二维码 + ) : verificationScreenshot ? ( 验证页面 ) : (
)} - 等待手机验证完成,无需手动操作... + 等待手机验证完成,无需点击确认。
)} diff --git a/internal/adapter/adapter.go b/internal/adapter/adapter.go index 61ccdd1..f035d48 100644 --- a/internal/adapter/adapter.go +++ b/internal/adapter/adapter.go @@ -23,6 +23,7 @@ import ( // 测试可注入桩实现,避免依赖 Chromium。 type browserManager interface { FetchOrderDetail(ctx context.Context, orderID, cookieID, cookieValue string, requireSpec ...bool) (*browser.OrderDetail, error) + CookieRenew(ctx context.Context, cookieID, cookieStr string, headless bool) (map[string]string, error) PasswordLogin(ctx context.Context, account, password, cookieID, userDataDir string, headless bool) (map[string]string, error) } @@ -154,8 +155,11 @@ func (a *Adapter) localOrderDetail(ctx context.Context, orderID string) (*automa }, true } -// OnPasswordLoginRefresh 连续失败时调用浏览器密码登录刷新 cookie。 -// 同一账号冷却 engine.PasswordLoginMinGap,避免短时间反复尝试。 +// OnPasswordLoginRefresh 连续失败时恢复 Cookie。 +// +// 恢复顺序是“浏览器快速续期 -> 密码登录”。快速续期复用旧 Cookie 打开闲鱼, +// 尝试点“快速进入”刷新浏览器登录态;这比账号密码登录更轻,风控压力也更小。 +// 同一账号冷却 engine.PasswordLoginMinGap,避免短时间反复触发浏览器恢复。 func (a *Adapter) OnPasswordLoginRefresh(ctx context.Context, cookieID string) bool { if a.browser == nil { a.logger.Warn("密码登录刷新失败:浏览器自动化已禁用") @@ -179,33 +183,56 @@ func (a *Adapter) OnPasswordLoginRefresh(ctx context.Context, cookieID string) b a.logger.Warn("密码登录刷新失败:读取账号详情失败", "account", cookieID, "err", err) return false } + a.mu.Lock() + a.lastLoginByCID[cookieID] = time.Now() + a.mu.Unlock() + + // 先走 Cookie 快速续期。只要旧 Cookie 还能触发快速进入,就不暴露账号密码登录, + // 也减少滑块/人脸/设备校验等更重风控的概率。 + if a.saveRecoveredBrowserCookies(ctx, cookieID, d.UserID, func() (map[string]string, error) { + return a.browser.CookieRenew(ctx, cookieID, d.Value, !d.ShowBrowser) + }, "浏览器快速续期") { + return true + } + if strings.TrimSpace(d.Username) == "" || strings.TrimSpace(d.Password) == "" { a.logger.Warn("密码登录刷新失败:账号未配置登录用户名或密码", "account", cookieID) return false } - a.mu.Lock() - a.lastLoginByCID[cookieID] = time.Now() - a.mu.Unlock() - cookies, err := a.browser.PasswordLogin(ctx, d.Username, d.Password, cookieID, "", !d.ShowBrowser) + return a.saveRecoveredBrowserCookies(ctx, cookieID, d.UserID, func() (map[string]string, error) { + return a.browser.PasswordLogin(ctx, d.Username, d.Password, cookieID, "", !d.ShowBrowser) + }, "密码登录刷新") +} + +// saveRecoveredBrowserCookies 执行浏览器恢复动作,统一校验、保存 Cookie 并清理 token 缓存。 +// Cookie 更新后,旧 accessToken 与旧 session 绑定,继续复用会造成“新 Cookie + 旧 token” +// 的逻辑冲突,所以这里必须清除缓存,让 engine 下一轮重新派生 token。 +func (a *Adapter) saveRecoveredBrowserCookies(ctx context.Context, cookieID string, userID int64, recover func() (map[string]string, error), action string) bool { + cookies, err := recover() if err != nil { - a.logger.Warn("密码登录刷新失败", "account", cookieID, "err", err) + a.logger.Warn(action+"失败", "account", cookieID, "err", err) return false } cookieStr := browser.MarshalCookies(cookies) if strings.TrimSpace(cookieStr) == "" { - a.logger.Warn("密码登录刷新失败:浏览器未返回 cookie", "account", cookieID) + a.logger.Warn(action+"失败:浏览器未返回 cookie", "account", cookieID) return false } - if err := a.store.Cookies.Save(ctx, cookieID, cookieStr, d.UserID); err != nil { - a.logger.Warn("密码登录刷新失败:保存 cookie 失败", "account", cookieID, "err", err) + if err := a.store.Cookies.Save(ctx, cookieID, cookieStr, userID); err != nil { + a.logger.Warn(action+"失败:保存 cookie 失败", "account", cookieID, "err", err) return false } - a.logger.Info("密码登录刷新 cookie 成功", "account", cookieID) + if a.store.Tokens != nil { + if err := a.store.Tokens.Clear(ctx, cookieID); err != nil { + a.logger.Warn(action+"后清除 token 缓存失败", "account", cookieID, "err", err) + } + } + a.logger.Info(action+" cookie 成功", "account", cookieID) return true } // 编译期保证 *Adapter 同时实现 engine.Handler 与 automation.OrderDetailFetcher。 var ( - _ engine.Handler = (*Adapter)(nil) + _ engine.Handler = (*Adapter)(nil) _ automation.OrderDetailFetcher = (*Adapter)(nil) ) diff --git a/internal/adapter/adapter_test.go b/internal/adapter/adapter_test.go index 4cbf720..9aa581d 100644 --- a/internal/adapter/adapter_test.go +++ b/internal/adapter/adapter_test.go @@ -24,6 +24,9 @@ func (f *fakeNotifier) NotifyAccountAlert(cookieID, level, title, body string) { type fakeBrowser struct { fetchErr error fetchDetail *browser.OrderDetail + renewErr error + renewCookies map[string]string + renewCalls int loginErr error loginCookies map[string]string loginCalls int @@ -32,6 +35,10 @@ type fakeBrowser struct { func (f *fakeBrowser) FetchOrderDetail(_ context.Context, _, _, _ string, _ ...bool) (*browser.OrderDetail, error) { return f.fetchDetail, f.fetchErr } +func (f *fakeBrowser) CookieRenew(_ context.Context, _, _ string, _ bool) (map[string]string, error) { + f.renewCalls++ + return f.renewCookies, f.renewErr +} func (f *fakeBrowser) PasswordLogin(_ context.Context, _, _, _, _ string, _ bool) (map[string]string, error) { f.loginCalls++ return f.loginCookies, f.loginErr @@ -148,12 +155,42 @@ func TestOnPasswordLoginRefresh_NoCredentialsReturnsFalse(t *testing.T) { store, cleanup := newAdapterTestStore(t) defer cleanup() a := New(store, nil, nil) - a.SetBrowser(&fakeBrowser{}) + a.SetBrowser(&fakeBrowser{renewErr: errors.New("quick enter unavailable")}) if a.OnPasswordLoginRefresh(context.Background(), "cid") { t.Fatal("账号未配用户名/密码应返回 false") } } +// TestOnPasswordLoginRefresh_BrowserRenewSuccess 无账密时旧 Cookie 仍可快速续期,应保存新 Cookie 并跳过密码登录。 +func TestOnPasswordLoginRefresh_BrowserRenewSuccess(t *testing.T) { + store, cleanup := newAdapterTestStore(t) + defer cleanup() + ctx := context.Background() + if err := store.Tokens.Save(ctx, "cid", "did-old", "tok-old", 9999999999); err != nil { + t.Fatalf("保存旧 token: %v", err) + } + + fb := &fakeBrowser{renewCookies: map[string]string{"unb": "1", "_m_h5_tk": "renewed"}} + a := New(store, nil, nil) + a.SetBrowser(fb) + if !a.OnPasswordLoginRefresh(ctx, "cid") { + t.Fatal("快速续期成功应返回 true") + } + if fb.renewCalls != 1 { + t.Fatalf("CookieRenew 应调用一次,got %d", fb.renewCalls) + } + if fb.loginCalls != 0 { + t.Fatalf("快速续期成功后不应密码登录,got %d", fb.loginCalls) + } + saved, _ := store.Cookies.GetValue(ctx, "cid") + if saved == "" || saved == "unb=1; _m_h5_tk=tk;" { + t.Fatalf("快速续期 cookie 未保存: %q", saved) + } + if _, err := store.Tokens.Get(ctx, "cid"); err != db.ErrNotFound { + t.Fatalf("Cookie 更新后应清除旧 token,got %v", err) + } +} + // TestOnPasswordLoginRefresh_Success 配好凭据后浏览器登录成功,cookie 被保存。 func TestOnPasswordLoginRefresh_Success(t *testing.T) { store, cleanup := newAdapterTestStore(t) @@ -162,7 +199,7 @@ func TestOnPasswordLoginRefresh_Success(t *testing.T) { // 配置账号用户名/密码。 store.DB.ExecContext(ctx, `UPDATE cookies SET username='u', password='p' WHERE id='cid'`) - fb := &fakeBrowser{loginCookies: map[string]string{"unb": "1", "_m_h5_tk": "fresh"}} + fb := &fakeBrowser{renewErr: errors.New("quick enter unavailable"), loginCookies: map[string]string{"unb": "1", "_m_h5_tk": "fresh"}} a := New(store, nil, nil) a.SetBrowser(fb) if !a.OnPasswordLoginRefresh(ctx, "cid") { @@ -184,7 +221,7 @@ func TestOnPasswordLoginRefresh_LoginError(t *testing.T) { ctx := context.Background() store.DB.ExecContext(ctx, `UPDATE cookies SET username='u', password='p' WHERE id='cid'`) - fb := &fakeBrowser{loginErr: errors.New("captcha required")} + fb := &fakeBrowser{renewErr: errors.New("quick enter unavailable"), loginErr: errors.New("captcha required")} a := New(store, nil, nil) a.SetBrowser(fb) if a.OnPasswordLoginRefresh(ctx, "cid") { @@ -199,7 +236,7 @@ func TestOnPasswordLoginRefresh_Cooldown(t *testing.T) { ctx := context.Background() store.DB.ExecContext(ctx, `UPDATE cookies SET username='u', password='p' WHERE id='cid'`) - fb := &fakeBrowser{loginCookies: map[string]string{"unb": "1"}} + fb := &fakeBrowser{renewErr: errors.New("quick enter unavailable"), loginCookies: map[string]string{"unb": "1"}} a := New(store, nil, nil) a.SetBrowser(fb) if !a.OnPasswordLoginRefresh(ctx, "cid") { diff --git a/internal/browser/cookierenew.go b/internal/browser/cookierenew.go new file mode 100644 index 0000000..e5dcb71 --- /dev/null +++ b/internal/browser/cookierenew.go @@ -0,0 +1,59 @@ +package browser + +import ( + "context" + "fmt" + "time" + + "github.com/playwright-community/playwright-go" +) + +// CookieRenew 用现有 Cookie 打开闲鱼页面,尝试通过“快速进入”刷新浏览器登录态。 +// +// 这个方法位于密码登录之前:如果 Cookie 仍保留可续期的浏览器会话,页面通常会给出 +// 免输密码的快速进入入口。成功点击后提取完整 Cookie,可避免更重的账号密码登录。 +func (m *Manager) CookieRenew(ctx context.Context, cookieID, cookieStr string, headless bool) (map[string]string, error) { + if cookieStr == "" { + return nil, fmt.Errorf("Cookie为空,无法浏览器续期") + } + page, release, err := m.newPage(ctx, cookieID, cookieStr, headless) + if err != nil { + return nil, err + } + defer release() + + if _, err := page.Goto(goofishIMURL, playwright.PageGotoOptions{ + WaitUntil: playwright.WaitUntilStateDomcontentloaded, + Timeout: playwright.Float(30000), + }); err != nil { + m.logger.Warn("浏览器续期访问 IM 页面异常", "cookieID", cookieID, "err", err) + } + if checkLoginSuccess(page) { + m.logger.Info("浏览器续期:已有有效登录态", "cookieID", cookieID) + return extractPageCookies(page) + } + + if !clickQuickEnter(page) { + return nil, fmt.Errorf("未找到快速进入入口,需要密码登录") + } + time.Sleep(5 * time.Second) + if !checkLoginSuccess(page) { + return nil, fmt.Errorf("快速进入后仍未检测到登录态") + } + m.logger.Info("浏览器续期:快速进入成功", "cookieID", cookieID) + return extractPageCookies(page) +} + +func clickQuickEnter(page playwright.Page) bool { + frames := append([]playwright.Frame{page.MainFrame()}, page.Frames()...) + for _, f := range frames { + for _, sel := range loginBtnSelectors { + el, err := f.QuerySelector(sel) + if err == nil && el != nil { + _ = el.Click() + return true + } + } + } + return false +} diff --git a/internal/engine/account.go b/internal/engine/account.go index 72abf80..c24ab3c 100644 --- a/internal/engine/account.go +++ b/internal/engine/account.go @@ -7,8 +7,10 @@ package engine import ( "context" + "crypto/rand" "fmt" "log/slog" + "math/big" "strings" "sync" "time" @@ -17,6 +19,7 @@ import ( "xianyu-go/internal/db" "xianyu-go/internal/xianyu/mtop" "xianyu-go/internal/xianyu/protocol" + "xianyu-go/internal/xianyu/renew" "xianyu-go/internal/xianyu/ws" ) @@ -31,10 +34,10 @@ const ( // token 心跳间隔。主动刷新 token 让服务端持续续期 cookie(_m_h5_tk / // sgcookie 等),避免 cookie 自然滑向过期。15 分钟一次,平衡保活与风控。 // 不宜过短,否则易触发阿里系滑块风控。 - TokenRefreshInterval = 15 * time.Minute - TokenRefreshMinGap = time.Minute - MessageCooldown = 5 * time.Minute // 收到消息后 5 分钟内不刷 cookie - PasswordLoginMinGap = 30 * time.Minute + TokenRefreshInterval = 15 * time.Minute + TokenRefreshMinGap = time.Minute + MessageCooldown = 5 * time.Minute // 收到消息后 5 分钟内不刷 cookie + PasswordLoginMinGap = 30 * time.Minute // TokenCacheTTL 缓存的 accessToken 视为有效的时长。tokenRefreshLoop 每 15min // 刷新一次会续期该缓存;短重启 / 瞬时 mtop 失败时回退到此缓存不掉线。 @@ -110,26 +113,27 @@ type Account struct { store *db.Store mtop mtop.Client + renewer cookieRenewer wsDialer wsDialer handler Handler logger *slog.Logger // 运行时状态(受 mu 保护) - mu sync.Mutex - currentToken string - deviceID string - connFailures int - lastMsgReceived time.Time - lastTokenRefresh time.Time - lastPasswordLogin time.Time - runtimeState string - runtimeMessage string - runtimeUpdatedAt time.Time - stopFn context.CancelFunc - stopped bool - conn WSConn - connStartedAt time.Time // 本次 WS 连接建立时间,用于短连接检测 - authExpiredAlerted bool // 已发过 auth_expired 告警,连接恢复后复位(避免刷屏) + mu sync.Mutex + currentToken string + deviceID string + connFailures int + lastMsgReceived time.Time + lastTokenRefresh time.Time + lastPasswordLogin time.Time + runtimeState string + runtimeMessage string + runtimeUpdatedAt time.Time + stopFn context.CancelFunc + stopped bool + conn WSConn + connStartedAt time.Time // 本次 WS 连接建立时间,用于短连接检测 + authExpiredAlerted bool // 已发过 auth_expired 告警,连接恢复后复位(避免刷屏) // 去重 dedupMu sync.Mutex @@ -173,6 +177,10 @@ func (defaultDialer) Dial(ctx context.Context, cfg ws.Config, logger *slog.Logge return ws.Dial(ctx, cfg, logger) } +type cookieRenewer interface { + RenewAPIFirst(ctx context.Context, cookiesStr string) (*renew.Result, error) +} + // Config 构造 Account 所需依赖。 type Config struct { CookieID string @@ -182,6 +190,8 @@ type Config struct { Logger *slog.Logger // MTop 可选:注入 mtop 客户端以便测试 mock。 nil 时使用默认 HTTP 实现。 MTop mtop.Client + // Renewer 可选:注入 Cookie 接口续期服务以便测试 mock。nil 时使用默认实现。 + Renewer cookieRenewer } // New 构造单账号运行时(未启动)。 @@ -190,10 +200,15 @@ func New(cfg Config) *Account { if logger == nil { logger = slog.Default() } + mtopWasNil := cfg.MTop == nil mtopClient := cfg.MTop if mtopClient == nil { mtopClient = mtop.NewClient() } + renewer := cfg.Renewer + if renewer == nil && mtopWasNil { + renewer = renew.Service{} + } cookies := protocol.TransCookies(cfg.CookieStr) myid := cookies["unb"] a := &Account{ @@ -202,6 +217,7 @@ func New(cfg Config) *Account { UserID: myid, store: cfg.Store, mtop: mtopClient, + renewer: renewer, wsDialer: defaultDialer{}, handler: cfg.Handler, logger: logger.With("account", cfg.CookieID), @@ -254,11 +270,28 @@ func (a *Account) Run(parent context.Context) error { failures := a.connFailures a.mu.Unlock() a.setRuntimeError(ctx, err) - if mtop.IsSessionExpiredErr(err) { - a.logger.Warn("session 已失效,清除 token 缓存并进入慢重试", "err", err) + if mtop.IsRiskVerificationErr(err) { + a.logger.Warn("闲鱼要求安全验证,停止快速重试", "err", err) a.clearTokenCache(ctx) + a.alert(ctx, AlertLevelWarn, "闲鱼要求安全验证", + "账号触发闲鱼风控验证(滑块/人脸等)。系统已停止快速重试,请在后台重新扫码或完成验证。") + if sleepCtx(ctx, AuthExpiredRetryInterval) != nil { + return ctx.Err() + } + continue + } + if mtop.IsSessionExpiredErr(err) { + a.logger.Warn("session 已失效,先尝试接口续期", "err", err) + a.clearTokenCache(ctx) + if a.tryAPIRenew(ctx) { + a.resetFailures() + if sleepCtx(ctx, 2*time.Second) != nil { + return ctx.Err() + } + continue + } a.alert(ctx, AlertLevelWarn, "账号 session 已失效", - "登录凭证已被闲鱼服务端判定为失效,系统正在尝试通过浏览器密码登录自动恢复。若长时间未恢复,请人工处理。") + "登录凭证已被闲鱼服务端判定为失效,接口续期未恢复,系统将继续尝试浏览器密码登录自动恢复。") if err := a.handleMaxFailures(ctx); err != nil { return err } @@ -478,7 +511,50 @@ func (a *Account) resetFailures() { a.connFailures = 0 } -// retryDelay 移植自 _calculate_retry_delay。 +// tryAPIRenew 是密码登录前的轻量恢复层。 +// 闲鱼很多“登录态滑向过期”的场景会先允许 hasLogin/silentHasLogin/ +// setLoginSettings 刷新一批 Cookie;直接上密码登录更重,也更容易触发风控。 +// 因此这里先尝试接口续期:只要 Cookie 有变化就保存并清 token 缓存,让下一轮 +// acquireToken 用新 Cookie 重新派生 accessToken。 +func (a *Account) tryAPIRenew(ctx context.Context) bool { + if a.renewer == nil { + return false + } + a.mu.Lock() + cookieStr := a.CookieStr + a.mu.Unlock() + res, err := a.renewer.RenewAPIFirst(ctx, cookieStr) + if err != nil { + a.logger.Warn("接口续期失败", "err", err) + return false + } + if res == nil || res.NewCookies == "" || res.NewCookies == cookieStr { + if res != nil { + a.logger.Info("接口续期未产生 Cookie 更新", "success", res.Success, "message", res.Message) + } + return false + } + a.replaceCookieStr(res.NewCookies) + if a.store != nil && a.store.Cookies != nil { + if d, e := a.store.Cookies.GetDetails(ctx, a.CookieID); e == nil && d != nil { + if err := a.store.Cookies.Save(ctx, a.CookieID, res.NewCookies, d.UserID); err != nil { + a.logger.Error("接口续期后保存 cookie 失败", "cookie_id", a.CookieID, "err", err) + } + } + } + a.clearTokenCache(ctx) + if res.Success { + a.setRuntimeState(RuntimeConnecting, "登录凭证已接口续期,正在重新连接") + a.logger.Info("接口续期成功", "method", res.RenewMethod, "updated", strings.Join(res.UpdatedCookieNames, ",")) + return true + } + a.setRuntimeState(RuntimeConnecting, "登录凭证已有新 Cookie,正在重新验证") + a.logger.Info("接口续期返回部分 Cookie 更新,下一轮重新验证", "updated", strings.Join(res.UpdatedCookieNames, ",")) + return true +} + +// retryDelay 按错误类型计算退避,并加入 0-30% 抖动。 +// 多账号同时断线时,纯固定退避会让所有账号在同一秒重连,容易形成重连风暴。 func (a *Account) retryDelay(errMsg string) time.Duration { a.mu.Lock() f := a.connFailures @@ -495,7 +571,23 @@ func (a *Account) retryDelay(errMsg string) time.Duration { default: secs = min(5*f, 30) } - return time.Duration(secs) * time.Second + return withRetryJitter(time.Duration(secs) * time.Second) +} + +func withRetryJitter(base time.Duration) time.Duration { + if base <= 0 { + return 0 + } + maxJitter := base / 3 + if maxJitter <= 0 { + return base + } + n, err := rand.Int(rand.Reader, big.NewInt(int64(maxJitter))) + if err != nil { + // 熵源异常时使用时间纳秒兜底;这里只影响退避抖动,不用于安全令牌。 + return base + time.Duration(time.Now().UnixNano()%int64(maxJitter)) + } + return base + time.Duration(n.Int64()) } // refreshToken 调 mtop token API,返回 (accessToken, 更新后的 cookie)。 diff --git a/internal/engine/account_extra_test.go b/internal/engine/account_extra_test.go index db2cf7b..fc293f9 100644 --- a/internal/engine/account_extra_test.go +++ b/internal/engine/account_extra_test.go @@ -187,17 +187,11 @@ func TestRetryDelay_FailureClampsAtOne(t *testing.T) { defer cleanup() acc.connFailures = 0 // close-frame:min(3*1,15)=3s。 - if d := acc.retryDelay("no close frame received or sent"); d != 3*time.Second { - t.Errorf("failures=0 clamp to 1: got %v want 3s", d) - } + expectDelayRange(t, acc.retryDelay("no close frame received or sent"), 3*time.Second) // timeout:min(10*1,60)=10s。 - if d := acc.retryDelay("timeout reading"); d != 10*time.Second { - t.Errorf("timeout failures=0: got %v want 10s", d) - } + expectDelayRange(t, acc.retryDelay("timeout reading"), 10*time.Second) // default:min(5*1,30)=5s。 - if d := acc.retryDelay("random error"); d != 5*time.Second { - t.Errorf("default failures=0: got %v want 5s", d) - } + expectDelayRange(t, acc.retryDelay("random error"), 5*time.Second) } // TestRetryDelay_TimeoutVariant "timeout" 关键词分支。 @@ -206,13 +200,9 @@ func TestRetryDelay_TimeoutVariant(t *testing.T) { defer cleanup() acc.connFailures = 3 // min(10*3,60)=30s。 - if d := acc.retryDelay("dial timeout"); d != 30*time.Second { - t.Errorf("timeout failures=3: got %v want 30s", d) - } + expectDelayRange(t, acc.retryDelay("dial timeout"), 30*time.Second) acc.connFailures = 10 - if d := acc.retryDelay("timeout"); d != 60*time.Second { - t.Errorf("timeout failures=10 cap: got %v want 60s", d) - } + expectDelayRange(t, acc.retryDelay("timeout"), 60*time.Second) } // TestHandleMaxFailures_RecentMessageSkipPasswordLogin 最近仍收到消息时跳过密码登录刷新, diff --git a/internal/engine/engine_test.go b/internal/engine/engine_test.go index 3f8adc1..0f2d893 100644 --- a/internal/engine/engine_test.go +++ b/internal/engine/engine_test.go @@ -281,24 +281,22 @@ func TestRetryDelay(t *testing.T) { defer acc.Stop() acc.connFailures = 1 - if d := acc.retryDelay("no close frame received or sent"); d != 3*time.Second { - t.Errorf("close-frame failures=1: %v want 3s", d) - } + expectDelayRange(t, acc.retryDelay("no close frame received or sent"), 3*time.Second) acc.connFailures = 10 - if d := acc.retryDelay("no close frame received or sent"); d != 15*time.Second { - t.Errorf("close-frame failures=10: %v want 15s (capped)", d) - } + expectDelayRange(t, acc.retryDelay("no close frame received or sent"), 15*time.Second) acc.connFailures = 2 - if d := acc.retryDelay("connection refused"); d != 20*time.Second { - t.Errorf("refused failures=2: %v want 20s", d) - } + expectDelayRange(t, acc.retryDelay("connection refused"), 20*time.Second) acc.connFailures = 10 - if d := acc.retryDelay("connection refused"); d != 60*time.Second { - t.Errorf("refused failures=10: %v want 60s (capped)", d) - } + expectDelayRange(t, acc.retryDelay("connection refused"), 60*time.Second) acc.connFailures = 1 - if d := acc.retryDelay("some other error"); d != 5*time.Second { - t.Errorf("other failures=1: %v want 5s", d) + expectDelayRange(t, acc.retryDelay("some other error"), 5*time.Second) +} + +func expectDelayRange(t *testing.T, got, base time.Duration) { + t.Helper() + max := base + base/3 + if got < base || got > max { + t.Fatalf("retryDelay=%v want in [%v,%v]", got, base, max) } } diff --git a/internal/webui/static/assets/index-Bzj0nqFG.js b/internal/webui/static/assets/index-Bzj0nqFG.js new file mode 100644 index 0000000..d5a7075 --- /dev/null +++ b/internal/webui/static/assets/index-Bzj0nqFG.js @@ -0,0 +1,502 @@ +var bT=Object.defineProperty;var wT=(e,t,n)=>t in e?bT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var sd=(e,t,n)=>wT(e,typeof t!="symbol"?t+"":t,n);function jT(e,t){for(var n=0;nr[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const s of l)if(s.type==="childList")for(const d of s.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function n(l){const s={};return l.integrity&&(s.integrity=l.integrity),l.referrerPolicy&&(s.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?s.credentials="include":l.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(l){if(l.ep)return;l.ep=!0;const s=n(l);fetch(l.href,s)}})();function Ky(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yp={exports:{}},Bo={};/** + * @license React + * react-jsx-runtime.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 Jw;function _T(){if(Jw)return Bo;Jw=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,l,s){var d=null;if(s!==void 0&&(d=""+s),l.key!==void 0&&(d=""+l.key),"key"in l){s={};for(var f in l)f!=="key"&&(s[f]=l[f])}else s=l;return l=s.ref,{$$typeof:e,type:r,key:d,ref:l!==void 0?l:null,props:s}}return Bo.Fragment=t,Bo.jsx=n,Bo.jsxs=n,Bo}var ej;function NT(){return ej||(ej=1,Yp.exports=_T()),Yp.exports}var c=NT(),Gp={exports:{}},ze={};/** + * @license React + * react.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 tj;function ST(){if(tj)return ze;tj=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function w(P){return P===null||typeof P!="object"?null:(P=b&&P[b]||P["@@iterator"],typeof P=="function"?P:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,S={};function A(P,Q,ne){this.props=P,this.context=Q,this.refs=S,this.updater=ne||j}A.prototype.isReactComponent={},A.prototype.setState=function(P,Q){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,Q,"setState")},A.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function C(){}C.prototype=A.prototype;function M(P,Q,ne){this.props=P,this.context=Q,this.refs=S,this.updater=ne||j}var k=M.prototype=new C;k.constructor=M,_(k,A.prototype),k.isPureReactComponent=!0;var D=Array.isArray;function E(){}var $={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function K(P,Q,ne){var I=ne.ref;return{$$typeof:e,type:P,key:Q,ref:I!==void 0?I:null,props:ne}}function T(P,Q){return K(P.type,Q,P.props)}function re(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function Z(P){var Q={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(ne){return Q[ne]})}var pe=/\/+/g;function fe(P,Q){return typeof P=="object"&&P!==null&&P.key!=null?Z(""+P.key):Q.toString(36)}function ce(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(E,E):(P.status="pending",P.then(function(Q){P.status==="pending"&&(P.status="fulfilled",P.value=Q)},function(Q){P.status==="pending"&&(P.status="rejected",P.reason=Q)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function R(P,Q,ne,I,he){var be=typeof P;(be==="undefined"||be==="boolean")&&(P=null);var _e=!1;if(P===null)_e=!0;else switch(be){case"bigint":case"string":case"number":_e=!0;break;case"object":switch(P.$$typeof){case e:case t:_e=!0;break;case v:return _e=P._init,R(_e(P._payload),Q,ne,I,he)}}if(_e)return he=he(P),_e=I===""?"."+fe(P,0):I,D(he)?(ne="",_e!=null&&(ne=_e.replace(pe,"$&/")+"/"),R(he,Q,ne,"",function(ye){return ye})):he!=null&&(re(he)&&(he=T(he,ne+(he.key==null||P&&P.key===he.key?"":(""+he.key).replace(pe,"$&/")+"/")+_e)),Q.push(he)),1;_e=0;var W=I===""?".":I+":";if(D(P))for(var V=0;V>>1,ue=R[se];if(0>>1;sel(ne,G))Il(he,ne)?(R[se]=he,R[I]=G,se=I):(R[se]=ne,R[Q]=G,se=Q);else if(Il(he,G))R[se]=he,R[I]=G,se=I;else break e}}return z}function l(R,z){var G=R.sortIndex-z.sortIndex;return G!==0?G:R.id-z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],h=[],v=1,y=null,b=3,w=!1,j=!1,_=!1,S=!1,A=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function k(R){for(var z=n(h);z!==null;){if(z.callback===null)r(h);else if(z.startTime<=R)r(h),z.sortIndex=z.expirationTime,t(m,z);else break;z=n(h)}}function D(R){if(_=!1,k(R),!j)if(n(m)!==null)j=!0,E||(E=!0,Z());else{var z=n(h);z!==null&&ce(D,z.startTime-R)}}var E=!1,$=-1,U=5,K=-1;function T(){return S?!0:!(e.unstable_now()-KR&&T());){var se=y.callback;if(typeof se=="function"){y.callback=null,b=y.priorityLevel;var ue=se(y.expirationTime<=R);if(R=e.unstable_now(),typeof ue=="function"){y.callback=ue,k(R),z=!0;break t}y===n(m)&&r(m),k(R)}else r(m);y=n(m)}if(y!==null)z=!0;else{var P=n(h);P!==null&&ce(D,P.startTime-R),z=!1}}break e}finally{y=null,b=G,w=!1}z=void 0}}finally{z?Z():E=!1}}}var Z;if(typeof M=="function")Z=function(){M(re)};else if(typeof MessageChannel<"u"){var pe=new MessageChannel,fe=pe.port2;pe.port1.onmessage=re,Z=function(){fe.postMessage(null)}}else Z=function(){A(re,0)};function ce(R,z){$=A(function(){R(e.unstable_now())},z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125se?(R.sortIndex=G,t(h,R),n(m)===null&&R===n(h)&&(_?(C($),$=-1):_=!0,ce(D,G-se))):(R.sortIndex=ue,t(m,R),j||w||(j=!0,E||(E=!0,Z()))),R},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(R){var z=b;return function(){var G=b;b=z;try{return R.apply(this,arguments)}finally{b=G}}}})(Xp)),Xp}var aj;function ET(){return aj||(aj=1,Fp.exports=OT()),Fp.exports}var Wp={exports:{}},vn={};/** + * @license React + * react-dom.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 ij;function kT(){if(ij)return vn;ij=1;var e=zs();function t(m){var h="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Wp.exports=kT(),Wp.exports}/** + * @license React + * react-dom-client.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 sj;function CT(){if(sj)return Uo;sj=1;var e=ET(),t=zs(),n=iA();function r(a){var i="https://react.dev/errors/"+a;if(1ue||(a.current=se[ue],se[ue]=null,ue--)}function ne(a,i){ue++,se[ue]=a.current,a.current=i}var I=P(null),he=P(null),be=P(null),_e=P(null);function W(a,i){switch(ne(be,i),ne(he,a),ne(I,null),i.nodeType){case 9:case 11:a=(a=i.documentElement)&&(a=a.namespaceURI)?jw(a):0;break;default:if(a=i.tagName,i=i.namespaceURI)i=jw(i),a=_w(i,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}Q(I),ne(I,a)}function V(){Q(I),Q(he),Q(be)}function ye(a){a.memoizedState!==null&&ne(_e,a);var i=I.current,o=_w(i,a.type);i!==o&&(ne(he,a),ne(I,o))}function xe(a){he.current===a&&(Q(I),Q(he)),_e.current===a&&(Q(_e),Io._currentValue=G)}var ae,Le;function Ce(a){if(ae===void 0)try{throw Error()}catch(o){var i=o.stack.trim().match(/\n( *(at )?)/);ae=i&&i[1]||"",Le=-1)":-1p||L[u]!==ee[p]){var oe=` +`+L[u].replace(" at new "," at ");return a.displayName&&oe.includes("")&&(oe=oe.replace("",a.displayName)),oe}while(1<=u&&0<=p);break}}}finally{Y=!1,Error.prepareStackTrace=o}return(o=a?a.displayName||a.name:"")?Ce(o):""}function Pe(a,i){switch(a.tag){case 26:case 27:case 5:return Ce(a.type);case 16:return Ce("Lazy");case 13:return a.child!==i&&i!==null?Ce("Suspense Fallback"):Ce("Suspense");case 19:return Ce("SuspenseList");case 0:case 15:return ge(a.type,!1);case 11:return ge(a.type.render,!1);case 1:return ge(a.type,!0);case 31:return Ce("Activity");default:return""}}function Be(a){try{var i="",o=null;do i+=Pe(a,o),o=a,a=a.return;while(a);return i}catch(u){return` +Error generating stack: `+u.message+` +`+u.stack}}var Ve=Object.prototype.hasOwnProperty,Dt=e.unstable_scheduleCallback,ie=e.unstable_cancelCallback,De=e.unstable_shouldYield,Ue=e.unstable_requestPaint,B=e.unstable_now,Te=e.unstable_getCurrentPriorityLevel,lt=e.unstable_ImmediatePriority,Zr=e.unstable_UserBlockingPriority,Qn=e.unstable_NormalPriority,$n=e.unstable_LowPriority,wi=e.unstable_IdlePriority,xl=e.log,q=e.unstable_setDisableYieldValue,ve=null,we=null;function $e(a){if(typeof xl=="function"&&q(a),we&&typeof we.setStrictMode=="function")try{we.setStrictMode(ve,a)}catch{}}var We=Math.clz32?Math.clz32:Cr,Jt=Math.log,jt=Math.LN2;function Cr(a){return a>>>=0,a===0?32:31-(Jt(a)/jt|0)|0}var _t=256,bl=262144,Vc=4194304;function ji(a){var i=a&42;if(i!==0)return i;switch(a&-a){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function Fc(a,i,o){var u=a.pendingLanes;if(u===0)return 0;var p=0,g=a.suspendedLanes,N=a.pingedLanes;a=a.warmLanes;var O=u&134217727;return O!==0?(u=O&~g,u!==0?p=ji(u):(N&=O,N!==0?p=ji(N):o||(o=O&~a,o!==0&&(p=ji(o))))):(O=u&~g,O!==0?p=ji(O):N!==0?p=ji(N):o||(o=u&~a,o!==0&&(p=ji(o)))),p===0?0:i!==0&&i!==p&&(i&g)===0&&(g=p&-p,o=i&-i,g>=o||g===32&&(o&4194048)!==0)?i:p}function Fs(a,i){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&i)===0}function s5(a,i){switch(a){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32: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 i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rx(){var a=Vc;return Vc<<=1,(Vc&62914560)===0&&(Vc=4194304),a}function Dm(a){for(var i=[],o=0;31>o;o++)i.push(a);return i}function Xs(a,i){a.pendingLanes|=i,i!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function o5(a,i,o,u,p,g){var N=a.pendingLanes;a.pendingLanes=o,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=o,a.entangledLanes&=o,a.errorRecoveryDisabledLanes&=o,a.shellSuspendCounter=0;var O=a.entanglements,L=a.expirationTimes,ee=a.hiddenUpdates;for(o=N&~o;0"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var h5=/[\n"\\]/g;function er(a){return a.replace(h5,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Lm(a,i,o,u,p,g,N,O){a.name="",N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?a.type=N:a.removeAttribute("type"),i!=null?N==="number"?(i===0&&a.value===""||a.value!=i)&&(a.value=""+Jn(i)):a.value!==""+Jn(i)&&(a.value=""+Jn(i)):N!=="submit"&&N!=="reset"||a.removeAttribute("value"),i!=null?Bm(a,N,Jn(i)):o!=null?Bm(a,N,Jn(o)):u!=null&&a.removeAttribute("value"),p==null&&g!=null&&(a.defaultChecked=!!g),p!=null&&(a.checked=p&&typeof p!="function"&&typeof p!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?a.name=""+Jn(O):a.removeAttribute("name")}function vx(a,i,o,u,p,g,N,O){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(a.type=g),i!=null||o!=null){if(!(g!=="submit"&&g!=="reset"||i!=null)){Rm(a);return}o=o!=null?""+Jn(o):"",i=i!=null?""+Jn(i):o,O||i===a.value||(a.value=i),a.defaultValue=i}u=u??p,u=typeof u!="function"&&typeof u!="symbol"&&!!u,a.checked=O?a.checked:!!u,a.defaultChecked=!!u,N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(a.name=N),Rm(a)}function Bm(a,i,o){i==="number"&&Zc(a.ownerDocument)===a||a.defaultValue===""+o||(a.defaultValue=""+o)}function Al(a,i,o,u){if(a=a.options,i){i={};for(var p=0;p"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ym=!1;if(ea)try{var Js={};Object.defineProperty(Js,"passive",{get:function(){Ym=!0}}),window.addEventListener("test",Js,Js),window.removeEventListener("test",Js,Js)}catch{Ym=!1}var $a=null,Gm=null,Jc=null;function _x(){if(Jc)return Jc;var a,i=Gm,o=i.length,u,p="value"in $a?$a.value:$a.textContent,g=p.length;for(a=0;a=no),kx=" ",Cx=!1;function Tx(a,i){switch(a){case"keyup":return H5.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mx(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Cl=!1;function K5(a,i){switch(a){case"compositionend":return Mx(i);case"keypress":return i.which!==32?null:(Cx=!0,kx);case"textInput":return a=i.data,a===kx&&Cx?null:a;default:return null}}function Y5(a,i){if(Cl)return a==="compositionend"||!Zm&&Tx(a,i)?(a=_x(),Jc=Gm=$a=null,Cl=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:o,offset:i-a};a=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Bx(o)}}function Hx(a,i){return a&&i?a===i?!0:a&&a.nodeType===3?!1:i&&i.nodeType===3?Hx(a,i.parentNode):"contains"in a?a.contains(i):a.compareDocumentPosition?!!(a.compareDocumentPosition(i)&16):!1:!1}function qx(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var i=Zc(a.document);i instanceof a.HTMLIFrameElement;){try{var o=typeof i.contentWindow.location.href=="string"}catch{o=!1}if(o)a=i.contentWindow;else break;i=Zc(a.document)}return i}function eh(a){var i=a&&a.nodeName&&a.nodeName.toLowerCase();return i&&(i==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||i==="textarea"||a.contentEditable==="true")}var J5=ea&&"documentMode"in document&&11>=document.documentMode,Tl=null,th=null,lo=null,nh=!1;function Kx(a,i,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;nh||Tl==null||Tl!==Zc(u)||(u=Tl,"selectionStart"in u&&eh(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),lo&&io(lo,u)||(lo=u,u=Gu(th,"onSelect"),0>=N,p-=N,Tr=1<<32-We(i)+p|o<Re?(Ge=Ee,Ee=null):Ge=Ee.sibling;var Je=te(F,Ee,J[Re],de);if(Je===null){Ee===null&&(Ee=Ge);break}a&&Ee&&Je.alternate===null&&i(F,Ee),H=g(Je,H,Re),Qe===null?ke=Je:Qe.sibling=Je,Qe=Je,Ee=Ge}if(Re===J.length)return o(F,Ee),Fe&&na(F,Re),ke;if(Ee===null){for(;ReRe?(Ge=Ee,Ee=null):Ge=Ee.sibling;var ii=te(F,Ee,Je.value,de);if(ii===null){Ee===null&&(Ee=Ge);break}a&&Ee&&ii.alternate===null&&i(F,Ee),H=g(ii,H,Re),Qe===null?ke=ii:Qe.sibling=ii,Qe=ii,Ee=Ge}if(Je.done)return o(F,Ee),Fe&&na(F,Re),ke;if(Ee===null){for(;!Je.done;Re++,Je=J.next())Je=me(F,Je.value,de),Je!==null&&(H=g(Je,H,Re),Qe===null?ke=Je:Qe.sibling=Je,Qe=Je);return Fe&&na(F,Re),ke}for(Ee=u(Ee);!Je.done;Re++,Je=J.next())Je=le(Ee,F,Re,Je.value,de),Je!==null&&(a&&Je.alternate!==null&&Ee.delete(Je.key===null?Re:Je.key),H=g(Je,H,Re),Qe===null?ke=Je:Qe.sibling=Je,Qe=Je);return a&&Ee.forEach(function(xT){return i(F,xT)}),Fe&&na(F,Re),ke}function ct(F,H,J,de){if(typeof J=="object"&&J!==null&&J.type===_&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case w:e:{for(var ke=J.key;H!==null;){if(H.key===ke){if(ke=J.type,ke===_){if(H.tag===7){o(F,H.sibling),de=p(H,J.props.children),de.return=F,F=de;break e}}else if(H.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===U&&Di(ke)===H.type){o(F,H.sibling),de=p(H,J.props),mo(de,J),de.return=F,F=de;break e}o(F,H);break}else i(F,H);H=H.sibling}J.type===_?(de=Ei(J.props.children,F.mode,de,J.key),de.return=F,F=de):(de=cu(J.type,J.key,J.props,null,F.mode,de),mo(de,J),de.return=F,F=de)}return N(F);case j:e:{for(ke=J.key;H!==null;){if(H.key===ke)if(H.tag===4&&H.stateNode.containerInfo===J.containerInfo&&H.stateNode.implementation===J.implementation){o(F,H.sibling),de=p(H,J.children||[]),de.return=F,F=de;break e}else{o(F,H);break}else i(F,H);H=H.sibling}de=ch(J,F.mode,de),de.return=F,F=de}return N(F);case U:return J=Di(J),ct(F,H,J,de)}if(ce(J))return Ae(F,H,J,de);if(Z(J)){if(ke=Z(J),typeof ke!="function")throw Error(r(150));return J=ke.call(J),Me(F,H,J,de)}if(typeof J.then=="function")return ct(F,H,vu(J),de);if(J.$$typeof===M)return ct(F,H,fu(F,J),de);yu(F,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,H!==null&&H.tag===6?(o(F,H.sibling),de=p(H,J),de.return=F,F=de):(o(F,H),de=oh(J,F.mode,de),de.return=F,F=de),N(F)):o(F,H)}return function(F,H,J,de){try{fo=0;var ke=ct(F,H,J,de);return Hl=null,ke}catch(Ee){if(Ee===Ul||Ee===hu)throw Ee;var Qe=Ln(29,Ee,null,F.mode);return Qe.lanes=de,Qe.return=F,Qe}finally{}}}var zi=mb(!0),hb=mb(!1),Ha=!1;function wh(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function jh(a,i){a=a.updateQueue,i.updateQueue===a&&(i.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function qa(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function Ka(a,i,o){var u=a.updateQueue;if(u===null)return null;if(u=u.shared,(tt&2)!==0){var p=u.pending;return p===null?i.next=i:(i.next=p.next,p.next=i),u.pending=i,i=ou(a),Zx(a,null,o),i}return su(a,u,i,o),ou(a)}function ho(a,i,o){if(i=i.updateQueue,i!==null&&(i=i.shared,(o&4194048)!==0)){var u=i.lanes;u&=a.pendingLanes,o|=u,i.lanes=o,ix(a,o)}}function _h(a,i){var o=a.updateQueue,u=a.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var p=null,g=null;if(o=o.firstBaseUpdate,o!==null){do{var N={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};g===null?p=g=N:g=g.next=N,o=o.next}while(o!==null);g===null?p=g=i:g=g.next=i}else p=g=i;o={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:g,shared:u.shared,callbacks:u.callbacks},a.updateQueue=o;return}a=o.lastBaseUpdate,a===null?o.firstBaseUpdate=i:a.next=i,o.lastBaseUpdate=i}var Nh=!1;function po(){if(Nh){var a=Bl;if(a!==null)throw a}}function vo(a,i,o,u){Nh=!1;var p=a.updateQueue;Ha=!1;var g=p.firstBaseUpdate,N=p.lastBaseUpdate,O=p.shared.pending;if(O!==null){p.shared.pending=null;var L=O,ee=L.next;L.next=null,N===null?g=ee:N.next=ee,N=L;var oe=a.alternate;oe!==null&&(oe=oe.updateQueue,O=oe.lastBaseUpdate,O!==N&&(O===null?oe.firstBaseUpdate=ee:O.next=ee,oe.lastBaseUpdate=L))}if(g!==null){var me=p.baseState;N=0,oe=ee=L=null,O=g;do{var te=O.lane&-536870913,le=te!==O.lane;if(le?(Ye&te)===te:(u&te)===te){te!==0&&te===Ll&&(Nh=!0),oe!==null&&(oe=oe.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var Ae=a,Me=O;te=i;var ct=o;switch(Me.tag){case 1:if(Ae=Me.payload,typeof Ae=="function"){me=Ae.call(ct,me,te);break e}me=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Me.payload,te=typeof Ae=="function"?Ae.call(ct,me,te):Ae,te==null)break e;me=y({},me,te);break e;case 2:Ha=!0}}te=O.callback,te!==null&&(a.flags|=64,le&&(a.flags|=8192),le=p.callbacks,le===null?p.callbacks=[te]:le.push(te))}else le={lane:te,tag:O.tag,payload:O.payload,callback:O.callback,next:null},oe===null?(ee=oe=le,L=me):oe=oe.next=le,N|=te;if(O=O.next,O===null){if(O=p.shared.pending,O===null)break;le=O,O=le.next,le.next=null,p.lastBaseUpdate=le,p.shared.pending=null}}while(!0);oe===null&&(L=me),p.baseState=L,p.firstBaseUpdate=ee,p.lastBaseUpdate=oe,g===null&&(p.shared.lanes=0),Xa|=N,a.lanes=N,a.memoizedState=me}}function pb(a,i){if(typeof a!="function")throw Error(r(191,a));a.call(i)}function vb(a,i){var o=a.callbacks;if(o!==null)for(a.callbacks=null,a=0;ag?g:8;var N=R.T,O={};R.T=O,qh(a,!1,i,o);try{var L=p(),ee=R.S;if(ee!==null&&ee(O,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var oe=o3(L,u);xo(a,i,oe,Kn(a))}else xo(a,i,u,Kn(a))}catch(me){xo(a,i,{then:function(){},status:"rejected",reason:me},Kn())}finally{z.p=g,N!==null&&O.types!==null&&(N.types=O.types),R.T=N}}function h3(){}function Uh(a,i,o,u){if(a.tag!==5)throw Error(r(476));var p=Fb(a).queue;Vb(a,p,i,G,o===null?h3:function(){return Xb(a),o(u)})}function Fb(a){var i=a.memoizedState;if(i!==null)return i;i={memoizedState:G,baseState:G,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:la,lastRenderedState:G},next:null};var o={};return i.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:la,lastRenderedState:o},next:null},a.memoizedState=i,a=a.alternate,a!==null&&(a.memoizedState=i),i}function Xb(a){var i=Fb(a);i.next===null&&(i=a.alternate.memoizedState),xo(a,i.next.queue,{},Kn())}function Hh(){return un(Io)}function Wb(){return zt().memoizedState}function Zb(){return zt().memoizedState}function p3(a){for(var i=a.return;i!==null;){switch(i.tag){case 24:case 3:var o=Kn();a=qa(o);var u=Ka(i,a,o);u!==null&&(Mn(u,i,o),ho(u,i,o)),i={cache:yh()},a.payload=i;return}i=i.return}}function v3(a,i,o){var u=Kn();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Ou(a)?Jb(i,o):(o=lh(a,i,o,u),o!==null&&(Mn(o,a,u),e1(o,i,u)))}function Qb(a,i,o){var u=Kn();xo(a,i,o,u)}function xo(a,i,o,u){var p={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Ou(a))Jb(i,p);else{var g=a.alternate;if(a.lanes===0&&(g===null||g.lanes===0)&&(g=i.lastRenderedReducer,g!==null))try{var N=i.lastRenderedState,O=g(N,o);if(p.hasEagerState=!0,p.eagerState=O,Rn(O,N))return su(a,i,p,0),ft===null&&lu(),!1}catch{}finally{}if(o=lh(a,i,p,u),o!==null)return Mn(o,a,u),e1(o,i,u),!0}return!1}function qh(a,i,o,u){if(u={lane:2,revertLane:wp(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Ou(a)){if(i)throw Error(r(479))}else i=lh(a,o,u,2),i!==null&&Mn(i,a,2)}function Ou(a){var i=a.alternate;return a===Ie||i!==null&&i===Ie}function Jb(a,i){Kl=bu=!0;var o=a.pending;o===null?i.next=i:(i.next=o.next,o.next=i),a.pending=i}function e1(a,i,o){if((o&4194048)!==0){var u=i.lanes;u&=a.pendingLanes,o|=u,i.lanes=o,ix(a,o)}}var bo={readContext:un,use:_u,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useLayoutEffect:At,useInsertionEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useSyncExternalStore:At,useId:At,useHostTransitionStatus:At,useFormState:At,useActionState:At,useOptimistic:At,useMemoCache:At,useCacheRefresh:At};bo.useEffectEvent=At;var t1={readContext:un,use:_u,useCallback:function(a,i){return jn().memoizedState=[a,i===void 0?null:i],a},useContext:un,useEffect:Rb,useImperativeHandle:function(a,i,o){o=o!=null?o.concat([a]):null,Su(4194308,4,Hb.bind(null,i,a),o)},useLayoutEffect:function(a,i){return Su(4194308,4,a,i)},useInsertionEffect:function(a,i){Su(4,2,a,i)},useMemo:function(a,i){var o=jn();i=i===void 0?null:i;var u=a();if(Ii){$e(!0);try{a()}finally{$e(!1)}}return o.memoizedState=[u,i],u},useReducer:function(a,i,o){var u=jn();if(o!==void 0){var p=o(i);if(Ii){$e(!0);try{o(i)}finally{$e(!1)}}}else p=i;return u.memoizedState=u.baseState=p,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:p},u.queue=a,a=a.dispatch=v3.bind(null,Ie,a),[u.memoizedState,a]},useRef:function(a){var i=jn();return a={current:a},i.memoizedState=a},useState:function(a){a=Ih(a);var i=a.queue,o=Qb.bind(null,Ie,i);return i.dispatch=o,[a.memoizedState,o]},useDebugValue:Lh,useDeferredValue:function(a,i){var o=jn();return Bh(o,a,i)},useTransition:function(){var a=Ih(!1);return a=Vb.bind(null,Ie,a.queue,!0,!1),jn().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,i,o){var u=Ie,p=jn();if(Fe){if(o===void 0)throw Error(r(407));o=o()}else{if(o=i(),ft===null)throw Error(r(349));(Ye&127)!==0||jb(u,i,o)}p.memoizedState=o;var g={value:o,getSnapshot:i};return p.queue=g,Rb(Nb.bind(null,u,g,a),[a]),u.flags|=2048,Gl(9,{destroy:void 0},_b.bind(null,u,g,o,i),null),o},useId:function(){var a=jn(),i=ft.identifierPrefix;if(Fe){var o=Mr,u=Tr;o=(u&~(1<<32-We(u)-1)).toString(32)+o,i="_"+i+"R_"+o,o=wu++,0<\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof u.is=="string"?N.createElement("select",{is:u.is}):N.createElement("select"),u.multiple?g.multiple=!0:u.size&&(g.size=u.size);break;default:g=typeof u.is=="string"?N.createElement(p,{is:u.is}):N.createElement(p)}}g[on]=i,g[An]=u;e:for(N=i.child;N!==null;){if(N.tag===5||N.tag===6)g.appendChild(N.stateNode);else if(N.tag!==4&&N.tag!==27&&N.child!==null){N.child.return=N,N=N.child;continue}if(N===i)break e;for(;N.sibling===null;){if(N.return===null||N.return===i)break e;N=N.return}N.sibling.return=N.return,N=N.sibling}i.stateNode=g;e:switch(fn(g,p,u),p){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&oa(i)}}return vt(i),rp(i,i.type,a===null?null:a.memoizedProps,i.pendingProps,o),null;case 6:if(a&&i.stateNode!=null)a.memoizedProps!==u&&oa(i);else{if(typeof u!="string"&&i.stateNode===null)throw Error(r(166));if(a=be.current,$l(i)){if(a=i.stateNode,o=i.memoizedProps,u=null,p=cn,p!==null)switch(p.tag){case 27:case 5:u=p.memoizedProps}a[on]=i,a=!!(a.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||bw(a.nodeValue,o)),a||Ba(i,!0)}else a=Vu(a).createTextNode(u),a[on]=i,i.stateNode=a}return vt(i),null;case 31:if(o=i.memoizedState,a===null||a.memoizedState!==null){if(u=$l(i),o!==null){if(a===null){if(!u)throw Error(r(318));if(a=i.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(557));a[on]=i}else ki(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;vt(i),a=!1}else o=mh(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=o),a=!0;if(!a)return i.flags&256?(Un(i),i):(Un(i),null);if((i.flags&128)!==0)throw Error(r(558))}return vt(i),null;case 13:if(u=i.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(p=$l(i),u!==null&&u.dehydrated!==null){if(a===null){if(!p)throw Error(r(318));if(p=i.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(r(317));p[on]=i}else ki(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;vt(i),p=!1}else p=mh(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=p),p=!0;if(!p)return i.flags&256?(Un(i),i):(Un(i),null)}return Un(i),(i.flags&128)!==0?(i.lanes=o,i):(o=u!==null,a=a!==null&&a.memoizedState!==null,o&&(u=i.child,p=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(p=u.alternate.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==p&&(u.flags|=2048)),o!==a&&o&&(i.child.flags|=8192),Mu(i,i.updateQueue),vt(i),null);case 4:return V(),a===null&&Sp(i.stateNode.containerInfo),vt(i),null;case 10:return aa(i.type),vt(i),null;case 19:if(Q(Pt),u=i.memoizedState,u===null)return vt(i),null;if(p=(i.flags&128)!==0,g=u.rendering,g===null)if(p)jo(u,!1);else{if(Ot!==0||a!==null&&(a.flags&128)!==0)for(a=i.child;a!==null;){if(g=xu(a),g!==null){for(i.flags|=128,jo(u,!1),a=g.updateQueue,i.updateQueue=a,Mu(i,a),i.subtreeFlags=0,a=o,o=i.child;o!==null;)Qx(o,a),o=o.sibling;return ne(Pt,Pt.current&1|2),Fe&&na(i,u.treeForkCount),i.child}a=a.sibling}u.tail!==null&&B()>$u&&(i.flags|=128,p=!0,jo(u,!1),i.lanes=4194304)}else{if(!p)if(a=xu(g),a!==null){if(i.flags|=128,p=!0,a=a.updateQueue,i.updateQueue=a,Mu(i,a),jo(u,!0),u.tail===null&&u.tailMode==="hidden"&&!g.alternate&&!Fe)return vt(i),null}else 2*B()-u.renderingStartTime>$u&&o!==536870912&&(i.flags|=128,p=!0,jo(u,!1),i.lanes=4194304);u.isBackwards?(g.sibling=i.child,i.child=g):(a=u.last,a!==null?a.sibling=g:i.child=g,u.last=g)}return u.tail!==null?(a=u.tail,u.rendering=a,u.tail=a.sibling,u.renderingStartTime=B(),a.sibling=null,o=Pt.current,ne(Pt,p?o&1|2:o&1),Fe&&na(i,u.treeForkCount),a):(vt(i),null);case 22:case 23:return Un(i),Ah(),u=i.memoizedState!==null,a!==null?a.memoizedState!==null!==u&&(i.flags|=8192):u&&(i.flags|=8192),u?(o&536870912)!==0&&(i.flags&128)===0&&(vt(i),i.subtreeFlags&6&&(i.flags|=8192)):vt(i),o=i.updateQueue,o!==null&&Mu(i,o.retryQueue),o=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(o=a.memoizedState.cachePool.pool),u=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),u!==o&&(i.flags|=2048),a!==null&&Q(Mi),null;case 24:return o=null,a!==null&&(o=a.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),aa(Rt),vt(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function w3(a,i){switch(dh(i),i.tag){case 1:return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 3:return aa(Rt),V(),a=i.flags,(a&65536)!==0&&(a&128)===0?(i.flags=a&-65537|128,i):null;case 26:case 27:case 5:return xe(i),null;case 31:if(i.memoizedState!==null){if(Un(i),i.alternate===null)throw Error(r(340));ki()}return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 13:if(Un(i),a=i.memoizedState,a!==null&&a.dehydrated!==null){if(i.alternate===null)throw Error(r(340));ki()}return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 19:return Q(Pt),null;case 4:return V(),null;case 10:return aa(i.type),null;case 22:case 23:return Un(i),Ah(),a!==null&&Q(Mi),a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 24:return aa(Rt),null;case 25:return null;default:return null}}function S1(a,i){switch(dh(i),i.tag){case 3:aa(Rt),V();break;case 26:case 27:case 5:xe(i);break;case 4:V();break;case 31:i.memoizedState!==null&&Un(i);break;case 13:Un(i);break;case 19:Q(Pt);break;case 10:aa(i.type);break;case 22:case 23:Un(i),Ah(),a!==null&&Q(Mi);break;case 24:aa(Rt)}}function _o(a,i){try{var o=i.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var p=u.next;o=p;do{if((o.tag&a)===a){u=void 0;var g=o.create,N=o.inst;u=g(),N.destroy=u}o=o.next}while(o!==p)}}catch(O){it(i,i.return,O)}}function Va(a,i,o){try{var u=i.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var g=p.next;u=g;do{if((u.tag&a)===a){var N=u.inst,O=N.destroy;if(O!==void 0){N.destroy=void 0,p=i;var L=o,ee=O;try{ee()}catch(oe){it(p,L,oe)}}}u=u.next}while(u!==g)}}catch(oe){it(i,i.return,oe)}}function A1(a){var i=a.updateQueue;if(i!==null){var o=a.stateNode;try{vb(i,o)}catch(u){it(a,a.return,u)}}}function O1(a,i,o){o.props=$i(a.type,a.memoizedProps),o.state=a.memoizedState;try{o.componentWillUnmount()}catch(u){it(a,i,u)}}function No(a,i){try{var o=a.ref;if(o!==null){switch(a.tag){case 26:case 27:case 5:var u=a.stateNode;break;case 30:u=a.stateNode;break;default:u=a.stateNode}typeof o=="function"?a.refCleanup=o(u):o.current=u}}catch(p){it(a,i,p)}}function Dr(a,i){var o=a.ref,u=a.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(p){it(a,i,p)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(p){it(a,i,p)}else o.current=null}function E1(a){var i=a.type,o=a.memoizedProps,u=a.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(p){it(a,a.return,p)}}function ap(a,i,o){try{var u=a.stateNode;q3(u,a.type,o,i),u[An]=i}catch(p){it(a,a.return,p)}}function k1(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&ei(a.type)||a.tag===4}function ip(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||k1(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&ei(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function lp(a,i,o){var u=a.tag;if(u===5||u===6)a=a.stateNode,i?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(a,i):(i=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,i.appendChild(a),o=o._reactRootContainer,o!=null||i.onclick!==null||(i.onclick=Jr));else if(u!==4&&(u===27&&ei(a.type)&&(o=a.stateNode,i=null),a=a.child,a!==null))for(lp(a,i,o),a=a.sibling;a!==null;)lp(a,i,o),a=a.sibling}function Du(a,i,o){var u=a.tag;if(u===5||u===6)a=a.stateNode,i?o.insertBefore(a,i):o.appendChild(a);else if(u!==4&&(u===27&&ei(a.type)&&(o=a.stateNode),a=a.child,a!==null))for(Du(a,i,o),a=a.sibling;a!==null;)Du(a,i,o),a=a.sibling}function C1(a){var i=a.stateNode,o=a.memoizedProps;try{for(var u=a.type,p=i.attributes;p.length;)i.removeAttributeNode(p[0]);fn(i,u,o),i[on]=a,i[An]=o}catch(g){it(a,a.return,g)}}var ca=!1,Ut=!1,sp=!1,T1=typeof WeakSet=="function"?WeakSet:Set,tn=null;function j3(a,i){if(a=a.containerInfo,Ep=ed,a=qx(a),eh(a)){if("selectionStart"in a)var o={start:a.selectionStart,end:a.selectionEnd};else e:{o=(o=a.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var p=u.anchorOffset,g=u.focusNode;u=u.focusOffset;try{o.nodeType,g.nodeType}catch{o=null;break e}var N=0,O=-1,L=-1,ee=0,oe=0,me=a,te=null;t:for(;;){for(var le;me!==o||p!==0&&me.nodeType!==3||(O=N+p),me!==g||u!==0&&me.nodeType!==3||(L=N+u),me.nodeType===3&&(N+=me.nodeValue.length),(le=me.firstChild)!==null;)te=me,me=le;for(;;){if(me===a)break t;if(te===o&&++ee===p&&(O=N),te===g&&++oe===u&&(L=N),(le=me.nextSibling)!==null)break;me=te,te=me.parentNode}me=le}o=O===-1||L===-1?null:{start:O,end:L}}else o=null}o=o||{start:0,end:0}}else o=null;for(kp={focusedElem:a,selectionRange:o},ed=!1,tn=i;tn!==null;)if(i=tn,a=i.child,(i.subtreeFlags&1028)!==0&&a!==null)a.return=i,tn=a;else for(;tn!==null;){switch(i=tn,g=i.alternate,a=i.flags,i.tag){case 0:if((a&4)!==0&&(a=i.updateQueue,a=a!==null?a.events:null,a!==null))for(o=0;o title"))),fn(g,u,o),g[on]=a,en(g),u=g;break e;case"link":var N=$w("link","href",p).get(u+(o.href||""));if(N){for(var O=0;Oct&&(N=ct,ct=Me,Me=N);var F=Ux(O,Me),H=Ux(O,ct);if(F&&H&&(le.rangeCount!==1||le.anchorNode!==F.node||le.anchorOffset!==F.offset||le.focusNode!==H.node||le.focusOffset!==H.offset)){var J=me.createRange();J.setStart(F.node,F.offset),le.removeAllRanges(),Me>ct?(le.addRange(J),le.extend(H.node,H.offset)):(J.setEnd(H.node,H.offset),le.addRange(J))}}}}for(me=[],le=O;le=le.parentNode;)le.nodeType===1&&me.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;Oo?32:o,R.T=null,o=hp,hp=null;var g=Za,N=ha;if(Yt=0,Zl=Za=null,ha=0,(tt&6)!==0)throw Error(r(331));var O=tt;if(tt|=4,H1(g.current),L1(g,g.current,N,o),tt=O,Co(0,!1),we&&typeof we.onPostCommitFiberRoot=="function")try{we.onPostCommitFiberRoot(ve,g)}catch{}return!0}finally{z.p=p,R.T=u,lw(a,i)}}function ow(a,i,o){i=nr(o,i),i=Vh(a.stateNode,i,2),a=Ka(a,i,2),a!==null&&(Xs(a,2),Pr(a))}function it(a,i,o){if(a.tag===3)ow(a,a,o);else for(;i!==null;){if(i.tag===3){ow(i,a,o);break}else if(i.tag===1){var u=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Wa===null||!Wa.has(u))){a=nr(o,a),o=c1(2),u=Ka(i,o,2),u!==null&&(u1(o,u,i,a),Xs(u,2),Pr(u));break}}i=i.return}}function gp(a,i,o){var u=a.pingCache;if(u===null){u=a.pingCache=new S3;var p=new Set;u.set(i,p)}else p=u.get(i),p===void 0&&(p=new Set,u.set(i,p));p.has(o)||(up=!0,p.add(o),a=C3.bind(null,a,i,o),i.then(a,a))}function C3(a,i,o){var u=a.pingCache;u!==null&&u.delete(i),a.pingedLanes|=a.suspendedLanes&o,a.warmLanes&=~o,ft===a&&(Ye&o)===o&&(Ot===4||Ot===3&&(Ye&62914560)===Ye&&300>B()-Iu?(tt&2)===0&&Ql(a,0):dp|=o,Wl===Ye&&(Wl=0)),Pr(a)}function cw(a,i){i===0&&(i=rx()),a=Oi(a,i),a!==null&&(Xs(a,i),Pr(a))}function T3(a){var i=a.memoizedState,o=0;i!==null&&(o=i.retryLane),cw(a,o)}function M3(a,i){var o=0;switch(a.tag){case 31:case 13:var u=a.stateNode,p=a.memoizedState;p!==null&&(o=p.retryLane);break;case 19:u=a.stateNode;break;case 22:u=a.stateNode._retryCache;break;default:throw Error(r(314))}u!==null&&u.delete(i),cw(a,o)}function D3(a,i){return Dt(a,i)}var qu=null,es=null,xp=!1,Ku=!1,bp=!1,Ja=0;function Pr(a){a!==es&&a.next===null&&(es===null?qu=es=a:es=es.next=a),Ku=!0,xp||(xp=!0,z3())}function Co(a,i){if(!bp&&Ku){bp=!0;do for(var o=!1,u=qu;u!==null;){if(a!==0){var p=u.pendingLanes;if(p===0)var g=0;else{var N=u.suspendedLanes,O=u.pingedLanes;g=(1<<31-We(42|a)+1)-1,g&=p&~(N&~O),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(o=!0,mw(u,g))}else g=Ye,g=Fc(u,u===ft?g:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(g&3)===0||Fs(u,g)||(o=!0,mw(u,g));u=u.next}while(o);bp=!1}}function P3(){uw()}function uw(){Ku=xp=!1;var a=0;Ja!==0&&Y3()&&(a=Ja);for(var i=B(),o=null,u=qu;u!==null;){var p=u.next,g=dw(u,i);g===0?(u.next=null,o===null?qu=p:o.next=p,p===null&&(es=o)):(o=u,(a!==0||(g&3)!==0)&&(Ku=!0)),u=p}Yt!==0&&Yt!==5||Co(a),Ja!==0&&(Ja=0)}function dw(a,i){for(var o=a.suspendedLanes,u=a.pingedLanes,p=a.expirationTimes,g=a.pendingLanes&-62914561;0O)break;var oe=L.transferSize,me=L.initiatorType;oe&&ww(me)&&(L=L.responseEnd,N+=oe*(L"u"?null:document;function Dw(a,i,o){var u=ts;if(u&&typeof i=="string"&&i){var p=er(i);p='link[rel="'+a+'"][href="'+p+'"]',typeof o=="string"&&(p+='[crossorigin="'+o+'"]'),Mw.has(p)||(Mw.add(p),a={rel:a,crossOrigin:o,href:i},u.querySelector(p)===null&&(i=u.createElement("link"),fn(i,"link",a),en(i),u.head.appendChild(i)))}}function eT(a){pa.D(a),Dw("dns-prefetch",a,null)}function tT(a,i){pa.C(a,i),Dw("preconnect",a,i)}function nT(a,i,o){pa.L(a,i,o);var u=ts;if(u&&a&&i){var p='link[rel="preload"][as="'+er(i)+'"]';i==="image"&&o&&o.imageSrcSet?(p+='[imagesrcset="'+er(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(p+='[imagesizes="'+er(o.imageSizes)+'"]')):p+='[href="'+er(a)+'"]';var g=p;switch(i){case"style":g=ns(a);break;case"script":g=rs(a)}or.has(g)||(a=y({rel:"preload",href:i==="image"&&o&&o.imageSrcSet?void 0:a,as:i},o),or.set(g,a),u.querySelector(p)!==null||i==="style"&&u.querySelector(Po(g))||i==="script"&&u.querySelector(zo(g))||(i=u.createElement("link"),fn(i,"link",a),en(i),u.head.appendChild(i)))}}function rT(a,i){pa.m(a,i);var o=ts;if(o&&a){var u=i&&typeof i.as=="string"?i.as:"script",p='link[rel="modulepreload"][as="'+er(u)+'"][href="'+er(a)+'"]',g=p;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=rs(a)}if(!or.has(g)&&(a=y({rel:"modulepreload",href:a},i),or.set(g,a),o.querySelector(p)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(zo(g)))return}u=o.createElement("link"),fn(u,"link",a),en(u),o.head.appendChild(u)}}}function aT(a,i,o){pa.S(a,i,o);var u=ts;if(u&&a){var p=Nl(u).hoistableStyles,g=ns(a);i=i||"default";var N=p.get(g);if(!N){var O={loading:0,preload:null};if(N=u.querySelector(Po(g)))O.loading=5;else{a=y({rel:"stylesheet",href:a,"data-precedence":i},o),(o=or.get(g))&&Ip(a,o);var L=N=u.createElement("link");en(L),fn(L,"link",a),L._p=new Promise(function(ee,oe){L.onload=ee,L.onerror=oe}),L.addEventListener("load",function(){O.loading|=1}),L.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Xu(N,i,u)}N={type:"stylesheet",instance:N,count:1,state:O},p.set(g,N)}}}function iT(a,i){pa.X(a,i);var o=ts;if(o&&a){var u=Nl(o).hoistableScripts,p=rs(a),g=u.get(p);g||(g=o.querySelector(zo(p)),g||(a=y({src:a,async:!0},i),(i=or.get(p))&&$p(a,i),g=o.createElement("script"),en(g),fn(g,"link",a),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},u.set(p,g))}}function lT(a,i){pa.M(a,i);var o=ts;if(o&&a){var u=Nl(o).hoistableScripts,p=rs(a),g=u.get(p);g||(g=o.querySelector(zo(p)),g||(a=y({src:a,async:!0,type:"module"},i),(i=or.get(p))&&$p(a,i),g=o.createElement("script"),en(g),fn(g,"link",a),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},u.set(p,g))}}function Pw(a,i,o,u){var p=(p=be.current)?Fu(p):null;if(!p)throw Error(r(446));switch(a){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(i=ns(o.href),o=Nl(p).hoistableStyles,u=o.get(i),u||(u={type:"style",instance:null,count:0,state:null},o.set(i,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){a=ns(o.href);var g=Nl(p).hoistableStyles,N=g.get(a);if(N||(p=p.ownerDocument||p,N={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(a,N),(g=p.querySelector(Po(a)))&&!g._p&&(N.instance=g,N.state.loading=5),or.has(a)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},or.set(a,o),g||sT(p,a,o,N.state))),i&&u===null)throw Error(r(528,""));return N}if(i&&u!==null)throw Error(r(529,""));return null;case"script":return i=o.async,o=o.src,typeof o=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=rs(o),o=Nl(p).hoistableScripts,u=o.get(i),u||(u={type:"script",instance:null,count:0,state:null},o.set(i,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,a))}}function ns(a){return'href="'+er(a)+'"'}function Po(a){return'link[rel="stylesheet"]['+a+"]"}function zw(a){return y({},a,{"data-precedence":a.precedence,precedence:null})}function sT(a,i,o,u){a.querySelector('link[rel="preload"][as="style"]['+i+"]")?u.loading=1:(i=a.createElement("link"),u.preload=i,i.addEventListener("load",function(){return u.loading|=1}),i.addEventListener("error",function(){return u.loading|=2}),fn(i,"link",o),en(i),a.head.appendChild(i))}function rs(a){return'[src="'+er(a)+'"]'}function zo(a){return"script[async]"+a}function Iw(a,i,o){if(i.count++,i.instance===null)switch(i.type){case"style":var u=a.querySelector('style[data-href~="'+er(o.href)+'"]');if(u)return i.instance=u,en(u),u;var p=y({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(a.ownerDocument||a).createElement("style"),en(u),fn(u,"style",p),Xu(u,o.precedence,a),i.instance=u;case"stylesheet":p=ns(o.href);var g=a.querySelector(Po(p));if(g)return i.state.loading|=4,i.instance=g,en(g),g;u=zw(o),(p=or.get(p))&&Ip(u,p),g=(a.ownerDocument||a).createElement("link"),en(g);var N=g;return N._p=new Promise(function(O,L){N.onload=O,N.onerror=L}),fn(g,"link",u),i.state.loading|=4,Xu(g,o.precedence,a),i.instance=g;case"script":return g=rs(o.src),(p=a.querySelector(zo(g)))?(i.instance=p,en(p),p):(u=o,(p=or.get(g))&&(u=y({},o),$p(u,p)),a=a.ownerDocument||a,p=a.createElement("script"),en(p),fn(p,"link",u),a.head.appendChild(p),i.instance=p);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(u=i.instance,i.state.loading|=4,Xu(u,o.precedence,a));return i.instance}function Xu(a,i,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=u.length?u[u.length-1]:null,g=p,N=0;N title"):null)}function oT(a,i,o){if(o===1||i.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return a=i.disabled,typeof i.precedence=="string"&&a==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Lw(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function cT(a,i,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var p=ns(u.href),g=i.querySelector(Po(p));if(g){i=g._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(a.count++,a=Zu.bind(a),i.then(a,a)),o.state.loading|=4,o.instance=g,en(g);return}g=i.ownerDocument||i,u=zw(u),(p=or.get(p))&&Ip(u,p),g=g.createElement("link"),en(g);var N=g;N._p=new Promise(function(O,L){N.onload=O,N.onerror=L}),fn(g,"link",u),o.instance=g}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(o,i),(i=o.state.preload)&&(o.state.loading&3)===0&&(a.count++,o=Zu.bind(a),i.addEventListener("load",o),i.addEventListener("error",o))}}var Rp=0;function uT(a,i){return a.stylesheets&&a.count===0&&Ju(a,a.stylesheets),0Rp?50:800)+i);return a.unsuspend=o,function(){a.unsuspend=null,clearTimeout(u),clearTimeout(p)}}:null}function Zu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ju(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var Qu=null;function Ju(a,i){a.stylesheets=null,a.unsuspend!==null&&(a.count++,Qu=new Map,i.forEach(dT,a),Qu=null,Zu.call(a))}function dT(a,i){if(!(i.state.loading&4)){var o=Qu.get(a);if(o)var u=o.get(null);else{o=new Map,Qu.set(a,o);for(var p=a.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Vp.exports=CT(),Vp.exports}var MT=TT();const DT=Ky(MT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PT=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),zT=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),cj=e=>{const t=zT(e);return t.charAt(0).toUpperCase()+t.slice(1)},lA=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),IT=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="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 $T={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 RT=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:l="",children:s,iconNode:d,...f},m)=>x.createElement("svg",{ref:m,...$T,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:lA("lucide",l),...!s&&!IT(f)&&{"aria-hidden":"true"},...f},[...d.map(([h,v])=>x.createElement(h,v)),...Array.isArray(s)?s:[s]]));/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Oe=(e,t)=>{const n=x.forwardRef(({className:r,...l},s)=>x.createElement(RT,{ref:s,iconNode:t,className:lA(`lucide-${PT(cj(e))}`,`lucide-${e}`,r),...l}));return n.displayName=cj(e),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 LT=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],uj=Oe("activity",LT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Rv=Oe("arrow-right",BT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UT=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],gs=Oe("bell",UT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HT=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],ps=Oe("bot",HT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qT=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],sA=Oe("box",qT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const KT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ci=Oe("check",KT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const YT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],GT=Oe("chevron-down",YT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VT=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],FT=Oe("chevron-left",VT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const XT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],WT=Oe("chevron-right",XT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZT=[["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"}]],$d=Oe("circle-alert",ZT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const QT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],oA=Oe("circle-check",QT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JT=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],eM=Oe("circle-dashed",JT);/** + * @license lucide-react v0.562.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 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],cA=Oe("clock-3",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=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],dj=Oe("clock",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:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],od=Oe("cloud-upload",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=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],fj=Oe("code",aM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iM=[["rect",{width:"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"}]],lM=Oe("copy",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 sM=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Lv=Oe("credit-card",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 oM=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],cM=Oe("database",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 uM=[["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"}]],dM=Oe("dollar-sign",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:"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"}]],uA=Oe("external-link",fM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mM=[["path",{d:"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"}]],ic=Oe("eye-off",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 hM=[["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"}]],xs=Oe("eye",hM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pM=[["path",{d:"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:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],vM=Oe("file-down",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 yM=[["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"}]],mj=Oe("file-text",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 gM=[["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"}]],xM=Oe("gift",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=[["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"}]],hj=Oe("image",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 wM=[["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"}]],jM=Oe("key",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 _M=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],NM=Oe("layers",_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 SM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],AM=Oe("layout-dashboard",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 OM=[["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"}]],EM=Oe("link-2",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 kM=[["path",{d:"M16 5H3",key:"m91uny"}],["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 19H3",key:"zzsher"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]],CM=Oe("list-plus",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 TM=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Yn=Oe("loader-circle",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=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],pj=Oe("lock-keyhole",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 DM=[["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=Oe("lock",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:"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=Oe("log-out",zM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $M=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],dA=Oe("mail",$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 RM=[["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"}]],Cd=Oe("message-circle",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:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],uc=Oe("package-check",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 BM=[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],Zp=Oe("package-plus",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 UM=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],fA=Oe("package",UM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HM=[["path",{d:"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"}]],mA=Oe("pen",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 qM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ja=Oe("plus",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 KM=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],YM=Oe("power",KM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const GM=[["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"}]],Qp=Oe("qr-code",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 VM=[["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"}]],pr=Oe("refresh-cw",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 FM=[["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"}]],Sa=Oe("save",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 XM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],WM=Oe("search",XM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZM=[["path",{d:"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"}]],Yy=Oe("send",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 QM=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Gy=Oe("settings",QM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JM=[["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"}]],hA=Oe("shield-check",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 eD=[["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"}]],pA=Oe("shopping-bag",eD);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tD=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],vj=Oe("shopping-cart",tD);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nD=[["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=Oe("sparkles",nD);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rD=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],bs=Oe("square-pen",rD);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aD=[["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"}]],xa=Oe("trash-2",aD);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iD=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],lD=Oe("trending-up",iD);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sD=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]],yj=Oe("truck",sD);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oD=[["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"}]],tc=Oe("upload",oD);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cD=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],uD=Oe("user-round",cD);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dD=[["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"}]],Bv=Oe("user",dD);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fD=[["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"}]],yA=Oe("users",fD);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mD=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],hD=Oe("webhook",mD);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xt=Oe("x",pD);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vD=[["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"}]],Uv=Oe("zap",vD),yD=({activeTab:e,onNavigate:t,onLogout:n})=>{const r=[{id:"dashboard",icon:AM,label:"仪表盘"},{id:"accounts",icon:yA,label:"账号管理"},{id:"orders",icon:pA,label:"订单管理"},{id:"cards",icon:Lv,label:"卡密库存"},{id:"items",icon:sA,label:"商品列表"},{id:"rules",icon:Uv,label:"自动化规则"},{id:"notifications",icon:gs,label:"通知设置"},{id:"settings",icon:Gy,label:"系统与AI"}];return c.jsxs("div",{className:"w-64 h-screen fixed left-0 top-0 bg-white border-r border-gray-100 flex flex-col justify-between z-20 shadow-[4px_0_24px_rgba(0,0,0,0.02)]",children:[c.jsxs("div",{className:"p-6",children:[c.jsxs("div",{className:"flex items-center gap-3 mb-12 px-2",children:[c.jsx("div",{className:"w-10 h-10 bg-[#0094f7] squircle flex items-center justify-center shrink-0 p-1.5",style:{filter:"drop-shadow(0 4px 12px rgba(0,148,247,0.25))"},children:c.jsx("img",{src:"/static/ydisks-logo.svg",alt:"Ydisks",className:"w-full h-full"})}),c.jsxs("h1",{className:"text-xl font-extrabold tracking-tight text-gray-900",children:["Ydisks闲鱼助手 ",c.jsx("span",{className:"text-xs bg-[#0094f7] text-white px-1.5 py-0.5 rounded ml-1",children:"PRO"})]})]}),c.jsx("nav",{className:"space-y-2",children:r.map(l=>{const s=l.icon,d=e===l.id;return c.jsxs("button",{onClick:()=>t(l.id),className:`w-full flex items-center gap-3 px-4 py-3.5 rounded-2xl transition-all duration-300 group relative overflow-hidden ${d?"bg-[#0094f7] text-white font-bold shadow-lg shadow-blue-100 transform scale-[1.02]":"text-gray-500 hover:bg-gray-50 hover:text-gray-900"}`,children:[c.jsx(s,{className:`w-5 h-5 transition-colors ${d?"text-white":"text-gray-400 group-hover:text-gray-600"}`}),c.jsx("span",{className:"text-sm tracking-wide",children:l.label}),d&&c.jsx(vA,{className:"w-4 h-4 absolute right-3 text-white/30 animate-pulse"})]},l.id)})})]}),c.jsx("div",{className:"p-6 border-t border-gray-50",children:c.jsxs("button",{onClick:n,className:"w-full flex items-center gap-3 px-4 py-3 text-gray-500 hover:text-red-500 hover:bg-red-50 rounded-2xl transition-all duration-200 font-medium",children:[c.jsx(IM,{className:"w-5 h-5"}),c.jsx("span",{className:"text-sm",children:"退出登录"})]})})]})},gD=e=>{if(!e)return"";const t=new URLSearchParams;for(const[r,l]of Object.entries(e))l!=null&&t.set(r,String(l));const n=t.toString();return n?`?${n}`:""},Rf=async(e,t,n={})=>{const r=gD(n.params),l=`${t}${r}`,s=await fetch(l,{method:e,credentials:"include",headers:{...n.body===void 0?{}:{"Content-Type":"application/json"}},body:n.body===void 0?void 0:JSON.stringify(n.body)}),f=(s.headers.get("content-type")||"").includes("application/json");if(!s.ok){const m=f?await s.json().catch(()=>{}):await s.text().catch(()=>{}),h=typeof m=="string"?m:(m==null?void 0:m.detail)||(m==null?void 0:m.message)||(m==null?void 0:m.msg);throw new Error(h||`请求失败: ${s.status}`)}return f?await s.json():await s.text()},Tt=async(e,t)=>Rf("GET",e,{params:t}),$t=async(e,t)=>Rf("POST",e,{body:t}),Sn=async(e,t)=>Rf("PUT",e,{body:t}),ml=async(e,t)=>Rf("DELETE",e,{params:t}),Vy=async(e,t)=>{const n=await fetch(e,{method:"POST",credentials:"include",body:t}),s=(n.headers.get("content-type")||"").includes("application/json")?await n.json().catch(()=>{}):await n.text().catch(()=>{});if(!n.ok){const d=typeof s=="string"?s:(s==null?void 0:s.detail)||(s==null?void 0:s.message)||(s==null?void 0:s.msg),f=new Error(d||"请求失败: "+n.status);throw f.payload=s,f}return s},xD=async e=>$t("/login",e),gA=async()=>Tt("/verify"),bD=async e=>Sn("/account/credentials",e),wD=async(e,t)=>$t("/cookies",{id:e,value:t}),jD=(e,t)=>{const n=e.avatar_url||"";if(!n)return"";try{const r=new URL(n,window.location.origin);return r.hostname.endsWith("alicdn.com")&&r.searchParams.set("_v",t),r.toString()}catch{return n}},Fy=async()=>{const e=await Tt("/cookies/details"),t=Date.now().toString();return e.map(n=>({id:n.id,value:"",cookie:"",enabled:n.enabled,auto_confirm:n.auto_confirm,remark:n.remark,note:n.remark,pause_duration:n.pause_duration,username:n.username||"",login_password:"",show_browser:n.show_browser,nickname:n.nickname||n.remark||`账号 ${n.id.substring(0,6)}`,avatar_url:jD(n,t),profile_error:n.profile_error||"",ai_enabled:!1}))},_D=async()=>Tt("/cookies/runtime-status"),ND=async()=>$t("/qr-login/generate"),SD=async e=>Tt(`/qr-login/check/${e}`),AD=async(e,t)=>Sn(`/cookies/${e}/status`,{enabled:t}),OD=async e=>ml(`/cookies/${e}`),ED=async(e,t)=>Sn(`/cookies/${e}/remark`,{remark:t}),kD=async(e,t)=>Sn(`/cookies/${e}/auto-confirm`,{auto_confirm:t}),CD=async(e,t)=>Sn(`/cookies/${e}/pause-duration`,{pause_duration:t}),gj=async(e,t)=>Sn(`/cookies/${e}`,{id:e,value:t}),TD=async e=>$t(`/cookies/${e}/refresh-profile`,{}),MD=async(e,t)=>Sn(`/cookies/${e}/login-info`,t),DD=async()=>Tt("/ai-reply-settings"),xj=async(e,t,n=1,r=20)=>{const l={page:n,page_size:r};t&&t!=="all"&&(l.status=t);const s=await Tt("/api/orders",l),f=(s.orders||s.data||[]).map(m=>({...m,id:m.id||m.order_id,status:m.status||m.order_status||"processing",quantity:Number(m.quantity||1)}));return{success:!0,data:f,total:s.total||f.length,page:s.page||n,page_size:s.page_size||r,total_pages:s.total_pages||1}},PD=async(e,t)=>Sn(`/api/orders/${e}`,t),zD=async e=>ml(`/api/orders/${e}`),ID=async(e,t)=>{const n=new FormData,r=await fetch("/api/orders/refresh",{method:"POST",credentials:"include",body:n}),l=await r.json().catch(()=>({}));if(!r.ok||l.success===!1)throw new Error(l.detail||l.message||`订单同步失败: ${r.status}`);return l},$D=async e=>$t(`/api/orders/${e}/refresh`),RD=async(e,t,n)=>$t("/api/orders/manual-ship",{order_ids:e,ship_mode:t,custom_content:n}),LD=async e=>{const t=e instanceof FormData,n=await fetch("/api/orders/import",{method:"POST",credentials:"include",headers:{...t?{}:{"Content-Type":"application/json"}},body:t?e:JSON.stringify(e)}),r=await n.json().catch(()=>({}));if(!n.ok||r.success===!1)throw new Error(r.detail||r.message||`订单导入失败: ${n.status}`);return r},BD=async()=>Tt("/admin/stats"),bj=async(e=7)=>{let t;if(typeof e=="number"){const n=new Date,r=new Date;r.setDate(r.getDate()-e),t={start_date:r.toISOString().split("T")[0],end_date:n.toISOString().split("T")[0]}}else t=e;return Tt("/analytics/orders",t)},UD=async e=>{const t=await Tt("/analytics/orders/valid",{start_date:e.start_date,end_date:e.end_date});return(Array.isArray(t)?t:t.orders||[]).map(r=>({...r,id:r.id||r.order_id,status:r.status||r.order_status||"processing",quantity:Number(r.quantity||1)}))},HD=e=>{let t=e.api_config;if(typeof t=="string"&&t.trim())try{t=JSON.parse(t)}catch{t=void 0}return{...e,api_config:t||void 0}},xA=e=>({...e,api_config:e.api_config?JSON.stringify(e.api_config):""}),va=async()=>{const e=await Tt("/cards");return(Array.isArray(e)?e:e.cards||[]).map(HD)},qD=async e=>$t("/cards",xA(e)),wj=async(e,t)=>Sn(`/cards/${e}`,xA(t)),KD=async e=>ml(`/cards/${e}`),YD=async e=>{const t=new FormData;return t.append("file",e),Vy("/cards/batch",t)},GD=async(e,t)=>$t(`/cards/${e}/append-data`,{content:t}),Jp=e=>e===!0||e===1||e==="1",Ns=async()=>{const e=await Tt("/items");return(Array.isArray(e)?e:e.items||[]).map(n=>({...n,id:n.id||`${n.cookie_id}-${n.item_id}`,is_multi_spec:Jp(n.is_multi_spec),is_multi_qty_ship:Jp(n.is_multi_qty_ship??n.multi_quantity_delivery),multi_quantity_delivery:Jp(n.multi_quantity_delivery??n.is_multi_qty_ship)}))},VD=async e=>$t("/items/get-all-from-account",{cookie_id:e}),FD=async(e,t)=>ml(`/items/${e}/${t}`),XD=async(e,t)=>$t(`/items/${e}`,t),WD=async e=>{const t=new FormData;t.set("cookie_id",e.cookie_id),t.set("title",e.title),t.set("description",e.description),t.set("price",e.price),t.set("original_price",e.original_price||""),t.set("quantity",String(e.quantity)),t.set("postage_mode",e.postage_mode),t.set("postage",e.postage||"");for(const n of e.images)t.append("images",n);return Vy("/items/publish",t)},ZD=async e=>{const t=new FormData;return t.set("file",e.file),e.imagesZip&&t.set("images_zip",e.imagesZip),e.defaultCookieId&&t.set("default_cookie_id",e.defaultCookieId),Vy("/items/publish-batches/preview",t)},QD=async e=>$t("/items/publish-batches",{preview_id:e}),cd=async e=>Tt(`/items/publish-batches/${e}`),JD=async e=>$t(`/items/publish-batches/${e}/cancel`,{}),eP=async e=>$t(`/items/publish-batches/${e}/retry-failed`,{}),tP=async(e,t,n)=>Sn(`/items/${e}/${t}`,n),Rd=async()=>{const e=await Tt("/automation-rules");return(Array.isArray(e)?e:e.data||e.rules||[]).map(n=>{var r,l;return{id:String(n.id),name:n.name||"",trigger_type:n.trigger_type||"order_paid",item_keyword:n.item_title||n.item_id||"",cookie_id:n.cookie_id||"",item_id:n.item_id||"",item_title:n.item_title||"",card_group_id:Number(((r=(n.actions||[]).find(s=>s.action_type==="send_card"))==null?void 0:r.card_id)||0),card_group_name:((l=(n.actions||[]).find(s=>s.action_type==="send_card"))==null?void 0:l.card_name)||"",priority:n.priority||100,enabled:n.enabled||!1,config_json:n.config_json||"{}",actions:(n.actions||[]).map(s=>({id:s.id?String(s.id):void 0,action_type:s.action_type,card_id:Number(s.card_id||0),card_name:s.card_name||"",delivery_count:Number(s.delivery_count||1),message_template:s.message_template||"",delay_seconds:Number(s.delay_seconds||0),config_json:s.config_json||"{}",enabled:s.enabled!==!1,sort_order:Number(s.sort_order||0)})),variants:(n.actions||[]).filter(s=>s.action_type==="send_card").map(s=>{let d={};try{d=JSON.parse(s.config_json||"{}")}catch{}return{id:s.id?String(s.id):void 0,spec_name:d.spec_name||"",spec_value:d.spec_value||"",card_id:Number(s.card_id||0),card_name:s.card_name||"",delivery_count:Number(s.delivery_count||1),enabled:s.enabled!==!1,config_json:s.config_json||"{}"}})}})},nP=(e,t)=>{if(e!=="order_paid")return t.map((l,s)=>({...l,sort_order:l.sort_order||s+1}));const n=t.filter(l=>l.action_type==="send_card").map((l,s)=>({...l,sort_order:s+1})),r=t.filter(l=>l.action_type!=="send_card"&&l.action_type!=="confirm_shipment");return[...n,...r.map((l,s)=>({...l,sort_order:n.length+s+1})),{action_type:"confirm_shipment",enabled:!0,sort_order:n.length+r.length+1}]},jj=async e=>{const t=e.trigger_type||"order_paid",r=[{order_paid:"付款后自动发货",buyer_reviewed:"评价后发送赠品",review_missing_timeout:"超时未评价求评价"}[t]||"自动化规则",e.item_title||e.item_id||e.cookie_id||""].filter(Boolean).join(" - "),l=e.variants&&e.variants.length>0?e.variants.map((f,m)=>({action_type:"send_card",card_id:f.card_id,delivery_count:f.delivery_count||1,enabled:f.enabled!==!1,sort_order:m+1,config_json:JSON.stringify({spec_name:f.spec_name||"",spec_value:f.spec_value||""})})):e.actions&&e.actions.length>0?e.actions:[{action_type:"send_card",card_id:e.card_group_id||0,delivery_count:1,enabled:!0,sort_order:1}],s=nP(t,l),d={cookie_id:e.cookie_id||"",item_id:e.item_id||"",name:(e.name||"").trim()||r||"自动化规则",trigger_type:t,enabled:e.enabled??!0,priority:e.priority||100,config_json:e.config_json||"{}",actions:s.map((f,m)=>({action_type:f.action_type,card_id:f.card_id||0,delivery_count:f.delivery_count||1,message_template:f.message_template||"",delay_seconds:f.delay_seconds||0,config_json:f.config_json||"{}",enabled:f.enabled!==!1,sort_order:f.sort_order||m+1}))};return e.id?Sn(`/automation-rules/${e.id}`,d):$t("/automation-rules",d)},rP=async e=>ml(`/automation-rules/${e}`),aP=async e=>{if(!e)return[];const t=await Tt(`/keywords-with-item-id/${e}`);return(Array.isArray(t)?t:[]).map((r,l)=>({id:String(l),keyword:r.keyword||"",reply_content:r.reply||"",match_type:"exact",enabled:!0}))},iP=async(e,t)=>{const n=await Tt(`/keywords-with-item-id/${t}`),r=Array.isArray(n)?n:[];if(e.id){const l=parseInt(e.id);l>=0&&l{const n=await Tt(`/keywords-with-item-id/${t}`),r=Array.isArray(n)?n:[],l=parseInt(e);return l>=0&&l{const e=await Tt("/system-settings");return e.data||e},wA=async e=>{const t=Object.entries(e).map(([n,r])=>Sn(`/system-settings/${n}`,{value:String(r)}));return await Promise.all(t),{success:!0,message:"Settings saved"}},sP=async e=>Tt(`/ai-reply-settings/${e}`),oP=async(e,t)=>{const n={ai_enabled:t.ai_enabled??!1,max_discount_percent:t.max_discount_percent??10,max_discount_amount:t.max_discount_amount??100,max_bargain_rounds:t.max_bargain_rounds??3,custom_prompts:t.custom_prompts??""};return Sn(`/ai-reply-settings/${e}`,n)},cP=async(e,t="")=>(await $t("/ai-models",{base_url:e,api_key:t})).models||[],jA=async()=>({success:!0,data:(await Tt("/notification-channels")||[]).map(n=>{let r;try{r=JSON.parse(n.config)}catch{r=void 0}return{id:String(n.id),name:n.name,type:n.type,config:r,enabled:n.enabled,created_at:n.created_at,updated_at:n.updated_at}})}),uP=async e=>$t("/notification-channels",{...e,config:JSON.stringify(e.config)}),_j=async(e,t)=>{const n={...t};return"config"in t&&(n.config=JSON.stringify(t.config)),Sn(`/notification-channels/${e}`,n)},dP=async e=>ml(`/notification-channels/${e}`),fP=async e=>{const t=await Tt(`/message-notifications/${e}`);return(t==null?void 0:t.channel_ids)||[]},mP=async(e,t)=>$t(`/message-notifications/${e}`,{channel_ids:t}),hP=async e=>$t(`/notification-channels/${e}/test`,{}),Nj=async()=>Tt("/api/default-replies"),pP=async e=>{const t=await Tt(`/api/default-reply/${e}`);return{cookie_id:e,enabled:t.enabled||!1,reply_content:t.reply_content||"",reply_once:t.reply_once||!1,reply_image_url:t.reply_image_url||""}},vP=async(e,t)=>Sn(`/api/default-reply/${e}`,{enabled:t.enabled??!1,reply_content:t.reply_content||"",reply_once:t.reply_once??!1,reply_image_url:t.reply_image_url||""}),yP=async e=>ml(`/api/default-reply/${e}`),gP=async e=>$t(`/api/default-reply/${e}/clear-records`,{});function _A(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t{var n=e.children,r=e.width,l=e.height,s=e.viewBox,d=e.className,f=e.style,m=e.title,h=e.desc,v=NP(e,_P),y=s||{width:r,height:l,x:0,y:0},b=nt("recharts-surface",d);return x.createElement("svg",Hv({},Xn(v),{className:b,width:r,height:l,style:f,viewBox:"".concat(y.x," ").concat(y.y," ").concat(y.width," ").concat(y.height),ref:t}),x.createElement("title",null,m),x.createElement("desc",null,h),n)}),AP=["children","className"];function qv(){return qv=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.className,l=OP(e,AP),s=nt("recharts-layer",r);return x.createElement("g",qv({className:s},Xn(l),{ref:t}),n)}),It=iA(),AA=x.createContext(null),kP=()=>x.useContext(AA);function ht(e){return function(){return e}}const OA=Math.cos,Ld=Math.sin,Er=Math.sqrt,Bd=Math.PI,Lf=2*Bd,Kv=Math.PI,Yv=2*Kv,Ki=1e-6,CP=Yv-Ki;function EA(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return EA;const n=10**t;return function(r){this._+=r[0];for(let l=1,s=r.length;lKi)if(!(Math.abs(y*m-h*v)>Ki)||!s)this._append`L${this._x1=t},${this._y1=n}`;else{let w=r-d,j=l-f,_=m*m+h*h,S=w*w+j*j,A=Math.sqrt(_),C=Math.sqrt(b),M=s*Math.tan((Kv-Math.acos((_+b-S)/(2*A*C)))/2),k=M/C,D=M/A;Math.abs(k-1)>Ki&&this._append`L${t+k*v},${n+k*y}`,this._append`A${s},${s},0,0,${+(y*w>v*j)},${this._x1=t+D*m},${this._y1=n+D*h}`}}arc(t,n,r,l,s,d){if(t=+t,n=+n,r=+r,d=!!d,r<0)throw new Error(`negative radius: ${r}`);let f=r*Math.cos(l),m=r*Math.sin(l),h=t+f,v=n+m,y=1^d,b=d?l-s:s-l;this._x1===null?this._append`M${h},${v}`:(Math.abs(this._x1-h)>Ki||Math.abs(this._y1-v)>Ki)&&this._append`L${h},${v}`,r&&(b<0&&(b=b%Yv+Yv),b>CP?this._append`A${r},${r},0,1,${y},${t-f},${n-m}A${r},${r},0,1,${y},${this._x1=h},${this._y1=v}`:b>Ki&&this._append`A${r},${r},0,${+(b>=Kv)},${y},${this._x1=t+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(t,n,r,l){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+l}h${-r}Z`}toString(){return this._}}function Zy(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new MP(t)}function Qy(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function kA(e){this._context=e}kA.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Bf(e){return new kA(e)}function CA(e){return e[0]}function TA(e){return e[1]}function MA(e,t){var n=ht(!0),r=null,l=Bf,s=null,d=Zy(f);e=typeof e=="function"?e:e===void 0?CA:ht(e),t=typeof t=="function"?t:t===void 0?TA:ht(t);function f(m){var h,v=(m=Qy(m)).length,y,b=!1,w;for(r==null&&(s=l(w=d())),h=0;h<=v;++h)!(h=w;--j)f.point(M[j],k[j]);f.lineEnd(),f.areaEnd()}A&&(M[b]=+e(S,b,y),k[b]=+t(S,b,y),f.point(r?+r(S,b,y):M[b],n?+n(S,b,y):k[b]))}if(C)return f=null,C+""||null}function v(){return MA().defined(l).curve(d).context(s)}return h.x=function(y){return arguments.length?(e=typeof y=="function"?y:ht(+y),r=null,h):e},h.x0=function(y){return arguments.length?(e=typeof y=="function"?y:ht(+y),h):e},h.x1=function(y){return arguments.length?(r=y==null?null:typeof y=="function"?y:ht(+y),h):r},h.y=function(y){return arguments.length?(t=typeof y=="function"?y:ht(+y),n=null,h):t},h.y0=function(y){return arguments.length?(t=typeof y=="function"?y:ht(+y),h):t},h.y1=function(y){return arguments.length?(n=y==null?null:typeof y=="function"?y:ht(+y),h):n},h.lineX0=h.lineY0=function(){return v().x(e).y(t)},h.lineY1=function(){return v().x(e).y(n)},h.lineX1=function(){return v().x(r).y(t)},h.defined=function(y){return arguments.length?(l=typeof y=="function"?y:ht(!!y),h):l},h.curve=function(y){return arguments.length?(d=y,s!=null&&(f=d(s)),h):d},h.context=function(y){return arguments.length?(y==null?s=f=null:f=d(s=y),h):s},h}class DA{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function DP(e){return new DA(e,!0)}function PP(e){return new DA(e,!1)}const Jy={draw(e,t){const n=Er(t/Bd);e.moveTo(n,0),e.arc(0,0,n,0,Lf)}},zP={draw(e,t){const n=Er(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},PA=Er(1/3),IP=PA*2,$P={draw(e,t){const n=Er(t/IP),r=n*PA;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},RP={draw(e,t){const n=Er(t),r=-n/2;e.rect(r,r,n,n)}},LP=.8908130915292852,zA=Ld(Bd/10)/Ld(7*Bd/10),BP=Ld(Lf/10)*zA,UP=-OA(Lf/10)*zA,HP={draw(e,t){const n=Er(t*LP),r=BP*n,l=UP*n;e.moveTo(0,-n),e.lineTo(r,l);for(let s=1;s<5;++s){const d=Lf*s/5,f=OA(d),m=Ld(d);e.lineTo(m*n,-f*n),e.lineTo(f*r-m*l,m*r+f*l)}e.closePath()}},ev=Er(3),qP={draw(e,t){const n=-Er(t/(ev*3));e.moveTo(0,n*2),e.lineTo(-ev*n,-n),e.lineTo(ev*n,-n),e.closePath()}},cr=-.5,ur=Er(3)/2,Gv=1/Er(12),KP=(Gv/2+1)*3,YP={draw(e,t){const n=Er(t/KP),r=n/2,l=n*Gv,s=r,d=n*Gv+n,f=-s,m=d;e.moveTo(r,l),e.lineTo(s,d),e.lineTo(f,m),e.lineTo(cr*r-ur*l,ur*r+cr*l),e.lineTo(cr*s-ur*d,ur*s+cr*d),e.lineTo(cr*f-ur*m,ur*f+cr*m),e.lineTo(cr*r+ur*l,cr*l-ur*r),e.lineTo(cr*s+ur*d,cr*d-ur*s),e.lineTo(cr*f+ur*m,cr*m-ur*f),e.closePath()}};function GP(e,t){let n=null,r=Zy(l);e=typeof e=="function"?e:ht(e||Jy),t=typeof t=="function"?t:ht(t===void 0?64:+t);function l(){let s;if(n||(n=s=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),s)return n=null,s+""||null}return l.type=function(s){return arguments.length?(e=typeof s=="function"?s:ht(s),l):e},l.size=function(s){return arguments.length?(t=typeof s=="function"?s:ht(+s),l):t},l.context=function(s){return arguments.length?(n=s??null,l):n},l}function Ud(){}function Hd(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function IA(e){this._context=e}IA.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Hd(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Hd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function VP(e){return new IA(e)}function $A(e){this._context=e}$A.prototype={areaStart:Ud,areaEnd:Ud,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Hd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function FP(e){return new $A(e)}function RA(e){this._context=e}RA.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Hd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function XP(e){return new RA(e)}function LA(e){this._context=e}LA.prototype={areaStart:Ud,areaEnd:Ud,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function WP(e){return new LA(e)}function Sj(e){return e<0?-1:1}function Aj(e,t,n){var r=e._x1-e._x0,l=t-e._x1,s=(e._y1-e._y0)/(r||l<0&&-0),d=(n-e._y1)/(l||r<0&&-0),f=(s*l+d*r)/(r+l);return(Sj(s)+Sj(d))*Math.min(Math.abs(s),Math.abs(d),.5*Math.abs(f))||0}function Oj(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function tv(e,t,n){var r=e._x0,l=e._y0,s=e._x1,d=e._y1,f=(s-r)/3;e._context.bezierCurveTo(r+f,l+f*t,s-f,d-f*n,s,d)}function qd(e){this._context=e}qd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:tv(this,this._t0,Oj(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,tv(this,Oj(this,n=Aj(this,e,t)),n);break;default:tv(this,this._t0,n=Aj(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function BA(e){this._context=new UA(e)}(BA.prototype=Object.create(qd.prototype)).point=function(e,t){qd.prototype.point.call(this,t,e)};function UA(e){this._context=e}UA.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,l,s){this._context.bezierCurveTo(t,e,r,n,s,l)}};function ZP(e){return new qd(e)}function QP(e){return new BA(e)}function HA(e){this._context=e}HA.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Ej(e),l=Ej(t),s=0,d=1;d=0;--t)l[t]=(d[t]-l[t+1])/s[t];for(s[n-1]=(e[n]+l[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function e6(e){return new Uf(e,.5)}function t6(e){return new Uf(e,0)}function n6(e){return new Uf(e,1)}function al(e,t){if((d=e.length)>1)for(var n=1,r,l,s=e[t[0]],d,f=s.length;n=0;)n[t]=t;return n}function r6(e,t){return e[t]}function a6(e){const t=[];return t.key=e,t}function i6(){var e=ht([]),t=Vv,n=al,r=r6;function l(s){var d=Array.from(e.apply(this,arguments),a6),f,m=d.length,h=-1,v;for(const y of s)for(f=0,++h;f0){for(var n,r,l=0,s=e[0].length,d;l0){for(var n=0,r=e[t[0]],l,s=r.length;n0)||!((s=(l=e[t[0]]).length)>0))){for(var n=0,r=1,l,s,d;r1&&arguments[1]!==void 0?arguments[1]:u6,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function hn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var f=n[d-1];return typeof f=="string"?l+f+s:f!==void 0?l+di(f)+s:l+s},"")}var rn=e=>e===0?0:e>0?1:-1,Ar=e=>typeof e=="number"&&e!=+e,il=e=>typeof e=="string"&&e.length>1&&e.indexOf("%")===e.length-1,je=e=>(typeof e=="number"||e instanceof Number)&&!Ar(e),qr=e=>je(e)||typeof e=="string",d6=0,dc=e=>{var t=++d6;return"".concat(e||"").concat(t)},xn=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!je(t)&&typeof t!="string")return r;var s;if(il(t)){if(n==null)return r;var d=t.indexOf("%");s=n*parseFloat(t.slice(0,d))/100}else s=+t;return Ar(s)&&(s=r),l&&n!=null&&s>n&&(s=n),s},YA=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;rr&&(typeof t=="function"?t(r):Hr(r,t))===n)}var Nt=e=>e===null||typeof e>"u",Ac=e=>Nt(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function Dn(e){return e!=null}function hl(){}var f6=["type","size","sizeType"];function Xv(){return Xv=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t="symbol".concat(Ac(e));return VA[t]||Jy},b6=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*g6;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},w6=(e,t)=>{VA["symbol".concat(Ac(e))]=t},FA=e=>{var t=e.type,n=t===void 0?"circle":t,r=e.size,l=r===void 0?64:r,s=e.sizeType,d=s===void 0?"area":s,f=v6(e,f6),m=Cj(Cj({},f),{},{type:n,size:l,sizeType:d}),h="circle";typeof n=="string"&&(h=n);var v=()=>{var _=x6(h),S=GP().type(_).size(b6(l,d,h)),A=S();if(A!==null)return A},y=m.className,b=m.cx,w=m.cy,j=Xn(m);return je(b)&&je(w)&&je(l)?x.createElement("path",Xv({},j,{className:nt("recharts-symbols",y),transform:"translate(".concat(b,", ").concat(w,")"),d:v()})):null};FA.registerSymbol=w6;var XA=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,n0=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(x.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(l=>{Xy(l)&&typeof n[l]=="function"&&(r[l]=(s=>n[l](n,s)))}),r},j6=(e,t,n)=>r=>(e(t,n,r),null),Oc=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(l=>{var s=e[l];Xy(l)&&typeof s=="function"&&(r||(r={}),r[l]=j6(s,t,n))}),r};function Tj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function _6(e){for(var t=1;t(d[f]===void 0&&r[f]!==void 0&&(d[f]=r[f]),d),n);return s}function Kd(){return Kd=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var w=y.formatter||l,j=nt({"recharts-legend-item":!0,["legend-item-".concat(b)]:!0,inactive:y.inactive});if(y.type==="none")return null;var _=typeof f=="object"?WA({},f):{};_.color=y.inactive?s:_.color||y.color;var S=w?w(y.value,y,b):y.value;return x.createElement("li",Kd({className:j,style:h,key:"legend-item-".concat(b)},Oc(e,y,b)),x.createElement(Wy,{width:n,height:n,viewBox:m,style:v,"aria-label":"".concat(y.value," legend icon")},x.createElement(M6,{data:y,iconType:d,inactiveColor:s})),x.createElement("span",{className:"recharts-legend-item-text",style:_},S))})}var P6=e=>{var t=an(e,C6),n=t.payload,r=t.layout,l=t.align;if(!n||!n.length)return null;var s={padding:0,margin:0,textAlign:r==="horizontal"?l:"left"};return x.createElement("ul",{className:"recharts-default-legend",style:s},x.createElement(D6,Kd({},t,{payload:n})))};function z6(e,t){const n=new Map;for(let r=0;rObject.prototype.propertyIsEnumerable.call(e,t))}function r0(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const B6="[object RegExp]",QA="[object String]",JA="[object Number]",eO="[object Boolean]",tO="[object Arguments]",U6="[object Symbol]",H6="[object Date]",q6="[object Map]",K6="[object Set]",Y6="[object Array]",G6="[object ArrayBuffer]",V6="[object Object]",F6="[object DataView]",X6="[object Uint8Array]",W6="[object Uint8ClampedArray]",Z6="[object Uint16Array]",Q6="[object Uint32Array]",J6="[object Int8Array]",ez="[object Int16Array]",tz="[object Int32Array]",nz="[object Float32Array]",rz="[object Float64Array]",Dj=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function az(e){return typeof Dj.Buffer<"u"&&Dj.Buffer.isBuffer(e)}function iz(e,t){return Fi(e,void 0,e,new Map,t)}function Fi(e,t,n,r=new Map,l=void 0){const s=l==null?void 0:l(e,t,n,r);if(s!==void 0)return s;if(Wv(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){const d=new Array(e.length);r.set(e,d);for(let f=0;f{}):Zv(e,t,function r(l,s,d,f,m,h){const v=n(l,s,d,f,m,h);return v!==void 0?!!v:Zv(l,s,r,h,!1)},new Map,!0)}function Zv(e,t,n,r,l=!1){if(t===e)return!0;switch(typeof t){case"object":return oz(e,t,n,r);case"function":return Object.keys(t).length>0?Zv(e,{...t},n,r,l):Td(e,t);default:return nO(e)&&l?typeof t=="string"?t==="":!0:Td(e,t)}}function oz(e,t,n,r){if(t==null)return!0;if(Array.isArray(t))return aO(e,t,n,r);if(t instanceof Map)return cz(e,t,n,r);if(t instanceof Set)return uz(e,t,n,r);const l=Object.keys(t);if(e==null||Wv(e))return l.length===0;if(l.length===0)return!0;if(r!=null&&r.has(t))return r.get(t)===e;r==null||r.set(t,e);try{for(let s=0;s{})}function dz(e){return e=sz(e),t=>iO(t,e)}function fz(e,t){return iz(e,(n,r,l,s)=>{if(typeof e=="object"){if(r0(e)==="[object Object]"&&typeof e.constructor!="function"){const d={};return s.set(e,d),jr(d,e,l,s),d}switch(Object.prototype.toString.call(e)){case JA:case QA:case eO:{const d=new e.constructor(e==null?void 0:e.valueOf());return jr(d,e),d}case tO:{const d={};return jr(d,e),d.length=e.length,d[Symbol.iterator]=e[Symbol.iterator],d}default:return}}})}function mz(e){return fz(e)}const hz=/^(?:0|[1-9]\d*)$/;function lO(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e=0}function sO(e){return e!=null&&typeof e!="function"&&xz(e.length)}function bz(e){return typeof e=="object"&&e!==null}function wz(e){return bz(e)&&sO(e)}function Pj(e,t=ZA){return wz(e)?z6(Array.from(e),I6(gz(t),1)):[]}function oO(e,t,n){return t===!0?Pj(e,n):typeof t=="function"?Pj(e,t):e}var nv={exports:{}},rv={},av={exports:{}},iv={};/** + * @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 zj;function jz(){if(zj)return iv;zj=1;var e=zs();function t(y,b){return y===b&&(y!==0||1/y===1/b)||y!==y&&b!==b}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,l=e.useEffect,s=e.useLayoutEffect,d=e.useDebugValue;function f(y,b){var w=b(),j=r({inst:{value:w,getSnapshot:b}}),_=j[0].inst,S=j[1];return s(function(){_.value=w,_.getSnapshot=b,m(_)&&S({inst:_})},[y,w,b]),l(function(){return m(_)&&S({inst:_}),y(function(){m(_)&&S({inst:_})})},[y]),d(w),w}function m(y){var b=y.getSnapshot;y=y.value;try{var w=b();return!n(y,w)}catch{return!0}}function h(y,b){return b()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return iv.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,iv}var Ij;function _z(){return Ij||(Ij=1,av.exports=jz()),av.exports}/** + * @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 $j;function Nz(){if($j)return rv;$j=1;var e=zs(),t=_z();function n(h,v){return h===v&&(h!==0||1/h===1/v)||h!==h&&v!==v}var r=typeof Object.is=="function"?Object.is:n,l=t.useSyncExternalStore,s=e.useRef,d=e.useEffect,f=e.useMemo,m=e.useDebugValue;return rv.useSyncExternalStoreWithSelector=function(h,v,y,b,w){var j=s(null);if(j.current===null){var _={hasValue:!1,value:null};j.current=_}else _=j.current;j=f(function(){function A(E){if(!C){if(C=!0,M=E,E=b(E),w!==void 0&&_.hasValue){var $=_.value;if(w($,E))return k=$}return k=E}if($=k,r(M,E))return $;var U=b(E);return w!==void 0&&w($,U)?(M=E,$):(M=E,k=U)}var C=!1,M,k,D=y===void 0?null:y;return[function(){return A(v())},D===null?void 0:function(){return A(D())}]},[v,y,b,w]);var S=l(h,j[0],j[1]);return d(function(){_.hasValue=!0,_.value=S},[S]),m(S),S},rv}var Rj;function Sz(){return Rj||(Rj=1,nv.exports=Nz()),nv.exports}var Az=Sz(),a0=x.createContext(null),Oz=e=>e,dt=()=>{var e=x.useContext(a0);return e?e.store.dispatch:Oz},Md=()=>{},Ez=()=>Md,kz=(e,t)=>e===t;function Ne(e){var t=x.useContext(a0),n=x.useMemo(()=>t?r=>{if(r!=null)return e(r)}:Md,[t,e]);return Az.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:Ez,t?t.store.getState:Md,t?t.store.getState:Md,n,kz)}function Cz(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Tz(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var Lj=e=>Array.isArray(e)?e:[e];function Mz(e){const t=Array.isArray(e[0])?e[0]:e;return Tz(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Dz(e,t){const n=[],{length:r}=e;for(let l=0;ltypeof WeakRef>"u"?Pz:WeakRef,cO=zz(),Iz=0,Bj=1;function dd(){return{s:Iz,v:void 0,o:null,p:null}}function $z(e){return e instanceof cO?e.deref():e}function uO(e,t={}){let n=dd();const{resultEqualityCheck:r}=t;let l,s=0;function d(){let f=n;const{length:m}=arguments;for(let y=0,b=m;y{n=dd(),d.resetResultsCount()},d.resultsCount=()=>s,d.resetResultsCount=()=>{s=0},d}function Rz(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...l)=>{let s=0,d=0,f,m={},h=l.pop();typeof h=="object"&&(m=h,h=l.pop()),Cz(h,`createSelector expects an output function after the inputs, but received: [${typeof h}]`);const v={...n,...m},{memoize:y,memoizeOptions:b=[],argsMemoize:w=uO,argsMemoizeOptions:j=[]}=v,_=Lj(b),S=Lj(j),A=Mz(l),C=y(function(){return s++,h.apply(null,arguments)},..._),M=w(function(){d++;const D=Dz(A,arguments);return f=C.apply(null,D),f},...S);return Object.assign(M,{resultFunc:h,memoizedResultFunc:C,dependencies:A,dependencyRecomputations:()=>d,resetDependencyRecomputations:()=>{d=0},lastResult:()=>f,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:y,argsMemoize:w})};return Object.assign(r,{withTypes:()=>r}),r}var X=Rz(uO);function Lz(e,t=1){const n=[],r=Math.floor(t),l=(s,d)=>{for(let f=0;f{if(e!==t){const r=Uj(e),l=Uj(t);if(r===l&&r===0){if(et)return n==="desc"?-1:1}return n==="desc"?l-r:r-l}return 0};function dO(e){return typeof e=="symbol"||e instanceof Symbol}const Uz=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Hz=/^\w*$/;function qz(e,t){return Array.isArray(e)?!1:typeof e=="number"||typeof e=="boolean"||e==null||dO(e)?!0:typeof e=="string"&&(Hz.test(e)||!Uz.test(e))||t!=null}function Kz(e,t,n,r){if(e==null)return[];n=n,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(f=>String(f));const l=(f,m)=>{let h=f;for(let v=0;vm==null||f==null?m:typeof f=="object"&&"key"in f?Object.hasOwn(m,f.key)?m[f.key]:l(m,f.path):typeof f=="function"?f(m):Array.isArray(f)?l(m,f):typeof m=="object"?m[f]:m,d=t.map(f=>(Array.isArray(f)&&f.length===1&&(f=f[0]),f==null||typeof f=="function"||Array.isArray(f)||qz(f)?f:{key:f,path:t0(f)}));return e.map(f=>({original:f,criteria:d.map(m=>s(m,f))})).slice().sort((f,m)=>{for(let h=0;hf.original)}function Hf(e,...t){const n=t.length;return n>1&&Qv(e,t[0],t[1])?t=[]:n>2&&Qv(t[0],t[1],t[2])&&(t=[t[0]]),Kz(e,Lz(t),["asc"])}var fO=e=>e.legend.settings,Yz=e=>e.legend.size,Gz=e=>e.legend.payload,Vz=X([Gz,fO],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?Hf(r,n):r});function Fz(){return Ne(Vz)}function Xz(e,t){return Jz(e)||Qz(e,t)||Zz(e,t)||Wz()}function Wz(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zz(e,t){if(e){if(typeof e=="string")return Hj(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hj(e,t):void 0}}function Hj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nfd||Math.abs(e.left-t.left)>fd||Math.abs(e.top-t.top)>fd||Math.abs(e.width-t.width)>fd}function Kj(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function mO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=x.useState({height:0,left:0,top:0,width:0}),n=Xz(t,2),r=n[0],l=n[1],s=x.useRef(null),d=x.useRef(r);d.current=r;var f=x.useCallback(m=>{if(s.current!=null&&(s.current.disconnect(),s.current=null),m!=null){var h=Kj(m);if(qj(h,d.current)&&l(h),typeof ResizeObserver<"u"){var v=new ResizeObserver(()=>{var y=Kj(m);qj(y,d.current)&&l(y)});v.observe(m),s.current=v}}},[...e]);return x.useEffect(()=>()=>{var m;(m=s.current)===null||m===void 0||m.disconnect()},[]),[r,f]}function mn(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var e8=typeof Symbol=="function"&&Symbol.observable||"@@observable",Yj=e8,lv=()=>Math.random().toString(36).substring(7).split("").join("."),t8={INIT:`@@redux/INIT${lv()}`,REPLACE:`@@redux/REPLACE${lv()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${lv()}`},Yd=t8;function i0(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function hO(e,t,n){if(typeof e!="function")throw new Error(mn(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(mn(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(mn(1));return n(hO)(e,t)}let r=e,l=t,s=new Map,d=s,f=0,m=!1;function h(){d===s&&(d=new Map,s.forEach((S,A)=>{d.set(A,S)}))}function v(){if(m)throw new Error(mn(3));return l}function y(S){if(typeof S!="function")throw new Error(mn(4));if(m)throw new Error(mn(5));let A=!0;h();const C=f++;return d.set(C,S),function(){if(A){if(m)throw new Error(mn(6));A=!1,h(),d.delete(C),s=null}}}function b(S){if(!i0(S))throw new Error(mn(7));if(typeof S.type>"u")throw new Error(mn(8));if(typeof S.type!="string")throw new Error(mn(17));if(m)throw new Error(mn(9));try{m=!0,l=r(l,S)}finally{m=!1}return(s=d).forEach(C=>{C()}),S}function w(S){if(typeof S!="function")throw new Error(mn(10));r=S,b({type:Yd.REPLACE})}function j(){const S=y;return{subscribe(A){if(typeof A!="object"||A===null)throw new Error(mn(11));function C(){const k=A;k.next&&k.next(v())}return C(),{unsubscribe:S(C)}},[Yj](){return this}}}return b({type:Yd.INIT}),{dispatch:b,subscribe:y,getState:v,replaceReducer:w,[Yj]:j}}function n8(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Yd.INIT})>"u")throw new Error(mn(12));if(typeof n(void 0,{type:Yd.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(mn(13))})}function pO(e){const t=Object.keys(e),n={};for(let s=0;s"u")throw f&&f.type,new Error(mn(14));h[y]=j,m=m||j!==w}return m=m||r.length!==Object.keys(d).length,m?h:d}}function Gd(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function r8(...e){return t=>(n,r)=>{const l=t(n,r);let s=()=>{throw new Error(mn(15))};const d={getState:l.getState,dispatch:(m,...h)=>s(m,...h)},f=e.map(m=>m(d));return s=Gd(...f)(l.dispatch),{...l,dispatch:s}}}function vO(e){return i0(e)&&"type"in e&&typeof e.type=="string"}var yO=Symbol.for("immer-nothing"),Gj=Symbol.for("immer-draftable"),Nn=Symbol.for("immer-state");function _r(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Vn=Object,Ss=Vn.getPrototypeOf,Vd="constructor",qf="prototype",Jv="configurable",Fd="enumerable",Dd="writable",fc="value",Aa=e=>!!e&&!!e[Nn];function Or(e){var t;return e?gO(e)||Yf(e)||!!e[Gj]||!!((t=e[Vd])!=null&&t[Gj])||Gf(e)||Vf(e):!1}var a8=Vn[qf][Vd].toString(),Vj=new WeakMap;function gO(e){if(!e||!l0(e))return!1;const t=Ss(e);if(t===null||t===Vn[qf])return!0;const n=Vn.hasOwnProperty.call(t,Vd)&&t[Vd];if(n===Object)return!0;if(!hs(n))return!1;let r=Vj.get(n);return r===void 0&&(r=Function.toString.call(n),Vj.set(n,r)),r===a8}function Kf(e,t,n=!0){Ec(e)===0?(n?Reflect.ownKeys(e):Vn.keys(e)).forEach(l=>{t(l,e[l],e)}):e.forEach((r,l)=>t(l,r,e))}function Ec(e){const t=e[Nn];return t?t.type_:Yf(e)?1:Gf(e)?2:Vf(e)?3:0}var Fj=(e,t,n=Ec(e))=>n===2?e.has(t):Vn[qf].hasOwnProperty.call(e,t),ey=(e,t,n=Ec(e))=>n===2?e.get(t):e[t],Xd=(e,t,n,r=Ec(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function i8(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Yf=Array.isArray,Gf=e=>e instanceof Map,Vf=e=>e instanceof Set,l0=e=>typeof e=="object",hs=e=>typeof e=="function",sv=e=>typeof e=="boolean";function l8(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var ya=e=>e.copy_||e.base_,s0=e=>e.modified_?e.copy_:e.base_;function ty(e,t){if(Gf(e))return new Map(e);if(Vf(e))return new Set(e);if(Yf(e))return Array[qf].slice.call(e);const n=gO(e);if(t===!0||t==="class_only"&&!n){const r=Vn.getOwnPropertyDescriptors(e);delete r[Nn];let l=Reflect.ownKeys(r);for(let s=0;s1&&Vn.defineProperties(e,{set:md,add:md,clear:md,delete:md}),Vn.freeze(e),t&&Kf(e,(n,r)=>{o0(r,!0)},!1)),e}function s8(){_r(2)}var md={[fc]:s8};function Ff(e){return e===null||!l0(e)?!0:Vn.isFrozen(e)}var Wd="MapSet",ny="Patches",Xj="ArrayMethods",xO={};function ll(e){const t=xO[e];return t||_r(0,e),t}var Wj=e=>!!xO[e],mc,bO=()=>mc,o8=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Wj(Wd)?ll(Wd):void 0,arrayMethodsPlugin_:Wj(Xj)?ll(Xj):void 0});function Zj(e,t){t&&(e.patchPlugin_=ll(ny),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ry(e){ay(e),e.drafts_.forEach(c8),e.drafts_=null}function ay(e){e===mc&&(mc=e.parent_)}var Qj=e=>mc=o8(mc,e);function c8(e){const t=e[Nn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Jj(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[Nn].modified_&&(ry(t),_r(4)),Or(e)&&(e=e_(t,e));const{patchPlugin_:l}=t;l&&l.generateReplacementPatches_(n[Nn].base_,e,t)}else e=e_(t,n);return u8(t,e,!0),ry(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==yO?e:void 0}function e_(e,t){if(Ff(t))return t;const n=t[Nn];if(!n)return Zd(t,e.handledSet_,e);if(!Xf(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);_O(n,e)}return n.copy_}function u8(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&o0(t,n)}function wO(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Xf=(e,t)=>e.scope_===t,d8=[];function jO(e,t,n,r){const l=ya(e),s=e.type_;if(r!==void 0&&ey(l,r,s)===t){Xd(l,r,n,s);return}if(!e.draftLocations_){const f=e.draftLocations_=new Map;Kf(l,(m,h)=>{if(Aa(h)){const v=f.get(h)||[];v.push(m),f.set(h,v)}})}const d=e.draftLocations_.get(t)??d8;for(const f of d)Xd(l,f,n,s)}function f8(e,t,n){e.callbacks_.push(function(l){var f;const s=t;if(!s||!Xf(s,l))return;(f=l.mapSetPlugin_)==null||f.fixSetContents(s);const d=s0(s);jO(e,s.draft_??s,d,n),_O(s,l)})}function _O(e,t){var r;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((r=e.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:l}=t;if(l){const s=l.getPath(e);s&&l.generatePatches_(e,s,t)}wO(e)}}function m8(e,t,n){const{scope_:r}=e;if(Aa(n)){const l=n[Nn];Xf(l,r)&&l.callbacks_.push(function(){Pd(e);const d=s0(l);jO(e,n,d,t)})}else Or(n)&&e.callbacks_.push(function(){const s=ya(e);e.type_===3?s.has(n)&&Zd(n,r.handledSet_,r):ey(s,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Zd(ey(e.copy_,t,e.type_),r.handledSet_,r)})}function Zd(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Aa(e)||t.has(e)||!Or(e)||Ff(e)||(t.add(e),Kf(e,(r,l)=>{if(Aa(l)){const s=l[Nn];if(Xf(s,n)){const d=s0(s);Xd(e,r,d,e.type_),wO(s)}}else Or(l)&&Zd(l,t,n)})),e}function h8(e,t){const n=Yf(e),r={type_:n?1:0,scope_:t?t.scope_:bO(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let l=r,s=Qd;n&&(l=[r],s=hc);const{revoke:d,proxy:f}=Proxy.revocable(l,s);return r.draft_=f,r.revoke_=d,[f,r]}var Qd={get(e,t){if(t===Nn)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n!=null&&n.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const l=ya(e);if(!Fj(l,t,e.type_))return p8(e,l,t);const s=l[t];if(e.finalized_||!Or(s)||r&&e.operationMethod&&(n!=null&&n.isMutatingArrayMethod(e.operationMethod))&&l8(t))return s;if(s===ov(e.base_,t)){Pd(e);const d=e.type_===1?+t:t,f=ly(e.scope_,s,e,d);return e.copy_[d]=f}return s},has(e,t){return t in ya(e)},ownKeys(e){return Reflect.ownKeys(ya(e))},set(e,t,n){const r=NO(ya(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const l=ov(ya(e),t),s=l==null?void 0:l[Nn];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(i8(n,l)&&(n!==void 0||Fj(e.base_,t,e.type_)))return!0;Pd(e),iy(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),m8(e,t,n)),!0},deleteProperty(e,t){return Pd(e),ov(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),iy(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ya(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Dd]:!0,[Jv]:e.type_!==1||t!=="length",[Fd]:r[Fd],[fc]:n[t]}},defineProperty(){_r(11)},getPrototypeOf(e){return Ss(e.base_)},setPrototypeOf(){_r(12)}},hc={};for(let e in Qd){let t=Qd[e];hc[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}hc.deleteProperty=function(e,t){return hc.set.call(this,e,t,void 0)};hc.set=function(e,t,n){return Qd.set.call(this,e[0],t,n,e[0])};function ov(e,t){const n=e[Nn];return(n?ya(n):e)[t]}function p8(e,t,n){var l;const r=NO(t,n);return r?fc in r?r[fc]:(l=r.get)==null?void 0:l.call(e.draft_):void 0}function NO(e,t){if(!(t in e))return;let n=Ss(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Ss(n)}}function iy(e){e.modified_||(e.modified_=!0,e.parent_&&iy(e.parent_))}function Pd(e){e.copy_||(e.assigned_=new Map,e.copy_=ty(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var v8=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,l)=>{if(hs(n)&&!hs(r)){const d=r;r=n;const f=this;return function(h=d,...v){return f.produce(h,y=>r.call(this,y,...v))}}hs(r)||_r(6),l!==void 0&&!hs(l)&&_r(7);let s;if(Or(n)){const d=Qj(this),f=ly(d,n,void 0);let m=!0;try{s=r(f),m=!1}finally{m?ry(d):ay(d)}return Zj(d,l),Jj(s,d)}else if(!n||!l0(n)){if(s=r(n),s===void 0&&(s=n),s===yO&&(s=void 0),this.autoFreeze_&&o0(s,!0),l){const d=[],f=[];ll(ny).generateReplacementPatches_(n,s,{patches_:d,inversePatches_:f}),l(d,f)}return s}else _r(1,n)},this.produceWithPatches=(n,r)=>{if(hs(n))return(f,...m)=>this.produceWithPatches(f,h=>n(h,...m));let l,s;return[this.produce(n,r,(f,m)=>{l=f,s=m}),l,s]},sv(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),sv(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),sv(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Or(t)||_r(8),Aa(t)&&(t=mr(t));const n=Qj(this),r=ly(n,t,void 0);return r[Nn].isManual_=!0,ay(n),r}finishDraft(t,n){const r=t&&t[Nn];(!r||!r.isManual_)&&_r(9);const{scope_:l}=r;return Zj(l,n),Jj(void 0,l)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const s=n[r];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}r>-1&&(n=n.slice(r+1));const l=ll(ny).applyPatches_;return Aa(t)?l(t,n):this.produce(t,s=>l(s,n))}};function ly(e,t,n,r){const[l,s]=Gf(t)?ll(Wd).proxyMap_(t,n):Vf(t)?ll(Wd).proxySet_(t,n):h8(t,n);return((n==null?void 0:n.scope_)??bO()).drafts_.push(l),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?f8(n,s,r):s.callbacks_.push(function(m){var v;(v=m.mapSetPlugin_)==null||v.fixSetContents(s);const{patchPlugin_:h}=m;s.modified_&&h&&h.generatePatches_(s,[],m)}),l}function mr(e){return Aa(e)||_r(10,e),SO(e)}function SO(e){if(!Or(e)||Ff(e))return e;const t=e[Nn];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ty(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=ty(e,!0);return Kf(n,(l,s)=>{Xd(n,l,SO(s))},r),t&&(t.finalized_=!1),n}var y8=new v8,AO=y8.produce;function OO(e){return({dispatch:n,getState:r})=>l=>s=>typeof s=="function"?s(n,r,e):l(s)}var g8=OO(),x8=OO,b8=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Gd:Gd.apply(null,arguments)};function Wn(e,t){function n(...r){if(t){let l=t(...r);if(!l)throw new Error(Fn(0));return{type:e,payload:l.payload,..."meta"in l&&{meta:l.meta},..."error"in l&&{error:l.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>vO(r)&&r.type===e,n}var EO=class nc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,nc.prototype)}static get[Symbol.species](){return nc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new nc(...t[0].concat(this)):new nc(...t.concat(this))}};function t_(e){return Or(e)?AO(e,()=>{}):e}function hd(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function w8(e){return typeof e=="boolean"}var j8=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:l=!0,actionCreatorCheck:s=!0}=t??{};let d=new EO;return n&&(w8(n)?d.push(g8):d.push(x8(n.extraArgument))),d},kO="RTK_autoBatch",yt=()=>e=>({payload:e,meta:{[kO]:!0}}),n_=e=>t=>{setTimeout(t,e)},_8=(e,t)=>n=>{let r=!1;const l=()=>{r||(r=!0,cancelAnimationFrame(s),clearTimeout(d),n())},s=e(l),d=setTimeout(l,t)},CO=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let l=!0,s=!1,d=!1;const f=new Set,m=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?_8(window.requestAnimationFrame,100):n_(10):e.type==="callback"?e.queueNotification:n_(e.timeout),h=()=>{d=!1,s&&(s=!1,f.forEach(v=>v()))};return Object.assign({},r,{subscribe(v){const y=()=>l&&v(),b=r.subscribe(y);return f.add(v),()=>{b(),f.delete(v)}},dispatch(v){var y;try{return l=!((y=v==null?void 0:v.meta)!=null&&y[kO]),s=!l,s&&(d||(d=!0,m(h))),r.dispatch(v)}finally{l=!0}}})},N8=e=>function(n){const{autoBatch:r=!0}=n??{};let l=new EO(e);return r&&l.push(CO(typeof r=="object"?r:void 0)),l};function S8(e){const t=j8(),{reducer:n=void 0,middleware:r,devTools:l=!0,preloadedState:s=void 0,enhancers:d=void 0}=e||{};let f;if(typeof n=="function")f=n;else if(i0(n))f=pO(n);else throw new Error(Fn(1));let m;typeof r=="function"?m=r(t):m=t();let h=Gd;l&&(h=b8({trace:!1,...typeof l=="object"&&l}));const v=r8(...m),y=N8(v);let b=typeof d=="function"?d(y):y();const w=h(...b);return hO(f,s,w)}function TO(e){const t={},n=[];let r;const l={addCase(s,d){const f=typeof s=="string"?s:s.type;if(!f)throw new Error(Fn(28));if(f in t)throw new Error(Fn(29));return t[f]=d,l},addAsyncThunk(s,d){return d.pending&&(t[s.pending.type]=d.pending),d.rejected&&(t[s.rejected.type]=d.rejected),d.fulfilled&&(t[s.fulfilled.type]=d.fulfilled),d.settled&&n.push({matcher:s.settled,reducer:d.settled}),l},addMatcher(s,d){return n.push({matcher:s,reducer:d}),l},addDefaultCase(s){return r=s,l}};return e(l),[t,n,r]}function A8(e){return typeof e=="function"}function O8(e,t){let[n,r,l]=TO(t),s;if(A8(e))s=()=>t_(e());else{const f=t_(e);s=()=>f}function d(f=s(),m){let h=[n[m.type],...r.filter(({matcher:v})=>v(m)).map(({reducer:v})=>v)];return h.filter(v=>!!v).length===0&&(h=[l]),h.reduce((v,y)=>{if(y)if(Aa(v)){const w=y(v,m);return w===void 0?v:w}else{if(Or(v))return AO(v,b=>y(b,m));{const b=y(v,m);if(b===void 0){if(v===null)return v;throw Error("A case reducer on a non-draftable value must not return undefined")}return b}}return v},f)}return d.getInitialState=s,d}var E8="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",k8=(e=21)=>{let t="",n=e;for(;n--;)t+=E8[Math.random()*64|0];return t},C8=Symbol.for("rtk-slice-createasyncthunk");function T8(e,t){return`${e}/${t}`}function M8({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[C8];return function(l){const{name:s,reducerPath:d=s}=l;if(!s)throw new Error(Fn(11));const f=(typeof l.reducers=="function"?l.reducers(P8()):l.reducers)||{},m=Object.keys(f),h={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},v={addCase(k,D){const E=typeof k=="string"?k:k.type;if(!E)throw new Error(Fn(12));if(E in h.sliceCaseReducersByType)throw new Error(Fn(13));return h.sliceCaseReducersByType[E]=D,v},addMatcher(k,D){return h.sliceMatchers.push({matcher:k,reducer:D}),v},exposeAction(k,D){return h.actionCreators[k]=D,v},exposeCaseReducer(k,D){return h.sliceCaseReducersByName[k]=D,v}};m.forEach(k=>{const D=f[k],E={reducerName:k,type:T8(s,k),createNotation:typeof l.reducers=="function"};I8(D)?R8(E,D,v,t):z8(E,D,v)});function y(){const[k={},D=[],E=void 0]=typeof l.extraReducers=="function"?TO(l.extraReducers):[l.extraReducers],$={...k,...h.sliceCaseReducersByType};return O8(l.initialState,U=>{for(let K in $)U.addCase(K,$[K]);for(let K of h.sliceMatchers)U.addMatcher(K.matcher,K.reducer);for(let K of D)U.addMatcher(K.matcher,K.reducer);E&&U.addDefaultCase(E)})}const b=k=>k,w=new Map,j=new WeakMap;let _;function S(k,D){return _||(_=y()),_(k,D)}function A(){return _||(_=y()),_.getInitialState()}function C(k,D=!1){function E(U){let K=U[k];return typeof K>"u"&&D&&(K=hd(j,E,A)),K}function $(U=b){const K=hd(w,D,()=>new WeakMap);return hd(K,U,()=>{const T={};for(const[re,Z]of Object.entries(l.selectors??{}))T[re]=D8(Z,U,()=>hd(j,U,A),D);return T})}return{reducerPath:k,getSelectors:$,get selectors(){return $(E)},selectSlice:E}}const M={name:s,reducer:S,actions:h.actionCreators,caseReducers:h.sliceCaseReducersByName,getInitialState:A,...C(d),injectInto(k,{reducerPath:D,...E}={}){const $=D??d;return k.inject({reducerPath:$,reducer:S},E),{...M,...C($,!0)}}};return M}}function D8(e,t,n,r){function l(s,...d){let f=t(s);return typeof f>"u"&&r&&(f=n()),e(f,...d)}return l.unwrapped=e,l}var bn=M8();function P8(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function z8({type:e,reducerName:t,createNotation:n},r,l){let s,d;if("reducer"in r){if(n&&!$8(r))throw new Error(Fn(17));s=r.reducer,d=r.prepare}else s=r;l.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,d?Wn(e,d):Wn(e))}function I8(e){return e._reducerDefinitionType==="asyncThunk"}function $8(e){return e._reducerDefinitionType==="reducerWithPrepare"}function R8({type:e,reducerName:t},n,r,l){if(!l)throw new Error(Fn(18));const{payloadCreator:s,fulfilled:d,pending:f,rejected:m,settled:h,options:v}=n,y=l(e,s,v);r.exposeAction(t,y),d&&r.addCase(y.fulfilled,d),f&&r.addCase(y.pending,f),m&&r.addCase(y.rejected,m),h&&r.addMatcher(y.settled,h),r.exposeCaseReducer(t,{fulfilled:d||pd,pending:f||pd,rejected:m||pd,settled:h||pd})}function pd(){}var L8="task",MO="listener",DO="completed",c0="cancelled",B8=`task-${c0}`,U8=`task-${DO}`,sy=`${MO}-${c0}`,H8=`${MO}-${DO}`,Wf=class{constructor(e){sd(this,"code");sd(this,"name","TaskAbortError");sd(this,"message");this.code=e,this.message=`${L8} ${c0} (reason: ${e})`}},u0=(e,t)=>{if(typeof e!="function")throw new TypeError(Fn(32))},Jd=()=>{},PO=(e,t=Jd)=>(e.catch(t),e),zO=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Ji=e=>{if(e.aborted)throw new Wf(e.reason)};function IO(e,t){let n=Jd;return new Promise((r,l)=>{const s=()=>l(new Wf(e.reason));if(e.aborted){s();return}n=zO(e,s),t.finally(()=>n()).then(r,l)}).finally(()=>{n=Jd})}var q8=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof Wf?"cancelled":"rejected",error:n}}finally{t==null||t()}},ef=e=>t=>PO(IO(e,t).then(n=>(Ji(e),n))),$O=e=>{const t=ef(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:ws}=Object,r_={},Zf="listenerMiddleware",K8=(e,t)=>{const n=r=>zO(e,()=>r.abort(e.reason));return(r,l)=>{u0(r);const s=new AbortController;n(s);const d=q8(async()=>{Ji(e),Ji(s.signal);const f=await r({pause:ef(s.signal),delay:$O(s.signal),signal:s.signal});return Ji(s.signal),f},()=>s.abort(U8));return l!=null&&l.autoJoin&&t.push(d.catch(Jd)),{result:ef(e)(d),cancel(){s.abort(B8)}}}},Y8=(e,t)=>{const n=async(r,l)=>{Ji(t);let s=()=>{};const f=[new Promise((m,h)=>{let v=e({predicate:r,effect:(y,b)=>{b.unsubscribe(),m([y,b.getState(),b.getOriginalState()])}});s=()=>{v(),h()}})];l!=null&&f.push(new Promise(m=>setTimeout(m,l,null)));try{const m=await IO(t,Promise.race(f));return Ji(t),m}finally{s()}};return((r,l)=>PO(n(r,l)))},RO=e=>{let{type:t,actionCreator:n,matcher:r,predicate:l,effect:s}=e;if(t)l=Wn(t).match;else if(n)t=n.type,l=n.match;else if(r)l=r;else if(!l)throw new Error(Fn(21));return u0(s),{predicate:l,type:t,effect:s}},LO=ws(e=>{const{type:t,predicate:n,effect:r}=RO(e);return{id:k8(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(Fn(22))}}},{withTypes:()=>LO}),a_=(e,t)=>{const{type:n,effect:r,predicate:l}=RO(t);return Array.from(e.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===l)&&s.effect===r)},oy=e=>{e.pending.forEach(t=>{t.abort(sy)})},G8=(e,t)=>()=>{for(const n of t.keys())oy(n);e.clear()},i_=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},BO=ws(Wn(`${Zf}/add`),{withTypes:()=>BO}),V8=Wn(`${Zf}/removeAll`),UO=ws(Wn(`${Zf}/remove`),{withTypes:()=>UO}),F8=(...e)=>{console.error(`${Zf}/error`,...e)},kc=(e={})=>{const t=new Map,n=new Map,r=w=>{const j=n.get(w)??0;n.set(w,j+1)},l=w=>{const j=n.get(w)??1;j===1?n.delete(w):n.set(w,j-1)},{extra:s,onError:d=F8}=e;u0(d);const f=w=>(w.unsubscribe=()=>t.delete(w.id),t.set(w.id,w),j=>{w.unsubscribe(),j!=null&&j.cancelActive&&oy(w)}),m=(w=>{const j=a_(t,w)??LO(w);return f(j)});ws(m,{withTypes:()=>m});const h=w=>{const j=a_(t,w);return j&&(j.unsubscribe(),w.cancelActive&&oy(j)),!!j};ws(h,{withTypes:()=>h});const v=async(w,j,_,S)=>{const A=new AbortController,C=Y8(m,A.signal),M=[];try{w.pending.add(A),r(w),await Promise.resolve(w.effect(j,ws({},_,{getOriginalState:S,condition:(k,D)=>C(k,D).then(Boolean),take:C,delay:$O(A.signal),pause:ef(A.signal),extra:s,signal:A.signal,fork:K8(A.signal,M),unsubscribe:w.unsubscribe,subscribe:()=>{t.set(w.id,w)},cancelActiveListeners:()=>{w.pending.forEach((k,D,E)=>{k!==A&&(k.abort(sy),E.delete(k))})},cancel:()=>{A.abort(sy),w.pending.delete(A)},throwIfCancelled:()=>{Ji(A.signal)}})))}catch(k){k instanceof Wf||i_(d,k,{raisedBy:"effect"})}finally{await Promise.all(M),A.abort(H8),l(w),w.pending.delete(A)}},y=G8(t,n);return{middleware:w=>j=>_=>{if(!vO(_))return j(_);if(BO.match(_))return m(_.payload);if(V8.match(_)){y();return}if(UO.match(_))return h(_.payload);let S=w.getState();const A=()=>{if(S===r_)throw new Error(Fn(23));return S};let C;try{if(C=j(_),t.size>0){const M=w.getState(),k=Array.from(t.values());for(const D of k){let E=!1;try{E=D.predicate(_,M,S)}catch($){E=!1,i_(d,$,{raisedBy:"predicate"})}E&&v(D,_,w,A)}}}finally{S=r_}return C},startListening:m,stopListening:h,clearListeners:y}};function Fn(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var X8={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},HO=bn({name:"chartLayout",initialState:X8,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,l,s;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(l=t.payload.bottom)!==null&&l!==void 0?l:0,e.margin.left=(s=t.payload.left)!==null&&s!==void 0?s:0},setScale(e,t){e.scale=t.payload}}}),Qf=HO.actions,W8=Qf.setMargin,Z8=Qf.setLayout,Q8=Qf.setChartSize,J8=Qf.setScale,eI=HO.reducer;function qO(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function He(e){return Number.isFinite(e)}function Kr(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function l_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function vs(e){for(var t=1;t{if(t&&n){var r=n.width,l=n.height,s=t.align,d=t.verticalAlign,f=t.layout;if((f==="vertical"||f==="horizontal"&&d==="middle")&&s!=="center"&&je(e[s]))return vs(vs({},e),{},{[s]:e[s]+(r||0)});if((f==="horizontal"||f==="vertical"&&s==="center")&&d!=="middle"&&je(e[d]))return vs(vs({},e),{},{[d]:e[d]+(l||0)})}return e},Vr=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",KO=(e,t,n,r)=>{if(r)return e.map(f=>f.coordinate);var l,s,d=e.map(f=>(f.coordinate===t&&(l=!0),f.coordinate===n&&(s=!0),f.coordinate));return l||d.push(t),s||d.push(n),d},YO=(e,t,n)=>{if(!e)return null;var r=e.duplicateDomain,l=e.type,s=e.range,d=e.scale,f=e.realScaleType,m=e.isCategorical,h=e.categoricalDomain,v=e.tickCount,y=e.ticks,b=e.niceTicks,w=e.axisType;if(!d)return null;var j=f==="scaleBand"&&d.bandwidth?d.bandwidth()/2:2,_=l==="category"&&d.bandwidth?d.bandwidth()/j:0;if(_=w==="angleAxis"&&s&&s.length>=2?rn(s[0]-s[1])*2*_:_,y||b){var S=(y||b||[]).map((A,C)=>{var M=r?r.indexOf(A):A,k=d.map(M);return He(k)?{coordinate:k+_,value:A,offset:_,index:C}:null}).filter(Dn);return S}return m&&h?h.map((A,C)=>{var M=d.map(A);return He(M)?{coordinate:M+_,value:A,index:C,offset:_}:null}).filter(Dn):d.ticks&&v!=null?d.ticks(v).map((A,C)=>{var M=d.map(A);return He(M)?{coordinate:M+_,value:A,index:C,offset:_}:null}).filter(Dn):d.domain().map((A,C)=>{var M=d.map(A);return He(M)?{coordinate:M+_,value:r?r[A]:A,index:C,offset:_}:null}).filter(Dn)},iI=(e,t)=>{if(!t||t.length!==2||!je(t[0])||!je(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),l=[e[0],e[1]];return(!je(e[0])||e[0]r)&&(l[1]=r),l[0]>r&&(l[0]=r),l[1]{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var l=0;l=0?(h[0]=s,s+=b,h[1]=s):(h[0]=d,d+=b,h[1]=d)}}}},sI=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var l=0;l=0?(m[0]=s,s+=h,m[1]=s):(m[0]=0,m[1]=0)}}}},oI={sign:lI,expand:l6,none:al,silhouette:s6,wiggle:o6,positive:sI},cI=(e,t,n)=>{var r,l=(r=oI[n])!==null&&r!==void 0?r:al,s=i6().keys(t).value((f,m)=>Number(rt(f,m,0))).order(Vv).offset(l),d=s(e);return d.forEach((f,m)=>{f.forEach((h,v)=>{var y=rt(e[v],t[m],0);Array.isArray(y)&&y.length===2&&je(y[0])&&je(y[1])&&(h[0]=y[0],h[1]=y[1])})}),d};function GO(e){return e==null?void 0:String(e)}function s_(e){var t=e.axis,n=e.ticks,r=e.bandSize,l=e.entry,s=e.index,d=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Nt(l[t.dataKey])){var f=GA(n,"value",l[t.dataKey]);if(f)return f.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var m=rt(l,Nt(d)?t.dataKey:d),h=t.scale.map(m);return je(h)?h:null}var o_=e=>{var t=e.axis,n=e.ticks,r=e.offset,l=e.bandSize,s=e.entry,d=e.index;if(t.type==="category")return n[d]?n[d].coordinate+r:null;var f=rt(s,t.dataKey,t.scale.domain()[d]);if(Nt(f))return null;var m=t.scale.map(f);return je(m)?m-l/2+r:null},uI=e=>{var t=e.numericAxis,n=t.scale.domain();if(t.type==="number"){var r=Math.min(n[0],n[1]),l=Math.max(n[0],n[1]);return r<=0&&l>=0?0:l<0?l:r}return n[0]},dI=e=>{var t=e.flat(2).filter(je);return[Math.min(...t),Math.max(...t)]},fI=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],mI=(e,t,n)=>{if(!(e==null||Object.keys(e).length===0))return fI(Object.keys(e).reduce((r,l)=>{var s=e[l];if(!s)return r;var d=s.stackedData,f=d.reduce((m,h)=>{var v=qO(h,t,n),y=dI(v);return!He(y[0])||!He(y[1])?m:[Math.min(m[0],y[0]),Math.max(m[1],y[1])]},[1/0,-1/0]);return[Math.min(f[0],r[0]),Math.max(f[1],r[1])]},[1/0,-1/0]))},c_=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,u_=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,As=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var l=Hf(t,v=>v.coordinate),s=1/0,d=1,f=l.length;d{if(t==="horizontal")return e.relativeX;if(t==="vertical")return e.relativeY},pI=(e,t)=>t==="centric"?e.angle:e.radius,Ca=e=>e.layout.width,Ta=e=>e.layout.height,vI=e=>e.layout.scale,VO=e=>e.layout.margin,Jf=X(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),em=X(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),FO="data-recharts-item-index",XO="data-recharts-item-id",Cc=60;function f_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function vd(e){for(var t=1;te.brush.height;function wI(e){var t=em(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var l=typeof r.width=="number"?r.width:Cc;return n+l}return n},0)}function jI(e){var t=em(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var l=typeof r.width=="number"?r.width:Cc;return n+l}return n},0)}function _I(e){var t=Jf(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function NI(e){var t=Jf(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Wt=X([Ca,Ta,VO,bI,wI,jI,_I,NI,fO,Yz],(e,t,n,r,l,s,d,f,m,h)=>{var v={left:(n.left||0)+l,right:(n.right||0)+s},y={top:(n.top||0)+d,bottom:(n.bottom||0)+f},b=vd(vd({},y),v),w=b.bottom;b.bottom+=r,b=aI(b,m,h);var j=e-b.left-b.right,_=t-b.top-b.bottom;return vd(vd({brushBottom:w},b),{},{width:Math.max(j,0),height:Math.max(_,0)})}),SI=X(Wt,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),d0=X(Ca,Ta,(e,t)=>({x:0,y:0,width:e,height:t})),AI=x.createContext(null),wn=()=>x.useContext(AI)!=null,tm=e=>e.brush,nm=X([tm,Wt,VO],(e,t,n)=>({height:e.height,x:je(e.x)?e.x:t.left,y:je(e.y)?e.y:t.top+t.height+t.brushBottom-((n==null?void 0:n.bottom)||0),width:je(e.width)?e.width:t.width}));function OI(e,t,{signal:n,edges:r}={}){let l,s=null;const d=r!=null&&r.includes("leading"),f=r==null||r.includes("trailing"),m=()=>{s!==null&&(e.apply(l,s),l=void 0,s=null)},h=()=>{f&&m(),w()};let v=null;const y=()=>{v!=null&&clearTimeout(v),v=setTimeout(()=>{v=null,h()},t)},b=()=>{v!==null&&(clearTimeout(v),v=null)},w=()=>{b(),l=void 0,s=null},j=()=>{m()},_=function(...S){if(n!=null&&n.aborted)return;l=this,s=S;const A=v==null;y(),d&&A&&m()};return _.schedule=y,_.cancel=w,_.flush=j,n==null||n.addEventListener("abort",w,{once:!0}),_}function EI(e,t=0,n={}){typeof n!="object"&&(n={});const{leading:r=!1,trailing:l=!0,maxWait:s}=n,d=Array(2);r&&(d[0]="leading"),l&&(d[1]="trailing");let f,m=null;const h=OI(function(...b){f=e.apply(this,b),m=null},t,{edges:d}),v=function(...b){return s!=null&&(m===null&&(m=Date.now()),Date.now()-m>=s)?(f=e.apply(this,b),m=Date.now(),h.cancel(),h.schedule(),f):(h.apply(this,b),f)},y=()=>(h.flush(),f);return v.cancel=h.cancel,v.flush=y,v}function kI(e,t=0,n={}){const{leading:r=!0,trailing:l=!0}=n;return EI(e,t,{leading:r,maxWait:t,trailing:l})}var tf=function(t,n){for(var r=arguments.length,l=new Array(r>2?r-2:0),s=2;sl[d++]))}},Rr={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},WO=(e,t,n)=>{var r=n.width,l=r===void 0?Rr.width:r,s=n.height,d=s===void 0?Rr.height:s,f=n.aspect,m=n.maxHeight,h=il(l)?e:Number(l),v=il(d)?t:Number(d);return f&&f>0&&(h?v=h/f:v&&(h=v*f),m&&v!=null&&v>m&&(v=m)),{calculatedWidth:h,calculatedHeight:v}},CI={width:0,height:0,overflow:"visible"},TI={width:0,overflowX:"visible"},MI={height:0,overflowY:"visible"},DI={},PI=e=>{var t=e.width,n=e.height,r=il(t),l=il(n);return r&&l?CI:r?TI:l?MI:DI};function zI(e){var t=e.width,n=e.height,r=e.aspect,l=t,s=n;return l===void 0&&s===void 0?(l=Rr.width,s=Rr.height):l===void 0?l=r&&r>0?void 0:Rr.width:s===void 0&&(s=r&&r>0?void 0:Rr.height),{width:l,height:s}}var II=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function nf(){return nf=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({width:n,height:r}),[n,r]);return VI(l)?x.createElement(ZO.Provider,{value:l},t):null}var f0=()=>x.useContext(ZO),FI=x.forwardRef((e,t)=>{var n=e.aspect,r=e.initialDimension,l=r===void 0?Rr.initialDimension:r,s=e.width,d=e.height,f=e.minWidth,m=f===void 0?Rr.minWidth:f,h=e.minHeight,v=e.maxHeight,y=e.children,b=e.debounce,w=b===void 0?Rr.debounce:b,j=e.id,_=e.className,S=e.onResize,A=e.style,C=A===void 0?{}:A,M=YI(e,II),k=x.useRef(null),D=x.useRef();D.current=S,x.useImperativeHandle(t,()=>k.current);var E=x.useState({containerWidth:l.width,containerHeight:l.height}),$=BI(E,2),U=$[0],K=$[1],T=x.useCallback((R,z)=>{K(G=>{var se=Math.round(R),ue=Math.round(z);return G.containerWidth===se&&G.containerHeight===ue?G:{containerWidth:se,containerHeight:ue}})},[]);x.useEffect(()=>{if(k.current==null||typeof ResizeObserver>"u")return hl;var R=P=>{var Q,ne=P[0];if(ne!=null){var I=ne.contentRect,he=I.width,be=I.height;T(he,be),(Q=D.current)===null||Q===void 0||Q.call(D,he,be)}};w>0&&(R=kI(R,w,{trailing:!0,leading:!1}));var z=new ResizeObserver(R),G=k.current.getBoundingClientRect(),se=G.width,ue=G.height;return T(se,ue),z.observe(k.current),()=>{z.disconnect()}},[T,w]);var re=U.containerWidth,Z=U.containerHeight;tf(!n||n>0,"The aspect(%s) must be greater than zero.",n);var pe=WO(re,Z,{width:s,height:d,aspect:n,maxHeight:v}),fe=pe.calculatedWidth,ce=pe.calculatedHeight;return tf(re<0||Z<0||fe!=null&&fe>0||ce!=null&&ce>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,fe,ce,s,d,m,h,n),x.createElement("div",nf({id:j?"".concat(j):void 0,className:nt("recharts-responsive-container",_),style:h_(h_({},C),{},{width:s,height:d,minWidth:m,minHeight:h,maxHeight:v}),ref:k},M),x.createElement("div",{style:PI({width:s,height:d})},x.createElement(QO,{width:fe,height:ce},y)))}),yd=x.forwardRef((e,t)=>{var n=f0();if(Kr(n.width)&&Kr(n.height))return e.children;var r=zI({width:e.width,height:e.height,aspect:e.aspect}),l=r.width,s=r.height,d=WO(void 0,void 0,{width:l,height:s,aspect:e.aspect,maxHeight:e.maxHeight}),f=d.calculatedWidth,m=d.calculatedHeight;return je(f)&&je(m)?x.createElement(QO,{width:f,height:m},e.children):x.createElement(FI,nf({},e,{width:l,height:s,ref:t}))});function m0(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var rm=()=>{var e,t=wn(),n=Ne(SI),r=Ne(nm),l=(e=Ne(tm))===null||e===void 0?void 0:e.padding;return!t||!r||!l?n:{width:r.width-l.left-l.right,height:r.height-l.top-l.bottom,x:l.left,y:l.top}},XI={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},JO=()=>{var e;return(e=Ne(Wt))!==null&&e!==void 0?e:XI},h0=()=>Ne(Ca),p0=()=>Ne(Ta),WI=()=>Ne(e=>e.layout.margin),Ze=e=>e.layout.layoutType,pl=()=>Ne(Ze),v0=()=>{var e=pl();if(e==="horizontal"||e==="vertical")return e},y0=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},ZI=()=>Ne(y0),QI=()=>{var e=pl();return e!==void 0},Tc=e=>{var t=dt(),n=wn(),r=e.width,l=e.height,s=f0(),d=r,f=l;return s&&(d=s.width>0?s.width:r,f=s.height>0?s.height:l),x.useEffect(()=>{!n&&Kr(d)&&Kr(f)&&t(Q8({width:d,height:f}))},[t,n,d,f]),null},eE=Symbol.for("immer-nothing"),v_=Symbol.for("immer-draftable"),Zn=Symbol.for("immer-state");function Nr(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var pc=Object.getPrototypeOf;function Os(e){return!!e&&!!e[Zn]}function sl(e){var t;return e?tE(e)||Array.isArray(e)||!!e[v_]||!!((t=e.constructor)!=null&&t[v_])||Mc(e)||im(e):!1}var JI=Object.prototype.constructor.toString(),y_=new WeakMap;function tE(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=y_.get(n);return r===void 0&&(r=Function.toString.call(n),y_.set(n,r)),r===JI}function rf(e,t,n=!0){am(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(l=>{t(l,e[l],e)}):e.forEach((r,l)=>t(l,r,e))}function am(e){const t=e[Zn];return t?t.type_:Array.isArray(e)?1:Mc(e)?2:im(e)?3:0}function cy(e,t){return am(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function nE(e,t,n){const r=am(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function e$(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Mc(e){return e instanceof Map}function im(e){return e instanceof Set}function Yi(e){return e.copy_||e.base_}function uy(e,t){if(Mc(e))return new Map(e);if(im(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=tE(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Zn];let l=Reflect.ownKeys(r);for(let s=0;s1&&Object.defineProperties(e,{set:gd,add:gd,clear:gd,delete:gd}),Object.freeze(e),t&&Object.values(e).forEach(n=>g0(n,!0))),e}function t$(){Nr(2)}var gd={value:t$};function lm(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var n$={};function ol(e){const t=n$[e];return t||Nr(0,e),t}var vc;function rE(){return vc}function r$(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function g_(e,t){t&&(ol("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function dy(e){fy(e),e.drafts_.forEach(a$),e.drafts_=null}function fy(e){e===vc&&(vc=e.parent_)}function x_(e){return vc=r$(vc,e)}function a$(e){const t=e[Zn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function b_(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Zn].modified_&&(dy(t),Nr(4)),sl(e)&&(e=af(t,e),t.parent_||lf(t,e)),t.patches_&&ol("Patches").generateReplacementPatches_(n[Zn].base_,e,t.patches_,t.inversePatches_)):e=af(t,n,[]),dy(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==eE?e:void 0}function af(e,t,n){if(lm(t))return t;const r=e.immer_.shouldUseStrictIteration(),l=t[Zn];if(!l)return rf(t,(s,d)=>w_(e,l,t,s,d,n),r),t;if(l.scope_!==e)return t;if(!l.modified_)return lf(e,l.base_,!0),l.base_;if(!l.finalized_){l.finalized_=!0,l.scope_.unfinalizedDrafts_--;const s=l.copy_;let d=s,f=!1;l.type_===3&&(d=new Set(s),s.clear(),f=!0),rf(d,(m,h)=>w_(e,l,s,m,h,n,f),r),lf(e,s,!1),n&&e.patches_&&ol("Patches").generatePatches_(l,n,e.patches_,e.inversePatches_)}return l.copy_}function w_(e,t,n,r,l,s,d){if(l==null||typeof l!="object"&&!d)return;const f=lm(l);if(!(f&&!d)){if(Os(l)){const m=s&&t&&t.type_!==3&&!cy(t.assigned_,r)?s.concat(r):void 0,h=af(e,l,m);if(nE(n,r,h),Os(h))e.canAutoFreeze_=!1;else return}else d&&n.add(l);if(sl(l)&&!f){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===l&&f)return;af(e,l),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(Mc(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&lf(e,l)}}}function lf(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&g0(t,n)}function i$(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:rE(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let l=r,s=x0;n&&(l=[r],s=yc);const{revoke:d,proxy:f}=Proxy.revocable(l,s);return r.draft_=f,r.revoke_=d,f}var x0={get(e,t){if(t===Zn)return e;const n=Yi(e);if(!cy(n,t))return l$(e,n,t);const r=n[t];return e.finalized_||!sl(r)?r:r===cv(e.base_,t)?(uv(e),e.copy_[t]=hy(r,e)):r},has(e,t){return t in Yi(e)},ownKeys(e){return Reflect.ownKeys(Yi(e))},set(e,t,n){const r=aE(Yi(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const l=cv(Yi(e),t),s=l==null?void 0:l[Zn];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(e$(n,l)&&(n!==void 0||cy(e.base_,t)))return!0;uv(e),my(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return cv(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,uv(e),my(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Yi(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Nr(11)},getPrototypeOf(e){return pc(e.base_)},setPrototypeOf(){Nr(12)}},yc={};rf(x0,(e,t)=>{yc[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});yc.deleteProperty=function(e,t){return yc.set.call(this,e,t,void 0)};yc.set=function(e,t,n){return x0.set.call(this,e[0],t,n,e[0])};function cv(e,t){const n=e[Zn];return(n?Yi(n):e)[t]}function l$(e,t,n){var l;const r=aE(t,n);return r?"value"in r?r.value:(l=r.get)==null?void 0:l.call(e.draft_):void 0}function aE(e,t){if(!(t in e))return;let n=pc(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=pc(n)}}function my(e){e.modified_||(e.modified_=!0,e.parent_&&my(e.parent_))}function uv(e){e.copy_||(e.copy_=uy(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var s$=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const s=n;n=t;const d=this;return function(m=s,...h){return d.produce(m,v=>n.call(this,v,...h))}}typeof n!="function"&&Nr(6),r!==void 0&&typeof r!="function"&&Nr(7);let l;if(sl(t)){const s=x_(this),d=hy(t,void 0);let f=!0;try{l=n(d),f=!1}finally{f?dy(s):fy(s)}return g_(s,r),b_(l,s)}else if(!t||typeof t!="object"){if(l=n(t),l===void 0&&(l=t),l===eE&&(l=void 0),this.autoFreeze_&&g0(l,!0),r){const s=[],d=[];ol("Patches").generateReplacementPatches_(t,l,s,d),r(s,d)}return l}else Nr(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(d,...f)=>this.produceWithPatches(d,m=>t(m,...f));let r,l;return[this.produce(t,n,(d,f)=>{r=d,l=f}),r,l]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){sl(e)||Nr(8),Os(e)&&(e=o$(e));const t=x_(this),n=hy(e,void 0);return n[Zn].isManual_=!0,fy(t),n}finishDraft(e,t){const n=e&&e[Zn];(!n||!n.isManual_)&&Nr(9);const{scope_:r}=n;return g_(r,t),b_(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const l=t[n];if(l.path.length===0&&l.op==="replace"){e=l.value;break}}n>-1&&(t=t.slice(n+1));const r=ol("Patches").applyPatches_;return Os(e)?r(e,t):this.produce(e,l=>r(l,t))}};function hy(e,t){const n=Mc(e)?ol("MapSet").proxyMap_(e,t):im(e)?ol("MapSet").proxySet_(e,t):i$(e,t);return(t?t.scope_:rE()).drafts_.push(n),n}function o$(e){return Os(e)||Nr(10,e),iE(e)}function iE(e){if(!sl(e)||lm(e))return e;const t=e[Zn];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=uy(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=uy(e,!0);return rf(n,(l,s)=>{nE(n,l,iE(s))},r),t&&(t.finalized_=!1),n}var c$=new s$;c$.produce;var u$={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},lE=bn({name:"legend",initialState:u$,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:yt()},replaceLegendPayload:{reducer(e,t){var n=t.payload,r=n.prev,l=n.next,s=mr(e).payload.indexOf(r);s>-1&&(e.payload[s]=l)},prepare:yt()},removeLegendPayload:{reducer(e,t){var n=mr(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:yt()}}}),Dc=lE.actions,j_=Dc.setLegendSize,d$=Dc.setLegendSettings,sE=Dc.addLegendPayload,oE=Dc.replaceLegendPayload,cE=Dc.removeLegendPayload,f$=lE.reducer,dv={exports:{}},fv={};/** + * @license React + * use-sync-external-store-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 __;function m$(){if(__)return fv;__=1;var e=zs();function t(m,h){return m===h&&(m!==0||1/m===1/h)||m!==m&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,l=e.useRef,s=e.useEffect,d=e.useMemo,f=e.useDebugValue;return fv.useSyncExternalStoreWithSelector=function(m,h,v,y,b){var w=l(null);if(w.current===null){var j={hasValue:!1,value:null};w.current=j}else j=w.current;w=d(function(){function S(D){if(!A){if(A=!0,C=D,D=y(D),b!==void 0&&j.hasValue){var E=j.value;if(b(E,D))return M=E}return M=D}if(E=M,n(C,D))return E;var $=y(D);return b!==void 0&&b(E,$)?(C=D,E):(C=D,M=$)}var A=!1,C,M,k=v===void 0?null:v;return[function(){return S(h())},k===null?void 0:function(){return S(k())}]},[h,v,y,b]);var _=r(m,w[0],w[1]);return s(function(){j.hasValue=!0,j.value=_},[_]),f(_),_},fv}var N_;function h$(){return N_||(N_=1,dv.exports=m$()),dv.exports}h$();function p$(e){e()}function v$(){let e=null,t=null;return{clear(){e=null,t=null},notify(){p$(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const l=t={callback:n,next:null,prev:t};return l.prev?l.prev.next=l:e=l,function(){!r||e===null||(r=!1,l.next?l.next.prev=l.prev:t=l.prev,l.prev?l.prev.next=l.next:e=l.next)}}}}var S_={notify(){},get:()=>[]};function y$(e,t){let n,r=S_,l=0,s=!1;function d(_){v();const S=r.subscribe(_);let A=!1;return()=>{A||(A=!0,S(),y())}}function f(){r.notify()}function m(){j.onStateChange&&j.onStateChange()}function h(){return s}function v(){l++,n||(n=e.subscribe(m),r=v$())}function y(){l--,n&&l===0&&(n(),n=void 0,r.clear(),r=S_)}function b(){s||(s=!0,v())}function w(){s&&(s=!1,y())}const j={addNestedSub:d,notifyNestedSubs:f,handleChangeWrapper:m,isSubscribed:h,trySubscribe:b,tryUnsubscribe:w,getListeners:()=>r};return j}var g$=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",x$=g$(),b$=()=>typeof navigator<"u"&&navigator.product==="ReactNative",w$=b$(),j$=()=>x$||w$?x.useLayoutEffect:x.useEffect,_$=j$();function A_(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function N$(e,t){if(A_(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let l=0;l{const m=y$(l);return{store:l,subscription:m,getServerState:r?()=>r:void 0}},[l,r]),d=x.useMemo(()=>l.getState(),[l]);_$(()=>{const{subscription:m}=s;return m.onStateChange=m.notifyNestedSubs,m.trySubscribe(),d!==l.getState()&&m.notifyNestedSubs(),()=>{m.tryUnsubscribe(),m.onStateChange=void 0}},[s,d]);const f=n||A$;return x.createElement(f.Provider,{value:s},t)}var E$=O$,k$=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function C$(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function $s(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(k$.has(r)){if(e[r]==null&&t[r]==null)continue;if(!N$(e[r],t[r]))return!1}else if(!C$(e[r],t[r]))return!1;return!0}var T$=["contextPayload"];function py(){return py=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{s(d$({align:t,layout:n,verticalAlign:r,itemSorter:l}))},[s,t,n,r,l]),null}function G$(e){var t=e.width,n=e.height,r=dt();return x.useLayoutEffect(()=>{r(j_({width:t,height:n}))},[r,t,n]),x.useLayoutEffect(()=>()=>{r(j_({width:0,height:0}))},[r]),null}function V$(e,t,n,r){return e==="vertical"&&t!=null?{height:t}:e==="horizontal"?{width:n||r}:null}var F$={align:"center",iconSize:14,inactiveColor:"#ccc",itemSorter:"value",labelStyle:{},layout:"horizontal",verticalAlign:"bottom"};function X$(e){var t=an(e,F$),n=Fz(),r=kP(),l=WI(),s=t.width,d=t.height,f=t.wrapperStyle,m=t.portal,h=mO([n]),v=M$(h,2),y=v[0],b=v[1],w=h0(),j=p0();if(w==null||j==null)return null;var _=w-((l==null?void 0:l.left)||0)-((l==null?void 0:l.right)||0),S=V$(t.layout,d,s,_),A=m?f:Es(Es({position:"absolute",width:(S==null?void 0:S.width)||s||"auto",height:(S==null?void 0:S.height)||d||"auto"},K$(f,t,l,w,j,y)),f),C=m??r;if(C==null||n==null)return null;var M=x.createElement("div",{className:"recharts-legend-wrapper",style:A,ref:b},x.createElement(Y$,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),!m&&x.createElement(G$,{width:y.width,height:y.height}),x.createElement(q$,py({},t,S,{margin:l,chartWidth:w,chartHeight:j,contextPayload:n})));return It.createPortal(M,C)}var uE=x.memo(X$,$s);uE.displayName="Legend";function vy(){return vy=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.separator,n=t===void 0?is.separator:t,r=e.contentStyle,l=e.itemStyle,s=e.labelStyle,d=s===void 0?is.labelStyle:s,f=e.payload,m=e.formatter,h=e.itemSorter,v=e.wrapperClassName,y=e.labelClassName,b=e.label,w=e.labelFormatter,j=e.accessibilityLayer,_=j===void 0?is.accessibilityLayer:j,S=()=>{if(f&&f.length){var U={padding:0,margin:0},K=iR(f,h),T=K.map((re,Z)=>{if(!re||re.type==="none")return null;var pe=re.formatter||m||aR,fe=re.value,ce=re.name,R=fe,z=ce;if(pe){var G=pe(fe,ce,re,Z,f);if(Array.isArray(G)){var se=J$(G,2);R=se[0],z=se[1]}else if(G!=null)R=G;else return null}var ue=Ho(Ho({},is.itemStyle),{},{color:re.color||is.itemStyle.color},l);return x.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(Z),style:ue},qr(z)?x.createElement("span",{className:"recharts-tooltip-item-name"},z):null,qr(z)?x.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,x.createElement("span",{className:"recharts-tooltip-item-value"},R),x.createElement("span",{className:"recharts-tooltip-item-unit"},re.unit||""))});return x.createElement("ul",{className:"recharts-tooltip-item-list",style:U},T)}return null},A=Ho(Ho({},is.contentStyle),r),C=Ho({margin:0},d),M=!Nt(b),k=M?b:"",D=nt("recharts-default-tooltip",v),E=nt("recharts-tooltip-label",y);M&&w&&f!==void 0&&f!==null&&(k=w(b,f));var $=_?{role:"status","aria-live":"assertive"}:{};return x.createElement("div",vy({className:D,style:A},$),x.createElement("p",{className:E,style:C},x.isValidElement(k)?k:"".concat(k)),S())},qo="recharts-tooltip-wrapper",sR={visibility:"hidden"};function oR(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return nt(qo,{["".concat(qo,"-right")]:je(n)&&t&&je(t.x)&&n>=t.x,["".concat(qo,"-left")]:je(n)&&t&&je(t.x)&&n=t.y,["".concat(qo,"-top")]:je(r)&&t&&je(t.y)&&r0?l:0),y=n[r]+l;if(t[r])return d[r]?v:y;var b=m[r];if(b==null)return 0;if(d[r]){var w=v,j=b;return wS?Math.max(v,b):Math.max(y,b)}function cR(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function uR(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTop,l=e.offsetLeft,s=e.position,d=e.reverseDirection,f=e.tooltipBox,m=e.useTranslate3d,h=e.viewBox,v,y,b;return f.height>0&&f.width>0&&n?(y=T_({allowEscapeViewBox:t,coordinate:n,key:"x",offset:l,position:s,reverseDirection:d,tooltipDimension:f.width,viewBox:h,viewBoxDimension:h.width}),b=T_({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:s,reverseDirection:d,tooltipDimension:f.height,viewBox:h,viewBoxDimension:h.height}),v=cR({translateX:y,translateY:b,useTranslate3d:m})):v=sR,{cssProperties:v,cssClasses:oR({translateX:y,translateY:b,coordinate:n})}}var dR=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Pc={isSsr:dR()};function fR(e,t){return vR(e)||pR(e,t)||hR(e,t)||mR()}function mR(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hR(e,t){if(e){if(typeof e=="string")return M_(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M_(e,t):void 0}}function M_(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nPc.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),t=fR(e,2),n=t[0],r=t[1];return x.useEffect(()=>{if(window.matchMedia){var l=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>{r(l.matches)};return l.addEventListener("change",s),()=>{l.removeEventListener("change",s)}}},[]),n}function D_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function ls(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),h=bR(m,2),v=h[0],y=h[1];x.useEffect(()=>{var A=C=>{if(C.key==="Escape"){var M,k,D,E;y({dismissed:!0,dismissedAtCoordinate:{x:(M=(k=e.coordinate)===null||k===void 0?void 0:k.x)!==null&&M!==void 0?M:0,y:(D=(E=e.coordinate)===null||E===void 0?void 0:E.y)!==null&&D!==void 0?D:0}})}};return document.addEventListener("keydown",A),()=>{document.removeEventListener("keydown",A)}},[(t=e.coordinate)===null||t===void 0?void 0:t.x,(n=e.coordinate)===null||n===void 0?void 0:n.y]),v.dismissed&&(((r=(l=e.coordinate)===null||l===void 0?void 0:l.x)!==null&&r!==void 0?r:0)!==v.dismissedAtCoordinate.x||((s=(d=e.coordinate)===null||d===void 0?void 0:d.y)!==null&&s!==void 0?s:0)!==v.dismissedAtCoordinate.y)&&y(ls(ls({},v),{},{dismissed:!1}));var b=uR({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset=="number"?e.offset:e.offset.x,offsetTop:typeof e.offset=="number"?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:{height:e.lastBoundingBox.height,width:e.lastBoundingBox.width},useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),w=b.cssClasses,j=b.cssProperties,_=e.hasPortalFromProps?{}:ls(ls({transition:SR({prefersReducedMotion:f,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},j),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),S=ls(ls({},_),{},{visibility:!v.dismissed&&e.active&&e.hasPayload?"visible":"hidden"},e.wrapperStyle);return x.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:w,style:S,ref:e.innerRef},e.children)}var OR=x.memo(AR),fE=()=>{var e;return(e=Ne(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function yy(){return yy=Object.assign?Object.assign.bind():function(e){for(var t=1;tHe(e.x)&&He(e.y),R_=e=>e.base!=null&&sf(e.base)&&sf(e),Ko=e=>e.x,Yo=e=>e.y,TR=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(Ac(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=$_["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return $_[n]||Bf},L_={connectNulls:!1,type:"linear"},MR=e=>{var t=e.type,n=t===void 0?L_.type:t,r=e.points,l=r===void 0?[]:r,s=e.baseLine,d=e.layout,f=e.connectNulls,m=f===void 0?L_.connectNulls:f,h=TR(n,d),v=m?l.filter(sf):l;if(Array.isArray(s)){var y,b=l.map((A,C)=>I_(I_({},A),{},{base:s[C]}));d==="vertical"?y=ud().y(Yo).x1(Ko).x0(A=>A.base.x):y=ud().x(Ko).y1(Yo).y0(A=>A.base.y);var w=y.defined(R_).curve(h),j=m?b.filter(R_):b;return w(j)}var _;d==="vertical"&&je(s)?_=ud().y(Yo).x1(Ko).x0(s):je(s)?_=ud().x(Ko).y1(Yo).y0(s):_=MA().x(Ko).y(Yo);var S=_.defined(sf).curve(h);return S(v)},lc=e=>{var t=e.className,n=e.points,r=e.path,l=e.pathRef,s=pl();if((!n||!n.length)&&!r)return null;var d={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||s,connectNulls:e.connectNulls},f=n&&n.length?MR(d):r;return x.createElement("path",yy({},zn(e),n0(e),{className:nt("recharts-curve",t),d:f===null?void 0:f,ref:l}))},DR=["x","y","top","left","width","height","className"];function gy(){return gy=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(l,"v").concat(r,"M").concat(s,",").concat(t,"h").concat(n),UR=e=>{var t=e.x,n=t===void 0?0:t,r=e.y,l=r===void 0?0:r,s=e.top,d=s===void 0?0:s,f=e.left,m=f===void 0?0:f,h=e.width,v=h===void 0?0:h,y=e.height,b=y===void 0?0:y,w=e.className,j=RR(e,DR),_=PR({x:n,y:l,top:d,left:m,width:v,height:b},j);return!je(n)||!je(l)||!je(v)||!je(b)||!je(d)||!je(m)?null:x.createElement("path",gy({},Xn(_),{className:nt("recharts-cross",w),d:BR(n,l,v,b,d,m)}))};function HR(e,t,n,r){var l=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-l:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-l,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}var of=1e-4,mE=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],hE=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),U_=(e,t)=>n=>{var r=mE(e,t);return hE(r,n)},qR=(e,t)=>n=>{var r=mE(e,t),l=[...r.map((s,d)=>s*d).slice(1),0];return hE(l,n)},KR=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var l=r.map(s=>parseFloat(s));return[l[0],l[1],l[2],l[3]]},YR=function(){for(var t=arguments.length,n=new Array(t),r=0;r{var l=U_(e,n),s=U_(t,r),d=qR(e,n),f=h=>h>1?1:h<0?0:h,m=h=>{for(var v=h>1?1:h,y=v,b=0;b<8;++b){var w=l(y)-v,j=d(y);if(Math.abs(w-v)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,l=t.damping,s=l===void 0?8:l,d=t.dt,f=d===void 0?16.67:d,m=1,h=[0],v=0,y=0,b=1e4,w=0;w{var C,M,k;if(A<=0)return 0;if(A>=1)return m;var D=A*S,E=Math.floor(D),$=D-E;return((C=h[E])!==null&&C!==void 0?C:0)+(((M=h[E+1])!==null&&M!==void 0?M:0)-((k=h[E])!==null&&k!==void 0?k:0))*$}},FR=e=>{if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return H_(e);case"spring":return VR();default:if(e.split("(")[0]==="cubic-bezier")return H_(e)}return typeof e=="function"?e:null},XR=(e,t,n)=>{var r,l=s=>{var d=t.tick(s);if(t.getState()==="active"){if(n(t.getInterpolated()),t.getProgress()===1){t.complete(),r=void 0;return}r=e.setTimeout(l,d);return}r=e.setTimeout(l,d)};return r=e.setTimeout(l,0),()=>{var s;return(s=r)===null||s===void 0?void 0:s()}},pE=x.createContext(XR);pE.Provider;function WR(e){var t=x.useContext(pE);return x.useMemo(()=>e??t,[e,t])}function ZR(e,t,n){return(t=QR(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function QR(e){var t=JR(e,"string");return typeof t=="symbol"?t:t+""}function JR(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var q_="init",K_="pending",Y_="active",e7="completed";function pv(e){return Math.max(0,e)}class t7{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(t){var n;ZR(this,"state",q_),this.animationId=t.animationId,this.onAnimationEnd=t.onAnimationEnd,this.animationDuration=pv(t.animationDuration),this.animationBegin=pv(t.animationBegin),this.progress=0,this.from=t.from,this.to=t.to,this.easing=t.easing,(n=t.onAnimationStart)===null||n===void 0||n.call(t)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(t){if(this.getState()===q_)return this.state=K_,this.beginStartedTime=t,this.animationBegin;if(this.getState()===K_){if(this.beginStartedTime==null)throw new Error;var n=t-this.beginStartedTime;return n>=this.animationBegin?(this.state=Y_,this.animationStartedTime=t,this.nextAnimationUpdate(0)):pv(this.animationBegin-n)}if(this.getState()===Y_){if(this.animationStartedTime==null)throw new Error;var r=t-this.animationStartedTime;return this.setProgress(r/this.animationDuration),this.nextAnimationUpdate(r)}return 0}setProgress(t){this.progress=Math.min(1,Math.max(0,t))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state==="active"){var t;(t=this.onAnimationEnd)===null||t===void 0||t.call(this)}this.state=e7}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class n7 extends t7{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(Et(this.getFrom(),this.getTo(),this.getProgress()))}}class r7{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),l=null,s=d=>{d-r>=n?t(d):l=requestAnimationFrame(s)};return l=requestAnimationFrame(s),()=>{l!=null&&cancelAnimationFrame(l)}}}function a7(e,t){return o7(e)||s7(e,t)||l7(e,t)||i7()}function i7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function l7(e,t){if(e){if(typeof e=="string")return G_(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?G_(e,t):void 0}}function G_(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{},onAnimationStart:()=>{}},V_=0,vv=1;function vE(e){var t=an(e,c7),n=t.animationId,r=t.isActive,l=t.canBegin,s=t.duration,d=t.easing,f=t.begin,m=t.onAnimationEnd,h=t.onAnimationStart,v=t.children,y=dE(),b=r==="auto"?!Pc.isSsr&&!y:r,w=WR(t.animationController),j=x.useState(b?V_:vv),_=a7(j,2),S=_[0],A=_[1];return x.useEffect(()=>{b||A(vv)},[b]),x.useEffect(()=>{var C=FR(d);if(!b||!l||C==null)return hl;var M=new r7,k=new n7({animationId:n,easing:C,animationDuration:s,animationBegin:f,onAnimationStart:h,onAnimationEnd:m,from:V_,to:vv});return w(M,k,A)},[w,n,b,l,s,d,f,h,m]),v(Number(S))}function yE(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=x.useRef(dc(t)),r=x.useRef(e);return r.current!==e&&(n.current=dc(t),r.current=e),n.current}var u7=e=>e.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),d7=(e,t,n)=>e.map(r=>"".concat(u7(r)," ").concat(t,"ms ").concat(n)).join(","),f7=["radius"],m7=["radius"],F_,X_,W_,Z_,Q_,J_,e2,t2,n2,r2;function a2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function i2(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{var s=di(n),d=di(r),f=Math.min(Math.abs(s)/2,Math.abs(d)/2),m=d>=0?1:-1,h=s>=0?1:-1,v=d>=0&&s>=0||d<0&&s<0?1:0,y;if(f>0&&Array.isArray(l)){for(var b=[0,0,0,0],w=0,j=4;wf?f:S}y=hn(F_||(F_=zr(["M",",",""])),e,t+m*b[0]),b[0]>0&&(y+=hn(X_||(X_=zr(["A ",",",",0,0,",",",",",""])),b[0],b[0],v,e+h*b[0],t)),y+=hn(W_||(W_=zr(["L ",",",""])),e+n-h*b[1],t),b[1]>0&&(y+=hn(Z_||(Z_=zr(["A ",",",",0,0,",`, + `,",",""])),b[1],b[1],v,e+n,t+m*b[1])),y+=hn(Q_||(Q_=zr(["L ",",",""])),e+n,t+r-m*b[2]),b[2]>0&&(y+=hn(J_||(J_=zr(["A ",",",",0,0,",`, + `,",",""])),b[2],b[2],v,e+n-h*b[2],t+r)),y+=hn(e2||(e2=zr(["L ",",",""])),e+h*b[3],t+r),b[3]>0&&(y+=hn(t2||(t2=zr(["A ",",",",0,0,",`, + `,",",""])),b[3],b[3],v,e,t+r-m*b[3])),y+="Z"}else if(f>0&&l===+l&&l>0){var A=Math.min(f,l);y=hn(n2||(n2=zr(["M ",",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",","," Z"])),e,t+m*A,A,A,v,e+h*A,t,e+n-h*A,t,A,A,v,e+n,t+m*A,e+n,t+r-m*A,A,A,v,e+n-h*A,t+r,e+h*A,t+r,A,A,v,e,t+r-m*A)}else y=hn(r2||(r2=zr(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return y},c2={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},gE=e=>{var t=an(e,c2),n=x.useRef(null),r=x.useState(-1),l=g7(r,2),s=l[0],d=l[1];x.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var G=n.current.getTotalLength();G&&d(G)}catch{}},[]);var f=t.x,m=t.y,h=t.width,v=t.height,y=t.radius,b=t.className,w=t.animationEasing,j=t.animationDuration,_=t.animationBegin,S=t.isAnimationActive,A=t.isUpdateAnimationActive,C=x.useRef(h),M=x.useRef(v),k=x.useRef(f),D=x.useRef(m),E=x.useMemo(()=>({x:f,y:m,width:h,height:v,radius:y}),[f,m,h,v,y]),$=yE(E,"rectangle-");if(f!==+f||m!==+m||h!==+h||v!==+v||h===0||v===0)return null;var U=nt("recharts-rectangle",b);if(!A){var K=Xn(t);K.radius;var T=l2(K,f7);return x.createElement("path",cf({},T,{x:di(f),y:di(m),width:di(h),height:di(v),radius:typeof y=="number"?y:void 0,className:U,d:o2(f,m,h,v,y)}))}var re=C.current,Z=M.current,pe=k.current,fe=D.current,ce="0px ".concat(s===-1?1:s,"px"),R="".concat(s,"px ").concat(s,"px"),z=d7(["strokeDasharray"],j,typeof w=="string"?w:c2.animationEasing);return x.createElement(vE,{animationId:$,key:$,canBegin:s>0,duration:j,easing:w,isActive:A,begin:_},G=>{var se=Et(re,h,G),ue=Et(Z,v,G),P=Et(pe,f,G),Q=Et(fe,m,G);n.current&&(C.current=se,M.current=ue,k.current=P,D.current=Q);var ne;S?G>0?ne={transition:z,strokeDasharray:R}:ne={strokeDasharray:ce}:ne={strokeDasharray:R};var I=Xn(t);I.radius;var he=l2(I,m7);return x.createElement("path",cf({},he,{radius:typeof y=="number"?y:void 0,className:U,d:o2(P,Q,se,ue,y),ref:n,style:i2(i2({},ne),t.style)}))})};function u2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function d2(e){for(var t=1;te*180/Math.PI,Ht=(e,t,n,r)=>({x:e+Math.cos(-uf*r)*n,y:t+Math.sin(-uf*r)*n}),xE=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},O7=(e,t)=>{var n=e.x,r=e.y,l=t.x,s=t.y;return Math.sqrt((n-l)**2+(r-s)**2)},E7=(e,t)=>{var n=e.x,r=e.y,l=t.cx,s=t.cy,d=O7({x:n,y:r},{x:l,y:s});if(d<=0)return{radius:d,angle:0};var f=(n-l)/d,m=Math.acos(f);return r>s&&(m=2*Math.PI-m),{radius:d,angle:A7(m),angleInRadian:m}},k7=e=>{var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),l=Math.floor(n/360),s=Math.min(r,l);return{startAngle:t-s*360,endAngle:n-s*360}},C7=(e,t)=>{var n=t.startAngle,r=t.endAngle,l=Math.floor(n/360),s=Math.floor(r/360),d=Math.min(l,s);return e+d*360},T7=(e,t)=>{var n=e.relativeX,r=e.relativeY,l=E7({x:n,y:r},t),s=l.radius,d=l.angle,f=t.innerRadius,m=t.outerRadius;if(sm||s===0)return null;var h=k7(t),v=h.startAngle,y=h.endAngle,b=d,w;if(v<=y){for(;b>y;)b-=360;for(;b=v&&b<=y}else{for(;b>v;)b-=360;for(;b=y&&b<=v}return w?d2(d2({},t),{},{radius:s,angle:C7(b,t)}):null};function bE(e){var t=e.cx,n=e.cy,r=e.radius,l=e.startAngle,s=e.endAngle,d=Ht(t,n,r,l),f=Ht(t,n,r,s);return{points:[d,f],cx:t,cy:n,radius:r,startAngle:l,endAngle:s}}var f2,m2,h2,p2,v2,y2,g2;function xy(){return xy=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=rn(t-e),r=Math.min(Math.abs(t-e),359.999);return n*r},xd=e=>{var t=e.cx,n=e.cy,r=e.radius,l=e.angle,s=e.sign,d=e.isExternal,f=e.cornerRadius,m=e.cornerIsExternal,h=f*(d?1:-1)+r,v=Math.asin(f/h)/uf,y=m?l:l+s*v,b=Ht(t,n,h,y),w=Ht(t,n,r,y),j=m?l-s*v:l,_=Ht(t,n,h*Math.cos(v*uf),j);return{center:b,circleTangency:w,lineTangency:_,theta:v}},wE=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,l=e.outerRadius,s=e.startAngle,d=e.endAngle,f=M7(s,d),m=s+f,h=Ht(t,n,l,s),v=Ht(t,n,l,m),y=hn(f2||(f2=Xi(["M ",",",` + A `,",",`,0, + `,",",`, + `,",",` + `])),h.x,h.y,l,l,+(Math.abs(f)>180),+(s>m),v.x,v.y);if(r>0){var b=Ht(t,n,r,s),w=Ht(t,n,r,m);y+=hn(m2||(m2=Xi(["L ",",",` + A `,",",`,0, + `,",",`, + `,","," Z"])),w.x,w.y,r,r,+(Math.abs(f)>180),+(s<=m),b.x,b.y)}else y+=hn(h2||(h2=Xi(["L ",","," Z"])),t,n);return y},D7=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,l=e.outerRadius,s=e.cornerRadius,d=e.forceCornerRadius,f=e.cornerIsExternal,m=e.startAngle,h=e.endAngle,v=rn(h-m),y=xd({cx:t,cy:n,radius:l,angle:m,sign:v,cornerRadius:s,cornerIsExternal:f}),b=y.circleTangency,w=y.lineTangency,j=y.theta,_=xd({cx:t,cy:n,radius:l,angle:h,sign:-v,cornerRadius:s,cornerIsExternal:f}),S=_.circleTangency,A=_.lineTangency,C=_.theta,M=f?Math.abs(m-h):Math.abs(m-h)-j-C;if(M<0)return d?hn(p2||(p2=Xi(["M ",",",` + a`,",",",0,0,1,",`,0 + a`,",",",0,0,1,",`,0 + `])),w.x,w.y,s,s,s*2,s,s,-s*2):wE({cx:t,cy:n,innerRadius:r,outerRadius:l,startAngle:m,endAngle:h});var k=hn(v2||(v2=Xi(["M ",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",",` + `])),w.x,w.y,s,s,+(v<0),b.x,b.y,l,l,+(M>180),+(v<0),S.x,S.y,s,s,+(v<0),A.x,A.y);if(r>0){var D=xd({cx:t,cy:n,radius:r,angle:m,sign:v,isExternal:!0,cornerRadius:s,cornerIsExternal:f}),E=D.circleTangency,$=D.lineTangency,U=D.theta,K=xd({cx:t,cy:n,radius:r,angle:h,sign:-v,isExternal:!0,cornerRadius:s,cornerIsExternal:f}),T=K.circleTangency,re=K.lineTangency,Z=K.theta,pe=f?Math.abs(m-h):Math.abs(m-h)-U-Z;if(pe<0&&s===0)return"".concat(k,"L").concat(t,",").concat(n,"Z");k+=hn(y2||(y2=Xi(["L",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",","Z"])),re.x,re.y,s,s,+(v<0),T.x,T.y,r,r,+(pe>180),+(v>0),E.x,E.y,s,s,+(v<0),$.x,$.y)}else k+=hn(g2||(g2=Xi(["L",",","Z"])),t,n);return k},P7={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},jE=e=>{var t=an(e,P7),n=t.cx,r=t.cy,l=t.innerRadius,s=t.outerRadius,d=t.cornerRadius,f=t.forceCornerRadius,m=t.cornerIsExternal,h=t.startAngle,v=t.endAngle,y=t.className;if(s0&&Math.abs(h-v)<360?_=D7({cx:n,cy:r,innerRadius:l,outerRadius:s,cornerRadius:Math.min(j,w/2),forceCornerRadius:f,cornerIsExternal:m,startAngle:h,endAngle:v}):_=wE({cx:n,cy:r,innerRadius:l,outerRadius:s,startAngle:h,endAngle:v}),x.createElement("path",xy({},Xn(t),{className:b,d:_}))};function z7(e,t,n){if(e==="horizontal")return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e==="vertical")return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(XA(t)){if(e==="centric"){var r=t.cx,l=t.cy,s=t.innerRadius,d=t.outerRadius,f=t.angle,m=Ht(r,l,s,f),h=Ht(r,l,d,f);return[{x:m.x,y:m.y},{x:h.x,y:h.y}]}return bE(t)}}function I7(e){return dO(e)?NaN:Number(e)}function yv(e){return e?(e=I7(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function _E(e,t,n){n&&typeof n!="number"&&Qv(e,t,n)&&(t=n=void 0),e=yv(e),t===void 0?(t=e,e=0):t=yv(t),n=n===void 0?ee.chartData,zc=X([kr],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),sm=(e,t,n,r)=>r?zc(e):kr(e),NE=(e,t,n)=>n?zc(e):kr(e),$7=X([sm],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t!=null?t.slice(n,r+1):[]}),R7=X([zc],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t!=null?t.slice(n,r+1):[]}),L7=X([kr],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t!=null?t.slice(n,r+1):[]});function b0(e,t){return q7(e)||H7(e,t)||U7(e,t)||B7()}function B7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function U7(e,t){if(e){if(typeof e=="string")return x2(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?x2(e,t):void 0}}function x2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.e^s.s<0?1:-1;for(r=s.d.length,l=e.d.length,t=0,n=re.d[t]^s.s<0?1:-1;return r===l?0:r>l^s.s<0?1:-1};Se.decimalPlaces=Se.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*gt;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Se.dividedBy=Se.div=function(e){return _a(this,new this.constructor(e))};Se.dividedToIntegerBy=Se.idiv=function(e){var t=this,n=t.constructor;return mt(_a(t,new n(e),0,1),n.precision)};Se.equals=Se.eq=function(e){return!this.cmp(e)};Se.exponent=function(){return Kt(this)};Se.greaterThan=Se.gt=function(e){return this.cmp(e)>0};Se.greaterThanOrEqualTo=Se.gte=function(e){return this.cmp(e)>=0};Se.isInteger=Se.isint=function(){return this.e>this.d.length-2};Se.isNegative=Se.isneg=function(){return this.s<0};Se.isPositive=Se.ispos=function(){return this.s>0};Se.isZero=function(){return this.s===0};Se.lessThan=Se.lt=function(e){return this.cmp(e)<0};Se.lessThanOrEqualTo=Se.lte=function(e){return this.cmp(e)<1};Se.logarithm=Se.log=function(e){var t,n=this,r=n.constructor,l=r.precision,s=l+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(Gn))throw Error(vr+"NaN");if(n.s<1)throw Error(vr+(n.s?"NaN":"-Infinity"));return n.eq(Gn)?new r(0):(wt=!1,t=_a(gc(n,s),gc(e,s),s),wt=!0,mt(t,l))};Se.minus=Se.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?kE(t,e):OE(t,(e.s=-e.s,e))};Se.modulo=Se.mod=function(e){var t,n=this,r=n.constructor,l=r.precision;if(e=new r(e),!e.s)throw Error(vr+"NaN");return n.s?(wt=!1,t=_a(n,e,0,1).times(e),wt=!0,n.minus(t)):mt(new r(n),l)};Se.naturalExponential=Se.exp=function(){return EE(this)};Se.naturalLogarithm=Se.ln=function(){return gc(this)};Se.negated=Se.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Se.plus=Se.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?OE(t,e):kE(t,(e.s=-e.s,e))};Se.precision=Se.sd=function(e){var t,n,r,l=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(el+e);if(t=Kt(l)+1,r=l.d.length-1,n=r*gt+1,r=l.d[r],r){for(;r%10==0;r/=10)n--;for(r=l.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};Se.squareRoot=Se.sqrt=function(){var e,t,n,r,l,s,d,f=this,m=f.constructor;if(f.s<1){if(!f.s)return new m(0);throw Error(vr+"NaN")}for(e=Kt(f),wt=!1,l=Math.sqrt(+f),l==0||l==1/0?(t=Lr(f.d),(t.length+e)%2==0&&(t+="0"),l=Math.sqrt(t),e=Ls((e+1)/2)-(e<0||e%2),l==1/0?t="5e"+e:(t=l.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new m(t)):r=new m(l.toString()),n=m.precision,l=d=n+3;;)if(s=r,r=s.plus(_a(f,s,d+2)).times(.5),Lr(s.d).slice(0,d)===(t=Lr(r.d)).slice(0,d)){if(t=t.slice(d-3,d+1),l==d&&t=="4999"){if(mt(s,n+1,0),s.times(s).eq(f)){r=s;break}}else if(t!="9999")break;d+=4}return wt=!0,mt(r,n)};Se.times=Se.mul=function(e){var t,n,r,l,s,d,f,m,h,v=this,y=v.constructor,b=v.d,w=(e=new y(e)).d;if(!v.s||!e.s)return new y(0);for(e.s*=v.s,n=v.e+e.e,m=b.length,h=w.length,m=0;){for(t=0,l=m+r;l>r;)f=s[l]+w[r]*b[l-r-1]+t,s[l--]=f%nn|0,t=f/nn|0;s[l]=(s[l]+t)%nn|0}for(;!s[--d];)s.pop();return t?++n:s.shift(),e.d=s,e.e=n,wt?mt(e,y.precision):e};Se.toDecimalPlaces=Se.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(Yr(e,0,Rs),t===void 0?t=r.rounding:Yr(t,0,8),mt(n,e+Kt(n)+1,t))};Se.toExponential=function(e,t){var n,r=this,l=r.constructor;return e===void 0?n=cl(r,!0):(Yr(e,0,Rs),t===void 0?t=l.rounding:Yr(t,0,8),r=mt(new l(r),e+1,t),n=cl(r,!0,e+1)),n};Se.toFixed=function(e,t){var n,r,l=this,s=l.constructor;return e===void 0?cl(l):(Yr(e,0,Rs),t===void 0?t=s.rounding:Yr(t,0,8),r=mt(new s(l),e+Kt(l)+1,t),n=cl(r.abs(),!1,e+Kt(r)+1),l.isneg()&&!l.isZero()?"-"+n:n)};Se.toInteger=Se.toint=function(){var e=this,t=e.constructor;return mt(new t(e),Kt(e)+1,t.rounding)};Se.toNumber=function(){return+this};Se.toPower=Se.pow=function(e){var t,n,r,l,s,d,f=this,m=f.constructor,h=12,v=+(e=new m(e));if(!e.s)return new m(Gn);if(f=new m(f),!f.s){if(e.s<1)throw Error(vr+"Infinity");return f}if(f.eq(Gn))return f;if(r=m.precision,e.eq(Gn))return mt(f,r);if(t=e.e,n=e.d.length-1,d=t>=n,s=f.s,d){if((n=v<0?-v:v)<=AE){for(l=new m(Gn),t=Math.ceil(r/gt+4),wt=!1;n%2&&(l=l.times(f),j2(l.d,t)),n=Ls(n/2),n!==0;)f=f.times(f),j2(f.d,t);return wt=!0,e.s<0?new m(Gn).div(l):mt(l,r)}}else if(s<0)throw Error(vr+"NaN");return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,f.s=1,wt=!1,l=e.times(gc(f,r+h)),wt=!0,l=EE(l),l.s=s,l};Se.toPrecision=function(e,t){var n,r,l=this,s=l.constructor;return e===void 0?(n=Kt(l),r=cl(l,n<=s.toExpNeg||n>=s.toExpPos)):(Yr(e,1,Rs),t===void 0?t=s.rounding:Yr(t,0,8),l=mt(new s(l),e,t),n=Kt(l),r=cl(l,e<=n||n<=s.toExpNeg,e)),r};Se.toSignificantDigits=Se.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(Yr(e,1,Rs),t===void 0?t=r.rounding:Yr(t,0,8)),mt(new r(n),e,t)};Se.toString=Se.valueOf=Se.val=Se.toJSON=Se[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Kt(e),n=e.constructor;return cl(e,t<=n.toExpNeg||t>=n.toExpPos)};function OE(e,t){var n,r,l,s,d,f,m,h,v=e.constructor,y=v.precision;if(!e.s||!t.s)return t.s||(t=new v(e)),wt?mt(t,y):t;if(m=e.d,h=t.d,d=e.e,l=t.e,m=m.slice(),s=d-l,s){for(s<0?(r=m,s=-s,f=h.length):(r=h,l=d,f=m.length),d=Math.ceil(y/gt),f=d>f?d+1:f+1,s>f&&(s=f,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(f=m.length,s=h.length,f-s<0&&(s=f,r=h,h=m,m=r),n=0;s;)n=(m[--s]=m[s]+h[s]+n)/nn|0,m[s]%=nn;for(n&&(m.unshift(n),++l),f=m.length;m[--f]==0;)m.pop();return t.d=m,t.e=l,wt?mt(t,y):t}function Yr(e,t,n){if(e!==~~e||en)throw Error(el+e)}function Lr(e){var t,n,r,l=e.length-1,s="",d=e[0];if(l>0){for(s+=d,t=1;td?1:-1;else for(f=m=0;fl[f]?1:-1;break}return m}function n(r,l,s){for(var d=0;s--;)r[s]-=d,d=r[s]1;)r.shift()}return function(r,l,s,d){var f,m,h,v,y,b,w,j,_,S,A,C,M,k,D,E,$,U,K=r.constructor,T=r.s==l.s?1:-1,re=r.d,Z=l.d;if(!r.s)return new K(r);if(!l.s)throw Error(vr+"Division by zero");for(m=r.e-l.e,$=Z.length,D=re.length,w=new K(T),j=w.d=[],h=0;Z[h]==(re[h]||0);)++h;if(Z[h]>(re[h]||0)&&--m,s==null?C=s=K.precision:d?C=s+(Kt(r)-Kt(l))+1:C=s,C<0)return new K(0);if(C=C/gt+2|0,h=0,$==1)for(v=0,Z=Z[0],C++;(h1&&(Z=e(Z,v),re=e(re,v),$=Z.length,D=re.length),k=$,_=re.slice(0,$),S=_.length;S<$;)_[S++]=0;U=Z.slice(),U.unshift(0),E=Z[0],Z[1]>=nn/2&&++E;do v=0,f=t(Z,_,$,S),f<0?(A=_[0],$!=S&&(A=A*nn+(_[1]||0)),v=A/E|0,v>1?(v>=nn&&(v=nn-1),y=e(Z,v),b=y.length,S=_.length,f=t(y,_,b,S),f==1&&(v--,n(y,$16)throw Error(w0+Kt(e));if(!e.s)return new v(Gn);for(wt=!1,f=y,d=new v(.03125);e.abs().gte(.1);)e=e.times(d),h+=5;for(r=Math.log(Gi(2,h))/Math.LN10*2+5|0,f+=r,n=l=s=new v(Gn),v.precision=f;;){if(l=mt(l.times(e),f),n=n.times(++m),d=s.plus(_a(l,n,f)),Lr(d.d).slice(0,f)===Lr(s.d).slice(0,f)){for(;h--;)s=mt(s.times(s),f);return v.precision=y,t==null?(wt=!0,mt(s,y)):s}s=d}}function Kt(e){for(var t=e.e*gt,n=e.d[0];n>=10;n/=10)t++;return t}function gv(e,t,n){if(t>e.LN10.sd())throw wt=!0,n&&(e.precision=n),Error(vr+"LN10 precision limit exceeded");return mt(new e(e.LN10),t)}function si(e){for(var t="";e--;)t+="0";return t}function gc(e,t){var n,r,l,s,d,f,m,h,v,y=1,b=10,w=e,j=w.d,_=w.constructor,S=_.precision;if(w.s<1)throw Error(vr+(w.s?"NaN":"-Infinity"));if(w.eq(Gn))return new _(0);if(t==null?(wt=!1,h=S):h=t,w.eq(10))return t==null&&(wt=!0),gv(_,h);if(h+=b,_.precision=h,n=Lr(j),r=n.charAt(0),s=Kt(w),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)w=w.times(e),n=Lr(w.d),r=n.charAt(0),y++;s=Kt(w),r>1?(w=new _("0."+n),s++):w=new _(r+"."+n.slice(1))}else return m=gv(_,h+2,S).times(s+""),w=gc(new _(r+"."+n.slice(1)),h-b).plus(m),_.precision=S,t==null?(wt=!0,mt(w,S)):w;for(f=d=w=_a(w.minus(Gn),w.plus(Gn),h),v=mt(w.times(w),h),l=3;;){if(d=mt(d.times(v),h),m=f.plus(_a(d,new _(l),h)),Lr(m.d).slice(0,h)===Lr(f.d).slice(0,h))return f=f.times(2),s!==0&&(f=f.plus(gv(_,h+2,S).times(s+""))),f=_a(f,new _(y),h),_.precision=S,t==null?(wt=!0,mt(f,S)):f;f=m,l+=2}}function w2(e,t){var n,r,l;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(l=t.length;t.charCodeAt(l-1)===48;)--l;if(t=t.slice(r,l),t){if(l-=r,n=n-r-1,e.e=Ls(n/gt),e.d=[],r=(n+1)%gt,n<0&&(r+=gt),rdf||e.e<-df))throw Error(w0+n)}else e.s=0,e.e=0,e.d=[0];return e}function mt(e,t,n){var r,l,s,d,f,m,h,v,y=e.d;for(d=1,s=y[0];s>=10;s/=10)d++;if(r=t-d,r<0)r+=gt,l=t,h=y[v=0];else{if(v=Math.ceil((r+1)/gt),s=y.length,v>=s)return e;for(h=s=y[v],d=1;s>=10;s/=10)d++;r%=gt,l=r-gt+d}if(n!==void 0&&(s=Gi(10,d-l-1),f=h/s%10|0,m=t<0||y[v+1]!==void 0||h%s,m=n<4?(f||m)&&(n==0||n==(e.s<0?3:2)):f>5||f==5&&(n==4||m||n==6&&(r>0?l>0?h/Gi(10,d-l):0:y[v-1])%10&1||n==(e.s<0?8:7))),t<1||!y[0])return m?(s=Kt(e),y.length=1,t=t-s-1,y[0]=Gi(10,(gt-t%gt)%gt),e.e=Ls(-t/gt)||0):(y.length=1,y[0]=e.e=e.s=0),e;if(r==0?(y.length=v,s=1,v--):(y.length=v+1,s=Gi(10,gt-r),y[v]=l>0?(h/Gi(10,d-l)%Gi(10,l)|0)*s:0),m)for(;;)if(v==0){(y[0]+=s)==nn&&(y[0]=1,++e.e);break}else{if(y[v]+=s,y[v]!=nn)break;y[v--]=0,s=1}for(r=y.length;y[--r]===0;)y.pop();if(wt&&(e.e>df||e.e<-df))throw Error(w0+Kt(e));return e}function kE(e,t){var n,r,l,s,d,f,m,h,v,y,b=e.constructor,w=b.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new b(e),wt?mt(t,w):t;if(m=e.d,y=t.d,r=t.e,h=e.e,m=m.slice(),d=h-r,d){for(v=d<0,v?(n=m,d=-d,f=y.length):(n=y,r=h,f=m.length),l=Math.max(Math.ceil(w/gt),f)+2,d>l&&(d=l,n.length=1),n.reverse(),l=d;l--;)n.push(0);n.reverse()}else{for(l=m.length,f=y.length,v=l0;--l)m[f++]=0;for(l=y.length;l>d;){if(m[--l]0?s=s.charAt(0)+"."+s.slice(1)+si(r):d>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(l<0?"e":"e+")+l):l<0?(s="0."+si(-l-1)+s,n&&(r=n-d)>0&&(s+=si(r))):l>=d?(s+=si(l+1-d),n&&(r=n-l-1)>0&&(s=s+"."+si(r))):((r=l+1)0&&(l+1===d&&(s+="."),s+=si(r))),e.s<0?"-"+s:s}function j2(e,t){if(e.length>t)return e.length=t,!0}function CE(e){var t,n,r;function l(s){var d=this;if(!(d instanceof l))return new l(s);if(d.constructor=l,s instanceof l){d.s=s.s,d.e=s.e,d.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(el+s);if(s>0)d.s=1;else if(s<0)s=-s,d.s=-1;else{d.s=0,d.e=0,d.d=[0];return}if(s===~~s&&s<1e7){d.e=0,d.d=[s];return}return w2(d,s.toString())}else if(typeof s!="string")throw Error(el+s);if(s.charCodeAt(0)===45?(s=s.slice(1),d.s=-1):d.s=1,G7.test(s))w2(d,s);else throw Error(el+s)}if(l.prototype=Se,l.ROUND_UP=0,l.ROUND_DOWN=1,l.ROUND_CEIL=2,l.ROUND_FLOOR=3,l.ROUND_HALF_UP=4,l.ROUND_HALF_DOWN=5,l.ROUND_HALF_EVEN=6,l.ROUND_HALF_CEIL=7,l.ROUND_HALF_FLOOR=8,l.clone=CE,l.config=l.set=V7,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=l[t+1]&&r<=l[t+2])this[n]=r;else throw Error(el+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(el+n+": "+r);return this}var j0=CE(Y7);Gn=new j0(1);const Xe=j0;function TE(e){var t;return e===0?t=1:t=Math.floor(new Xe(e).abs().log(10).toNumber())+1,t}function ME(e,t,n){for(var r=new Xe(e),l=0,s=[];r.lt(t)&&l<1e5;)s.push(r.toNumber()),r=r.add(n),l++;return s}function xc(e,t){return Z7(e)||W7(e,t)||X7(e,t)||F7()}function F7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function X7(e,t){if(e){if(typeof e=="string")return _2(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_2(e,t):void 0}}function _2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=xc(e,2),n=t[0],r=t[1],l=n,s=r;return n>r&&(l=r,s=n),[l,s]},_0=(e,t,n)=>{if(e.lte(0))return new Xe(0);var r=TE(e.toNumber()),l=new Xe(10).pow(r),s=e.div(l),d=r!==1?.05:.1,f=new Xe(Math.ceil(s.div(d).toNumber())).add(n).mul(d),m=f.mul(l);return t?new Xe(m.toNumber()):new Xe(Math.ceil(m.toNumber()))},PE=(e,t,n)=>{var r;if(e.lte(0))return new Xe(0);var l=[1,2,2.5,5],s=e.toNumber(),d=Math.floor(new Xe(s).abs().log(10).toNumber()),f=new Xe(10).pow(d),m=e.div(f).toNumber(),h=l.findIndex(w=>w>=m-1e-10);if(h===-1&&(f=f.mul(10),h=0),h+=n,h>=l.length){var v=Math.floor(h/l.length);h%=l.length,f=f.mul(new Xe(10).pow(v))}var y=(r=l[h])!==null&&r!==void 0?r:1,b=new Xe(y).mul(f);return t?b:new Xe(Math.ceil(b.toNumber()))},Q7=(e,t,n)=>{var r=new Xe(1),l=new Xe(e);if(!l.isint()&&n){var s=Math.abs(e);s<1?(r=new Xe(10).pow(TE(e)-1),l=new Xe(Math.floor(l.div(r).toNumber())).mul(r)):s>1&&(l=new Xe(Math.floor(e)))}else e===0?l=new Xe(Math.floor((t-1)/2)):n||(l=new Xe(Math.floor(e)));for(var d=Math.floor((t-1)/2),f=[],m=0;m4&&arguments[4]!==void 0?arguments[4]:0,d=arguments.length>5&&arguments[5]!==void 0?arguments[5]:_0;if(!Number.isFinite((n-t)/(r-1)))return{step:new Xe(0),tickMin:new Xe(0),tickMax:new Xe(0)};var f=d(new Xe(n).sub(t).div(r-1),l,s),m;t<=0&&n>=0?m=new Xe(0):(m=new Xe(t).add(n).div(2),m=m.sub(new Xe(m).mod(f)));var h=Math.ceil(m.sub(t).div(f).toNumber()),v=Math.ceil(new Xe(n).sub(m).div(f).toNumber()),y=h+v+1;return y>r?zE(t,n,r,l,s+1,d):(y0?v+(r-y):v,h=n>0?h:h+(r-y)),{step:f,tickMin:m.sub(new Xe(h).mul(f)),tickMax:m.add(new Xe(v).mul(f))})},N2=function(t){var n=xc(t,2),r=n[0],l=n[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",m=Math.max(s,2),h=DE([r,l]),v=xc(h,2),y=v[0],b=v[1];if(y===-1/0||b===1/0){var w=b===1/0?[y,...Array(s-1).fill(1/0)]:[...Array(s-1).fill(-1/0),b];return r>l?w.reverse():w}if(y===b)return Q7(y,s,d);var j=f==="snap125"?PE:_0,_=zE(y,b,m,d,0,j),S=_.step,A=_.tickMin,C=_.tickMax,M=ME(A,C.add(new Xe(.1).mul(S)),S);return r>l?M.reverse():M},S2=function(t,n){var r=xc(t,2),l=r[0],s=r[1],d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",m=DE([l,s]),h=xc(m,2),v=h[0],y=h[1];if(v===-1/0||y===1/0)return[l,s];if(v===y)return[v];var b=f==="snap125"?PE:_0,w=Math.max(n,2),j=b(new Xe(y).sub(v).div(w-1),d,0),_=[...ME(new Xe(v),new Xe(y),j),y];return d===!1&&(_=_.map(S=>Math.round(S))),l>s?_.reverse():_},IE=e=>e.rootProps.maxBarSize,J7=e=>e.rootProps.barGap,$E=e=>e.rootProps.barCategoryGap,e9=e=>e.rootProps.barSize,Ic=e=>e.rootProps.stackOffset,RE=e=>e.rootProps.reverseStackOrder,N0=e=>e.options.chartName,S0=e=>e.rootProps.syncId,LE=e=>e.rootProps.syncMethod,A0=e=>e.options.eventEmitter,t9=e=>e.rootProps.baseValue,qt={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Bi={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},Ir={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},om=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function cm(e,t,n){if(n!=="auto")return n;if(e!=null)return Vr(e,t)?"category":"number"}function A2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function ff(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},O0=X([i9,y0],(e,t)=>{var n;if(e!=null)return e;var r=(n=cm(t,"angleAxis",O2.type))!==null&&n!==void 0?n:"category";return ff(ff({},O2),{},{type:r})}),l9=(e,t)=>e.polarAxis.radiusAxis[t],E0=X([l9,y0],(e,t)=>{var n;if(e!=null)return e;var r=(n=cm(t,"radiusAxis",E2.type))!==null&&n!==void 0?n:"category";return ff(ff({},E2),{},{type:r})}),um=e=>e.polarOptions,k0=X([Ca,Ta,Wt],xE),BE=X([um,k0],(e,t)=>{if(e!=null)return xn(e.innerRadius,t,0)}),UE=X([um,k0],(e,t)=>{if(e!=null)return xn(e.outerRadius,t,t*.8)}),s9=e=>{if(e==null)return[0,0];var t=e.startAngle,n=e.endAngle;return[t,n]},HE=X([um],s9);X([O0,HE],om);var qE=X([k0,BE,UE],(e,t,n)=>{if(!(e==null||t==null||n==null))return[t,n]});X([E0,qE],om);var KE=X([Ze,um,BE,UE,Ca,Ta],(e,t,n,r,l,s)=>{if(!(e!=="centric"&&e!=="radial"||t==null||n==null||r==null)){var d=t.cx,f=t.cy,m=t.startAngle,h=t.endAngle;return{cx:xn(d,l,l/2),cy:xn(f,s,s/2),innerRadius:n,outerRadius:r,startAngle:m,endAngle:h,clockWise:!1}}}),St=(e,t)=>t,$c=(e,t,n)=>n;function dm(e){return e==null?void 0:e.id}function YE(e,t,n){var r=t.chartData,l=r===void 0?[]:r,s=n.allowDuplicatedCategory,d=n.dataKey,f=new Map;return e.forEach(m=>{var h,v=(h=m.data)!==null&&h!==void 0?h:l;if(!(v==null||v.length===0)){var y=dm(m);v.forEach((b,w)=>{var j=d==null||s?w:String(rt(b,d,null)),_=rt(b,m.dataKey,0),S;f.has(j)?S=f.get(j):S={},Object.assign(S,{[y]:_}),f.set(j,S)})}}),Array.from(f.values())}function fm(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var mm=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function hm(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function o9(e,t){if(e.length===t.length){for(var n=0;n{var t=Ze(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},Bs=e=>e.tooltip.settings.axisId;function C0(e){if(e!=null){var t=e.ticks,n=e.bandwidth,r=e.range(),l=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:(function(s){function d(){return s.apply(this,arguments)}return d.toString=function(){return s.toString()},d})(()=>l),rangeMin:()=>l[0],rangeMax:()=>l[1],isInRange(s){var d=l[0],f=l[1];return d<=f?s>=d&&s<=f:s>=f&&s<=d},bandwidth:n?()=>n.call(e):void 0,ticks:t?s=>t.call(e,s):void 0,map:(s,d)=>{var f=e(s);if(f!=null){if(e.bandwidth&&d!==null&&d!==void 0&&d.position){var m=e.bandwidth();switch(d.position){case"middle":f+=m/2;break;case"end":f+=m;break}}return f}}}}}var GE=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Br(t)){for(var n,r,l=0;lr)&&(r=s))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t}default:return t}};function fi(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function c9(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function T0(e){let t,n,r;e.length!==2?(t=fi,n=(f,m)=>fi(e(f),m),r=(f,m)=>e(f)-m):(t=e===fi||e===c9?e:u9,n=e,r=e);function l(f,m,h=0,v=f.length){if(h>>1;n(f[y],m)<0?h=y+1:v=y}while(h>>1;n(f[y],m)<=0?h=y+1:v=y}while(hh&&r(f[y-1],m)>-r(f[y],m)?y-1:y}return{left:l,center:d,right:s}}function u9(){return 0}function VE(e){return e===null?NaN:+e}function*d9(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const f9=T0(fi),Rc=f9.right;T0(VE).center;class k2 extends Map{constructor(t,n=p9){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,l]of t)this.set(r,l)}get(t){return super.get(C2(this,t))}has(t){return super.has(C2(this,t))}set(t,n){return super.set(m9(this,t),n)}delete(t){return super.delete(h9(this,t))}}function C2({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function m9({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function h9({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function p9(e){return e!==null&&typeof e=="object"?e.valueOf():e}function v9(e=fi){if(e===fi)return FE;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function FE(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const y9=Math.sqrt(50),g9=Math.sqrt(10),x9=Math.sqrt(2);function mf(e,t,n){const r=(t-e)/Math.max(0,n),l=Math.floor(Math.log10(r)),s=r/Math.pow(10,l),d=s>=y9?10:s>=g9?5:s>=x9?2:1;let f,m,h;return l<0?(h=Math.pow(10,-l)/d,f=Math.round(e*h),m=Math.round(t*h),f/ht&&--m,h=-h):(h=Math.pow(10,l)*d,f=Math.round(e/h),m=Math.round(t/h),f*ht&&--m),m0))return[];if(e===t)return[e];const r=t=l))return[];const f=s-l+1,m=new Array(f);if(r)if(d<0)for(let h=0;h=r)&&(n=r);return n}function M2(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function XE(e,t,n=0,r=1/0,l){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(l=l===void 0?FE:v9(l);r>n;){if(r-n>600){const m=r-n+1,h=t-n+1,v=Math.log(m),y=.5*Math.exp(2*v/3),b=.5*Math.sqrt(v*y*(m-y)/m)*(h-m/2<0?-1:1),w=Math.max(n,Math.floor(t-h*y/m+b)),j=Math.min(r,Math.floor(t+(m-h)*y/m+b));XE(e,t,w,j,l)}const s=e[t];let d=n,f=r;for(Go(e,n,t),l(e[r],s)>0&&Go(e,n,r);d0;)--f}l(e[n],s)===0?Go(e,n,f):(++f,Go(e,f,r)),f<=t&&(n=f+1),t<=f&&(r=f-1)}return e}function Go(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function b9(e,t,n){if(e=Float64Array.from(d9(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return M2(e);if(t>=1)return T2(e);var r,l=(r-1)*t,s=Math.floor(l),d=T2(XE(e,s).subarray(0,s+1)),f=M2(e.subarray(s+1));return d+(f-d)*(l-s)}}function w9(e,t,n=VE){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,l=(r-1)*t,s=Math.floor(l),d=+n(e[s],s,e),f=+n(e[s+1],s+1,e);return d+(f-d)*(l-s)}}function j9(e,t,n){e=+e,t=+t,n=(l=arguments.length)<2?(t=e,e=0,1):l<3?1:+n;for(var r=-1,l=Math.max(0,Math.ceil((t-e)/n))|0,s=new Array(l);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?bd(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?bd(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=S9.exec(e))?new Pn(t[1],t[2],t[3],1):(t=A9.exec(e))?new Pn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=O9.exec(e))?bd(t[1],t[2],t[3],t[4]):(t=E9.exec(e))?bd(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=k9.exec(e))?L2(t[1],t[2]/100,t[3]/100,1):(t=C9.exec(e))?L2(t[1],t[2]/100,t[3]/100,t[4]):D2.hasOwnProperty(e)?I2(D2[e]):e==="transparent"?new Pn(NaN,NaN,NaN,0):null}function I2(e){return new Pn(e>>16&255,e>>8&255,e&255,1)}function bd(e,t,n,r){return r<=0&&(e=t=n=NaN),new Pn(e,t,n,r)}function D9(e){return e instanceof Lc||(e=jc(e)),e?(e=e.rgb(),new Pn(e.r,e.g,e.b,e.opacity)):new Pn}function Ny(e,t,n,r){return arguments.length===1?D9(e):new Pn(e,t,n,r??1)}function Pn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}P0(Pn,Ny,ZE(Lc,{brighter(e){return e=e==null?hf:Math.pow(hf,e),new Pn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?bc:Math.pow(bc,e),new Pn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Pn(tl(this.r),tl(this.g),tl(this.b),pf(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:$2,formatHex:$2,formatHex8:P9,formatRgb:R2,toString:R2}));function $2(){return`#${Wi(this.r)}${Wi(this.g)}${Wi(this.b)}`}function P9(){return`#${Wi(this.r)}${Wi(this.g)}${Wi(this.b)}${Wi((isNaN(this.opacity)?1:this.opacity)*255)}`}function R2(){const e=pf(this.opacity);return`${e===1?"rgb(":"rgba("}${tl(this.r)}, ${tl(this.g)}, ${tl(this.b)}${e===1?")":`, ${e})`}`}function pf(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function tl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Wi(e){return e=tl(e),(e<16?"0":"")+e.toString(16)}function L2(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Sr(e,t,n,r)}function QE(e){if(e instanceof Sr)return new Sr(e.h,e.s,e.l,e.opacity);if(e instanceof Lc||(e=jc(e)),!e)return new Sr;if(e instanceof Sr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,l=Math.min(t,n,r),s=Math.max(t,n,r),d=NaN,f=s-l,m=(s+l)/2;return f?(t===s?d=(n-r)/f+(n0&&m<1?0:d,new Sr(d,f,m,e.opacity)}function z9(e,t,n,r){return arguments.length===1?QE(e):new Sr(e,t,n,r??1)}function Sr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}P0(Sr,z9,ZE(Lc,{brighter(e){return e=e==null?hf:Math.pow(hf,e),new Sr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?bc:Math.pow(bc,e),new Sr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,l=2*n-r;return new Pn(xv(e>=240?e-240:e+120,l,r),xv(e,l,r),xv(e<120?e+240:e-120,l,r),this.opacity)},clamp(){return new Sr(B2(this.h),wd(this.s),wd(this.l),pf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=pf(this.opacity);return`${e===1?"hsl(":"hsla("}${B2(this.h)}, ${wd(this.s)*100}%, ${wd(this.l)*100}%${e===1?")":`, ${e})`}`}}));function B2(e){return e=(e||0)%360,e<0?e+360:e}function wd(e){return Math.max(0,Math.min(1,e||0))}function xv(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const z0=e=>()=>e;function I9(e,t){return function(n){return e+n*t}}function $9(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function R9(e){return(e=+e)==1?JE:function(t,n){return n-t?$9(t,n,e):z0(isNaN(t)?n:t)}}function JE(e,t){var n=t-e;return n?I9(e,n):z0(isNaN(e)?t:e)}const U2=(function e(t){var n=R9(t);function r(l,s){var d=n((l=Ny(l)).r,(s=Ny(s)).r),f=n(l.g,s.g),m=n(l.b,s.b),h=JE(l.opacity,s.opacity);return function(v){return l.r=d(v),l.g=f(v),l.b=m(v),l.opacity=h(v),l+""}}return r.gamma=e,r})(1);function L9(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),l;return function(s){for(l=0;ln&&(s=t.slice(n,s),f[d]?f[d]+=s:f[++d]=s),(r=r[0])===(l=l[0])?f[d]?f[d]+=l:f[++d]=l:(f[++d]=null,m.push({i:d,x:vf(r,l)})),n=bv.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function W9(e,t,n){var r=e[0],l=e[1],s=t[0],d=t[1];return l2?Z9:W9,m=h=null,y}function y(b){return b==null||isNaN(b=+b)?s:(m||(m=f(e.map(r),t,n)))(r(d(b)))}return y.invert=function(b){return d(l((h||(h=f(t,e.map(r),vf)))(b)))},y.domain=function(b){return arguments.length?(e=Array.from(b,yf),v()):e.slice()},y.range=function(b){return arguments.length?(t=Array.from(b),v()):t.slice()},y.rangeRound=function(b){return t=Array.from(b),n=I0,v()},y.clamp=function(b){return arguments.length?(d=b?!0:_n,v()):d!==_n},y.interpolate=function(b){return arguments.length?(n=b,v()):n},y.unknown=function(b){return arguments.length?(s=b,y):s},function(b,w){return r=b,l=w,v()}}function $0(){return pm()(_n,_n)}function Q9(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function gf(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function ks(e){return e=gf(Math.abs(e)),e?e[1]:NaN}function J9(e,t){return function(n,r){for(var l=n.length,s=[],d=0,f=e[0],m=0;l>0&&f>0&&(m+f+1>r&&(f=Math.max(1,r-m)),s.push(n.substring(l-=f,l+f)),!((m+=f+1)>r));)f=e[d=(d+1)%e.length];return s.reverse().join(t)}}function eL(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var tL=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function _c(e){if(!(t=tL.exec(e)))throw new Error("invalid format: "+e);var t;return new R0({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}_c.prototype=R0.prototype;function R0(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}R0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function nL(e){e:for(var t=e.length,n=1,r=-1,l;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(l+1):e}var xf;function rL(e,t){var n=gf(e,t);if(!n)return xf=void 0,e.toPrecision(t);var r=n[0],l=n[1],s=l-(xf=Math.max(-8,Math.min(8,Math.floor(l/3)))*3)+1,d=r.length;return s===d?r:s>d?r+new Array(s-d+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+gf(e,Math.max(0,t+s-1))[0]}function q2(e,t){var n=gf(e,t);if(!n)return e+"";var r=n[0],l=n[1];return l<0?"0."+new Array(-l).join("0")+r:r.length>l+1?r.slice(0,l+1)+"."+r.slice(l+1):r+new Array(l-r.length+2).join("0")}const K2={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Q9,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>q2(e*100,t),r:q2,s:rL,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Y2(e){return e}var G2=Array.prototype.map,V2=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function aL(e){var t=e.grouping===void 0||e.thousands===void 0?Y2:J9(G2.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",l=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?Y2:eL(G2.call(e.numerals,String)),d=e.percent===void 0?"%":e.percent+"",f=e.minus===void 0?"−":e.minus+"",m=e.nan===void 0?"NaN":e.nan+"";function h(y,b){y=_c(y);var w=y.fill,j=y.align,_=y.sign,S=y.symbol,A=y.zero,C=y.width,M=y.comma,k=y.precision,D=y.trim,E=y.type;E==="n"?(M=!0,E="g"):K2[E]||(k===void 0&&(k=12),D=!0,E="g"),(A||w==="0"&&j==="=")&&(A=!0,w="0",j="=");var $=(b&&b.prefix!==void 0?b.prefix:"")+(S==="$"?n:S==="#"&&/[boxX]/.test(E)?"0"+E.toLowerCase():""),U=(S==="$"?r:/[%p]/.test(E)?d:"")+(b&&b.suffix!==void 0?b.suffix:""),K=K2[E],T=/[defgprs%]/.test(E);k=k===void 0?6:/[gprs]/.test(E)?Math.max(1,Math.min(21,k)):Math.max(0,Math.min(20,k));function re(Z){var pe=$,fe=U,ce,R,z;if(E==="c")fe=K(Z)+fe,Z="";else{Z=+Z;var G=Z<0||1/Z<0;if(Z=isNaN(Z)?m:K(Math.abs(Z),k),D&&(Z=nL(Z)),G&&+Z==0&&_!=="+"&&(G=!1),pe=(G?_==="("?_:f:_==="-"||_==="("?"":_)+pe,fe=(E==="s"&&!isNaN(Z)&&xf!==void 0?V2[8+xf/3]:"")+fe+(G&&_==="("?")":""),T){for(ce=-1,R=Z.length;++cez||z>57){fe=(z===46?l+Z.slice(ce+1):Z.slice(ce))+fe,Z=Z.slice(0,ce);break}}}M&&!A&&(Z=t(Z,1/0));var se=pe.length+Z.length+fe.length,ue=se>1)+pe+Z+fe+ue.slice(se);break;default:Z=ue+pe+Z+fe;break}return s(Z)}return re.toString=function(){return y+""},re}function v(y,b){var w=Math.max(-8,Math.min(8,Math.floor(ks(b)/3)))*3,j=Math.pow(10,-w),_=h((y=_c(y),y.type="f",y),{suffix:V2[8+w/3]});return function(S){return _(j*S)}}return{format:h,formatPrefix:v}}var jd,L0,ek;iL({thousands:",",grouping:[3],currency:["$",""]});function iL(e){return jd=aL(e),L0=jd.format,ek=jd.formatPrefix,jd}function lL(e){return Math.max(0,-ks(Math.abs(e)))}function sL(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ks(t)/3)))*3-ks(Math.abs(e)))}function oL(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ks(t)-ks(e))+1}function tk(e,t,n,r){var l=jy(e,t,n),s;switch(r=_c(r??",f"),r.type){case"s":{var d=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(s=sL(l,d))&&(r.precision=s),ek(r,d)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=oL(l,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=lL(l))&&(r.precision=s-(r.type==="%")*2);break}}return L0(r)}function gi(e){var t=e.domain;return e.ticks=function(n){var r=t();return by(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var l=t();return tk(l[0],l[l.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),l=0,s=r.length-1,d=r[l],f=r[s],m,h,v=10;for(f0;){if(h=wy(d,f,n),h===m)return r[l]=d,r[s]=f,t(r);if(h>0)d=Math.floor(d/h)*h,f=Math.ceil(f/h)*h;else if(h<0)d=Math.ceil(d*h)/h,f=Math.floor(f*h)/h;else break;m=h}return e},e}function nk(){var e=$0();return e.copy=function(){return Bc(e,nk())},yr.apply(e,arguments),gi(e)}function rk(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,yf),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return rk(e).unknown(t)},e=arguments.length?Array.from(e,yf):[0,1],gi(n)}function ak(e,t){e=e.slice();var n=0,r=e.length-1,l=e[n],s=e[r],d;return sMath.pow(e,t)}function mL(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function W2(e){return(t,n)=>-e(-t,n)}function B0(e){const t=e(F2,X2),n=t.domain;let r=10,l,s;function d(){return l=mL(r),s=fL(r),n()[0]<0?(l=W2(l),s=W2(s),e(cL,uL)):e(F2,X2),t}return t.base=function(f){return arguments.length?(r=+f,d()):r},t.domain=function(f){return arguments.length?(n(f),d()):n()},t.ticks=f=>{const m=n();let h=m[0],v=m[m.length-1];const y=v0){for(;b<=w;++b)for(j=1;jv)break;A.push(_)}}else for(;b<=w;++b)for(j=r-1;j>=1;--j)if(_=b>0?j/s(-b):j*s(b),!(_v)break;A.push(_)}A.length*2{if(f==null&&(f=10),m==null&&(m=r===10?"s":","),typeof m!="function"&&(!(r%1)&&(m=_c(m)).precision==null&&(m.trim=!0),m=L0(m)),f===1/0)return m;const h=Math.max(1,r*f/t.ticks().length);return v=>{let y=v/s(Math.round(l(v)));return y*rn(ak(n(),{floor:f=>s(Math.floor(l(f))),ceil:f=>s(Math.ceil(l(f)))})),t}function ik(){const e=B0(pm()).domain([1,10]);return e.copy=()=>Bc(e,ik()).base(e.base()),yr.apply(e,arguments),e}function Z2(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Q2(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function U0(e){var t=1,n=e(Z2(t),Q2(t));return n.constant=function(r){return arguments.length?e(Z2(t=+r),Q2(t)):t},gi(n)}function lk(){var e=U0(pm());return e.copy=function(){return Bc(e,lk()).constant(e.constant())},yr.apply(e,arguments)}function J2(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function hL(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function pL(e){return e<0?-e*e:e*e}function H0(e){var t=e(_n,_n),n=1;function r(){return n===1?e(_n,_n):n===.5?e(hL,pL):e(J2(n),J2(1/n))}return t.exponent=function(l){return arguments.length?(n=+l,r()):n},gi(t)}function q0(){var e=H0(pm());return e.copy=function(){return Bc(e,q0()).exponent(e.exponent())},yr.apply(e,arguments),e}function vL(){return q0.apply(null,arguments).exponent(.5)}function eN(e){return Math.sign(e)*e*e}function yL(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function sk(){var e=$0(),t=[0,1],n=!1,r;function l(s){var d=yL(e(s));return isNaN(d)?r:n?Math.round(d):d}return l.invert=function(s){return e.invert(eN(s))},l.domain=function(s){return arguments.length?(e.domain(s),l):e.domain()},l.range=function(s){return arguments.length?(e.range((t=Array.from(s,yf)).map(eN)),l):t.slice()},l.rangeRound=function(s){return l.range(s).round(!0)},l.round=function(s){return arguments.length?(n=!!s,l):n},l.clamp=function(s){return arguments.length?(e.clamp(s),l):e.clamp()},l.unknown=function(s){return arguments.length?(r=s,l):r},l.copy=function(){return sk(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},yr.apply(l,arguments),gi(l)}function ok(){var e=[],t=[],n=[],r;function l(){var d=0,f=Math.max(1,t.length);for(n=new Array(f-1);++d0?n[f-1]:e[0],f=n?[r[n-1],t]:[r[h-1],r[h]]},d.unknown=function(m){return arguments.length&&(s=m),d},d.thresholds=function(){return r.slice()},d.copy=function(){return ck().domain([e,t]).range(l).unknown(s)},yr.apply(gi(d),arguments)}function uk(){var e=[.5],t=[0,1],n,r=1;function l(s){return s!=null&&s<=s?t[Rc(e,s,0,r)]:n}return l.domain=function(s){return arguments.length?(e=Array.from(s),r=Math.min(e.length,t.length-1),l):e.slice()},l.range=function(s){return arguments.length?(t=Array.from(s),r=Math.min(e.length,t.length-1),l):t.slice()},l.invertExtent=function(s){var d=t.indexOf(s);return[e[d-1],e[d]]},l.unknown=function(s){return arguments.length?(n=s,l):n},l.copy=function(){return uk().domain(e).range(t).unknown(n)},yr.apply(l,arguments)}const wv=new Date,jv=new Date;function Zt(e,t,n,r){function l(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return l.floor=s=>(e(s=new Date(+s)),s),l.ceil=s=>(e(s=new Date(s-1)),t(s,1),e(s),s),l.round=s=>{const d=l(s),f=l.ceil(s);return s-d(t(s=new Date(+s),d==null?1:Math.floor(d)),s),l.range=(s,d,f)=>{const m=[];if(s=l.ceil(s),f=f==null?1:Math.floor(f),!(s0))return m;let h;do m.push(h=new Date(+s)),t(s,f),e(s);while(hZt(d=>{if(d>=d)for(;e(d),!s(d);)d.setTime(d-1)},(d,f)=>{if(d>=d)if(f<0)for(;++f<=0;)for(;t(d,-1),!s(d););else for(;--f>=0;)for(;t(d,1),!s(d););}),n&&(l.count=(s,d)=>(wv.setTime(+s),jv.setTime(+d),e(wv),e(jv),Math.floor(n(wv,jv))),l.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?l.filter(r?d=>r(d)%s===0:d=>l.count(0,d)%s===0):l)),l}const bf=Zt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);bf.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Zt(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):bf);bf.range;const ba=1e3,hr=ba*60,wa=hr*60,Oa=wa*24,K0=Oa*7,tN=Oa*30,_v=Oa*365,Zi=Zt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*ba)},(e,t)=>(t-e)/ba,e=>e.getUTCSeconds());Zi.range;const Y0=Zt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ba)},(e,t)=>{e.setTime(+e+t*hr)},(e,t)=>(t-e)/hr,e=>e.getMinutes());Y0.range;const G0=Zt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*hr)},(e,t)=>(t-e)/hr,e=>e.getUTCMinutes());G0.range;const V0=Zt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ba-e.getMinutes()*hr)},(e,t)=>{e.setTime(+e+t*wa)},(e,t)=>(t-e)/wa,e=>e.getHours());V0.range;const F0=Zt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*wa)},(e,t)=>(t-e)/wa,e=>e.getUTCHours());F0.range;const Uc=Zt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*hr)/Oa,e=>e.getDate()-1);Uc.range;const vm=Zt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Oa,e=>e.getUTCDate()-1);vm.range;const dk=Zt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Oa,e=>Math.floor(e/Oa));dk.range;function vl(e){return Zt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*hr)/K0)}const ym=vl(0),wf=vl(1),gL=vl(2),xL=vl(3),Cs=vl(4),bL=vl(5),wL=vl(6);ym.range;wf.range;gL.range;xL.range;Cs.range;bL.range;wL.range;function yl(e){return Zt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/K0)}const gm=yl(0),jf=yl(1),jL=yl(2),_L=yl(3),Ts=yl(4),NL=yl(5),SL=yl(6);gm.range;jf.range;jL.range;_L.range;Ts.range;NL.range;SL.range;const X0=Zt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());X0.range;const W0=Zt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());W0.range;const Ea=Zt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Ea.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Zt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Ea.range;const ka=Zt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ka.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Zt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});ka.range;function fk(e,t,n,r,l,s){const d=[[Zi,1,ba],[Zi,5,5*ba],[Zi,15,15*ba],[Zi,30,30*ba],[s,1,hr],[s,5,5*hr],[s,15,15*hr],[s,30,30*hr],[l,1,wa],[l,3,3*wa],[l,6,6*wa],[l,12,12*wa],[r,1,Oa],[r,2,2*Oa],[n,1,K0],[t,1,tN],[t,3,3*tN],[e,1,_v]];function f(h,v,y){const b=vS).right(d,b);if(w===d.length)return e.every(jy(h/_v,v/_v,y));if(w===0)return bf.every(Math.max(jy(h,v,y),1));const[j,_]=d[b/d[w-1][2]53)return null;"w"in ae||(ae.w=1),"Z"in ae?(Ce=Sv(Vo(ae.y,0,1)),Y=Ce.getUTCDay(),Ce=Y>4||Y===0?jf.ceil(Ce):jf(Ce),Ce=vm.offset(Ce,(ae.V-1)*7),ae.y=Ce.getUTCFullYear(),ae.m=Ce.getUTCMonth(),ae.d=Ce.getUTCDate()+(ae.w+6)%7):(Ce=Nv(Vo(ae.y,0,1)),Y=Ce.getDay(),Ce=Y>4||Y===0?wf.ceil(Ce):wf(Ce),Ce=Uc.offset(Ce,(ae.V-1)*7),ae.y=Ce.getFullYear(),ae.m=Ce.getMonth(),ae.d=Ce.getDate()+(ae.w+6)%7)}else("W"in ae||"U"in ae)&&("w"in ae||(ae.w="u"in ae?ae.u%7:"W"in ae?1:0),Y="Z"in ae?Sv(Vo(ae.y,0,1)).getUTCDay():Nv(Vo(ae.y,0,1)).getDay(),ae.m=0,ae.d="W"in ae?(ae.w+6)%7+ae.W*7-(Y+5)%7:ae.w+ae.U*7-(Y+6)%7);return"Z"in ae?(ae.H+=ae.Z/100|0,ae.M+=ae.Z%100,Sv(ae)):Nv(ae)}}function U(V,ye,xe,ae){for(var Le=0,Ce=ye.length,Y=xe.length,ge,Pe;Le=Y)return-1;if(ge=ye.charCodeAt(Le++),ge===37){if(ge=ye.charAt(Le++),Pe=D[ge in nN?ye.charAt(Le++):ge],!Pe||(ae=Pe(V,xe,ae))<0)return-1}else if(ge!=xe.charCodeAt(ae++))return-1}return ae}function K(V,ye,xe){var ae=h.exec(ye.slice(xe));return ae?(V.p=v.get(ae[0].toLowerCase()),xe+ae[0].length):-1}function T(V,ye,xe){var ae=w.exec(ye.slice(xe));return ae?(V.w=j.get(ae[0].toLowerCase()),xe+ae[0].length):-1}function re(V,ye,xe){var ae=y.exec(ye.slice(xe));return ae?(V.w=b.get(ae[0].toLowerCase()),xe+ae[0].length):-1}function Z(V,ye,xe){var ae=A.exec(ye.slice(xe));return ae?(V.m=C.get(ae[0].toLowerCase()),xe+ae[0].length):-1}function pe(V,ye,xe){var ae=_.exec(ye.slice(xe));return ae?(V.m=S.get(ae[0].toLowerCase()),xe+ae[0].length):-1}function fe(V,ye,xe){return U(V,t,ye,xe)}function ce(V,ye,xe){return U(V,n,ye,xe)}function R(V,ye,xe){return U(V,r,ye,xe)}function z(V){return d[V.getDay()]}function G(V){return s[V.getDay()]}function se(V){return m[V.getMonth()]}function ue(V){return f[V.getMonth()]}function P(V){return l[+(V.getHours()>=12)]}function Q(V){return 1+~~(V.getMonth()/3)}function ne(V){return d[V.getUTCDay()]}function I(V){return s[V.getUTCDay()]}function he(V){return m[V.getUTCMonth()]}function be(V){return f[V.getUTCMonth()]}function _e(V){return l[+(V.getUTCHours()>=12)]}function W(V){return 1+~~(V.getUTCMonth()/3)}return{format:function(V){var ye=E(V+="",M);return ye.toString=function(){return V},ye},parse:function(V){var ye=$(V+="",!1);return ye.toString=function(){return V},ye},utcFormat:function(V){var ye=E(V+="",k);return ye.toString=function(){return V},ye},utcParse:function(V){var ye=$(V+="",!0);return ye.toString=function(){return V},ye}}}var nN={"-":"",_:" ",0:"0"},sn=/^\s*\d+/,TL=/^%/,ML=/[\\^$*+?|[\]().{}]/g;function et(e,t,n){var r=e<0?"-":"",l=(r?-e:e)+"",s=l.length;return r+(s[t.toLowerCase(),n]))}function PL(e,t,n){var r=sn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function zL(e,t,n){var r=sn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function IL(e,t,n){var r=sn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function $L(e,t,n){var r=sn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function RL(e,t,n){var r=sn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function rN(e,t,n){var r=sn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function aN(e,t,n){var r=sn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function LL(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function BL(e,t,n){var r=sn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function UL(e,t,n){var r=sn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function iN(e,t,n){var r=sn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function HL(e,t,n){var r=sn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function lN(e,t,n){var r=sn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function qL(e,t,n){var r=sn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function KL(e,t,n){var r=sn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function YL(e,t,n){var r=sn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function GL(e,t,n){var r=sn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function VL(e,t,n){var r=TL.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function FL(e,t,n){var r=sn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function XL(e,t,n){var r=sn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function sN(e,t){return et(e.getDate(),t,2)}function WL(e,t){return et(e.getHours(),t,2)}function ZL(e,t){return et(e.getHours()%12||12,t,2)}function QL(e,t){return et(1+Uc.count(Ea(e),e),t,3)}function mk(e,t){return et(e.getMilliseconds(),t,3)}function JL(e,t){return mk(e,t)+"000"}function eB(e,t){return et(e.getMonth()+1,t,2)}function tB(e,t){return et(e.getMinutes(),t,2)}function nB(e,t){return et(e.getSeconds(),t,2)}function rB(e){var t=e.getDay();return t===0?7:t}function aB(e,t){return et(ym.count(Ea(e)-1,e),t,2)}function hk(e){var t=e.getDay();return t>=4||t===0?Cs(e):Cs.ceil(e)}function iB(e,t){return e=hk(e),et(Cs.count(Ea(e),e)+(Ea(e).getDay()===4),t,2)}function lB(e){return e.getDay()}function sB(e,t){return et(wf.count(Ea(e)-1,e),t,2)}function oB(e,t){return et(e.getFullYear()%100,t,2)}function cB(e,t){return e=hk(e),et(e.getFullYear()%100,t,2)}function uB(e,t){return et(e.getFullYear()%1e4,t,4)}function dB(e,t){var n=e.getDay();return e=n>=4||n===0?Cs(e):Cs.ceil(e),et(e.getFullYear()%1e4,t,4)}function fB(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+et(t/60|0,"0",2)+et(t%60,"0",2)}function oN(e,t){return et(e.getUTCDate(),t,2)}function mB(e,t){return et(e.getUTCHours(),t,2)}function hB(e,t){return et(e.getUTCHours()%12||12,t,2)}function pB(e,t){return et(1+vm.count(ka(e),e),t,3)}function pk(e,t){return et(e.getUTCMilliseconds(),t,3)}function vB(e,t){return pk(e,t)+"000"}function yB(e,t){return et(e.getUTCMonth()+1,t,2)}function gB(e,t){return et(e.getUTCMinutes(),t,2)}function xB(e,t){return et(e.getUTCSeconds(),t,2)}function bB(e){var t=e.getUTCDay();return t===0?7:t}function wB(e,t){return et(gm.count(ka(e)-1,e),t,2)}function vk(e){var t=e.getUTCDay();return t>=4||t===0?Ts(e):Ts.ceil(e)}function jB(e,t){return e=vk(e),et(Ts.count(ka(e),e)+(ka(e).getUTCDay()===4),t,2)}function _B(e){return e.getUTCDay()}function NB(e,t){return et(jf.count(ka(e)-1,e),t,2)}function SB(e,t){return et(e.getUTCFullYear()%100,t,2)}function AB(e,t){return e=vk(e),et(e.getUTCFullYear()%100,t,2)}function OB(e,t){return et(e.getUTCFullYear()%1e4,t,4)}function EB(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Ts(e):Ts.ceil(e),et(e.getUTCFullYear()%1e4,t,4)}function kB(){return"+0000"}function cN(){return"%"}function uN(e){return+e}function dN(e){return Math.floor(+e/1e3)}var ss,yk,gk;CB({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function CB(e){return ss=CL(e),yk=ss.format,ss.parse,gk=ss.utcFormat,ss.utcParse,ss}function TB(e){return new Date(e)}function MB(e){return e instanceof Date?+e:+new Date(+e)}function Z0(e,t,n,r,l,s,d,f,m,h){var v=$0(),y=v.invert,b=v.domain,w=h(".%L"),j=h(":%S"),_=h("%I:%M"),S=h("%I %p"),A=h("%a %d"),C=h("%b %d"),M=h("%B"),k=h("%Y");function D(E){return(m(E)t(l/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(l,s)=>b9(e,s/r))},n.copy=function(){return jk(t).domain(e)},Ma.apply(n,arguments)}function bm(){var e=0,t=.5,n=1,r=1,l,s,d,f,m,h=_n,v,y=!1,b;function w(_){return isNaN(_=+_)?b:(_=.5+((_=+v(_))-s)*(r*_{if(e!=null){var r=e.scale,l=e.type;if(r==="auto")return l==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!t)?"point":l==="category"?"band":"linear";if(typeof r=="string")return LB(r)?r:"point"}};function BB(e,t){for(var n=0,r=e.length,l=e[0]t)?n=s+1:r=s}return n}function Ek(e,t){if(e){var n=t??e.domain(),r=n.map(s=>{var d;return(d=e(s))!==null&&d!==void 0?d:0}),l=e.range();if(!(n.length===0||l.length<2))return s=>{var d,f,m=BB(r,s);if(m<=0)return n[0];if(m>=n.length)return n[n.length-1];var h=(d=r[m-1])!==null&&d!==void 0?d:0,v=(f=r[m])!==null&&f!==void 0?f:0;return Math.abs(s-h)<=Math.abs(s-v)?n[m-1]:n[m]}}}function UB(e){if(e!=null)return"invert"in e&&typeof e.invert=="function"?e.invert.bind(e):Ek(e,void 0)}function mN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function _f(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);ne.cartesianAxis.xAxis[t],Da=(e,t)=>{var n=Ck(e,t);return n??Gt},Vt={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Oy,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:Cc},Tk=(e,t)=>e.cartesianAxis.yAxis[t],Pa=(e,t)=>{var n=Tk(e,t);return n??Vt},XB={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},tg=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return n??XB},Mt=(e,t,n)=>{switch(t){case"xAxis":return Da(e,n);case"yAxis":return Pa(e,n);case"zAxis":return tg(e,n);case"angleAxis":return O0(e,n);case"radiusAxis":return E0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},WB=(e,t,n)=>{switch(t){case"xAxis":return Da(e,n);case"yAxis":return Pa(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},Hs=(e,t,n)=>{switch(t){case"xAxis":return Da(e,n);case"yAxis":return Pa(e,n);case"angleAxis":return O0(e,n);case"radiusAxis":return E0(e,n);default:throw new Error("Unexpected axis type: ".concat(t))}},Mk=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function ng(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var wm=e=>e.graphicalItems.cartesianItems,ZB=X([St,$c],ng),rg=(e,t,n)=>e.filter(n).filter(r=>(t==null?void 0:t.includeHidden)===!0?!0:!r.hide),qs=X([wm,Mt,ZB],rg,{memoizeOptions:{resultEqualityCheck:hm}}),Dk=X([qs],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(fm)),Pk=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),QB=X([qs],Pk),ag=e=>e.map(t=>t.data).filter(Boolean).flat(1),JB=X([qs],e=>e.some(t=>!t.data)),zk=X([qs],ag,{memoizeOptions:{resultEqualityCheck:hm}}),ig=(e,t)=>{var n=t.chartData,r=n===void 0?[]:n,l=t.dataStartIndex,s=t.dataEndIndex;return e.length>0?e:r.slice(l,s+1)},lg=X([zk,sm],ig),Ik=(e,t,n)=>(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:rt(r,t.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>e.map(l=>({value:rt(l,r)}))):e.map(r=>({value:r})),$k=(e,t,n,r,l,s)=>{var d=r.chartData,f=d===void 0?[]:d,m=r.dataStartIndex,h=r.dataEndIndex,v=Ik(e,t,n);if(l&&(t==null?void 0:t.dataKey)!=null&&s.length>0){var y=f.slice(m,h+1),b=y.map(w=>({value:rt(w,t.dataKey)})).filter(w=>w.value!=null);return[...b,...v]}return v},Hc=X([lg,Mt,qs,sm,JB,zk],$k);function _s(e){if(qr(e)||e instanceof Date){var t=Number(e);if(He(t))return t}}function pN(e){if(Array.isArray(e)){var t=[_s(e[0]),_s(e[1])];return Br(t)?t:void 0}var n=_s(e);if(n!=null)return[n,n]}function Gr(e){return e.map(_s).filter(Dn)}function eU(e,t){var n=_s(e),r=_s(t);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var tU=X([Hc],e=>e==null?void 0:e.map(t=>t.value).sort(eU));function Rk(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function nU(e,t,n){if(!n)return[];if(!n.length)return[];var r;if(typeof t=="number"&&!Ar(t))r=t;else if(Array.isArray(t)){var l=Gr(t);l.length>0&&(r=Math.max(...l))}return r==null?[]:Gr(n.flatMap(s=>{var d=rt(e,s.dataKey),f,m;if(Array.isArray(d)){var h=kk(d,2);f=h[0],m=h[1]}else f=m=d;if(!(!He(f)||!He(m)))return[r-f,r+m]}))}var Qt=e=>{var t=ln(e),n=Bs(e);return Hs(e,t,n)},Ms=X([Qt],e=>e==null?void 0:e.dataKey),rU=X([Dk,sm,Qt],YE),Lk=(e,t,n,r)=>{var l={},s=t.reduce((d,f)=>{if(f.stackId==null)return d;var m=d[f.stackId];return m==null&&(m=[]),m.push(f),d[f.stackId]=m,d},l);return Object.fromEntries(Object.entries(s).map(d=>{var f=kk(d,2),m=f[0],h=f[1],v=r?[...h].reverse():h,y=v.map(dm);return[m,{stackedData:cI(e,y,n),graphicalItems:v}]}))},Nf=X([rU,Dk,Ic,RE],Lk),Bk=(e,t,n,r)=>{var l=t.dataStartIndex,s=t.dataEndIndex;if(r==null&&n!=="zAxis")return mI(e,l,s)},aU=X([Mt],e=>e.allowDataOverflow),sg=e=>{var t;if(e==null||!("domain"in e))return Oy;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var n=Gr(e.ticks);return[Math.min(...n),Math.max(...n)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:Oy},og=X([Mt],sg),cg=X([og,aU],SE),iU=X([Nf,kr,St,cg],Bk,{memoizeOptions:{resultEqualityCheck:mm}}),jm=e=>e.errorBars,lU=(e,t,n)=>e.flatMap(r=>t[r.id]).filter(Boolean).filter(r=>Rk(n,r)),Sf=function(){for(var t=arguments.length,n=new Array(t),r=0;r5&&arguments[5]!==void 0?arguments[5]:[],f,m;if(r.length>0&&r.forEach(h=>{var v,y=h.data!=null?[...h.data]:d,b=(v=l[h.id])===null||v===void 0?void 0:v.filter(w=>Rk(s,w));y.forEach(w=>{var j,_=rt(w,(j=n.dataKey)!==null&&j!==void 0?j:h.dataKey),S=nU(w,_,b);if(S.length>=2){var A=Math.min(...S),C=Math.max(...S);(f==null||Am)&&(m=C)}var M=pN(_);M!=null&&(f=f==null?M[0]:Math.min(f,M[0]),m=m==null?M[1]:Math.max(m,M[1]))})}),(n==null?void 0:n.dataKey)!=null&&r.length===0&&t.forEach(h=>{var v=pN(rt(h,n.dataKey));v!=null&&(f=f==null?v[0]:Math.min(f,v[0]),m=m==null?v[1]:Math.max(m,v[1]))}),He(f)&&He(m))return[f,m]},sU=X([lg,Mt,QB,jm,St,$7],ug,{memoizeOptions:{resultEqualityCheck:mm}});function oU(e){var t=e.value;if(qr(t)||t instanceof Date)return t}var cU=(e,t,n)=>{var r=e.map(oU).filter(l=>l!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&YA(r))?_E(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},Uk=e=>e.referenceElements.dots,Ks=(e,t,n)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>t==="xAxis"?r.xAxisId===n:r.yAxisId===n),uU=X([Uk,St,$c],Ks),Hk=e=>e.referenceElements.areas,dU=X([Hk,St,$c],Ks),qk=e=>e.referenceElements.lines,fU=X([qk,St,$c],Ks),Kk=(e,t)=>{if(e!=null){var n=Gr(e.map(r=>t==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},mU=X(uU,St,Kk),Yk=(e,t)=>{if(e!=null){var n=Gr(e.flatMap(r=>[t==="xAxis"?r.x1:r.y1,t==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},hU=X([dU,St],Yk);function pU(e){var t;if(e.x!=null)return Gr([e.x]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.x);return n==null||n.length===0?[]:Gr(n)}function vU(e){var t;if(e.y!=null)return Gr([e.y]);var n=(t=e.segment)===null||t===void 0?void 0:t.map(r=>r.y);return n==null||n.length===0?[]:Gr(n)}var Gk=(e,t)=>{if(e!=null){var n=e.flatMap(r=>t==="xAxis"?pU(r):vU(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},yU=X([fU,St],Gk),gU=X(mU,yU,hU,(e,t,n)=>Sf(e,n,t)),dg=(e,t,n,r,l,s,d,f)=>{if(n!=null)return n;var m=d==="vertical"&&f==="xAxis"||d==="horizontal"&&f==="yAxis",h=m?Sf(r,s,l):Sf(s,l);return K7(t,h,e.allowDataOverflow)},xU=X([Mt,og,cg,iU,sU,gU,Ze,St],dg,{memoizeOptions:{resultEqualityCheck:mm}}),bU=[0,1],fg=(e,t,n,r,l,s,d)=>{if(!((e==null||n==null||n.length===0)&&d===void 0)){var f=e.dataKey,m=e.type,h=Vr(t,s);if(h&&f==null){var v;return _E(0,(v=n==null?void 0:n.length)!==null&&v!==void 0?v:0)}return m==="category"?cU(r,e,h):l==="expand"&&!h?bU:d}},mg=X([Mt,Ze,lg,Hc,Ic,St,xU],fg),bi=X([Mt,Mk,N0],Ok),hg=(e,t,n)=>{var r=t.niceTicks;if(r!=="none"){var l=sg(t),s=Array.isArray(l)&&(l[0]==="auto"||l[1]==="auto");if((r==="snap125"||r==="adaptive")&&t!=null&&t.tickCount&&Br(e)){if(s)return N2(e,t.tickCount,t.allowDecimals,r);if(t.type==="number")return S2(e,t.tickCount,t.allowDecimals,r)}if(r==="auto"&&n==="linear"&&t!=null&&t.tickCount){if(s&&Br(e))return N2(e,t.tickCount,t.allowDecimals,"adaptive");if(t.type==="number"&&Br(e))return S2(e,t.tickCount,t.allowDecimals,"adaptive")}}},pg=X([mg,Hs,bi],hg),vg=(e,t,n,r)=>{if(r!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&Br(t)&&Array.isArray(n)&&n.length>0){var l,s,d=t[0],f=(l=n[0])!==null&&l!==void 0?l:0,m=t[1],h=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(d,f),Math.max(m,h)]}return t},wU=X([Mt,mg,pg,St],vg),jU=X(Hc,Mt,(e,t)=>{if(!(!t||t.type!=="number")){var n=1/0,r=Array.from(Gr(e.map(y=>y.value))).sort((y,b)=>y-b),l=r[0],s=r[r.length-1];if(l==null||s==null)return 1/0;var d=s-l;if(d===0)return 1/0;for(var f=0;fl,(e,t,n,r,l)=>{if(!He(e))return 0;var s=t==="vertical"?r.height:r.width;if(l==="gap")return e*s/2;if(l==="no-gap"){var d=xn(n,e*s),f=e*s/2;return f-d-(f-d)/s*d}return 0}),_U=(e,t,n)=>{var r=Da(e,t);return r==null||typeof r.padding!="string"?0:Vk(e,"xAxis",t,n,r.padding)},NU=(e,t,n)=>{var r=Pa(e,t);return r==null||typeof r.padding!="string"?0:Vk(e,"yAxis",t,n,r.padding)},SU=X(Da,_U,(e,t)=>{var n,r;if(e==null)return{left:0,right:0};var l=e.padding;return typeof l=="string"?{left:t,right:t}:{left:((n=l.left)!==null&&n!==void 0?n:0)+t,right:((r=l.right)!==null&&r!==void 0?r:0)+t}}),AU=X(Pa,NU,(e,t)=>{var n,r;if(e==null)return{top:0,bottom:0};var l=e.padding;return typeof l=="string"?{top:t,bottom:t}:{top:((n=l.top)!==null&&n!==void 0?n:0)+t,bottom:((r=l.bottom)!==null&&r!==void 0?r:0)+t}}),Fk=X([Wt,SU,nm,tm,(e,t,n)=>n],(e,t,n,r,l)=>{var s=r.padding;return l?[s.left,n.width-s.right]:[e.left+t.left,e.left+e.width-t.right]}),Xk=X([Wt,Ze,AU,nm,tm,(e,t,n)=>n],(e,t,n,r,l,s)=>{var d=l.padding;return s?[r.height-d.bottom,d.top]:t==="horizontal"?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),qc=(e,t,n,r)=>{var l;switch(t){case"xAxis":return Fk(e,n,r);case"yAxis":return Xk(e,n,r);case"zAxis":return(l=tg(e,n))===null||l===void 0?void 0:l.range;case"angleAxis":return HE(e);case"radiusAxis":return qE(e,n);default:return}},Wk=X([Mt,qc],om),OU=X([bi,wU],GE),yg=X([Mt,bi,OU,Wk],eg),Zk=(e,t,n,r)=>{if(!(n==null||n.dataKey==null)){var l=n.type,s=n.scale,d=Vr(e,r);if(d&&(l==="number"||s!=="auto"))return t.map(f=>f.value)}},gg=X([Ze,Hc,Hs,St],Zk),_m=X([yg],C0);X([yg],UB);X([yg,tU],Ek);X([qs,jm,St],lU);function Qk(e,t){return e.idt.id?1:0}var Nm=(e,t)=>t,Sm=(e,t,n)=>n,EU=X(Jf,Nm,Sm,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(Qk)),kU=X(em,Nm,Sm,(e,t,n)=>e.filter(r=>r.orientation===t).filter(r=>r.mirror===n).sort(Qk)),Jk=(e,t)=>({width:e.width,height:t.height}),CU=(e,t)=>{var n=typeof t.width=="number"?t.width:Cc;return{width:n,height:e.height}},eC=X(Wt,Da,Jk),TU=(e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}},MU=(e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}},DU=X(Ta,Wt,EU,Nm,Sm,(e,t,n,r,l)=>{var s={},d;return n.forEach(f=>{var m=Jk(t,f);d==null&&(d=TU(t,r,e));var h=r==="top"&&!l||r==="bottom"&&l;s[f.id]=d-Number(h)*m.height,d+=(h?-1:1)*m.height}),s}),PU=X(Ca,Wt,kU,Nm,Sm,(e,t,n,r,l)=>{var s={},d;return n.forEach(f=>{var m=CU(t,f);d==null&&(d=MU(t,r,e));var h=r==="left"&&!l||r==="right"&&l;s[f.id]=d-Number(h)*m.width,d+=(h?-1:1)*m.width}),s}),zU=(e,t)=>{var n=Da(e,t);if(n!=null)return DU(e,n.orientation,n.mirror)},IU=X([Wt,Da,zU,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var l=n==null?void 0:n[r];return l==null?{x:e.left,y:0}:{x:e.left,y:l}}}),$U=(e,t)=>{var n=Pa(e,t);if(n!=null)return PU(e,n.orientation,n.mirror)},RU=X([Wt,Pa,$U,(e,t)=>t],(e,t,n,r)=>{if(t!=null){var l=n==null?void 0:n[r];return l==null?{x:0,y:e.top}:{x:l,y:e.top}}}),tC=X(Wt,Pa,(e,t)=>{var n=typeof t.width=="number"?t.width:Cc;return{width:n,height:e.height}}),vN=(e,t,n)=>{switch(t){case"xAxis":return eC(e,n).width;case"yAxis":return tC(e,n).height;default:return}},nC=(e,t,n,r)=>{if(n!=null){var l=n.allowDuplicatedCategory,s=n.type,d=n.dataKey,f=Vr(e,r),m=t.map(v=>v.value),h=m.filter(v=>v!=null);if(d&&f&&s==="category"&&l&&YA(h))return m}},xg=X([Ze,Hc,Mt,St],nC),yN=X([Ze,WB,bi,_m,xg,gg,qc,pg,St],(e,t,n,r,l,s,d,f,m)=>{if(t!=null){var h=Vr(e,m);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:m,categoricalDomain:s,duplicateDomain:l,isCategorical:h,niceTicks:f,range:d,realScaleType:n,scale:r}}}),LU=(e,t,n,r,l,s,d,f,m)=>{if(!(t==null||r==null)){var h=Vr(e,m),v=t.type,y=t.ticks,b=t.tickCount,w=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,j=v==="category"&&r.bandwidth?r.bandwidth()/w:0;j=m==="angleAxis"&&s!=null&&s.length>=2?rn(s[0]-s[1])*2*j:j;var _=y||l;return _?_.map((S,A)=>{var C=d?d.indexOf(S):S,M=r.map(C);return He(M)?{index:A,coordinate:M+j,value:S,offset:j}:null}).filter(Dn):h&&f?f.map((S,A)=>{var C=r.map(S);return He(C)?{coordinate:C+j,value:S,index:A,offset:j}:null}).filter(Dn):r.ticks?r.ticks(b).map((S,A)=>{var C=r.map(S);return He(C)?{coordinate:C+j,value:S,index:A,offset:j}:null}).filter(Dn):r.domain().map((S,A)=>{var C=r.map(S);return He(C)?{coordinate:C+j,value:d?d[S]:S,index:A,offset:j}:null}).filter(Dn)}},rC=X([Ze,Hs,bi,_m,pg,qc,xg,gg,St],LU),BU=(e,t,n,r,l,s,d)=>{if(!(t==null||n==null||r==null||r[0]===r[1])){var f=Vr(e,d),m=t.tickCount,h=0;return h=d==="angleAxis"&&(r==null?void 0:r.length)>=2?rn(r[0]-r[1])*2*h:h,f&&s?s.map((v,y)=>{var b=n.map(v);return He(b)?{coordinate:b+h,value:v,index:y,offset:h}:null}).filter(Dn):n.ticks?n.ticks(m).map((v,y)=>{var b=n.map(v);return He(b)?{coordinate:b+h,value:v,index:y,offset:h}:null}).filter(Dn):n.domain().map((v,y)=>{var b=n.map(v);return He(b)?{coordinate:b+h,value:l?l[v]:v,index:y,offset:h}:null}).filter(Dn)}},hi=X([Ze,Hs,_m,qc,xg,gg,St],BU),pi=X(Mt,_m,(e,t)=>{if(!(e==null||t==null))return _f(_f({},e),{},{scale:t})}),UU=X([Mt,bi,mg,Wk],eg),HU=X([UU],C0);X((e,t,n)=>tg(e,n),HU,(e,t)=>{if(!(e==null||t==null))return _f(_f({},e),{},{scale:t})});var qU=X([Ze,Jf,em],(e,t,n)=>{switch(e){case"horizontal":return t.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),KU=(e,t,n)=>{var r;return(r=e.renderedTicks[t])===null||r===void 0?void 0:r[n]};X([KU],e=>{if(!(!e||e.length===0))return t=>{var n,r=1/0,l=e[0];for(var s of e){var d=Math.abs(s.coordinate-t);de.options.defaultTooltipEventType,iC=e=>e.options.validateTooltipEventTypes;function lC(e,t,n){if(e==null)return t;var r=e?"axis":"item";return n==null?t:n.includes(r)?r:t}function Kc(e,t){var n=aC(e),r=iC(e);return lC(t,n,r)}function YU(e){return Ne(t=>Kc(t,e))}var sC=(e,t)=>{var n,r=Number(t);if(!(Ar(r)||t==null))return r>=0?e==null||(n=e[r])===null||n===void 0?void 0:n.value:void 0},GU=e=>e.tooltip.settings,ui={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},VU={itemInteraction:{click:ui,hover:ui},axisInteraction:{click:ui,hover:ui},keyboardInteraction:ui,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},oC=bn({name:"tooltip",initialState:VU,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:yt()},replaceTooltipEntrySettings:{reducer(e,t){var n=t.payload,r=n.prev,l=n.next,s=mr(e).tooltipItemPayloads.indexOf(r);s>-1&&(e.tooltipItemPayloads[s]=l)},prepare:yt()},removeTooltipEntrySettings:{reducer(e,t){var n=mr(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:yt()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),gr=oC.actions,FU=gr.addTooltipEntrySettings,XU=gr.replaceTooltipEntrySettings,WU=gr.removeTooltipEntrySettings,ZU=gr.setTooltipSettingsState,cC=gr.setActiveMouseOverItemIndex,QU=gr.mouseLeaveItem,uC=gr.mouseLeaveChart,JU=gr.setActiveClickItemIndex,dC=gr.setMouseOverAxisIndex,eH=gr.setMouseClickAxisIndex,rc=gr.setSyncInteraction,Af=gr.setKeyboardInteraction,tH=oC.reducer;function gN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function _d(e){for(var t=1;t{if(t==null)return ui;var l=iH(e,t,n);if(l==null)return ui;if(l.active)return l;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var s=e.settings.active===!0;if(lH(l)){if(s)return _d(_d({},l),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return _d(_d({},ui),{},{coordinate:l.coordinate})};function sH(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function oH(e,t){var n=sH(e),r=t[0],l=t[1];if(n===void 0)return!1;var s=Math.min(r,l),d=Math.max(r,l);return n>=s&&n<=d}function cH(e,t,n){if(n==null||t==null)return!0;var r=rt(e,t);return r==null||!Br(n)?!0:oH(r,n)}var sc=(e,t,n,r)=>{var l=e==null?void 0:e.index;if(l==null)return null;var s=Number(l);if(!He(s))return l;var d=0,f=1/0;t.length>0&&(f=t.length-1);var m=Math.max(d,Math.min(s,f)),h=t[m];return h==null||cH(h,n,r)?String(m):null},mC=(e,t,n,r,l,s,d)=>{if(s!=null){var f=d[0],m=f==null?void 0:f.getPosition(s);if(m!=null)return m;var h=l==null?void 0:l[Number(s)];if(h)switch(n){case"horizontal":return{x:h.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:h.coordinate}}}},hC=(e,t,n,r)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var l;if(n==="hover"?l=e.itemInteraction.hover.graphicalItemId:l=e.itemInteraction.click.graphicalItemId,e.syncInteraction.active&&l==null)return e.tooltipItemPayloads;if(l==null&&(r!=null||e.keyboardInteraction.active)){var s=e.tooltipItemPayloads[0];return s!=null?[s]:[]}return e.tooltipItemPayloads.filter(d=>{var f;return((f=d.settings)===null||f===void 0?void 0:f.graphicalItemId)===l})},pC=e=>e.options.tooltipPayloadSearcher,Ys=e=>e.tooltip;function xN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function bN(e){for(var t=1;te(t)}function wN(e){if(typeof e=="string")return e}function vH(e){if(!(e==null||typeof e!="object")){var t="name"in e?mH(e.name):void 0,n="unit"in e?hH(e.unit):void 0,r="dataKey"in e?pH(e.dataKey):void 0,l="payload"in e?e.payload:void 0,s="color"in e?wN(e.color):void 0,d="fill"in e?wN(e.fill):void 0;return{name:t,unit:n,dataKey:r,payload:l,color:s,fill:d}}}function yH(e,t){return e??t}var vC=(e,t,n,r,l,s,d)=>{if(!(t==null||s==null)){var f=n.chartData,m=n.computedData,h=n.dataStartIndex,v=n.dataEndIndex,y=[];return e.reduce((b,w)=>{var j,_=w.dataDefinedOnItem,S=w.settings,A=yH(_,f),C=Array.isArray(A)?qO(A,h,v):A,M=(j=S==null?void 0:S.dataKey)!==null&&j!==void 0?j:r,k=S==null?void 0:S.nameKey,D;if(r&&Array.isArray(C)&&!Array.isArray(C[0])&&d==="axis"?D=GA(C,r,l):D=s(C,t,m,k),Array.isArray(D))D.forEach($=>{var U,K,T=vH($),re=T==null?void 0:T.name,Z=T==null?void 0:T.dataKey,pe=T==null?void 0:T.payload,fe=bN(bN({},S),{},{name:re,unit:T==null?void 0:T.unit,color:(U=T==null?void 0:T.color)!==null&&U!==void 0?U:S==null?void 0:S.color,fill:(K=T==null?void 0:T.fill)!==null&&K!==void 0?K:S==null?void 0:S.fill});b.push(d_({tooltipEntrySettings:fe,dataKey:Z,payload:pe,value:rt(pe,Z),name:re==null?void 0:String(re)}))});else{var E;b.push(d_({tooltipEntrySettings:S,dataKey:M,payload:D,value:rt(D,M),name:(E=rt(D,k))!==null&&E!==void 0?E:S==null?void 0:S.name}))}return b},y)}},bg=X([Qt,Mk,N0],Ok),gH=X([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),xH=X([ln,Bs],ng),gl=X([gH,Qt,xH],rg,{memoizeOptions:{resultEqualityCheck:hm}}),bH=X([gl],e=>e.filter(fm)),yC=X([gl],ag,{memoizeOptions:{resultEqualityCheck:hm}}),wH=X([gl],e=>e.some(t=>!t.data)),ul=X([yC,kr],ig),jH=X([bH,kr,Qt],YE),wg=X([ul,Qt,gl,kr,wH,yC],$k),gC=X([Qt],sg),_H=X([Qt],e=>e.allowDataOverflow),xC=X([gC,_H],SE),NH=X([gl],e=>e.filter(fm)),SH=X([jH,NH,Ic,RE],Lk),AH=X([SH,kr,ln,xC],Bk),OH=X([gl],Pk),EH=X([ul,Qt,OH,jm,ln,L7],ug,{memoizeOptions:{resultEqualityCheck:mm}}),kH=X([Uk,ln,Bs],Ks),CH=X([kH,ln],Kk),TH=X([Hk,ln,Bs],Ks),MH=X([TH,ln],Yk),DH=X([qk,ln,Bs],Ks),PH=X([DH,ln],Gk),zH=X([CH,PH,MH],Sf),IH=X([Qt,gC,xC,AH,EH,zH,Ze,ln],dg),Ds=X([Qt,Ze,ul,wg,Ic,ln,IH],fg),$H=X([Ds,Qt,bg],hg),RH=X([Qt,Ds,$H,ln],vg),bC=e=>{var t=ln(e),n=Bs(e),r=!1;return qc(e,t,n,r)},wC=X([Qt,bC],om),LH=X([Qt,bg,RH,wC],eg),jC=X([LH],C0),BH=X([Ze,wg,Qt,ln],nC),UH=X([Ze,wg,Qt,ln],Zk),HH=(e,t,n,r,l,s,d,f)=>{if(t){var m=t.type,h=Vr(e,f);if(r){var v=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,y=m==="category"&&r.bandwidth?r.bandwidth()/v:0;return y=f==="angleAxis"&&l!=null&&(l==null?void 0:l.length)>=2?rn(l[0]-l[1])*2*y:y,h&&d?d.map((b,w)=>{var j=r.map(b);return He(j)?{coordinate:j+y,value:b,index:w,offset:y}:null}).filter(Dn):r.domain().map((b,w)=>{var j=r.map(b);return He(j)?{coordinate:j+y,value:s?s[b]:b,index:w,offset:y}:null}).filter(Dn)}}},za=X([Ze,Qt,bg,jC,bC,BH,UH,ln],HH),jg=X([aC,iC,GU],(e,t,n)=>lC(n.shared,e,t)),_C=e=>e.tooltip.settings.trigger,_g=e=>e.tooltip.settings.defaultIndex,Yc=X([Ys,jg,_C,_g],fC),vi=X([Yc,ul,Ms,Ds],sc),NC=X([za,vi],sC),Ng=X([Yc],e=>{if(e)return e.dataKey}),SC=X([Yc],e=>{if(e)return e.graphicalItemId}),AC=X([Ys,jg,_C,_g],hC),qH=X([Ca,Ta,Ze,Wt,za,_g,AC],mC),KH=X([Yc,qH],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),YH=X([Yc],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),GH=X([AC,vi,kr,Ms,NC,pC,jg],vC),VH=X([GH],e=>{if(e!=null){var t=e.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(t))}});function jN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function _N(e){for(var t=1;tNe(Qt),QH=()=>{var e=ZH(),t=Ne(za),n=Ne(jC);return As(!e||!n?void 0:_N(_N({},e),{},{scale:n}),t)};function NN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function os(e){for(var t=1;t{var l=t.find(s=>s&&s.index===n);if(l){if(e==="horizontal")return{x:l.coordinate,y:r.relativeY};if(e==="vertical")return{x:r.relativeX,y:l.coordinate}}return{x:0,y:0}},rq=(e,t,n,r)=>{var l=t.find(h=>h&&h.index===n);if(l){if(e==="centric"){var s=l.coordinate,d=r.radius;return os(os(os({},r),Ht(r.cx,r.cy,d,s)),{},{angle:s,radius:d})}var f=l.coordinate,m=r.angle;return os(os(os({},r),Ht(r.cx,r.cy,f,m)),{},{angle:m,radius:f})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function aq(e,t){var n=e.relativeX,r=e.relativeY;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var OC=(e,t,n,r,l)=>{var s,d=(s=t==null?void 0:t.length)!==null&&s!==void 0?s:0;if(d<=1||e==null)return 0;if(r==="angleAxis"&&l!=null&&Math.abs(Math.abs(l[1]-l[0])-360)<=1e-6)for(var f=0;f0?(m=n[f-1])===null||m===void 0?void 0:m.coordinate:(h=n[d-1])===null||h===void 0?void 0:h.coordinate,j=(v=n[f])===null||v===void 0?void 0:v.coordinate,_=f>=d-1?(y=n[0])===null||y===void 0?void 0:y.coordinate:(b=n[f+1])===null||b===void 0?void 0:b.coordinate,S=void 0;if(!(w==null||j==null||_==null))if(rn(j-w)!==rn(_-j)){var A=[];if(rn(_-j)===rn(l[1]-l[0])){S=_;var C=j+l[1]-l[0];A[0]=Math.min(C,(C+w)/2),A[1]=Math.max(C,(C+w)/2)}else{S=w;var M=_+l[1]-l[0];A[0]=Math.min(j,(M+j)/2),A[1]=Math.max(j,(M+j)/2)}var k=[Math.min(j,(S+j)/2),Math.max(j,(S+j)/2)];if(e>k[0]&&e<=k[1]||e>=A[0]&&e<=A[1]){var D;return(D=n[f])===null||D===void 0?void 0:D.index}}else{var E=Math.min(w,_),$=Math.max(w,_);if(e>(E+j)/2&&e<=($+j)/2){var U;return(U=n[f])===null||U===void 0?void 0:U.index}}}else if(t)for(var K=0;K(T.coordinate+Z.coordinate)/2||K>0&&K(T.coordinate+Z.coordinate)/2&&e<=(T.coordinate+re.coordinate)/2)return T.index}}return-1},EC=()=>Ne(N0),Sg=(e,t)=>t,kC=(e,t,n)=>n,Ag=(e,t,n,r)=>r,iq=X(za,e=>Hf(e,t=>t.coordinate)),Og=X([Ys,Sg,kC,Ag],fC),Eg=X([Og,ul,Ms,Ds],sc),lq=(e,t,n)=>{if(t!=null){var r=Ys(e);return t==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},CC=X([Ys,Sg,kC,Ag],hC),Of=X([Ca,Ta,Ze,Wt,za,Ag,CC],mC),sq=X([Og,Of],(e,t)=>{var n;return(n=e.coordinate)!==null&&n!==void 0?n:t}),TC=X([za,Eg],sC),oq=X([CC,Eg,kr,Ms,TC,pC,Sg],vC),cq=X([Og,Eg],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),uq=(e,t,n,r,l,s,d)=>{if(!(!e||!n||!r||!l)&&aq(e,d)){var f=hI(e,t),m=OC(f,s,l,n,r),h=nq(t,l,m,e);return{activeIndex:String(m),activeCoordinate:h}}},dq=(e,t,n,r,l,s,d)=>{if(!(!e||!r||!l||!s||!n)){var f=T7(e,n);if(f){var m=pI(f,t),h=OC(m,d,s,r,l),v=rq(t,s,h,f);return{activeIndex:String(h),activeCoordinate:v}}}},fq=(e,t,n,r,l,s,d,f)=>{if(!(!e||!t||!r||!l||!s))return t==="horizontal"||t==="vertical"?uq(e,t,r,l,s,d,f):dq(e,t,n,r,l,s,d)},mq=X(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),hq=X(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(qt)),n=Array.from(new Set(t));return n.sort((r,l)=>r-l)},{memoizeOptions:{resultEqualityCheck:o9}});function SN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function AN(e){for(var t=1;tAN(AN({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),gq)},bq=new Set(Object.values(qt));function wq(e){return bq.has(e)}var MC=bn({name:"zIndex",initialState:xq,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:yt()},unregisterZIndexPortal:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!wq(n)&&delete e.zIndexMap[n])},prepare:yt()},registerZIndexPortalElement:{reducer:(e,t)=>{var n=t.payload,r=n.zIndex,l=n.element,s=n.isPanorama;e.zIndexMap[r]?s?e.zIndexMap[r].panoramaElement=l:e.zIndexMap[r].element=l:e.zIndexMap[r]={consumers:0,element:s?void 0:l,panoramaElement:s?l:void 0}},prepare:yt()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:yt()}}}),Am=MC.actions,jq=Am.registerZIndexPortal,Av=Am.unregisterZIndexPortal,_q=Am.registerZIndexPortalElement,Nq=Am.unregisterZIndexPortalElement,Sq=MC.reducer;function In(e){var t=e.zIndex,n=e.children,r=QI(),l=r&&t!==void 0&&t!==0,s=wn(),d=x.useRef(void 0),f=x.useRef(new Set),m=dt(),h=Ne(y=>mq(y,t,s));if(x.useLayoutEffect(()=>{if(!l){var y=f.current;y.forEach(w=>{m(Av({zIndex:w}))}),y.clear(),d.current=void 0;return}if(f.current.has(t)||(m(jq({zIndex:t})),f.current.add(t)),h){d.current=h;var b=f.current;b.forEach(w=>{w!==t&&(m(Av({zIndex:w})),b.delete(w))})}},[m,t,l,h]),x.useLayoutEffect(()=>{var y=f.current;return()=>{y.forEach(b=>{m(Av({zIndex:b}))}),y.clear()}},[m]),!l)return n;var v=h??d.current;return v?It.createPortal(n,v):null}function Ey(){return Ey=Object.assign?Object.assign.bind():function(e){for(var t=1;tx.useContext(DC),Ov={exports:{}},EN;function Dq(){return EN||(EN=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function l(m,h,v){this.fn=m,this.context=h,this.once=v||!1}function s(m,h,v,y,b){if(typeof v!="function")throw new TypeError("The listener must be a function");var w=new l(v,y||m,b),j=n?n+h:h;return m._events[j]?m._events[j].fn?m._events[j]=[m._events[j],w]:m._events[j].push(w):(m._events[j]=w,m._eventsCount++),m}function d(m,h){--m._eventsCount===0?m._events=new r:delete m._events[h]}function f(){this._events=new r,this._eventsCount=0}f.prototype.eventNames=function(){var h=[],v,y;if(this._eventsCount===0)return h;for(y in v=this._events)t.call(v,y)&&h.push(n?y.slice(1):y);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(v)):h},f.prototype.listeners=function(h){var v=n?n+h:h,y=this._events[v];if(!y)return[];if(y.fn)return[y.fn];for(var b=0,w=y.length,j=new Array(w);b{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!Ar(n))return e[n]}},Iq={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},PC=bn({name:"options",initialState:Iq,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),$q=PC.reducer,Rq=PC.actions.createEventEmitter;function Lq(e){return e.tooltip.syncInteraction}var Bq={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},zC=bn({name:"chartData",initialState:Bq,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var n=t.payload,r=n.startIndex,l=n.endIndex;r!=null&&(e.dataStartIndex=r),l!=null&&(e.dataEndIndex=l)}}}),Cg=zC.actions,CN=Cg.setChartData,Uq=Cg.setDataStartEndIndexes;Cg.setComputedData;var Hq=zC.reducer,qq=["x","y"];function TN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function cs(e){for(var t=1;tm.rootProps.className);x.useEffect(()=>{if(e==null)return hl;var m=(h,v,y)=>{if(t!==y&&e===h){if(v.payload.active===!1){n(rc({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r==="index"){var b;if(d&&v!==null&&v!==void 0&&(b=v.payload)!==null&&b!==void 0&&b.coordinate&&v.payload.sourceViewBox){var w=v.payload.coordinate,j=w.x,_=w.y,S=Vq(w,qq),A=v.payload.sourceViewBox,C=A.x,M=A.y,k=A.width,D=A.height,E=cs(cs({},S),{},{x:d.x+(k?(j-C)/k:0)*d.width,y:d.y+(D?(_-M)/D:0)*d.height});n(cs(cs({},v),{},{payload:cs(cs({},v.payload),{},{coordinate:E})}))}else n(v);return}if(l!=null){var $;if(typeof r=="function"){var U={activeTooltipIndex:v.payload.index==null?void 0:Number(v.payload.index),isTooltipActive:v.payload.active,activeIndex:v.payload.index==null?void 0:Number(v.payload.index),activeLabel:v.payload.label,activeDataKey:v.payload.dataKey,activeCoordinate:v.payload.coordinate},K=r(l,U);$=l[K]}else r==="value"&&($=l.find(z=>String(z.value)===v.payload.label));var T=v.payload.coordinate;if(T==null||d==null){n(rc({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if($==null){n(rc({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:v.payload.sourceViewBox,graphicalItemId:void 0}));return}var re=T.x,Z=T.y,pe=Math.min(re,d.x+d.width),fe=Math.min(Z,d.y+d.height),ce={x:s==="horizontal"?$.coordinate:pe,y:s==="horizontal"?fe:$.coordinate},R=rc({active:v.payload.active,coordinate:ce,dataKey:v.payload.dataKey,index:String($.index),label:v.payload.label,sourceViewBox:v.payload.sourceViewBox,graphicalItemId:v.payload.graphicalItemId});n(R)}}};return Nc.on(ky,m),()=>{Nc.off(ky,m)}},[f,n,t,e,r,l,s,d])}function Wq(){var e=Ne(S0),t=Ne(A0),n=dt();x.useEffect(()=>{if(e==null)return hl;var r=(l,s,d)=>{t!==d&&e===l&&n(Uq(s))};return Nc.on(kN,r),()=>{Nc.off(kN,r)}},[n,t,e])}function Zq(){var e=dt();x.useEffect(()=>{e(Rq())},[e]),Xq(),Wq()}function Qq(e,t,n,r,l,s){var d=Ne(j=>lq(j,e,t)),f=Ne(SC),m=Ne(A0),h=Ne(S0),v=Ne(LE),y=Ne(Lq),b=(y==null?void 0:y.sourceViewBox)!=null,w=rm();x.useEffect(()=>{if(!b&&h!=null&&m!=null){var j=rc({active:s,coordinate:n,dataKey:d,index:l,label:typeof r=="number"?String(r):r,sourceViewBox:w,graphicalItemId:f});Nc.emit(ky,h,j,m)}},[b,n,d,f,l,r,m,h,v,s,w])}function MN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function DN(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{$(ZU({shared:C,trigger:M,axisId:E,active:l,defaultIndex:U}))},[$,C,M,E,l,U]);var K=rm(),T=fE(),re=YU(C),Z=(t=Ne(xe=>cq(xe,re,M,U)))!==null&&t!==void 0?t:{},pe=Z.activeIndex,fe=Z.isActive,ce=Ne(xe=>oq(xe,re,M,U)),R=Ne(xe=>TC(xe,re,M,U)),z=Ne(xe=>sq(xe,re,M,U)),G=ce,se=Mq(),ue=(n=l??fe)!==null&&n!==void 0?n:!1,P=mO([G,ue]),Q=nK(P,2),ne=Q[0],I=Q[1],he=re==="axis"?R:void 0;Qq(re,M,z,he,pe,ue);var be=D??se;if(be==null||K==null||re==null)return null;var _e=G??zN;ue||(_e=zN),h&&_e.length&&(_e=oO(_e.filter(xe=>xe.value!=null&&(xe.hide!==!0||r.includeHidden)),b,sK));var W=_e.length>0,V=DN(DN({},r),{},{payload:_e,label:he,active:ue,activeIndex:pe,coordinate:z,accessibilityLayer:T}),ye=x.createElement(OR,{allowEscapeViewBox:s,animationDuration:d,animationEasing:f,isAnimationActive:v,active:ue,coordinate:z,hasPayload:W,offset:y,position:w,reverseDirection:j,useTranslate3d:_,viewBox:K,wrapperStyle:S,lastBoundingBox:ne,innerRef:I,hasPortalFromProps:!!D},oK(m,V));return x.createElement(x.Fragment,null,It.createPortal(ye,be),ue&&x.createElement(Tq,{cursor:A,tooltipEventType:re,coordinate:z,payload:_e,index:pe}))}var nl=e=>null;nl.displayName="Cell";function uK(e,t,n){return(t=dK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dK(e){var t=fK(e,"string");return typeof t=="symbol"?t:t+""}function fK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class mK{constructor(t){uK(this,"cache",new Map),this.maxSize=t}get(t){var n=this.cache.get(t);return n!==void 0&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(t,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function IN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function hK(e){for(var t=1;t{try{var n=document.getElementById(RN);n||(n=document.createElement("span"),n.setAttribute("id",RN),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,xK,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},oc=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Pc.isSsr)return{width:0,height:0};if(!IC.enableCache)return LN(t,n);var r=bK(t,n),l=$N.get(r);if(l)return l;var s=LN(t,n);return $N.set(r,s),s},$C;function Ef(e,t){return NK(e)||_K(e,t)||jK(e,t)||wK()}function wK(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jK(e,t){if(e){if(typeof e=="string")return BN(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?BN(e,t):void 0}}function BN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.children,n=e.breakAll,r=e.style;try{var l=[];Nt(t)||(n?l=t.toString().split(""):l=t.toString().split(LC));var s=l.map(f=>({word:f,width:oc(f,r).width})),d=n?0:oc(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:d}}catch{return null}};function UC(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}function KK(e){return Nt(e)||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}var HC=(e,t,n,r)=>e.reduce((l,s)=>{var d=s.word,f=s.width,m=l[l.length-1];if(m&&f!=null&&(t==null||r||m.width+f+ne.reduce((t,n)=>t.width>n.width?t:n),YK="…",VN=(e,t,n,r,l,s,d,f)=>{var m=e.slice(0,t),h=BC({breakAll:n,style:r,children:m+YK});if(!h)return[!1,[]];var v=HC(h.wordsWithComputedWidth,s,d,f),y=v.length>l||qC(v).width>Number(s);return[y,v]},GK=(e,t,n,r,l)=>{var s=e.maxLines,d=e.children,f=e.style,m=e.breakAll,h=je(s),v=String(d),y=HC(t,r,n,l);if(!h||l)return y;var b=y.length>s||qC(y).width>Number(r);if(!b)return y;for(var w=0,j=v.length-1,_=0,S;w<=j&&_<=v.length-1;){var A=Math.floor((w+j)/2),C=A-1,M=VN(v,C,m,f,s,r,n,l),k=YN(M,2),D=k[0],E=k[1],$=VN(v,A,m,f,s,r,n,l),U=YN($,1),K=U[0];if(!D&&!K&&(w=A+1),D&&K&&(j=A-1),!D&&K){S=E;break}_++}return S||y},FN=e=>{var t=Nt(e)?[]:e.toString().split(LC);return[{words:t,width:void 0}]},VK=e=>{var t=e.width,n=e.scaleToFit,r=e.children,l=e.style,s=e.breakAll,d=e.maxLines;if((t||n)&&!Pc.isSsr){var f,m,h=BC({breakAll:s,children:r,style:l});if(h){var v=h.wordsWithComputedWidth,y=h.spaceWidth;f=v,m=y}else return FN(r);return GK({breakAll:s,children:r,maxLines:d,style:l},f,m,t,!!n)}return FN(r)},KC="#808080",FK={angle:0,breakAll:!1,capHeight:"0.71em",fill:KC,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Om=x.forwardRef((e,t)=>{var n=an(e,FK),r=n.x,l=n.y,s=n.lineHeight,d=n.capHeight,f=n.fill,m=n.scaleToFit,h=n.textAnchor,v=n.verticalAnchor,y=KN(n,$K),b=x.useMemo(()=>VK({breakAll:y.breakAll,children:y.children,maxLines:y.maxLines,scaleToFit:m,style:y.style,width:y.width}),[y.breakAll,y.children,y.maxLines,m,y.style,y.width]),w=y.dx,j=y.dy,_=y.angle,S=y.className,A=y.breakAll,C=KN(y,RK);if(!qr(r)||!qr(l)||b.length===0)return null;var M=Number(r)+(je(w)?w:0),k=Number(l)+(je(j)?j:0);if(!He(M)||!He(k))return null;var D;switch(v){case"start":D=kv("calc(".concat(d,")"));break;case"middle":D=kv("calc(".concat((b.length-1)/2," * -").concat(s," + (").concat(d," / 2))"));break;default:D=kv("calc(".concat(b.length-1," * -").concat(s,")"));break}var E=[],$=b[0];if(m&&$!=null){var U=$.width,K=y.width;E.push("scale(".concat(je(K)&&je(U)?K/U:1,")"))}return _&&E.push("rotate(".concat(_,", ").concat(M,", ").concat(k,")")),E.length&&(C.transform=E.join(" ")),x.createElement("text",Cy({},Xn(C),{ref:t,x:M,y:k,className:nt("recharts-text",S),textAnchor:h,fill:f.includes("url")?KC:f}),b.map((T,re)=>{var Z=T.words.join(A?"":" ");return x.createElement("tspan",{x:M,dy:re===0?D:s,key:"".concat(Z,"-").concat(re)},Z)}))});Om.displayName="Text";function XN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function $r(e){for(var t=1;t{var t=e.viewBox,n=e.position,r=e.offset,l=r===void 0?0:r,s=e.parentViewBox,d=m0(t),f=d.x,m=d.y,h=d.height,v=d.upperWidth,y=d.lowerWidth,b=f,w=f+(v-y)/2,j=(b+w)/2,_=(v+y)/2,S=b+v/2,A=h>=0?1:-1,C=A*l,M=A>0?"end":"start",k=A>0?"start":"end",D=v>=0?1:-1,E=D*l,$=D>0?"end":"start",U=D>0?"start":"end",K=s;if(n==="top"){var T={x:b+v/2,y:m-C,horizontalAnchor:"middle",verticalAnchor:M};return K&&(T.height=Math.max(m-K.y,0),T.width=v),T}if(n==="bottom"){var re={x:w+y/2,y:m+h+C,horizontalAnchor:"middle",verticalAnchor:k};return K&&(re.height=Math.max(K.y+K.height-(m+h),0),re.width=y),re}if(n==="left"){var Z={x:j-E,y:m+h/2,horizontalAnchor:$,verticalAnchor:"middle"};return K&&(Z.width=Math.max(Z.x-K.x,0),Z.height=h),Z}if(n==="right"){var pe={x:j+_+E,y:m+h/2,horizontalAnchor:U,verticalAnchor:"middle"};return K&&(pe.width=Math.max(K.x+K.width-pe.x,0),pe.height=h),pe}var fe=K?{width:_,height:h}:{};return n==="insideLeft"?$r({x:j+E,y:m+h/2,horizontalAnchor:U,verticalAnchor:"middle"},fe):n==="insideRight"?$r({x:j+_-E,y:m+h/2,horizontalAnchor:$,verticalAnchor:"middle"},fe):n==="insideTop"?$r({x:b+v/2,y:m+C,horizontalAnchor:"middle",verticalAnchor:k},fe):n==="insideBottom"?$r({x:w+y/2,y:m+h-C,horizontalAnchor:"middle",verticalAnchor:M},fe):n==="insideTopLeft"?$r({x:b+E,y:m+C,horizontalAnchor:U,verticalAnchor:k},fe):n==="insideTopRight"?$r({x:b+v-E,y:m+C,horizontalAnchor:$,verticalAnchor:k},fe):n==="insideBottomLeft"?$r({x:w+E,y:m+h-C,horizontalAnchor:U,verticalAnchor:M},fe):n==="insideBottomRight"?$r({x:w+y-E,y:m+h-C,horizontalAnchor:$,verticalAnchor:M},fe):n&&typeof n=="object"&&(je(n.x)||il(n.x))&&(je(n.y)||il(n.y))?$r({x:f+xn(n.x,_),y:m+xn(n.y,h),horizontalAnchor:"end",verticalAnchor:"end"},fe):$r({x:S,y:m+h/2,horizontalAnchor:"middle",verticalAnchor:"middle"},fe)},JK=["labelRef"],eY=["content"];function WN(e,t){if(e==null)return{};var n,r,l=tY(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var t=e.x,n=e.y,r=e.upperWidth,l=e.lowerWidth,s=e.width,d=e.height,f=e.children,m=x.useMemo(()=>({x:t,y:n,upperWidth:r,lowerWidth:l,width:s,height:d}),[t,n,r,l,s,d]);return x.createElement(YC.Provider,{value:m},f)},GC=()=>{var e=x.useContext(YC),t=rm();return e||(t?m0(t):void 0)},lY=x.createContext(null),sY=()=>{var e=x.useContext(lY),t=Ne(KE);return e||t},oY=e=>{var t=e.value,n=e.formatter,r=Nt(e.children)?t:e.children;return typeof n=="function"?n(r):r},Tg=e=>e!=null&&typeof e=="function",cY=(e,t)=>{var n=rn(t-e),r=Math.min(Math.abs(t-e),360);return n*r},uY=(e,t,n,r,l)=>{var s=e.offset,d=e.className,f=l.cx,m=l.cy,h=l.innerRadius,v=l.outerRadius,y=l.startAngle,b=l.endAngle,w=l.clockWise,j=(h+v)/2,_=cY(y,b),S=_>=0?1:-1,A,C;switch(t){case"insideStart":A=y+S*s,C=w;break;case"insideEnd":A=b-S*s,C=!w;break;case"end":A=b+S*s,C=w;break;default:throw new Error("Unsupported position ".concat(t))}C=_<=0?C:!C;var M=Ht(f,m,j,A),k=Ht(f,m,j,A+(C?1:-1)*359),D="M".concat(M.x,",").concat(M.y,` + A`).concat(j,",").concat(j,",0,1,").concat(C?0:1,`, + `).concat(k.x,",").concat(k.y),E=Nt(e.id)?dc("recharts-radial-line-"):e.id;return x.createElement("text",ga({},r,{dominantBaseline:"central",className:nt("recharts-radial-bar-label",d)}),x.createElement("defs",null,x.createElement("path",{id:E,d:D})),x.createElement("textPath",{xlinkHref:"#".concat(E)},n))},dY=(e,t,n)=>{var r=e.cx,l=e.cy,s=e.innerRadius,d=e.outerRadius,f=e.startAngle,m=e.endAngle,h=(f+m)/2;if(n==="outside"){var v=Ht(r,l,d+t,h),y=v.x,b=v.y;return{x:y,y:b,textAnchor:y>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:l,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:l,textAnchor:"middle",verticalAnchor:"end"};var w=(s+d)/2,j=Ht(r,l,w,h),_=j.x,S=j.y;return{x:_,y:S,textAnchor:"middle",verticalAnchor:"middle"}},zd=e=>e!=null&&"cx"in e&&je(e.cx),fY={angle:0,offset:5,zIndex:qt.label,position:"middle",textBreakAll:!1};function mY(e){if(!zd(e))return e;var t=e.cx,n=e.cy,r=e.outerRadius,l=r*2;return{x:t-r,y:n-r,width:l,upperWidth:l,lowerWidth:l,height:l}}function oi(e){var t=an(e,fY),n=t.viewBox,r=t.parentViewBox,l=t.position,s=t.value,d=t.children,f=t.content,m=t.className,h=m===void 0?"":m,v=t.textBreakAll,y=t.labelRef,b=sY(),w=GC(),j=l==="center"?w:b??w,_,S,A;n==null?_=j:zd(n)?_=n:_=m0(n);var C=mY(_);if(!_||Nt(s)&&Nt(d)&&!x.isValidElement(f)&&typeof f!="function")return null;var M=ac(ac({},t),{},{viewBox:_});if(x.isValidElement(f)){M.labelRef;var k=WN(M,JK);return x.cloneElement(f,k)}if(typeof f=="function"){M.content;var D=WN(M,eY);if(S=x.createElement(f,D),x.isValidElement(S))return S}else S=oY(t);var E=Xn(t);if(zd(_)){if(l==="insideStart"||l==="insideEnd"||l==="end")return uY(t,l,S,E,_);A=dY(_,t.offset,t.position)}else{if(!C)return null;var $=QK({viewBox:C,position:l,offset:t.offset,parentViewBox:zd(r)?void 0:r});A=ac(ac({x:$.x,y:$.y,textAnchor:$.horizontalAnchor,verticalAnchor:$.verticalAnchor},$.width!==void 0?{width:$.width}:{}),$.height!==void 0?{height:$.height}:{})}return x.createElement(In,{zIndex:t.zIndex},x.createElement(Om,ga({ref:y,className:nt("recharts-label",h)},E,A,{textAnchor:UC(E.textAnchor)?E.textAnchor:A.textAnchor,breakAll:v}),S))}oi.displayName="Label";var hY=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?x.createElement(oi,ga({key:"label-implicit"},r)):qr(e)?x.createElement(oi,ga({key:"label-implicit",value:e},r)):x.isValidElement(e)?e.type===oi?x.cloneElement(e,ac({key:"label-implicit"},r)):x.createElement(oi,ga({key:"label-implicit",content:e},r)):Tg(e)?x.createElement(oi,ga({key:"label-implicit",content:e},r)):e&&typeof e=="object"?x.createElement(oi,ga({},e,{key:"label-implicit"},r)):null};function pY(e){var t=e.label,n=e.labelRef,r=GC();return hY(t,r,n)||null}var vY=["valueAccessor"],yY=["dataKey","clockWise","id","textBreakAll","zIndex"];function kf(){return kf=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(KK(t))return t},VC=x.createContext(void 0),FC=VC.Provider,XC=x.createContext(void 0),bY=XC.Provider;function wY(){return x.useContext(VC)}function jY(){return x.useContext(XC)}function Id(e){var t=e.valueAccessor,n=t===void 0?xY:t,r=QN(e,vY),l=r.dataKey;r.clockWise;var s=r.id,d=r.textBreakAll,f=r.zIndex,m=QN(r,yY),h=wY(),v=jY(),y=h||v;return!y||!y.length?null:x.createElement(In,{zIndex:f??qt.label},x.createElement(Ct,{className:"recharts-label-list"},y.map((b,w)=>{var j,_=Nt(l)?n(b,w):rt(b.payload,l),S=Nt(s)?{}:{id:"".concat(s,"-").concat(w)};return x.createElement(oi,kf({key:"label-".concat(w)},Xn(b),m,S,{fill:(j=r.fill)!==null&&j!==void 0?j:b.fill,parentViewBox:b.parentViewBox,value:_,textBreakAll:d,viewBox:b.viewBox,index:w,zIndex:0}))})))}Id.displayName="LabelList";function Mg(e){var t=e.label;return t?t===!0?x.createElement(Id,{key:"labelList-implicit"}):x.isValidElement(t)||Tg(t)?x.createElement(Id,{key:"labelList-implicit",content:t}):typeof t=="object"?x.createElement(Id,kf({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function Ty(){return Ty=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=e.cx,n=e.cy,r=e.r,l=e.className,s=nt("recharts-dot",l);return je(t)&&je(n)&&je(r)?x.createElement("circle",Ty({},zn(e),n0(e),{className:s,cx:t,cy:n,r})):null},ZC=e=>e.graphicalItems.polarItems,_Y=X([St,$c],ng),Em=X([ZC,Mt,_Y],rg),NY=X([Em],ag),km=X([NY,zc],ig),SY=X([km,Mt,Em],Ik);X([km,Mt,Em],(e,t,n)=>n.length>0?e.flatMap(r=>n.flatMap(l=>{var s,d=rt(r,(s=t.dataKey)!==null&&s!==void 0?s:l.dataKey);return{value:d,errorDomain:[]}})).filter(Boolean):(t==null?void 0:t.dataKey)!=null?e.map(r=>({value:rt(r,t.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var JN=()=>{},AY=X([km,Mt,Em,jm,St,R7],ug),OY=X([Mt,og,cg,JN,AY,JN,Ze,St],dg),QC=X([Mt,Ze,km,SY,Ic,St,OY],fg),EY=X([QC,Hs,bi],hg),kY=X([Mt,QC,EY,St],vg);X([bi,kY],GE);var CY={radiusAxis:{},angleAxis:{}},JC=bn({name:"polarAxis",initialState:CY,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),Cm=JC.actions;Cm.addRadiusAxis;Cm.removeRadiusAxis;Cm.addAngleAxis;Cm.removeAngleAxis;var TY=JC.reducer;function e4(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}function eS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function tS(e){for(var t=1;tt,Dg=X([ZC,zY],(e,t)=>e.filter(n=>n.type==="pie").find(n=>n.id===t)),IY=[],Pg=(e,t,n)=>(n==null?void 0:n.length)===0?IY:n,t4=X([zc,Dg,Pg],(e,t,n)=>{var r=e.chartData;if(t!=null){var l;if((t==null?void 0:t.data)!=null&&t.data.length>0?l=t.data:l=r,(!l||!l.length)&&n!=null&&(l=n.map(s=>tS(tS({},t.presentationProps),s.props))),l!=null)return l}}),$Y=X([t4,Dg,Pg],(e,t,n)=>{if(!(e==null||t==null))return e.map((r,l)=>{var s,d=rt(r,t.nameKey,t.name),f;return n!=null&&(s=n[l])!==null&&s!==void 0&&(s=s.props)!==null&&s!==void 0&&s.fill?f=n[l].props.fill:typeof r=="object"&&r!=null&&"fill"in r?f=r.fill:f=t.fill,{value:Is(d,t.dataKey),dataKey:t.dataKey,color:f,payload:r,type:t.legendType}})}),RY=X([t4,Dg,Pg,Wt],(e,t,n,r)=>{if(!(t==null||e==null))return XG({offset:r,pieSettings:t,displayedData:e,cells:n})}),Cv={exports:{}},ut={};/** + * @license React + * react-is.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 nS;function LY(){if(nS)return ut;nS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),b=Symbol.for("react.view_transition"),w=Symbol.for("react.client.reference");function j(_){if(typeof _=="object"&&_!==null){var S=_.$$typeof;switch(S){case e:switch(_=_.type,_){case n:case l:case r:case m:case h:case b:return _;default:switch(_=_&&_.$$typeof,_){case d:case f:case y:case v:return _;case s:return _;default:return S}}case t:return S}}}return ut.ContextConsumer=s,ut.ContextProvider=d,ut.Element=e,ut.ForwardRef=f,ut.Fragment=n,ut.Lazy=y,ut.Memo=v,ut.Portal=t,ut.Profiler=l,ut.StrictMode=r,ut.Suspense=m,ut.SuspenseList=h,ut.isContextConsumer=function(_){return j(_)===s},ut.isContextProvider=function(_){return j(_)===d},ut.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===e},ut.isForwardRef=function(_){return j(_)===f},ut.isFragment=function(_){return j(_)===n},ut.isLazy=function(_){return j(_)===y},ut.isMemo=function(_){return j(_)===v},ut.isPortal=function(_){return j(_)===t},ut.isProfiler=function(_){return j(_)===l},ut.isStrictMode=function(_){return j(_)===r},ut.isSuspense=function(_){return j(_)===m},ut.isSuspenseList=function(_){return j(_)===h},ut.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===n||_===l||_===r||_===m||_===h||typeof _=="object"&&_!==null&&(_.$$typeof===y||_.$$typeof===v||_.$$typeof===d||_.$$typeof===s||_.$$typeof===f||_.$$typeof===w||_.getModuleId!==void 0)},ut.typeOf=j,ut}var rS;function BY(){return rS||(rS=1,Cv.exports=LY()),Cv.exports}var UY=BY(),aS=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",iS=null,Tv=null,n4=e=>{if(e===iS&&Array.isArray(Tv))return Tv;var t=[];return x.Children.forEach(e,n=>{Nt(n)||(UY.isFragment(n)?t=t.concat(n4(n.props.children)):t.push(n))}),Tv=t,iS=e,t};function zg(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(l=>aS(l)):r=[aS(t)],n4(e).forEach(l=>{var s=Hr(l,"type.displayName")||Hr(l,"type.name");s&&r.indexOf(s)!==-1&&n.push(l)}),n}var r4=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0;function lS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function sS(e){for(var t=1;t{var r=dt();return(l,s)=>d=>{e==null||e(l,s,d),r(cC({activeIndex:String(s),activeDataKey:t,activeCoordinate:l.tooltipPosition,activeGraphicalItemId:n}))}},Rg=e=>{var t=dt();return(n,r)=>l=>{e==null||e(n,r,l),t(QU())}},Lg=(e,t,n)=>{var r=dt();return(l,s)=>d=>{e==null||e(l,s,d),r(JU({activeIndex:String(s),activeDataKey:t,activeCoordinate:l.tooltipPosition,activeGraphicalItemId:n}))}};function Bg(e){var t=e.tooltipEntrySettings,n=dt(),r=wn(),l=x.useRef(null);return x.useLayoutEffect(()=>{r||(l.current===null?n(FU(t)):l.current!==t&&n(XU({prev:l.current,next:t})),l.current=t)},[t,n,r]),x.useLayoutEffect(()=>()=>{l.current&&(n(WU(l.current)),l.current=null)},[n]),null}function i4(e){var t=e.legendPayload,n=dt(),r=wn(),l=x.useRef(null);return x.useLayoutEffect(()=>{r||(l.current===null?n(sE(t)):l.current!==t&&n(oE({prev:l.current,next:t})),l.current=t)},[n,r,t]),x.useLayoutEffect(()=>()=>{l.current&&(n(cE(l.current)),l.current=null)},[n]),null}function XY(e){var t=e.legendPayload,n=dt(),r=Ne(Ze),l=x.useRef(null);return x.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(l.current===null?n(sE(t)):l.current!==t&&n(oE({prev:l.current,next:t})),l.current=t)},[n,r,t]),x.useLayoutEffect(()=>()=>{l.current&&(n(cE(l.current)),l.current=null)},[n]),null}function WY(e,t){return eG(e)||JY(e,t)||QY(e,t)||ZY()}function ZY(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QY(e,t){if(e){if(typeof e=="string")return oS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oS(e,t):void 0}}function oS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n2&&arguments[2]!==void 0?arguments[2]:[],r=[];for(var l of n)r.push({status:"removed",prev:l});for(var s=0;se[Math.floor(s*n)]);return qg(r,t)}function nG(e,t){var n=t.map((r,l)=>e[l]);return qg(n,t)}function rG(e,t){for(var n=new Map,r=0;r{var w=n(y,b);if(w!=null){var j=r.get(w);if(j!==void 0)return l.add(w),j}}),d=[];for(var f of r){var m=WY(f,2),h=m[0],v=m[1];l.has(h)||d.push(v)}return qg(s,t,d)}function My(e,t,n){return t==null?null:e==null?t.map(r=>({status:"added",next:r})):n===Ug?tG(e,t):n===Hg?nG(e,t):aG(e,t,n)}function l4(e,t){var n=x.useRef(e),r=x.useRef(t.current),l=x.useRef(!0);n.current!==e&&(n.current=e,r.current=t.current,l.current=!1);var s=x.useCallback(function(d,f){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(f===0){l.current=!0;return}f===1&&(r.current=d),f>0&&l.current&&m&&(t.current=d)},[t]);return{startValue:r.current,syncStepValue:s}}function iG(e,t){return cG(e)||oG(e,t)||sG(e,t)||lG()}function lG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sG(e,t){if(e){if(typeof e=="string")return cS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cS(e,t):void 0}}function cS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{typeof e=="function"&&e(),s(!0)},[e]),f=x.useCallback(()=>{typeof t=="function"&&t(),s(!1)},[t]);return{isAnimating:l,handleAnimationStart:d,handleAnimationEnd:f}}function Yg(e){var t,n=e.animationInput,r=e.animationIdPrefix,l=e.items,s=e.previousItemsRef,d=e.isAnimationActive,f=e.animationBegin,m=e.animationDuration,h=e.animationEasing,v=e.onAnimationStart,y=e.onAnimationEnd,b=e.animationInterpolateFn,w=e.animationMatchBy,j=e.shouldUpdatePreviousRef,_=e.children,S=e.layout,A=yE(n,r),C=l4(A,s),M=(t=C.startValue)!==null&&t!==void 0?t:null,k=My(M,l,w??Ug);return x.createElement(vE,{animationId:A,begin:f,duration:m,isActive:d,easing:h,onAnimationEnd:y,onAnimationStart:v,key:A},D=>{var E=M==null,$=l==null?l:b(k,D,S),U=j?j(D):D>0;return C.syncStepValue($,D,U),$==null?null:_($,D,E)})}var Mv;function uG(e,t){return hG(e)||mG(e,t)||fG(e,t)||dG()}function dG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fG(e,t){if(e){if(typeof e=="string")return uS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uS(e,t):void 0}}function uS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var e=x.useState(()=>dc("uid-")),t=uG(e,1),n=t[0];return n},s4=(Mv=AT.useId)!==null&&Mv!==void 0?Mv:pG;function vG(e,t){var n=s4();return t||(e?"".concat(e,"-").concat(n):n)}var yG=x.createContext(void 0),Gg=e=>{var t=e.id,n=e.type,r=e.children,l=vG("recharts-".concat(n),t);return x.createElement(yG.Provider,{value:l},r(l))},gG={cartesianItems:[],polarItems:[]},o4=bn({name:"graphicalItems",initialState:gG,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:yt()},replaceCartesianGraphicalItem:{reducer(e,t){var n=t.payload,r=n.prev,l=n.next,s=mr(e).cartesianItems.indexOf(r);s>-1&&(e.cartesianItems[s]=l)},prepare:yt()},removeCartesianGraphicalItem:{reducer(e,t){var n=mr(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:yt()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:yt()},removePolarGraphicalItem:{reducer(e,t){var n=mr(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:yt()},replacePolarGraphicalItem:{reducer(e,t){var n=t.payload,r=n.prev,l=n.next,s=mr(e).polarItems.indexOf(r);s>-1&&(e.polarItems[s]=l)},prepare:yt()}}}),Gs=o4.actions,xG=Gs.addCartesianGraphicalItem,bG=Gs.replaceCartesianGraphicalItem,wG=Gs.removeCartesianGraphicalItem,jG=Gs.addPolarGraphicalItem,_G=Gs.removePolarGraphicalItem,NG=Gs.replacePolarGraphicalItem,SG=o4.reducer,AG=e=>{var t=dt(),n=x.useRef(null);return x.useLayoutEffect(()=>{n.current===null?t(xG(e)):n.current!==e&&t(bG({prev:n.current,next:e})),n.current=e},[t,e]),x.useLayoutEffect(()=>()=>{n.current&&(t(wG(n.current)),n.current=null)},[t]),null},c4=x.memo(AG),OG=e=>{var t=dt(),n=x.useRef(null);return x.useLayoutEffect(()=>{n.current===null?t(jG(e)):n.current!==e&&t(NG({prev:n.current,next:e})),n.current=e},[t,e]),x.useLayoutEffect(()=>()=>{n.current&&(t(_G(n.current)),n.current=null)},[t]),null},EG=x.memo(OG),kG=["key"],CG=["onMouseEnter","onClick","onMouseLeave"],TG=["id"],MG=["id"];function dl(){return dl=Object.assign?Object.assign.bind():function(e){for(var t=1;tzg(e.children,nl),[e.children]),n=Ne(r=>$Y(r,e.id,t));return n==null?null:x.createElement(XY,{legendPayload:n})}function RG(e){if(!(e==null||typeof e=="boolean"||typeof e=="function")){if(x.isValidElement(e)){var t,n=(t=e.props)===null||t===void 0?void 0:t.fill;return typeof n=="string"?n:void 0}var r=e.fill;return typeof r=="string"?r:void 0}}var LG=x.memo(e=>{var t=e.dataKey,n=e.nameKey,r=e.sectors,l=e.stroke,s=e.strokeWidth,d=e.fill,f=e.name,m=e.hide,h=e.tooltipType,v=e.id,y=e.activeShape,b=RG(y),w=r.map(_=>{var S=_.tooltipPayload;return b==null||S==null?S:S.map(A=>bt(bt({},A),{},{color:b,fill:b}))}),j={dataDefinedOnItem:w,getPosition:_=>{var S;return(S=r[Number(_)])===null||S===void 0?void 0:S.tooltipPosition},settings:{stroke:l,strokeWidth:s,fill:d,dataKey:t,nameKey:n,name:Is(f,t),hide:m,type:h,color:d,unit:"",graphicalItemId:v}};return x.createElement(Bg,{tooltipEntrySettings:j})}),BG=(e,t)=>e>t?"start":exn(typeof t=="function"?t(e):t,n,n*.8),HG=(e,t,n)=>{var r=t.top,l=t.left,s=t.width,d=t.height,f=xE(s,d),m=l+xn(e.cx,s,s/2),h=r+xn(e.cy,d,d/2),v=xn(e.innerRadius,f,0),y=UG(n,e.outerRadius,f),b=e.maxRadius||Math.sqrt(s*s+d*d)/2;return{cx:m,cy:h,innerRadius:v,outerRadius:y,maxRadius:b}},qG=(e,t)=>{var n=rn(t-e),r=Math.min(Math.abs(t-e),360);return n*r},KG=(e,t)=>{if(x.isValidElement(e))return x.cloneElement(e,t);if(typeof e=="function")return e(t);var n=nt("recharts-pie-label-line",typeof e!="boolean"?e.className:"");t.key;var r=Tm(t,kG);return x.createElement(lc,dl({},r,{type:"linear",className:n}))},YG=(e,t,n)=>{if(x.isValidElement(e))return x.cloneElement(e,t);var r=n;if(typeof e=="function"&&(r=e(t),x.isValidElement(r)))return r;var l=nt("recharts-pie-label-text",e4(e));return x.createElement(Om,dl({},t,{alignmentBaseline:"middle",className:l}),r)};function GG(e){var t=e.sectors,n=e.props,r=e.showLabels,l=n.label,s=n.labelLine,d=n.dataKey;if(!r||!l||!t)return null;var f=zn(n),m=rl(l),h=rl(s),v=typeof l=="object"&&"offsetRadius"in l&&typeof l.offsetRadius=="number"&&l.offsetRadius||20,y=t.map((b,w)=>{var j=(b.startAngle+b.endAngle)/2,_=Ht(b.cx,b.cy,b.outerRadius+v,j),S=bt(bt(bt(bt({},f),b),{},{stroke:"none"},m),{},{index:w,textAnchor:BG(_.x,b.cx)},_),A=bt(bt(bt(bt({},f),b),{},{fill:"none",stroke:b.fill},h),{},{index:w,points:[Ht(b.cx,b.cy,b.outerRadius,j),_],key:"line"});return x.createElement(In,{zIndex:qt.label,key:"label-".concat(b.startAngle,"-").concat(b.endAngle,"-").concat(b.midAngle,"-").concat(w)},x.createElement(Ct,null,s&&KG(s,A),YG(l,S,rt(b,d))))});return x.createElement(Ct,{className:"recharts-pie-labels"},y)}function VG(e){var t=e.sectors,n=e.props,r=e.showLabels,l=n.label;return typeof l=="object"&&l!=null&&"position"in l?x.createElement(Mg,{label:l}):x.createElement(GG,{sectors:t,props:n,showLabels:r})}function FG(e){var t=e.sectors,n=e.activeShape,r=e.inactiveShape,l=e.allOtherPieProps,s=e.shape,d=e.id,f=e.animationElapsedTime,m=e.isAnimating,h=e.isEntrance,v=Ne(vi),y=Ne(Ng),b=Ne(SC),w=l.onMouseEnter,j=l.onClick,_=l.onMouseLeave,S=Tm(l,CG),A=$g(w,l.dataKey,d),C=Rg(_),M=Lg(j,l.dataKey,d);return t==null||t.length===0?null:x.createElement(x.Fragment,null,t.map((k,D)=>{if((k==null?void 0:k.startAngle)===0&&(k==null?void 0:k.endAngle)===0&&t.length!==1)return null;var E=b==null||b===d,$=String(D)===v&&(y==null||l.dataKey===y)&&E,U=v?r:null,K=n&&$?n:U,T=bt(bt({},k),{},{stroke:k.stroke,tabIndex:-1,index:D,isActive:$,animationElapsedTime:f,isAnimating:m,isEntrance:h,[FO]:D,[XO]:d});return x.createElement(Ct,dl({key:"sector-".concat(k==null?void 0:k.startAngle,"-").concat(k==null?void 0:k.endAngle,"-").concat(k.midAngle,"-").concat(D),tabIndex:-1,className:"recharts-pie-sector"},Oc(S,k,D),{onMouseEnter:A(k,D),onMouseLeave:C(k,D),onClick:M(k,D)}),x.createElement(Ig,{option:K??s,DefaultShape:u4,shapeProps:T}))}))}function XG(e){var t,n=e.pieSettings,r=e.displayedData,l=e.cells,s=e.offset,d=n.cornerRadius,f=n.startAngle,m=n.endAngle,h=n.dataKey,v=n.nameKey,y=n.tooltipType,b=Math.abs(n.minAngle),w=qG(f,m),j=Math.abs(w),_=r.length<=1?0:(t=n.paddingAngle)!==null&&t!==void 0?t:0,S=r.filter(U=>rt(U,h,0)!==0).length,A=(j>=360?S:S-1)*_,C=r.reduce((U,K)=>{var T=rt(K,h,0);return U+(je(T)?T:0)},0),M=b>0&&C>0&&r.some(U=>{var K=rt(U,h,0),T=(je(K)?K:0)/C;return K!==0&&T*j0){var $;E=r.map((U,K)=>{var T=rt(U,h,0),re=rt(U,v,K),Z=HG(n,s,U),pe=(je(T)?T:0)/C,fe,ce=bt(bt({},U),l&&l[K]&&l[K].props),R=ce!=null&&"fill"in ce&&typeof ce.fill=="string"?ce.fill:n.fill;K?fe=$.endAngle+rn(w)*_*(T!==0?1:0):fe=f;var z=fe+rn(w)*((T!==0?k:0)+pe*D),G=(fe+z)/2,se=(Z.innerRadius+Z.outerRadius)/2,ue=[{name:re,value:T,payload:ce,dataKey:h,type:y,color:R,fill:R,graphicalItemId:n.id}],P=Ht(Z.cx,Z.cy,se,G);return $=bt(bt(bt(bt({},n.presentationProps),{},{percent:pe,cornerRadius:typeof d=="string"?parseFloat(d):d,name:re,tooltipPayload:ue,midAngle:G,middleRadius:se,tooltipPosition:P},ce),Z),{},{value:T,dataKey:h,startAngle:fe,endAngle:z,payload:ce,paddingAngle:T!==0?rn(w)*_:0}),$})}return E}function WG(e){var t=e.showLabels,n=e.sectors,r=e.children,l=x.useMemo(()=>!t||!n?[]:n.map(s=>({value:s.value,payload:s.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:s.cx,cy:s.cy,innerRadius:s.innerRadius,outerRadius:s.outerRadius,startAngle:s.startAngle,endAngle:s.endAngle,clockWise:!1},fill:s.fill})),[n,t]);return x.createElement(bY,{value:t?l:void 0},r)}var ZG=(e,t)=>{if(e==null)return[];var n=[],r=e.find(s=>s.status!=="removed"),l=r?r.next.startAngle:0;return e.forEach((s,d)=>{if(s.status!=="removed"){var f=d>0?Hr(s.next,"paddingAngle",0):0;if(s.status==="matched"){var m=Et(s.prev.endAngle-s.prev.startAngle,s.next.endAngle-s.next.startAngle,t),h=bt(bt({},s.next),{},{startAngle:l+f,endAngle:l+m+f});n.push(h),l=h.endAngle}else{var v=Et(0,s.next.endAngle-s.next.startAngle,t),y=bt(bt({},s.next),{},{startAngle:l+f,endAngle:l+v+f});n.push(y),l=y.endAngle}}}),n};function QG(e){var t=e.props,n=e.previousSectorsRef,r=e.id,l=t.sectors,s=t.activeShape,d=t.inactiveShape,f=t.animationInterpolateFn,m=Kg(t.onAnimationStart,t.onAnimationEnd),h=m.isAnimating,v=m.handleAnimationStart,y=m.handleAnimationEnd,b=ZI();return b==null?null:x.createElement(WG,{showLabels:!h,sectors:l},x.createElement(Yg,{animationInput:t,animationIdPrefix:"recharts-pie-",items:l,previousItemsRef:n,isAnimationActive:t.isAnimationActive,animationBegin:t.animationBegin,animationDuration:t.animationDuration,animationEasing:t.animationEasing,onAnimationStart:v,onAnimationEnd:y,animationInterpolateFn:f,animationMatchBy:t.animationMatchBy,layout:b},(w,j,_)=>x.createElement(Ct,null,x.createElement(FG,{sectors:w,activeShape:s,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r,animationElapsedTime:j,isAnimating:h||j<1,isEntrance:_}))),x.createElement(VG,{showLabels:!h,sectors:l,props:t}),t.children)}var JG={animationBegin:400,animationDuration:1500,animationEasing:"ease",animationInterpolateFn:ZG,animationMatchBy:Hg,cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,shape:u4,startAngle:0,stroke:"#fff",zIndex:qt.area};function eV(e){var t=e.id,n=Tm(e,TG),r=e.hide,l=e.className,s=e.rootTabIndex,d=x.useMemo(()=>zg(e.children,nl),[e.children]),f=Ne(v=>RY(v,t,d)),m=x.useRef(null),h=nt("recharts-pie",l);return r||f==null?(m.current=null,x.createElement(Ct,{tabIndex:s,className:h})):x.createElement(In,{zIndex:e.zIndex},x.createElement(LG,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:f,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t,activeShape:e.activeShape}),x.createElement(Ct,{tabIndex:s,className:h},x.createElement(QG,{props:bt(bt({},n),{},{sectors:f}),previousSectorsRef:m,id:t})))}function tV(e){var t=an(e,JG),n=t.id,r=Tm(t,MG),l=zn(r);return x.createElement(Gg,{id:n,type:"pie"},s=>x.createElement(x.Fragment,null,x.createElement(EG,{type:"pie",id:s,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:l,maxRadius:t.maxRadius}),x.createElement($G,dl({},r,{id:s})),x.createElement(eV,dl({},r,{id:s}))))}var Dy=tV;Dy.displayName="Pie";var nV=["points"];function fS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function Dv(e){for(var t=1;t{var A,C,M=Dv(Dv(Dv({r:3},d),b),{},{index:S,cx:(A=_.x)!==null&&A!==void 0?A:void 0,cy:(C=_.y)!==null&&C!==void 0?C:void 0,dataKey:s,value:_.value,payload:_.payload,points:t});return x.createElement(oV,{key:"dot-".concat(S),option:n,dotProps:M,className:l})}),j={};return f&&m!=null&&(j.clipPath="url(#clipPath-".concat(y?"":"dots-").concat(m,")")),x.createElement(In,{zIndex:v},x.createElement(Ct,Cf({className:r},j),w))}function mS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function hS(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),NV=X([_V,Ca,Ta],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),Vg=()=>Ne(NV),SV=()=>Ne(VH);function pS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function Pv(e){for(var t=1;t{var t=e.point,n=e.childIndex,r=e.mainColor,l=e.activeDot,s=e.dataKey,d=e.clipPath;if(l===!1||t.x==null||t.y==null)return null;var f={index:n,dataKey:s,cx:t.x,cy:t.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},m=Pv(Pv(Pv({},f),rl(l)),n0(l)),h;return x.isValidElement(l)?h=x.cloneElement(l,m):typeof l=="function"?h=l(m):h=x.createElement(WC,m),x.createElement(Ct,{className:"recharts-active-dot",clipPath:d},h)};function vS(e){var t=e.points,n=e.mainColor,r=e.activeDot,l=e.itemDataKey,s=e.clipPath,d=e.zIndex,f=d===void 0?qt.activeDot:d,m=Ne(vi),h=SV();if(t==null||h==null)return null;var v=t.find(y=>h.includes(y.payload));return Nt(v)?null:x.createElement(In,{zIndex:f},x.createElement(kV,{point:v,childIndex:Number(m),mainColor:n,dataKey:l,activeDot:r,clipPath:s}))}function CV(e,t){return PV(e)||DV(e,t)||MV(e,t)||TV()}function TV(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MV(e,t){if(e){if(typeof e=="string")return yS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yS(e,t):void 0}}function yS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var r=n??e;if(!Nt(r))return xn(r,t,0)},zV=(e,t,n)=>{var r={},l=e.filter(fm),s=e.filter(h=>h.stackId==null),d=l.reduce((h,v)=>{var y=h[v.stackId];return y==null&&(y=[]),y.push(v),h[v.stackId]=y,h},r),f=Object.entries(d).map(h=>{var v,y=CV(h,2),b=y[0],w=y[1],j=w.map(S=>S.dataKey),_=gS(t,n,(v=w[0])===null||v===void 0?void 0:v.barSize);return{stackId:b,dataKeys:j,barSize:_}}),m=s.map(h=>{var v=[h.dataKey].filter(b=>b!=null),y=gS(t,n,h.barSize);return{stackId:void 0,dataKeys:v,barSize:y}});return[...f,...m]};function xS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function Sd(e){for(var t=1;tC+(M.barSize||0),0);b+=(d-1)*f,b>=n&&(b-=(d-1)*f,f=0),b>=n&&y>0&&(v=!0,y*=.9,b=d*y);var w=Math.round((n-b)/2),j={offset:w-f,size:0};m=r.reduce((C,M)=>{var k,D={stackId:M.stackId,dataKeys:M.dataKeys,position:{offset:j.offset+j.size+f,size:v?y:(k=M.barSize)!==null&&k!==void 0?k:0}},E=[...C,D];return j=D.position,E},h)}else{var _=xn(t,n,0,!0);n-2*_-(d-1)*f<=0&&(f=0);var S=(n-2*_-(d-1)*f)/d;S>1&&(S=Math.round(S));var A=He(l)?Math.min(S,l):S;m=r.reduce((C,M,k)=>[...C,{stackId:M.stackId,dataKeys:M.dataKeys,position:{offset:_+(S+f)*k+(S-A)/2,size:A}}],h)}return m}}var BV=(e,t,n,r,l,s,d)=>{var f=Nt(d)?t:d,m=LV(n,r,l!==s?l:s,e,f);return l!==s&&m!=null&&(m=m.map(h=>Sd(Sd({},h),{},{position:Sd(Sd({},h.position),{},{offset:h.position.offset-l/2})}))),m},UV=(e,t)=>{var n=dm(t);if(!(!e||n==null||t==null)){var r=t.stackId;if(r!=null){var l=e[r];if(l){var s=l.stackedData;if(s)return s.find(d=>d.key===n)}}}},HV=(e,t)=>{if(!(e==null||t==null)){var n=e.find(r=>r.stackId===t.stackId&&t.dataKey!=null&&r.dataKeys.includes(t.dataKey));if(n!=null)return n.position}};function qV(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&He(e.zIndex)?e.zIndex:t}var m4=e=>{var t=e.chartData,n=dt(),r=wn();return x.useEffect(()=>r?()=>{}:(n(CN(t)),()=>{n(CN(void 0))}),[t,n,r]),null},bS={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},h4=bn({name:"brush",initialState:bS,reducers:{setBrushSettings(e,t){return t.payload==null?bS:t.payload}}});h4.actions.setBrushSettings;var KV=h4.reducer;function YV(e){return(e%180+180)%180}var GV=function(t){var n=t.width,r=t.height,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=YV(l),d=s*Math.PI/180,f=Math.atan(r/n),m=d>f&&d{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=mr(e).dots.findIndex(r=>r===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=mr(e).areas.findIndex(r=>r===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=mr(e).lines.findIndex(r=>r===t.payload);n!==-1&&e.lines.splice(n,1)}}}),Vs=p4.actions;Vs.addDot;Vs.removeDot;Vs.addArea;Vs.removeArea;Vs.addLine;Vs.removeLine;var FV=p4.reducer;function XV(e,t){return JV(e)||QV(e,t)||ZV(e,t)||WV()}function WV(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZV(e,t){if(e){if(typeof e=="string")return wS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wS(e,t):void 0}}function wS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.children,n=x.useState("".concat(dc("recharts"),"-clip")),r=XV(n,1),l=r[0],s=Vg();if(s==null)return null;var d=s.x,f=s.y,m=s.width,h=s.height;return x.createElement(eF.Provider,{value:l},x.createElement("defs",null,x.createElement("clipPath",{id:l},x.createElement("rect",{x:d,y:f,height:h,width:m}))),t)};function v4(e,t){if(t<1)return[];if(t===1)return e;for(var n=[],r=0;re*l)return!1;var s=n();return e*(t-e*s/2-r)>=0&&e*(t+e*s/2-l)<=0}function aF(e,t){return v4(e,t+1)}function iF(e,t,n,r,l){for(var s=(r||[]).slice(),d=t.start,f=t.end,m=0,h=1,v=d,y=function(){var j=r==null?void 0:r[m];if(j===void 0)return{v:v4(r,h)};var _=m,S,A=()=>(S===void 0&&(S=n(j,_)),S),C=j.coordinate,M=m===0||Sc(e,C,A,v,f);M||(m=0,v=d,h+=1),M&&(v=C+e*(A()/2+l),m+=h)},b;h<=s.length;)if(b=y(),b)return b.v;return[]}function lF(e,t,n,r,l){var s=(r||[]).slice(),d=s.length;if(d===0)return[];for(var f=t.start,m=t.end,h=1;h<=d;h++){for(var v=(d-1)%h,y=f,b=!0,w=function(){var k=r[_];if(k==null)return 0;var D=_,E,$=()=>(E===void 0&&(E=n(k,D)),E),U=k.coordinate,K=_===v||Sc(e,U,$,y,m);if(!K)return b=!1,1;K&&(y=U+e*($()/2+l))},j,_=v;_(_===void 0&&(_=n(w,b)),_);if(b===d-1){var A=e*(j.coordinate+e*S()/2-m);s[b]=j=yn(yn({},j),{},{tickCoord:A>0?j.coordinate-A*e:j.coordinate})}else s[b]=j=yn(yn({},j),{},{tickCoord:j.coordinate});if(j.tickCoord!=null){var C=Sc(e,j.tickCoord,S,f,m);C&&(m=j.tickCoord-e*(S()/2+l),s[b]=yn(yn({},j),{},{isShow:!0}))}},v=d-1;v>=0;v--)h(v);return s}function dF(e,t,n,r,l,s){var d=(r||[]).slice(),f=d.length,m=t.start,h=t.end;if(s){var v=r[f-1];if(v!=null){var y=n(v,f-1),b=e*(v.coordinate+e*y/2-h);if(d[f-1]=v=yn(yn({},v),{},{tickCoord:b>0?v.coordinate-b*e:v.coordinate}),v.tickCoord!=null){var w=Sc(e,v.tickCoord,()=>y,m,h);w&&(h=v.tickCoord-e*(y/2+l),d[f-1]=yn(yn({},v),{},{isShow:!0}))}}}for(var j=s?f-1:f,_=function(C){var M=d[C];if(M==null)return 1;var k=M,D,E=()=>(D===void 0&&(D=n(M,C)),D);if(C===0){var $=e*(k.coordinate-e*E()/2-m);d[C]=k=yn(yn({},k),{},{tickCoord:$<0?k.coordinate-$*e:k.coordinate})}else d[C]=k=yn(yn({},k),{},{tickCoord:k.coordinate});if(k.tickCoord!=null){var U=Sc(e,k.tickCoord,E,m,h);U&&(m=k.tickCoord+e*(E()/2+l),d[C]=yn(yn({},k),{},{isShow:!0}))}},S=0;S{var $=typeof h=="function"?h(D.value,E):D.value;return j==="width"?nF(oc($,{fontSize:t,letterSpacing:n}),_,y):oc($,{fontSize:t,letterSpacing:n})[j]},A=l[0],C=l[1],M=l.length>=2&&A!=null&&C!=null?rn(C.coordinate-A.coordinate):1,k=rF(s,M,j);return m==="equidistantPreserveStart"?iF(M,k,S,l,d):m==="equidistantPreserveEnd"?lF(M,k,S,l,d):(m==="preserveStart"||m==="preserveStartEnd"?w=dF(M,k,S,l,d,m==="preserveStartEnd"):w=uF(M,k,S,l,d),w.filter(D=>D.isShow))}var fF=e=>{var t=e.ticks,n=e.label,r=e.labelGapWithTick,l=r,s=e.tickSize,d=s===void 0?0:s,f=e.tickMargin,m=f===void 0?0:f,h=0;if(t){Array.from(t).forEach(w=>{if(w){var j=w.getBoundingClientRect();j.width>h&&(h=j.width)}});var v=n?n.getBoundingClientRect().width:0,y=d+m,b=h+y+v+(n?l:0);return Math.round(b)}return 0},mF={xAxis:{},yAxis:{}},y4=bn({name:"renderedTicks",initialState:mF,reducers:{setRenderedTicks:(e,t)=>{var n=t.payload,r=n.axisType,l=n.axisId,s=n.ticks;e[r][l]=s},removeRenderedTicks:(e,t)=>{var n=t.payload,r=n.axisType,l=n.axisId;delete e[r][l]}}}),g4=y4.actions,hF=g4.setRenderedTicks,pF=g4.removeRenderedTicks,vF=y4.reducer,yF=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function _S(e,t){return wF(e)||bF(e,t)||xF(e,t)||gF()}function gF(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xF(e,t){if(e){if(typeof e=="string")return NS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?NS(e,t):void 0}}function NS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{if(r==null||n==null)return hl;var s=t.map(d=>({value:d.value,coordinate:d.coordinate,offset:d.offset,index:d.index}));return l(hF({ticks:s,axisId:r,axisType:n})),()=>{l(pF({axisId:r,axisType:n}))}},[l,t,r,n]),null}var DF=x.forwardRef((e,t)=>{var n=e.ticks,r=n===void 0?[]:n,l=e.tick,s=e.tickLine,d=e.stroke,f=e.tickFormatter,m=e.unit,h=e.padding,v=e.tickTextProps,y=e.orientation,b=e.mirror,w=e.x,j=e.y,_=e.width,S=e.height,A=e.tickSize,C=e.tickMargin,M=e.fontSize,k=e.letterSpacing,D=e.getTicksConfig,E=e.events,$=e.axisType,U=e.axisId,K=Fg(kt(kt({},D),{},{ticks:r}),M,k),T=zn(D),re=rl(l),Z=UC(T.textAnchor)?T.textAnchor:kF(y,b),pe=CF(y,b),fe={};typeof s=="object"&&(fe=s);var ce=kt(kt({},T),{},{fill:"none"},fe),R=K.map(se=>kt({entry:se},EF(se,w,j,_,S,y,A,b,C))),z=R.map(se=>{var ue=se.entry,P=se.line;return x.createElement(Ct,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(ue.value,"-").concat(ue.coordinate,"-").concat(ue.tickCoord)},s&&x.createElement("line",fl({},ce,P,{className:nt("recharts-cartesian-axis-tick-line",Hr(s,"className"))})))}),G=R.map((se,ue)=>{var P,Q,ne=se.entry,I=se.tick,he=kt(kt(kt(kt({verticalAnchor:pe},T),{},{textAnchor:Z,stroke:"none",fill:d},I),{},{index:ue,payload:ne,visibleTicksCount:K.length,tickFormatter:f,padding:h},v),{},{angle:(P=(Q=v==null?void 0:v.angle)!==null&&Q!==void 0?Q:T.angle)!==null&&P!==void 0?P:0}),be=kt(kt({},he),re);return x.createElement(Ct,fl({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(ne.value,"-").concat(ne.coordinate,"-").concat(ne.tickCoord)},Oc(E,ne,ue)),l&&x.createElement(TF,{option:l,tickProps:be,value:"".concat(typeof f=="function"?f(ne.value,ue):ne.value).concat(m||"")}))});return x.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat($,"-ticks")},x.createElement(MF,{ticks:K,axisId:U,axisType:$}),G.length>0&&x.createElement(In,{zIndex:qt.label},x.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat($,"-tick-labels"),ref:t},G)),z.length>0&&x.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat($,"-tick-lines")},z))}),PF=x.forwardRef((e,t)=>{var n=e.axisLine,r=e.width,l=e.height,s=e.className,d=e.hide,f=e.ticks,m=e.axisType,h=e.axisId,v=jF(e,yF),y=x.useState(""),b=_S(y,2),w=b[0],j=b[1],_=x.useState(""),S=_S(_,2),A=S[0],C=S[1],M=x.useRef(null);x.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var D;return fF({ticks:M.current,label:(D=e.labelRef)===null||D===void 0?void 0:D.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var k=x.useCallback(D=>{if(D){var E=D.getElementsByClassName("recharts-cartesian-axis-tick-value");M.current=E;var $=E[0];if($){var U=window.getComputedStyle($),K=U.fontSize,T=U.letterSpacing;(K!==w||T!==A)&&(j(K),C(T))}}},[w,A]);return d||r!=null&&r<=0||l!=null&&l<=0?null:x.createElement(In,{zIndex:e.zIndex},x.createElement(Ct,{className:nt("recharts-cartesian-axis",s)},x.createElement(OF,{x:e.x,y:e.y,width:r,height:l,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:zn(e)}),x.createElement(DF,{ref:k,axisType:m,events:v,fontSize:w,getTicksConfig:e,height:e.height,letterSpacing:A,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:f,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:h}),x.createElement(iY,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},x.createElement(pY,{label:e.label,labelRef:e.labelRef}),e.children)))}),Xg=x.forwardRef((e,t)=>{var n=an(e,Na);return x.createElement(PF,fl({},n,{ref:t}))});Xg.displayName="CartesianAxis";var zF=["x1","y1","x2","y2","key"],IF=["offset"],$F=["xAxisId","yAxisId"],RF=["xAxisId","yAxisId"];function AS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function gn(e){for(var t=1;t{var t=e.fill;if(!t||t==="none")return null;var n=e.fillOpacity,r=e.x,l=e.y,s=e.width,d=e.height,f=e.ry;return x.createElement("rect",{x:r,y:l,ry:f,width:s,height:d,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function x4(e){var t=e.option,n=e.lineItemProps,r;if(x.isValidElement(t))r=x.cloneElement(t,n);else if(typeof t=="function")r=t(n);else{var l,s=n.x1,d=n.y1,f=n.x2,m=n.y2,h=n.key,v=Tf(n,zF),y=(l=zn(v))!==null&&l!==void 0?l:{};y.offset;var b=Tf(y,IF);r=x.createElement("line",Qi({},b,{x1:s,y1:d,x2:f,y2:m,fill:"none",key:h}))}return r}function KF(e){var t=e.x,n=e.width,r=e.horizontal,l=r===void 0?!0:r,s=e.horizontalPoints;if(!l||!s||!s.length)return null;e.xAxisId,e.yAxisId;var d=Tf(e,$F),f=s.map((m,h)=>{var v=gn(gn({},d),{},{x1:t,y1:m,x2:t+n,y2:m,key:"line-".concat(h),index:h});return x.createElement(x4,{key:"line-".concat(h),option:l,lineItemProps:v})});return x.createElement("g",{className:"recharts-cartesian-grid-horizontal"},f)}function YF(e){var t=e.y,n=e.height,r=e.vertical,l=r===void 0?!0:r,s=e.verticalPoints;if(!l||!s||!s.length)return null;e.xAxisId,e.yAxisId;var d=Tf(e,RF),f=s.map((m,h)=>{var v=gn(gn({},d),{},{x1:m,y1:t,x2:m,y2:t+n,key:"line-".concat(h),index:h});return x.createElement(x4,{option:l,lineItemProps:v,key:"line-".concat(h)})});return x.createElement("g",{className:"recharts-cartesian-grid-vertical"},f)}function GF(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,l=e.y,s=e.width,d=e.height,f=e.horizontalPoints,m=e.horizontal,h=m===void 0?!0:m;if(!h||!t||!t.length||f==null)return null;var v=f.map(b=>Math.round(b+l-l)).sort((b,w)=>b-w);l!==v[0]&&v.unshift(0);var y=v.map((b,w)=>{var j=v[w+1],_=j==null,S=_?l+d-b:j-b;if(S<=0)return null;var A=w%t.length;return x.createElement("rect",{key:"react-".concat(w),y:b,x:r,height:S,width:s,stroke:"none",fill:t[A],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return x.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},y)}function VF(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,l=e.fillOpacity,s=e.x,d=e.y,f=e.width,m=e.height,h=e.verticalPoints;if(!n||!r||!r.length)return null;var v=h.map(b=>Math.round(b+s-s)).sort((b,w)=>b-w);s!==v[0]&&v.unshift(0);var y=v.map((b,w)=>{var j=v[w+1],_=j==null,S=_?s+f-b:j-b;if(S<=0)return null;var A=w%r.length;return x.createElement("rect",{key:"react-".concat(w),x:b,y:d,width:S,height:m,stroke:"none",fill:r[A],fillOpacity:l,className:"recharts-cartesian-grid-bg"})});return x.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},y)}var FF=(e,t)=>{var n=e.xAxis,r=e.width,l=e.height,s=e.offset;return KO(Fg(gn(gn(gn({},Na),n),{},{ticks:YO(n),viewBox:{x:0,y:0,width:r,height:l}})),s.left,s.left+s.width,t)},XF=(e,t)=>{var n=e.yAxis,r=e.width,l=e.height,s=e.offset;return KO(Fg(gn(gn(gn({},Na),n),{},{ticks:YO(n),viewBox:{x:0,y:0,width:r,height:l}})),s.top,s.top+s.height,t)},WF={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:qt.grid};function b4(e){var t=h0(),n=p0(),r=JO(),l=gn(gn({},an(e,WF)),{},{x:je(e.x)?e.x:r.left,y:je(e.y)?e.y:r.top,width:je(e.width)?e.width:r.width,height:je(e.height)?e.height:r.height}),s=l.xAxisId,d=l.yAxisId,f=l.x,m=l.y,h=l.width,v=l.height,y=l.syncWithTicks,b=l.horizontalValues,w=l.verticalValues,j=wn(),_=Ne(K=>yN(K,"xAxis",s,j)),S=Ne(K=>yN(K,"yAxis",d,j));if(!Kr(h)||!Kr(v)||!je(f)||!je(m))return null;var A=l.verticalCoordinatesGenerator||FF,C=l.horizontalCoordinatesGenerator||XF,M=l.horizontalPoints,k=l.verticalPoints;if((!M||!M.length)&&typeof C=="function"){var D=b&&b.length,E=C({yAxis:S?gn(gn({},S),{},{ticks:D?b:S.ticks}):void 0,width:t??h,height:n??v,offset:r},D?!0:y);tf(Array.isArray(E),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof E,"]")),Array.isArray(E)&&(M=E)}if((!k||!k.length)&&typeof A=="function"){var $=w&&w.length,U=A({xAxis:_?gn(gn({},_),{},{ticks:$?w:_.ticks}):void 0,width:t??h,height:n??v,offset:r},$?!0:y);tf(Array.isArray(U),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof U,"]")),Array.isArray(U)&&(k=U)}return x.createElement(In,{zIndex:l.zIndex},x.createElement("g",{className:"recharts-cartesian-grid"},x.createElement(qF,{fill:l.fill,fillOpacity:l.fillOpacity,x:l.x,y:l.y,width:l.width,height:l.height,ry:l.ry}),x.createElement(GF,Qi({},l,{horizontalPoints:M})),x.createElement(VF,Qi({},l,{verticalPoints:k})),x.createElement(KF,Qi({},l,{offset:r,horizontalPoints:M,xAxis:_,yAxis:S})),x.createElement(YF,Qi({},l,{offset:r,verticalPoints:k,xAxis:_,yAxis:S}))))}b4.displayName="CartesianGrid";var ZF={},w4=bn({name:"errorBars",initialState:ZF,reducers:{addErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,l=n.errorBar;e[r]||(e[r]=[]),e[r].push(l)},replaceErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,l=n.prev,s=n.next;e[r]&&(e[r]=e[r].map(d=>d.dataKey===l.dataKey&&d.direction===l.direction?s:d))},removeErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,l=n.errorBar;e[r]&&(e[r]=e[r].filter(s=>s.dataKey!==l.dataKey||s.direction!==l.direction))}}}),Wg=w4.actions;Wg.addErrorBar;Wg.replaceErrorBar;Wg.removeErrorBar;var QF=w4.reducer,JF=["children"];function eX(e,t){if(e==null)return{};var n,r,l=tX(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0},rX=x.createContext(nX);function aX(e){var t=e.children,n=eX(e,JF);return x.createElement(rX.Provider,{value:n},t)}function Zg(e,t){var n,r,l=Ne(h=>Da(h,e)),s=Ne(h=>Pa(h,t)),d=(n=l==null?void 0:l.allowDataOverflow)!==null&&n!==void 0?n:Gt.allowDataOverflow,f=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:Vt.allowDataOverflow,m=d||f;return{needClip:m,needClipX:d,needClipY:f}}function j4(e){var t=e.xAxisId,n=e.yAxisId,r=e.clipPathId,l=Vg(),s=Zg(t,n),d=s.needClipX,f=s.needClipY,m=s.needClip,h=Ne(M=>Fk(M,t,!1)),v=Ne(M=>Xk(M,n,!1));if(!m||!l)return null;var y=l.x,b=l.y,w=l.width,j=l.height,_=d&&h?Math.min(h[0],h[1]):y-w/2,S=f&&v?Math.min(v[0],v[1]):b-j/2,A=d&&h?Math.abs(h[1]-h[0]):w*2,C=f&&v?Math.abs(v[1]-v[0]):j*2;return x.createElement("clipPath",{id:"clipPath-".concat(r)},x.createElement("rect",{x:_,y:S,width:A,height:C}))}function iX(e){var t=rl(e),n=3,r=2;if(t!=null){var l=t.r,s=t.strokeWidth,d=Number(l),f=Number(s);return(Number.isNaN(d)||d<0)&&(d=n),(Number.isNaN(f)||f<0)&&(f=r),{r:d,strokeWidth:f}}return{r:n,strokeWidth:r}}function Xr(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(l=>l.id===t))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:d4}function Wr(e,t){var n,r;return(n=(r=e.graphicalItems.cartesianItems.find(l=>l.id===t))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:d4}var _4=(e,t,n)=>pi(e,"xAxis",Xr(e,t),n),N4=(e,t,n)=>hi(e,"xAxis",Xr(e,t),n),S4=(e,t,n)=>pi(e,"yAxis",Wr(e,t),n),A4=(e,t,n)=>hi(e,"yAxis",Wr(e,t),n),lX=X([Ze,_4,S4,N4,A4],(e,t,n,r,l)=>Vr(e,"xAxis")?As(t,r,!1):As(n,l,!1)),sX=(e,t)=>t,O4=X([wm,sX],(e,t)=>e.filter(n=>n.type==="area").find(n=>n.id===t)),E4=e=>{var t=Ze(e),n=Vr(t,"xAxis");return n?"yAxis":"xAxis"},oX=(e,t)=>{var n=E4(e);return n==="yAxis"?Wr(e,t):Xr(e,t)},cX=(e,t,n)=>Nf(e,E4(e),oX(e,t),n),uX=X([O4,cX],(e,t)=>{var n;if(!(e==null||t==null)){var r=e.stackId,l=dm(e);if(!(r==null||l==null)){var s=(n=t[r])===null||n===void 0?void 0:n.stackedData,d=s==null?void 0:s.find(f=>f.key===l);if(d!=null)return d.map(f=>[f[0],f[1]])}}}),dX=X([Ze,_4,S4,N4,A4,uX,NE,lX,O4,t9],(e,t,n,r,l,s,d,f,m,h)=>{var v=d.chartData,y=d.dataStartIndex,b=d.dataEndIndex;if(!(m==null||e!=="horizontal"&&e!=="vertical"||t==null||n==null||r==null||l==null||r.length===0||l.length===0||f==null)){var w=m.data,j;if(w&&w.length>0?j=w:j=v==null?void 0:v.slice(y,b+1),j!=null)return $X({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:l,dataStartIndex:y,areaSettings:m,stackedData:s,displayedData:j,chartBaseValue:h,bandSize:f})}}),fX=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],mX=["id","baseLine"];function cc(){return cc=Object.assign?Object.assign.bind():function(e){for(var t=1;ty.y||0));return je(l)?v=Math.max(l,v):l&&Array.isArray(l)&&l.length&&(v=Math.max(...l.map(y=>y.y||0),v)),je(v)?x.createElement("rect",{x:fy.x||0));return je(l)?v=Math.max(l,v):l&&Array.isArray(l)&&l.length&&(v=Math.max(...l.map(y=>y.x||0),v)),je(v)?x.createElement("rect",{x:0,y:fe==null?[]:t===1?e.flatMap(n=>n.status==="removed"?[]:[n.next]):e.flatMap(n=>n.status==="matched"?[Ps(Ps({},n.next),{},{x:Et(n.prev.x,n.next.x,t),y:Et(n.prev.y,n.next.y,t)})]:n.status==="added"?[n.next]:[]),C4={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:Ug,animationInterpolateFn:SX,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:gX,xAxisId:0,yAxisId:0,zIndex:qt.area};function Df(e,t){return e&&e!=="none"?e:t}var AX=e=>{var t=e.dataKey,n=e.name,r=e.stroke,l=e.fill,s=e.legendType,d=e.hide;return[{inactive:d,dataKey:t,type:s,color:Df(r,l),value:Is(n,t),payload:e}]},OX=x.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,l=e.strokeWidth,s=e.fill,d=e.name,f=e.hide,m=e.unit,h=e.tooltipType,v=e.id,y={dataDefinedOnItem:n,getPosition:hl,settings:{stroke:r,strokeWidth:l,fill:s,dataKey:t,nameKey:void 0,name:Is(d,t),hide:f,type:h,color:Df(r,s),unit:m,graphicalItemId:v}};return x.createElement(Bg,{tooltipEntrySettings:y})});function EX(e){var t=e.clipPathId,n=e.points,r=e.props,l=r.needClip,s=r.dot,d=r.dataKey,f=zn(r);return x.createElement(uV,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:d,baseProps:f,needClip:l,clipPathId:t})}function kX(e){var t=e.showLabels,n=e.children,r=e.points,l=r.map(s=>{var d,f,m={x:(d=s.x)!==null&&d!==void 0?d:0,y:(f=s.y)!==null&&f!==void 0?f:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Ps(Ps({},m),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:m,fill:void 0})});return x.createElement(FC,{value:t?l:void 0},n)}function CX(e){var t=e.points,n=e.baseLine,r=e.needClip,l=e.clipPathId,s=e.props,d=e.animationElapsedTime,f=e.isAnimating,m=e.isEntrance,h=s.layout,v=s.type,y=s.stroke,b=s.connectNulls,w=s.isRange,j=s.shape,_=s.id,S=k4(s,xX),A=Xn(S),C=Ps(Ps({},A),{},{id:_,points:t,connectNulls:b,type:v,baseLine:n,layout:h,stroke:y,isRange:w,animationElapsedTime:d,isAnimating:f,isEntrance:m});return x.createElement(x.Fragment,null,(t==null?void 0:t.length)>1&&x.createElement(Ct,{clipPath:r?"url(#clipPath-".concat(l,")"):void 0},x.createElement(Ig,{option:j,DefaultShape:C4.shape,shapeProps:C})),x.createElement(EX,{points:t,props:S,clipPathId:l}))}function TX(e,t,n){if(je(e)){var r=je(t)?t:void 0;return Et(r,e,n)}if(Nt(e)||Ar(e)){var l=je(t)?t:void 0;return Et(l,0,n)}return e}function MX(e){var t=e.needClip,n=e.clipPathId,r=e.props,l=e.previousPointsRef,s=e.previousBaselineRef,d=r.points,f=r.baseLine,m=r.isAnimationActive,h=r.animationBegin,v=r.animationDuration,y=r.animationEasing,b=r.animationMatchBy,w=r.animationInterpolateFn,j=x.useMemo(()=>({points:d,baseLine:f}),[d,f]),_=l4(j,s),S=v0(),A=Kg(r.onAnimationStart,r.onAnimationEnd),C=A.isAnimating,M=A.handleAnimationStart,k=A.handleAnimationEnd,D=_.startValue;if(S==null)return null;var E;return Array.isArray(f)&&Array.isArray(D)?E=My(D,f,b):Array.isArray(f)?E=My(null,f,b):E=null,x.createElement(Yg,{animationInput:j,animationIdPrefix:"recharts-area-",items:d,previousItemsRef:l,isAnimationActive:m,animationBegin:h,animationDuration:v,animationEasing:y,onAnimationStart:M,onAnimationEnd:k,animationInterpolateFn:w,animationMatchBy:b,layout:S},($,U,K)=>{var T;return U===1?T=f:Array.isArray(f)?T=w(E,U,S):T=K?f:TX(f,D,U),_.syncStepValue(T,U),x.createElement(kX,{showLabels:!C,points:d},r.children,x.createElement(CX,{points:$,baseLine:T,needClip:t,clipPathId:n,props:r,animationElapsedTime:U,isAnimating:C||U<1,isEntrance:K}),x.createElement(Mg,{label:r.label}))})}function DX(e){var t=e.needClip,n=e.clipPathId,r=e.props,l=x.useRef(null),s=x.useRef();return x.createElement(MX,{needClip:t,clipPathId:n,props:r,previousPointsRef:l,previousBaselineRef:s})}class PX extends x.PureComponent{render(){var t=this.props,n=t.hide,r=t.dot,l=t.points,s=t.className,d=t.top,f=t.left,m=t.needClip,h=t.xAxisId,v=t.yAxisId,y=t.width,b=t.height,w=t.id,j=t.baseLine,_=t.zIndex;if(n)return null;var S=nt("recharts-area",s),A=w,C=iX(r),M=C.r,k=C.strokeWidth,D=r4(r),E=M*2+k,$=m?"url(#clipPath-".concat(D?"":"dots-").concat(A,")"):void 0;return x.createElement(In,{zIndex:_},x.createElement(Ct,{className:S},m&&x.createElement("defs",null,x.createElement(j4,{clipPathId:A,xAxisId:h,yAxisId:v}),!D&&x.createElement("clipPath",{id:"clipPath-dots-".concat(A)},x.createElement("rect",{x:f-E/2,y:d-E/2,width:y+E,height:b+E}))),x.createElement(DX,{needClip:m,clipPathId:A,props:this.props})),x.createElement(vS,{points:l,mainColor:Df(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:$}),this.props.isRange&&Array.isArray(j)&&x.createElement(vS,{points:j,mainColor:Df(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:$}))}}function zX(e){var t,n=e.activeDot,r=e.animationBegin,l=e.animationDuration,s=e.animationEasing,d=e.connectNulls,f=e.dot,m=e.fill,h=e.fillOpacity,v=e.hide,y=e.isAnimationActive,b=e.legendType,w=e.stroke,j=e.xAxisId,_=e.yAxisId,S=k4(e,bX),A=pl(),C=EC(),M=Zg(j,_),k=M.needClip,D=wn(),E=(t=Ne(ce=>dX(ce,e.id,D)))!==null&&t!==void 0?t:{},$=E.points,U=E.isRange,K=E.baseLine,T=Vg();if(A!=="horizontal"&&A!=="vertical"||T==null||C!=="AreaChart"&&C!=="ComposedChart")return null;var re=T.height,Z=T.width,pe=T.x,fe=T.y;return!$||!$.length?null:x.createElement(PX,Mf({},S,{activeDot:n,animationBegin:r,animationDuration:l,animationEasing:s,baseLine:K,connectNulls:d,dot:f,fill:m,fillOpacity:h,height:re,hide:v,layout:A,isAnimationActive:y,isRange:U,legendType:b,needClip:k,points:$,stroke:w,width:Z,left:pe,top:fe,xAxisId:j,yAxisId:_}))}var IX=(e,t,n,r,l)=>{var s=n??t;if(je(s))return s;var d=e==="horizontal"?l:r,f=d.scale.domain();if(d.type==="number"){var m=Math.max(f[0],f[1]),h=Math.min(f[0],f[1]);return s==="dataMin"?h:s==="dataMax"||m<0?m:Math.max(Math.min(f[0],f[1]),0)}return s==="dataMin"?f[0]:s==="dataMax"?f[1]:f[0]};function $X(e){var t=e.areaSettings,n=t.connectNulls,r=t.baseValue,l=t.dataKey,s=e.stackedData,d=e.layout,f=e.chartBaseValue,m=e.xAxis,h=e.yAxis,v=e.displayedData,y=e.dataStartIndex,b=e.xAxisTicks,w=e.yAxisTicks,j=e.bandSize,_=s&&s.length,S=IX(d,f,r,m,h),A=d==="horizontal",C=!1,M=v.map((D,E)=>{var $,U,K,T;if(_)T=s[y+E];else{var re=rt(D,l);Array.isArray(re)?(T=re,C=!0):T=[S,re]}var Z=($=(U=T)===null||U===void 0?void 0:U[1])!==null&&$!==void 0?$:null,pe=Z==null||_&&!n&&rt(D,l)==null;if(A){var fe;return{x:s_({axis:m,ticks:b,bandSize:j,entry:D,index:E}),y:pe?null:(fe=h.scale.map(Z))!==null&&fe!==void 0?fe:null,value:T,payload:D}}return{x:pe?null:(K=m.scale.map(Z))!==null&&K!==void 0?K:null,y:s_({axis:h,ticks:w,bandSize:j,entry:D,index:E}),value:T,payload:D}}),k;return _||C?k=M.map(D=>{var E,$=Array.isArray(D.value)?D.value[0]:null;if(A){var U;return{x:D.x,y:$!=null&&D.y!=null&&(U=h.scale.map($))!==null&&U!==void 0?U:null,payload:D.payload}}return{x:$!=null&&(E=m.scale.map($))!==null&&E!==void 0?E:null,y:D.y,payload:D.payload}}):k=A?h.scale.map(S):m.scale.map(S),{points:M,baseLine:k??0,isRange:C}}function RX(e){var t=an(e,C4),n=wn();return x.createElement(Gg,{id:t.id,type:"area"},r=>x.createElement(x.Fragment,null,x.createElement(i4,{legendPayload:AX(t)}),x.createElement(OX,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:r}),x.createElement(c4,{type:"area",id:r,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:GO(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),x.createElement(zX,Mf({},t,{id:r}))))}var T4=x.memo(RX,$s);T4.displayName="Area";var LX="Invariant failed";function BX(e,t){throw new Error(LX)}var UX=["option"];function HX(e,t){if(e==null)return{};var n,r,l=qX(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r1&&arguments[1]!==void 0?arguments[1]:0;return(r,l)=>{if(je(t))return t;var s=je(r)||Nt(r);return s?t(r,l):(s||BX(),n)}},YX=(e,t,n)=>n,GX=(e,t)=>t,Gc=X([wm,GX],(e,t)=>e.filter(n=>n.type==="bar").find(n=>n.id===t)),VX=X([Gc],e=>e==null?void 0:e.maxBarSize),FX=(e,t,n,r)=>r,XX=X([Ze,wm,Xr,Wr,YX],(e,t,n,r,l)=>t.filter(s=>e==="horizontal"?s.xAxisId===n:s.yAxisId===r).filter(s=>s.isPanorama===l).filter(s=>s.hide===!1).filter(s=>s.type==="bar")),WX=(e,t,n)=>{var r=Ze(e),l=Xr(e,t),s=Wr(e,t);if(!(l==null||s==null))return r==="horizontal"?Nf(e,"yAxis",s,n):Nf(e,"xAxis",l,n)},ZX=(e,t)=>{var n=Ze(e),r=Xr(e,t),l=Wr(e,t);if(!(r==null||l==null))return n==="horizontal"?vN(e,"xAxis",r):vN(e,"yAxis",l)},QX=X([XX,e9,ZX],zV),JX=(e,t,n)=>{var r,l,s=Gc(e,t);if(s==null)return 0;var d=Xr(e,t),f=Wr(e,t);if(d==null||f==null)return 0;var m=Ze(e),h=IE(e),v=s.maxBarSize,y=Nt(v)?h:v,b,w;return m==="horizontal"?(b=pi(e,"xAxis",d,n),w=hi(e,"xAxis",d,n)):(b=pi(e,"yAxis",f,n),w=hi(e,"yAxis",f,n)),(r=(l=As(b,w,!0))!==null&&l!==void 0?l:y)!==null&&r!==void 0?r:0},M4=(e,t,n)=>{var r=Ze(e),l=Xr(e,t),s=Wr(e,t);if(!(l==null||s==null)){var d,f;return r==="horizontal"?(d=pi(e,"xAxis",l,n),f=hi(e,"xAxis",l,n)):(d=pi(e,"yAxis",s,n),f=hi(e,"yAxis",s,n)),As(d,f)}},eW=X([QX,IE,J7,$E,JX,M4,VX],BV),tW=(e,t,n)=>{var r=Xr(e,t);if(r!=null)return pi(e,"xAxis",r,n)},nW=(e,t,n)=>{var r=Wr(e,t);if(r!=null)return pi(e,"yAxis",r,n)},rW=(e,t,n)=>{var r=Xr(e,t);if(r!=null)return hi(e,"xAxis",r,n)},aW=(e,t,n)=>{var r=Wr(e,t);if(r!=null)return hi(e,"yAxis",r,n)},iW=X([eW,Gc],HV),lW=X([WX,Gc],UV),sW=X([Wt,d0,tW,nW,rW,aW,iW,Ze,NE,M4,lW,Gc,FX],(e,t,n,r,l,s,d,f,m,h,v,y,b)=>{var w=m.chartData,j=m.dataStartIndex,_=m.dataEndIndex;if(!(y==null||d==null||t==null||f!=="horizontal"&&f!=="vertical"||n==null||r==null||l==null||s==null||h==null)){var S=y.data,A;if(S!=null&&S.length>0?A=S:A=w==null?void 0:w.slice(j,_+1),A!=null)return BW({layout:f,barSettings:y,pos:d,parentViewBox:t,bandSize:h,xAxis:n,yAxis:r,xAxisTicks:l,yAxisTicks:s,stackedData:v,displayedData:A,offset:e,cells:b,dataStartIndex:j})}}),oW=["index"];function Py(){return Py=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=x.useContext(D4);if(t!=null)return t.stackId;if(e!=null)return GO(e)},fW=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),mW=e=>{var t=x.useContext(D4);if(t!=null){var n=t.stackId;return"url(#".concat(fW(n,e),")")}},P4=e=>{var t=e.index,n=cW(e,oW),r=mW(t);return x.createElement(Ct,Py({className:"recharts-bar-stack-layer",clipPath:r},n))},hW=["onMouseEnter","onMouseLeave","onClick"],pW=["value","background","tooltipPosition"],vW=["id"],yW=["onMouseEnter","onClick","onMouseLeave"];function kS(e,t){return wW(e)||bW(e,t)||xW(e,t)||gW()}function gW(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xW(e,t){if(e){if(typeof e=="string")return CS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?CS(e,t):void 0}}function CS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.dataKey,n=e.name,r=e.fill,l=e.legendType,s=e.hide;return[{inactive:s,dataKey:t,type:l,color:r,value:Is(n,t),payload:e}]},OW=x.memo(e=>{var t=e.dataKey,n=e.stroke,r=e.strokeWidth,l=e.fill,s=e.name,d=e.hide,f=e.unit,m=e.tooltipType,h=e.id,v={dataDefinedOnItem:void 0,getPosition:hl,settings:{stroke:n,strokeWidth:r,fill:l,dataKey:t,nameKey:void 0,name:Is(s,t),hide:d,type:m,color:l,unit:f,graphicalItemId:h}};return x.createElement(Bg,{tooltipEntrySettings:v})});function EW(e){var t=Ne(vi),n=e.data,r=e.dataKey,l=e.background,s=e.allOtherBarProps,d=s.onMouseEnter,f=s.onMouseLeave,m=s.onClick,h=Pf(s,hW),v=$g(d,r,s.id),y=Rg(f),b=Lg(m,r,s.id);if(!l||n==null)return null;var w=rl(l);return x.createElement(In,{zIndex:qV(l,qt.barBackground)},n.map((j,_)=>{j.value;var S=j.background;j.tooltipPosition;var A=Pf(j,pW);if(!S)return null;var C=v(j,j.originalDataIndex),M=y(j,j.originalDataIndex),k=b(j,j.originalDataIndex),D=Ft(Ft(Ft(Ft(Ft({option:l,isActive:String(j.originalDataIndex)===t},A),{},{fill:"#eee"},S),w),Oc(h,j,_)),{},{onMouseEnter:C,onMouseLeave:M,onClick:k,dataKey:r,index:_,className:"recharts-bar-background-rectangle"});return x.createElement(Jg,yi({key:"background-bar-".concat(_)},D))}))}function kW(e){var t=e.showLabels,n=e.children,r=e.rects,l=r==null?void 0:r.map(s=>{var d={x:s.x,y:s.y,width:s.width,lowerWidth:s.width,upperWidth:s.width,height:s.height};return Ft(Ft({},d),{},{value:s.value,payload:s.payload,parentViewBox:s.parentViewBox,viewBox:d,fill:s.fill})});return x.createElement(FC,{value:t?l:void 0},n)}function CW(e){var t=e.shape,n=e.activeBar,r=e.baseProps,l=e.entry,s=e.index,d=e.dataKey,f=Ne(vi),m=Ne(Ng),h=n&&String(l.originalDataIndex)===f&&(m==null||d===m),v=x.useState(!1),y=kS(v,2),b=y[0],w=y[1],j=x.useState(!1),_=kS(j,2),S=_[0],A=_[1];x.useEffect(()=>{var $;return h?(w(!0),$=requestAnimationFrame(()=>{A(!0)})):A(!1),()=>{cancelAnimationFrame($)}},[h]);var C=x.useCallback(()=>{h||w(!1)},[h]),M=h&&S,k=h||b,D;h?n===!0?D=t:D=n:D=t;var E=x.createElement(Jg,yi({},r,{name:String(r.name)},l,{isActive:M,option:D,index:s,dataKey:d,animationElapsedTime:e.animationElapsedTime,isAnimating:e.isAnimating,isEntrance:e.isEntrance,onTransitionEnd:C}));return k?x.createElement(In,{zIndex:qt.activeBar},x.createElement(P4,{index:l.originalDataIndex},E)):E}function TW(e){var t=e.shape,n=e.baseProps,r=e.entry,l=e.index,s=e.dataKey;return x.createElement(Jg,yi({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:l,dataKey:s,animationElapsedTime:e.animationElapsedTime,isAnimating:e.isAnimating,isEntrance:e.isEntrance}))}function MW(e){var t,n=e.data,r=e.props,l=e.animationElapsedTime,s=e.isAnimating,d=e.isEntrance,f=(t=zn(r))!==null&&t!==void 0?t:{},m=f.id,h=Pf(f,vW),v=r.shape,y=r.dataKey,b=r.activeBar,w=r.onMouseEnter,j=r.onClick,_=r.onMouseLeave,S=Pf(r,yW),A=$g(w,y,m),C=Rg(_),M=Lg(j,y,m);return n?x.createElement(x.Fragment,null,n.map((k,D)=>x.createElement(P4,yi({index:k.originalDataIndex,key:"rectangle-".concat(k==null?void 0:k.x,"-").concat(k==null?void 0:k.y,"-").concat(k==null?void 0:k.value,"-").concat(D),className:"recharts-bar-rectangle"},Oc(S,k,D),{onMouseEnter:A(k,k.originalDataIndex),onMouseLeave:C(k,k.originalDataIndex),onClick:M(k,k.originalDataIndex)}),b?x.createElement(CW,{shape:v,activeBar:b,baseProps:h,entry:k,index:D,dataKey:y,animationElapsedTime:l,isAnimating:s,isEntrance:d}):x.createElement(TW,{shape:v,baseProps:h,entry:k,index:D,dataKey:y,animationElapsedTime:l,isAnimating:s,isEntrance:d})))):null}var DW=(e,t,n)=>e==null?[]:t===1?e.flatMap(r=>r.status==="removed"?[]:[r.next]):e.flatMap(r=>{if(r.status==="removed")return n==="horizontal"?[Ft(Ft({},r.prev),{},{height:Et(r.prev.height,0,t),y:Et(r.prev.y,r.prev.y+r.prev.height,t)})]:[Ft(Ft({},r.prev),{},{width:Et(r.prev.width,0,t)})];if(r.status==="matched")return[Ft(Ft({},r.next),{},{x:Et(r.prev.x,r.next.x,t),y:Et(r.prev.y,r.next.y,t),width:Et(r.prev.width,r.next.width,t),height:Et(r.prev.height,r.next.height,t)})];var l=r.next;return n==="horizontal"?[Ft(Ft({},l),{},{height:Et(0,l.height,t),y:Et(l.stackedBarStart,l.y,t)})]:[Ft(Ft({},l),{},{width:Et(0,l.width,t),x:Et(l.stackedBarStart,l.x,t)})]});function PW(e){var t=e.props,n=e.previousRectanglesRef,r=t.data,l=t.isAnimationActive,s=t.animationBegin,d=t.animationDuration,f=t.animationEasing,m=t.animationInterpolateFn,h=t.layout,v=Kg(t.onAnimationStart,t.onAnimationEnd),y=v.isAnimating,b=v.handleAnimationStart,w=v.handleAnimationEnd;return x.createElement(kW,{showLabels:!y,rects:r},x.createElement(Yg,{animationInput:r,animationIdPrefix:"recharts-bar-",items:r,previousItemsRef:n,isAnimationActive:l,animationBegin:s,animationDuration:d,animationEasing:f,onAnimationStart:b,onAnimationEnd:w,animationInterpolateFn:m,animationMatchBy:t.animationMatchBy,layout:h},(j,_,S)=>x.createElement(Ct,null,x.createElement(MW,{props:t,data:j,animationElapsedTime:_,isAnimating:y||_<1,isEntrance:S}))),x.createElement(Mg,{label:t.label}),t.children)}function zW(e){var t=x.useRef(null);return x.createElement(PW,{previousRectanglesRef:t,props:e})}var z4=0,IW=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:rt(e,t)}};class $W extends x.PureComponent{render(){var t=this.props,n=t.hide,r=t.data,l=t.dataKey,s=t.className,d=t.xAxisId,f=t.yAxisId,m=t.needClip,h=t.background,v=t.id;if(n||r==null)return null;var y=nt("recharts-bar",s),b=v;return x.createElement(Ct,{className:y,id:v},m&&x.createElement("defs",null,x.createElement(j4,{clipPathId:b,xAxisId:d,yAxisId:f})),x.createElement(Ct,{className:"recharts-bar-rectangles",clipPath:m?"url(#clipPath-".concat(b,")"):void 0},x.createElement(EW,{data:r,dataKey:l,background:h,allOtherBarProps:this.props}),x.createElement(zW,this.props)))}}var RW={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",animationInterpolateFn:DW,animationMatchBy:Hg,background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:z4,shape:Qg,xAxisId:0,yAxisId:0,zIndex:qt.bar};function LW(e){var t=e.xAxisId,n=e.yAxisId,r=e.hide,l=e.legendType,s=e.minPointSize,d=e.activeBar,f=e.animationBegin,m=e.animationDuration,h=e.animationEasing,v=e.isAnimationActive,y=Zg(t,n),b=y.needClip,w=pl(),j=wn(),_=zg(e.children,nl),S=Ne(M=>sW(M,e.id,j,_));if(w!=="vertical"&&w!=="horizontal")return null;var A,C=S==null?void 0:S[0];return C==null||C.height==null||C.width==null?A=0:A=w==="vertical"?C.height/2:C.width/2,x.createElement(aX,{xAxisId:t,yAxisId:n,data:S,dataPointFormatter:IW,errorBarOffset:A},x.createElement($W,yi({},e,{layout:w,needClip:b,data:S,xAxisId:t,yAxisId:n,hide:r,legendType:l,minPointSize:s,activeBar:d,animationBegin:f,animationDuration:m,animationEasing:h,isAnimationActive:v})))}function BW(e){var t=e.layout,n=e.barSettings,r=n.dataKey,l=n.minPointSize,s=n.hasCustomShape,d=e.pos,f=e.bandSize,m=e.xAxis,h=e.yAxis,v=e.xAxisTicks,y=e.yAxisTicks,b=e.stackedData,w=e.displayedData,j=e.offset,_=e.cells,S=e.parentViewBox,A=e.dataStartIndex,C=t==="horizontal"?h:m,M=b?C.scale.domain():null,k=uI({numericAxis:C}),D=C.scale.map(k);return w.map((E,$)=>{var U,K,T,re,Z,pe;if(b){var fe=b[$+A];if(fe==null)return null;U=iI(fe,M)}else U=rt(E,r),Array.isArray(U)||(U=[k,U]);var ce=KX(l,z4)(U[1],$);if(t==="horizontal"){var R,z=h.scale.map(U[0]),G=h.scale.map(U[1]);if(z==null||G==null)return null;K=o_({axis:m,ticks:v,bandSize:f,offset:d.offset,entry:E,index:$}),T=(R=G??z)!==null&&R!==void 0?R:void 0,re=d.size;var se=z-G;if(Z=Ar(se)?0:se,pe={x:K,y:j.top,width:re,height:j.height},Math.abs(ce)>0&&Math.abs(Z)0&&Math.abs(re)x.createElement(x.Fragment,null,x.createElement(i4,{legendPayload:AW(t)}),x.createElement(OW,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:l}),x.createElement(c4,{type:"bar",id:l,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:n,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r,hasCustomShape:t.shape!=null&&t.shape!==Qg}),x.createElement(In,{zIndex:t.zIndex},x.createElement(LW,yi({},t,{id:l})))))}var I4=x.memo(UW,$s);I4.displayName="Bar";var HW=["domain","range"],qW=["domain","range"];function MS(e,t){if(e==null)return{};var n,r,l=KW(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{if(d!=null)return zS(zS({},s),{},{type:d})},[s,d]);return x.useLayoutEffect(()=>{f!=null&&(n.current===null?t(pV(f)):n.current!==f&&t(vV({prev:n.current,next:f})),n.current=f)},[f,t]),x.useLayoutEffect(()=>()=>{n.current&&(t(yV(n.current)),n.current=null)},[t]),null}var JW=e=>{var t=e.xAxisId,n=e.className,r=Ne(d0),l=wn(),s="xAxis",d=Ne(b=>rC(b,s,t,l)),f=Ne(b=>eC(b,t)),m=Ne(b=>IU(b,t)),h=Ne(b=>Ck(b,t));if(f==null||m==null||h==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var v=Iy(e,GW);h.id,h.scale;var y=Iy(h,VW);return x.createElement(Xg,zy({},v,y,{x:m.x,y:m.y,width:f.width,height:f.height,className:nt("recharts-".concat(s," ").concat(s),n),viewBox:r,ticks:d,axisType:s,axisId:t}))},eZ={allowDataOverflow:Gt.allowDataOverflow,allowDecimals:Gt.allowDecimals,allowDuplicatedCategory:Gt.allowDuplicatedCategory,angle:Gt.angle,axisLine:Na.axisLine,height:Gt.height,hide:!1,includeHidden:Gt.includeHidden,interval:Gt.interval,label:!1,minTickGap:Gt.minTickGap,mirror:Gt.mirror,orientation:Gt.orientation,padding:Gt.padding,reversed:Gt.reversed,scale:Gt.scale,tick:Gt.tick,tickCount:Gt.tickCount,tickLine:Na.tickLine,tickSize:Na.tickSize,type:Gt.type,niceTicks:Gt.niceTicks,xAxisId:0},tZ=e=>{var t=an(e,eZ);return x.createElement(x.Fragment,null,x.createElement(QW,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),x.createElement(JW,t))},$y=x.memo(tZ,$4);$y.displayName="XAxis";var nZ=["type"],rZ=["dangerouslySetInnerHTML","ticks","scale"],aZ=["id","scale"];function Ry(){return Ry=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(d!=null)return $S($S({},s),{},{type:d})},[d,s]);return x.useLayoutEffect(()=>{f!=null&&(n.current===null?t(gV(f)):n.current!==f&&t(xV({prev:n.current,next:f})),n.current=f)},[f,t]),x.useLayoutEffect(()=>()=>{n.current&&(t(bV(n.current)),n.current=null)},[t]),null}function uZ(e){var t=e.yAxisId,n=e.className,r=e.width,l=e.label,s=x.useRef(null),d=x.useRef(null),f=Ne(d0),m=wn(),h=dt(),v="yAxis",y=Ne(A=>tC(A,t)),b=Ne(A=>RU(A,t)),w=Ne(A=>rC(A,v,t,m)),j=Ne(A=>Tk(A,t));if(x.useLayoutEffect(()=>{if(!(r!=="auto"||!y||Tg(l)||x.isValidElement(l)||j==null)){var A=s.current;if(A){var C=A.getCalculatedWidth();Math.round(y.width)!==Math.round(C)&&h(wV({id:t,width:C}))}}},[w,y,h,l,t,r,j]),y==null||b==null||j==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var _=Ly(e,rZ);j.id,j.scale;var S=Ly(j,aZ);return x.createElement(Xg,Ry({},_,S,{ref:s,labelRef:d,x:b.x,y:b.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:y.width,height:y.height,className:nt("recharts-".concat(v," ").concat(v),n),viewBox:f,ticks:w,axisType:v,axisId:t}))}var dZ={allowDataOverflow:Vt.allowDataOverflow,allowDecimals:Vt.allowDecimals,allowDuplicatedCategory:Vt.allowDuplicatedCategory,angle:Vt.angle,axisLine:Na.axisLine,hide:!1,includeHidden:Vt.includeHidden,interval:Vt.interval,label:!1,minTickGap:Vt.minTickGap,mirror:Vt.mirror,orientation:Vt.orientation,padding:Vt.padding,reversed:Vt.reversed,scale:Vt.scale,tick:Vt.tick,tickCount:Vt.tickCount,tickLine:Na.tickLine,tickSize:Na.tickSize,type:Vt.type,niceTicks:Vt.niceTicks,width:Vt.width,yAxisId:0},fZ=e=>{var t=an(e,dZ);return x.createElement(x.Fragment,null,x.createElement(cZ,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),x.createElement(uZ,t))},By=x.memo(fZ,$4);By.displayName="YAxis";var mZ=(e,t)=>t,ex=X([mZ,Ze,KE,ln,wC,za,iq,Wt],fq);function hZ(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function tx(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(hZ(e)){var l=e.currentTarget.getBBox();n=l.width>0?t.width/l.width:1,r=l.height>0?t.height/l.height:1}else{var s=e.currentTarget;n=s.offsetWidth>0?t.width/s.offsetWidth:1,r=s.offsetHeight>0?t.height/s.offsetHeight:1}var d=(f,m)=>({relativeX:Math.round((f-t.left)/n),relativeY:Math.round((m-t.top)/r)});return"touches"in e?Array.from(e.touches).map(f=>d(f.clientX,f.clientY)):d(e.clientX,e.clientY)}var R4=Wn("mouseClick"),L4=kc();L4.startListening({actionCreator:R4,effect:(e,t)=>{var n=e.payload,r=ex(t.getState(),tx(n));(r==null?void 0:r.activeIndex)!=null&&t.dispatch(eH({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var Uy=Wn("mouseMove"),B4=kc(),us=null,Ui=null,zv=null;B4.startListening({actionCreator:Uy,effect:(e,t)=>{var n=e.payload,r=t.getState(),l=r.eventSettings,s=l.throttleDelay,d=l.throttledEvents,f=d==="all"||(d==null?void 0:d.includes("mousemove"));us!==null&&(cancelAnimationFrame(us),us=null),Ui!==null&&(typeof s!="number"||!f)&&(clearTimeout(Ui),Ui=null),zv=tx(n);var m=()=>{var h=t.getState(),v=Kc(h,h.tooltip.settings.shared);if(!zv){us=null,Ui=null;return}if(v==="axis"){var y=ex(h,zv);(y==null?void 0:y.activeIndex)!=null?t.dispatch(dC({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate})):t.dispatch(uC())}us=null,Ui=null};if(!f){m();return}s==="raf"?us=requestAnimationFrame(m):typeof s=="number"&&Ui===null&&(Ui=setTimeout(m,s))}});function pZ(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<>":t}var RS={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},U4=bn({name:"rootProps",initialState:RS,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(n=t.payload.barGap)!==null&&n!==void 0?n:RS.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),vZ=U4.reducer,yZ=U4.actions.updateOptions,gZ=null,xZ={updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)},H4=bn({name:"polarOptions",initialState:gZ,reducers:xZ}),bZ=H4.actions.updatePolarOptions,wZ=H4.reducer,q4=Wn("keyDown"),K4=Wn("focus"),Y4=Wn("blur"),Mm=kc(),ds=null,Hi=null,Ad=null;Mm.startListening({actionCreator:q4,effect:(e,t)=>{Ad=e.payload,ds!==null&&(cancelAnimationFrame(ds),ds=null);var n=t.getState(),r=n.eventSettings,l=r.throttleDelay,s=r.throttledEvents,d=s==="all"||s.includes("keydown");Hi!==null&&(typeof l!="number"||!d)&&(clearTimeout(Hi),Hi=null);var f=()=>{try{var m=t.getState(),h=m.rootProps.accessibilityLayer!==!1;if(!h)return;var v=m.tooltip.keyboardInteraction,y=Ad;if(y!=="ArrowRight"&&y!=="ArrowLeft"&&y!=="Enter")return;var b=sc(v,ul(m),Ms(m),Ds(m)),w=b==null?-1:Number(b),j=!Number.isFinite(w)||w<0,_=za(m),S=ul(m),A=Kc(m,m.tooltip.settings.shared);if(y==="Enter"){if(j)return;var C=Of(m,A,"hover",String(v.index));t.dispatch(Af({active:!v.active,activeIndex:v.index,activeCoordinate:C}));return}var M=qU(m),k=M==="left-to-right"?1:-1,D=y==="ArrowRight"?1:-1,E;if(j){var $=Ms(m),U=Ds(m),K=D*k,T=ce=>({active:!1,index:String(ce),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(E=-1,K>0){for(var re=0;re=0;Z--)if(sc(T(Z),S,$,U)!=null){E=Z;break}if(E<0)return}else{E=w+D*k;var pe=(_==null?void 0:_.length)||S.length;if(pe===0||E>=pe||E<0)return}var fe=Of(m,A,"hover",String(E));t.dispatch(Af({active:!0,activeIndex:E.toString(),activeCoordinate:fe}))}finally{ds=null,Hi=null}};if(!d){f();return}l==="raf"?ds=requestAnimationFrame(f):typeof l=="number"&&Hi===null&&(f(),Ad=null,Hi=setTimeout(()=>{Ad?f():(Hi=null,ds=null)},l))}});Mm.startListening({actionCreator:K4,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var l=n.tooltip.keyboardInteraction;if(!l.active&&l.index==null){var s="0",d=Kc(n,n.tooltip.settings.shared),f=Of(n,d,"hover",String(s));t.dispatch(Af({active:!0,activeIndex:s,activeCoordinate:f}))}}}});Mm.startListening({actionCreator:Y4,effect:(e,t)=>{var n=t.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var l=n.tooltip.keyboardInteraction;l.active&&t.dispatch(Af({active:!1,activeIndex:l.index,activeCoordinate:l.coordinate}))}}});function G4(e){e.persist();var t=e.currentTarget;return new Proxy(e,{get:(n,r)=>{if(r==="currentTarget")return t;var l=Reflect.get(n,r);return typeof l=="function"?l.bind(n):l}})}var dr=Wn("externalEvent"),V4=kc(),Od=new Map,Wo=new Map,Iv=new Map;V4.startListening({actionCreator:dr,effect:(e,t)=>{var n=e.payload,r=n.handler,l=n.reactEvent;if(r!=null){var s=l.type,d=G4(l);Iv.set(s,{handler:r,reactEvent:d});var f=Od.get(s);f!==void 0&&(cancelAnimationFrame(f),Od.delete(s));var m=t.getState(),h=m.eventSettings,v=h.throttleDelay,y=h.throttledEvents,b=y,w=b==="all"||(b==null?void 0:b.includes(s)),j=Wo.get(s);j!==void 0&&(typeof v!="number"||!w)&&(clearTimeout(j),Wo.delete(s));var _=()=>{var C=Iv.get(s);try{if(!C)return;var M=C.handler,k=C.reactEvent,D=t.getState(),E={activeCoordinate:KH(D),activeDataKey:Ng(D),activeIndex:vi(D),activeLabel:NC(D),activeTooltipIndex:vi(D),isTooltipActive:YH(D)};M&&M(E,k)}finally{Od.delete(s),Wo.delete(s),Iv.delete(s)}};if(!w){_();return}if(v==="raf"){var S=requestAnimationFrame(_);Od.set(s,S)}else if(typeof v=="number"){if(!Wo.has(s)){_();var A=setTimeout(_,v);Wo.set(s,A)}}else _()}}});var jZ=X([Ys],e=>e.tooltipItemPayloads),_Z=X([jZ,(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(s=>s.settings.graphicalItemId===n);if(r!=null){var l=r.getPosition;if(l!=null)return l(t)}}}),F4=Wn("touchMove"),X4=kc(),qi=null,li=null,LS=null,Zo=null;X4.startListening({actionCreator:F4,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){Zo=G4(n);var r=t.getState(),l=r.eventSettings,s=l.throttleDelay,d=l.throttledEvents,f=d==="all"||d.includes("touchmove");qi!==null&&(cancelAnimationFrame(qi),qi=null),li!==null&&(typeof s!="number"||!f)&&(clearTimeout(li),li=null),LS=Array.from(n.touches).map(h=>tx({clientX:h.clientX,clientY:h.clientY,currentTarget:n.currentTarget}));var m=()=>{if(Zo!=null){var h=t.getState(),v=Kc(h,h.tooltip.settings.shared);if(v==="axis"){var y,b=(y=LS)===null||y===void 0?void 0:y[0];if(b==null){qi=null,li=null;return}var w=ex(h,b);(w==null?void 0:w.activeIndex)!=null&&t.dispatch(dC({activeIndex:w.activeIndex,activeDataKey:void 0,activeCoordinate:w.activeCoordinate}))}else if(v==="item"){var j,_=Zo.touches[0];if(document.elementFromPoint==null||_==null)return;var S=document.elementFromPoint(_.clientX,_.clientY);if(!S||!S.getAttribute)return;var A=S.getAttribute(FO),C=(j=S.getAttribute(XO))!==null&&j!==void 0?j:void 0,M=gl(h).find(E=>E.id===C);if(A==null||M==null||C==null)return;var k=M.dataKey,D=_Z(h,A,C);t.dispatch(cC({activeDataKey:k,activeIndex:A,activeCoordinate:D,activeGraphicalItemId:C}))}qi=null,li=null}};if(!f){m();return}s==="raf"?qi=requestAnimationFrame(m):typeof s=="number"&&li===null&&(m(),Zo=null,li=setTimeout(()=>{Zo?m():(li=null,qi=null)},s))}}});var nx={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},W4=bn({name:"eventSettings",initialState:nx,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),NZ=W4.actions.setEventSettings,SZ=W4.reducer,AZ=pO({brush:KV,cartesianAxis:jV,chartData:Hq,errorBars:QF,eventSettings:SZ,graphicalItems:SG,layout:eI,legend:f$,options:$q,polarAxis:TY,polarOptions:wZ,referenceElements:FV,renderedTicks:vF,rootProps:vZ,tooltip:tH,zIndex:Sq}),OZ=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return S8({reducer:AZ,preloadedState:t,middleware:r=>{var l;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((l="es6")!==null&&l!==void 0?l:"")}).concat([L4.middleware,B4.middleware,Mm.middleware,V4.middleware,X4.middleware])},enhancers:r=>{var l=r;return typeof r=="function"&&(l=r()),l.concat(CO({type:"raf"}))},devTools:{serialize:{replacer:pZ},name:"recharts-".concat(n)}})};function Z4(e){var t=e.preloadedState,n=e.children,r=e.reduxStoreName,l=wn(),s=x.useRef(null);if(l)return n;s.current==null&&(s.current=OZ(t,r));var d=a0;return x.createElement(E$,{context:d,store:s.current},n)}function EZ(e){var t=e.layout,n=e.margin,r=dt(),l=wn();return x.useEffect(()=>{l||(r(Z8(t)),r(W8(n)))},[r,l,t,n]),null}var Q4=x.memo(EZ,$s);function J4(e){var t=dt();return x.useEffect(()=>{t(yZ(e))},[t,e]),null}var kZ=e=>{var t=dt();return x.useEffect(()=>{t(NZ(e))},[t,e]),null},e5=x.memo(kZ,$s);function BS(e){var t=e.zIndex,n=e.isPanorama,r=x.useRef(null),l=dt();return x.useLayoutEffect(()=>(r.current&&l(_q({zIndex:t,element:r.current,isPanorama:n})),()=>{l(Nq({zIndex:t,isPanorama:n}))}),[l,t,n]),x.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(t)})}function US(e){var t=e.children,n=e.isPanorama,r=Ne(hq);if(!r||r.length===0)return t;var l=r.filter(d=>d<0),s=r.filter(d=>d>0);return x.createElement(x.Fragment,null,l.map(d=>x.createElement(BS,{key:d,zIndex:d,isPanorama:n})),t,s.map(d=>x.createElement(BS,{key:d,zIndex:d,isPanorama:n})))}var CZ=["children"];function TZ(e,t){if(e==null)return{};var n,r,l=MZ(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var n=h0(),r=p0(),l=fE();if(!Kr(n)||!Kr(r))return null;var s=e.children,d=e.otherAttributes,f=e.title,m=e.desc,h,v;return d!=null&&(typeof d.tabIndex=="number"?h=d.tabIndex:h=l?0:void 0,typeof d.role=="string"?v=d.role:v=l?"application":void 0),x.createElement(Wy,zf({},d,{title:f,desc:m,role:v,tabIndex:h,width:n,height:r,style:DZ,ref:t}),s)}),zZ=e=>{var t=e.children,n=Ne(nm);if(!n)return null;var r=n.width,l=n.height,s=n.y,d=n.x;return x.createElement(Wy,{width:r,height:l,x:d,y:s},t)},HS=x.forwardRef((e,t)=>{var n=e.children,r=TZ(e,CZ),l=wn();return l?x.createElement(zZ,null,x.createElement(US,{isPanorama:!0},n)):x.createElement(PZ,zf({ref:t},r),x.createElement(US,{isPanorama:!1},n))});function IZ(e,t){return BZ(e)||LZ(e,t)||RZ(e,t)||$Z()}function $Z(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RZ(e,t){if(e){if(typeof e=="string")return qS(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qS(e,t):void 0}}function qS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{if(r!=null){var d=r.getBoundingClientRect(),f=d.width/r.offsetWidth;He(f)&&f!==s&&e(J8(f))}},[r,e,s]),l}function KS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,r)}return n}function HZ(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n(Zq(),null);function $f(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var ZZ=x.forwardRef((e,t)=>{var n,r,l=x.useRef(null),s=x.useState({containerWidth:$f((n=e.style)===null||n===void 0?void 0:n.width),containerHeight:$f((r=e.style)===null||r===void 0?void 0:r.height)}),d=If(s,2),f=d[0],m=d[1],h=x.useCallback((y,b)=>{m(w=>{var j=Math.round(y),_=Math.round(b);return w.containerWidth===j&&w.containerHeight===_?w:{containerWidth:j,containerHeight:_}})},[]),v=x.useCallback(y=>{if(typeof t=="function"&&t(y),l.current!=null&&(l.current.disconnect(),l.current=null),y!=null&&typeof ResizeObserver<"u"){var b=y.getBoundingClientRect(),w=b.width,j=b.height;h(w,j);var _=A=>{var C=A[0];if(C!=null){var M=C.contentRect,k=M.width,D=M.height;h(k,D)}},S=new ResizeObserver(_);S.observe(y),l.current=S}},[t,h]);return x.useEffect(()=>()=>{var y=l.current;y!=null&&y.disconnect()},[h]),x.createElement(x.Fragment,null,x.createElement(Tc,{width:f.containerWidth,height:f.containerHeight}),x.createElement("div",mi({ref:v},e)))}),QZ=x.forwardRef((e,t)=>{var n=e.width,r=e.height,l=x.useState({containerWidth:$f(n),containerHeight:$f(r)}),s=If(l,2),d=s[0],f=s[1],m=x.useCallback((v,y)=>{f(b=>{var w=Math.round(v),j=Math.round(y);return b.containerWidth===w&&b.containerHeight===j?b:{containerWidth:w,containerHeight:j}})},[]),h=x.useCallback(v=>{if(typeof t=="function"&&t(v),v!=null){var y=v.getBoundingClientRect(),b=y.width,w=y.height;m(b,w)}},[t,m]);return x.createElement(x.Fragment,null,x.createElement(Tc,{width:d.containerWidth,height:d.containerHeight}),x.createElement("div",mi({ref:h},e)))}),JZ=x.forwardRef((e,t)=>{var n=e.width,r=e.height;return x.createElement(x.Fragment,null,x.createElement(Tc,{width:n,height:r}),x.createElement("div",mi({ref:t},e)))}),eQ=x.forwardRef((e,t)=>{var n=e.width,r=e.height;return typeof n=="string"||typeof r=="string"?x.createElement(QZ,mi({},e,{ref:t})):typeof n=="number"&&typeof r=="number"?x.createElement(JZ,mi({},e,{width:n,height:r,ref:t})):x.createElement(x.Fragment,null,x.createElement(Tc,{width:n,height:r}),x.createElement("div",mi({ref:t},e)))});function tQ(e){return e?ZZ:eQ}var nQ=x.forwardRef((e,t)=>{var n=e.children,r=e.className,l=e.height,s=e.onClick,d=e.onContextMenu,f=e.onDoubleClick,m=e.onMouseDown,h=e.onMouseEnter,v=e.onMouseLeave,y=e.onMouseMove,b=e.onMouseUp,w=e.onTouchEnd,j=e.onTouchMove,_=e.onTouchStart,S=e.style,A=e.width,C=e.responsive,M=e.dispatchTouchEvents,k=M===void 0?!0:M,D=x.useRef(null),E=dt(),$=x.useState(null),U=If($,2),K=U[0],T=U[1],re=x.useState(null),Z=If(re,2),pe=Z[0],fe=Z[1],ce=UZ(),R=f0(),z=(R==null?void 0:R.width)>0?R.width:A,G=(R==null?void 0:R.height)>0?R.height:l,se=x.useCallback(Y=>{ce(Y),typeof t=="function"&&t(Y),T(Y),fe(Y),Y!=null&&(D.current=Y)},[ce,t,T,fe]),ue=x.useCallback(Y=>{E(R4(Y)),E(dr({handler:s,reactEvent:Y}))},[E,s]),P=x.useCallback(Y=>{E(Uy(Y)),E(dr({handler:h,reactEvent:Y}))},[E,h]),Q=x.useCallback(Y=>{E(uC()),E(dr({handler:v,reactEvent:Y}))},[E,v]),ne=x.useCallback(Y=>{E(Uy(Y)),E(dr({handler:y,reactEvent:Y}))},[E,y]),I=x.useCallback(()=>{E(K4())},[E]),he=x.useCallback(()=>{E(Y4())},[E]),be=x.useCallback(Y=>{E(q4(Y.key))},[E]),_e=x.useCallback(Y=>{E(dr({handler:d,reactEvent:Y}))},[E,d]),W=x.useCallback(Y=>{E(dr({handler:f,reactEvent:Y}))},[E,f]),V=x.useCallback(Y=>{E(dr({handler:m,reactEvent:Y}))},[E,m]),ye=x.useCallback(Y=>{E(dr({handler:b,reactEvent:Y}))},[E,b]),xe=x.useCallback(Y=>{E(dr({handler:_,reactEvent:Y}))},[E,_]),ae=x.useCallback(Y=>{k&&E(F4(Y)),E(dr({handler:j,reactEvent:Y}))},[E,k,j]),Le=x.useCallback(Y=>{E(dr({handler:w,reactEvent:Y}))},[E,w]),Ce=tQ(C);return x.createElement(DC.Provider,{value:K},x.createElement(AA.Provider,{value:pe},x.createElement(Ce,{width:z??(S==null?void 0:S.width),height:G??(S==null?void 0:S.height),className:nt("recharts-wrapper",r),style:HZ({position:"relative",cursor:"default",width:z,height:G},S),onClick:ue,onContextMenu:_e,onDoubleClick:W,onFocus:I,onBlur:he,onKeyDown:be,onMouseDown:V,onMouseEnter:P,onMouseLeave:Q,onMouseMove:ne,onMouseUp:ye,onTouchEnd:Le,onTouchMove:ae,onTouchStart:xe,ref:se},x.createElement(WZ,null),n)))}),rQ=["width","height","responsive","children","className","style","compact","title","desc"];function aQ(e,t){if(e==null)return{};var n,r,l=iQ(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r{var n=e.width,r=e.height,l=e.responsive,s=e.children,d=e.className,f=e.style,m=e.compact,h=e.title,v=e.desc,y=aQ(e,rQ),b=zn(y);return m?x.createElement(x.Fragment,null,x.createElement(Tc,{width:n,height:r}),x.createElement(HS,{otherAttributes:b,title:h,desc:v},s)):x.createElement(nQ,{className:d,style:f,width:n,height:r,responsive:l??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},x.createElement(HS,{otherAttributes:b,title:h,desc:v,ref:t},x.createElement(tF,null,s)))});function Hy(){return Hy=Object.assign?Object.assign.bind():function(e){for(var t=1;tx.createElement(n5,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:fQ,tooltipPayloadSearcher:kg,categoricalChartProps:e,ref:t}));function hQ(e){var t=dt();return x.useEffect(()=>{t(bZ(e))},[t,e]),null}var pQ=["layout"];function qy(){return qy=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=an(e,EQ);return x.createElement(_Q,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:OQ,tooltipPayloadSearcher:kg,categoricalChartProps:n,ref:t})}),kQ=["axis"],CQ=x.forwardRef((e,t)=>x.createElement(n5,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:kQ,tooltipPayloadSearcher:kg,categoricalChartProps:e,ref:t}));const TQ=({status:e})=>{const t={processing:"bg-blue-100 text-blue-800",pending_ship:"bg-[#0094f7] text-white",shipped:"bg-blue-100 text-blue-700",completed:"bg-green-100 text-green-700",cancelled:"bg-gray-100 text-gray-500",refunding:"bg-red-100 text-red-600"},n={processing:"处理中",pending_ship:"待发货",shipped:"已发货",completed:"已完成",cancelled:"已取消",refunding:"退款中"};return c.jsx("span",{className:`px-3 py-1.5 rounded-lg text-xs font-bold ${t[e]||t.cancelled}`,children:n[e]||e})},Ed=({title:e,value:t,icon:n,colorClass:r,trend:l})=>c.jsxs("div",{className:"ios-card p-6 rounded-xl flex flex-col justify-between hover:translate-y-[-4px] transition-all duration-300 h-full relative overflow-hidden group border-0",children:[c.jsx("div",{className:`absolute -right-6 -top-6 w-32 h-32 ${r} opacity-10 rounded-full group-hover:scale-125 transition-transform duration-500 blur-2xl`}),c.jsxs("div",{className:"flex justify-between items-start mb-6",children:[c.jsx("div",{className:`p-4 rounded-2xl ${r} bg-opacity-10 backdrop-blur-sm`,children:c.jsx(n,{className:`w-6 h-6 ${r.replace("bg-","text-")}`})}),l&&c.jsxs("span",{className:"text-xs font-bold text-white bg-[#0094f7] px-3 py-1.5 rounded-full flex items-center gap-1 shadow-sm",children:[c.jsx(lD,{className:"w-3 h-3"})," ",l]})]}),c.jsxs("div",{className:"relative z-10",children:[c.jsx("h3",{className:"text-3xl font-extrabold text-gray-900 tracking-tight font-feature-settings-tnum",children:t}),c.jsx("p",{className:"text-gray-500 text-sm font-medium mt-1",children:e})]})]}),ZS=()=>{var be,_e;const[e,t]=x.useState(null),[n,r]=x.useState(null),[l,s]=x.useState("7days"),[d,f]=x.useState(""),[m,h]=x.useState(""),[v,y]=x.useState(null),[b,w]=x.useState(""),[j,_]=x.useState([]),[S,A]=x.useState(!1),[C,M]=x.useState([]),[k,D]=x.useState({}),E=["#0094f7","#3B82F6","#10B981","#F59E0B","#8B5CF6"],$=W=>{const V=W.getFullYear(),ye=String(W.getMonth()+1).padStart(2,"0"),xe=String(W.getDate()).padStart(2,"0");return`${V}-${ye}-${xe}`},U=W=>{const V=new Date,ye=$(V);let xe=ye;if(W==="yesterday"){const ae=new Date(V);ae.setDate(ae.getDate()-1);const Le=$(ae);return{startDate:Le,endDate:Le}}if(W==="3days"){const ae=new Date(V);ae.setDate(ae.getDate()-3),xe=$(ae)}else if(W==="7days"){const ae=new Date(V);ae.setDate(ae.getDate()-7),xe=$(ae)}else if(W==="30days"){const ae=new Date(V);ae.setDate(ae.getDate()-30),xe=$(ae)}else{if(W==="custom"&&d&&m)return{startDate:d,endDate:m};if(W==="custom"){const ae=new Date(V);ae.setDate(ae.getDate()-7),xe=$(ae)}}return{startDate:xe,endDate:ye}},K=W=>{const{startDate:V,endDate:ye}=U(W);A(!0),UD({start_date:V,end_date:ye}).then(_).catch(console.error).finally(()=>A(!1))},T=W=>{const V=new Date,{startDate:ye,endDate:xe}=U(W),ae={start_date:ye,end_date:xe},Le=re(W,V);Le&&bj(Le).then(y).catch(console.error),bj(ae).then(r).catch(console.error)},re=(W,V)=>{switch(V.getFullYear(),String(V.getMonth()+1).padStart(2,"0"),String(V.getDate()).padStart(2,"0"),W){case"today":const ye=new Date(V);ye.setDate(ye.getDate()-1);const xe=ye.getFullYear(),ae=String(ye.getMonth()+1).padStart(2,"0"),Le=String(ye.getDate()).padStart(2,"0");return{start_date:`${xe}-${ae}-${Le}`,end_date:`${xe}-${ae}-${Le}`};case"yesterday":const Ce=new Date(V);Ce.setDate(Ce.getDate()-2);const Y=Ce.getFullYear(),ge=String(Ce.getMonth()+1).padStart(2,"0"),Pe=String(Ce.getDate()).padStart(2,"0");return{start_date:`${Y}-${ge}-${Pe}`,end_date:`${Y}-${ge}-${Pe}`};case"7days":const Be=new Date(V);Be.setDate(Be.getDate()-7);const Ve=new Date(Be);return Ve.setDate(Ve.getDate()-7),{start_date:`${Ve.getFullYear()}-${String(Ve.getMonth()+1).padStart(2,"0")}-${String(Ve.getDate()).padStart(2,"0")}`,end_date:`${Be.getFullYear()}-${String(Be.getMonth()+1).padStart(2,"0")}-${String(Be.getDate()).padStart(2,"0")}`};case"30days":const Dt=new Date(V);Dt.setDate(Dt.getDate()-30);const ie=new Date(Dt);return ie.setDate(ie.getDate()-30),{start_date:`${ie.getFullYear()}-${String(ie.getMonth()+1).padStart(2,"0")}-${String(ie.getDate()).padStart(2,"0")}`,end_date:`${Dt.getFullYear()}-${String(Dt.getMonth()+1).padStart(2,"0")}-${String(Dt.getDate()).padStart(2,"0")}`};default:return null}},Z=()=>{if(!n||!v)return null;const W=n.revenue_stats.total_amount,V=v.revenue_stats.total_amount;if(V===0)return W>0?"+100%":"0%";const ye=(W-V)/V*100;return`${ye>=0?"+":""}${ye.toFixed(1)}%`};if(x.useEffect(()=>{BD().then(t).catch(console.error),T(l),Ns().then(W=>{M(W);const V={};W.forEach(ye=>{V[ye.item_id]=ye.item_title||ye.item_id}),D(V)}).catch(console.error)},[l]),x.useEffect(()=>{K(l)},[l]),!e||!n)return c.jsx("div",{className:"p-8 flex justify-center text-gray-400",children:c.jsx(uj,{className:"w-8 h-8 animate-spin text-[#0094f7]"})});const pe=((be=n.daily_stats)==null?void 0:be.map(W=>({name:W.date.slice(5),amount:W.amount,orders:W.order_count,avgAmount:W.order_count>0?(W.amount/W.order_count).toFixed(2):0})))||[],fe=n.item_stats||[],ce=n.revenue_stats.total_orders||0,R=n.revenue_stats.total_amount||0,z=fe.length>0?fe.map(W=>({name:(k[W.item_id]||W.item_id).length>12?(k[W.item_id]||W.item_id).substring(0,12)+"...":k[W.item_id]||W.item_id,sales:W.order_count})).sort((W,V)=>V.sales-W.sales).slice(0,10):[],G=Math.max(...z.map(W=>W.sales),1),se=fe.length>0?fe.map(W=>({name:(k[W.item_id]||W.item_id).length>10?(k[W.item_id]||W.item_id).substring(0,10)+"...":k[W.item_id]||W.item_id,value:W.order_count,percent:ce>0?W.order_count/ce*100:0})).sort((W,V)=>V.value-W.value).slice(0,6).map((W,V)=>({...W,color:E[V%E.length]})):[],ue=fe.length>0?fe.map(W=>({name:(k[W.item_id]||W.item_id).length>12?(k[W.item_id]||W.item_id).substring(0,12)+"...":k[W.item_id]||W.item_id,value:W.total_amount,orderCount:W.order_count,percentage:R>0?W.total_amount/R*100:0})).sort((W,V)=>V.value-W.value).slice(0,5).map((W,V)=>({...W,color:E[V%E.length],percentage:W.percentage.toFixed(1)})):[],P=[{key:"today",label:"今天"},{key:"yesterday",label:"昨天"},{key:"3days",label:"三天内"},{key:"7days",label:"7天内"},{key:"30days",label:"一个月内"},{key:"custom",label:"自定义"}],Q=((_e=P.find(W=>W.key===l))==null?void 0:_e.label)||"所选范围",ne=U(l),I=b.trim().toLowerCase(),he=j.filter(W=>{var V,ye,xe,ae;return((V=W.order_id)==null?void 0:V.toLowerCase().includes(I))||((ye=W.item_id)==null?void 0:ye.toLowerCase().includes(I))||((xe=W.item_title)==null?void 0:xe.toLowerCase().includes(I))||((ae=W.buyer_id)==null?void 0:ae.toLowerCase().includes(I))});return c.jsxs("div",{className:"space-y-8 animate-fade-in",children:[c.jsxs("div",{className:"flex flex-col md:flex-row justify-between md:items-end gap-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-4xl font-extrabold text-gray-900 tracking-tight",children:"运营概览"}),c.jsx("p",{className:"text-gray-500 mt-2 text-base",children:"欢迎回来,以下是闲鱼店铺的实时经营数据。"})]}),c.jsx("div",{className:"flex items-center gap-3",children:c.jsxs("div",{className:"text-sm font-bold text-gray-700 bg-white px-5 py-2.5 rounded-full shadow-sm border border-gray-100 flex items-center gap-2",children:[c.jsx("span",{className:"w-2.5 h-2.5 bg-green-500 rounded-full animate-pulse"}),"系统正常运行"]})})]}),c.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-gray-100/50 rounded-2xl",children:[P.map(W=>c.jsx("button",{onClick:()=>s(W.key),className:`px-5 py-2.5 rounded-xl text-sm font-bold transition-all ${l===W.key?"bg-[#0094f7] text-white shadow-md":"bg-white text-gray-600 hover:text-black hover:bg-gray-50"}`,children:W.label},W.key)),l==="custom"&&c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"date",value:d,onChange:W=>f(W.target.value),className:"px-3 py-2 rounded-xl text-sm border border-gray-200 focus:outline-none focus:ring-2 focus:ring-[#0094f7]"}),c.jsx("span",{className:"self-center text-gray-400",children:"-"}),c.jsx("input",{type:"date",value:m,onChange:W=>h(W.target.value),className:"px-3 py-2 rounded-xl text-sm border border-gray-200 focus:outline-none focus:ring-2 focus:ring-[#0094f7]"}),c.jsx("button",{onClick:()=>{T("custom"),K("custom")},className:"px-4 py-2 rounded-xl text-sm font-bold bg-black text-white hover:bg-gray-800 transition-colors",children:"应用"})]})]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[c.jsx(Ed,{title:"累计营收 (CNY)",value:`¥${n.revenue_stats.total_amount.toLocaleString("zh-CN",{minimumFractionDigits:2})}`,icon:dM,colorClass:"bg-blue-400",trend:Z()||void 0}),c.jsx(Ed,{title:"活跃账号 / 总数",value:`${e.active_cookies} / ${e.total_cookies}`,icon:yA,colorClass:"bg-blue-500"}),c.jsx(Ed,{title:"订单数",value:n.revenue_stats.total_orders.toLocaleString(),icon:vj,colorClass:"bg-blue-500"}),c.jsx(Ed,{title:"库存卡密余量",value:e.total_cards,icon:fA,colorClass:"bg-purple-500"})]}),c.jsxs("div",{className:"ios-card p-8 rounded-xl",children:[c.jsxs("div",{className:"mb-10",children:[c.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"营收趋势分析"}),c.jsxs("p",{className:"text-sm text-gray-400 mt-1",children:[Q,"的销售额走势"]})]}),c.jsx("div",{className:"h-[350px] w-full",children:pe.length===0||n.revenue_stats.total_amount===0?c.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[c.jsx(vj,{className:"w-16 h-16 mb-4 opacity-20"}),c.jsx("p",{className:"text-lg font-medium",children:"暂无营收数据"}),c.jsx("p",{className:"text-sm mt-2",children:"所选时间范围内暂无订单记录"})]}):pe.length<=2?c.jsx(yd,{width:"100%",height:"100%",children:c.jsxs(mQ,{data:pe,margin:{top:30,right:20,left:0,bottom:30},barCategoryGap:"45%",children:[c.jsx($y,{dataKey:"name",axisLine:!1,tickLine:!1,tick:{fill:"#374151",fontSize:14,fontWeight:600},dy:10}),c.jsx(By,{axisLine:!1,tickLine:!1,tick:{fill:"#9CA3AF",fontSize:13,fontWeight:500},tickFormatter:W=>`¥${W}`}),c.jsx(Ev,{contentStyle:{backgroundColor:"#fff",borderRadius:"8px",border:"1px solid #e5e7eb",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.1)",padding:"12px 16px"},labelStyle:{color:"#6b7280",fontWeight:500},itemStyle:{color:"#0094f7",fontWeight:600},cursor:{fill:"rgba(0, 148, 247, 0.08)"},formatter:W=>[`¥${Number(W).toFixed(2)}`,"营收"]}),c.jsx(I4,{dataKey:"amount",fill:"#0094f7",maxBarSize:72,radius:[12,12,0,0],stroke:"#000000",strokeWidth:0,children:pe.map((W,V)=>c.jsx(nl,{fill:["#0094f7","#FCD34D","#0071e3"][V%3]},`cell-${V}`))})]})}):c.jsx(yd,{width:"100%",height:"100%",children:c.jsxs(CQ,{data:pe,margin:{top:10,right:10,left:-20,bottom:0},children:[c.jsx("defs",{children:c.jsxs("linearGradient",{id:"colorAmount",x1:"0",y1:"0",x2:"0",y2:"1",children:[c.jsx("stop",{offset:"5%",stopColor:"#0094f7",stopOpacity:.5}),c.jsx("stop",{offset:"95%",stopColor:"#0094f7",stopOpacity:0})]})}),c.jsx($y,{dataKey:"name",axisLine:!1,tickLine:!1,tick:{fill:"#9CA3AF",fontSize:13,fontWeight:500},dy:15}),c.jsx(By,{axisLine:!1,tickLine:!1,tick:{fill:"#9CA3AF",fontSize:13,fontWeight:500}}),c.jsx(b4,{vertical:!1,stroke:"#F3F4F6",strokeDasharray:"3 3"}),c.jsx(Ev,{contentStyle:{backgroundColor:"#fff",borderRadius:"8px",border:"1px solid #e5e7eb",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.1)",padding:"12px 16px"},labelStyle:{color:"#6b7280",fontWeight:500},itemStyle:{color:"#0094f7",fontWeight:600},cursor:{stroke:"#0094f7",strokeWidth:2,strokeDasharray:"4 4"}}),c.jsx(T4,{type:"monotone",dataKey:"amount",stroke:"#0094f7",strokeWidth:4,fillOpacity:1,fill:"url(#colorAmount)",activeDot:{r:8,fill:"#fff",stroke:"#0094f7",strokeWidth:2}})]})})})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[c.jsxs("div",{className:"ios-card p-6 rounded-xl",children:[c.jsx("h3",{className:"font-bold text-lg text-gray-900 mb-6",children:"商品销量排行"}),c.jsx("div",{className:"h-[280px]",children:z.length===0?c.jsx("div",{className:"flex items-center justify-center h-full text-gray-400",children:"暂无数据"}):c.jsx("div",{className:"h-full space-y-4 overflow-y-auto pr-2",children:z.map((W,V)=>c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[c.jsx("span",{className:`w-7 h-7 rounded-xl flex items-center justify-center text-xs font-extrabold ${V<3?"bg-blue-600 text-white":"bg-gray-100 text-gray-500"}`,children:V+1}),c.jsx("span",{className:"font-bold text-gray-800 text-sm truncate",children:W.name})]}),c.jsxs("span",{className:"font-mono text-sm font-extrabold text-gray-900",children:[W.sales," 单"]})]}),c.jsx("div",{className:"h-3 rounded-full bg-gray-100 overflow-hidden",children:c.jsx("div",{className:"h-full rounded-full bg-[#0094f7]",style:{width:`${Math.max(8,W.sales/G*100)}%`}})})]},`${W.name}-${V}`))})})]}),c.jsxs("div",{className:"ios-card p-6 rounded-xl",children:[c.jsx("h3",{className:"font-bold text-lg text-gray-900 mb-6",children:"商品下单占比"}),c.jsx("div",{className:"h-[280px]",children:se.length===0?c.jsx("div",{className:"flex items-center justify-center h-full text-gray-400",children:"暂无数据"}):c.jsx(yd,{width:"100%",height:"100%",children:c.jsxs(WS,{children:[c.jsx(Dy,{data:se,cx:"50%",cy:"50%",innerRadius:60,outerRadius:90,paddingAngle:2,dataKey:"value",label:({name:W,payload:V})=>`${W} ${Number((V==null?void 0:V.percent)||0).toFixed(1)}%`,labelLine:!1,children:se.map((W,V)=>c.jsx(nl,{fill:W.color},`cell-${V}`))}),c.jsx(uE,{verticalAlign:"bottom",height:36,iconType:"circle",formatter:W=>c.jsx("span",{style:{color:"#6B7280",fontWeight:500},children:W})})]})})})]})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[c.jsxs("div",{className:"lg:col-span-2 ios-card p-0 rounded-xl border-0 bg-white overflow-hidden flex flex-col",children:[c.jsxs("div",{className:"p-6 border-b border-gray-50 flex justify-between items-center bg-[#FAFAFA]",children:[c.jsx("h3",{className:"font-bold text-lg text-gray-900",children:"参与统计的订单"}),c.jsx("div",{className:"relative",children:c.jsx("input",{placeholder:"搜索订单号/商品/买家...",value:b,onChange:W=>w(W.target.value),className:"pl-4 pr-4 py-2 rounded-xl bg-white border border-gray-100 text-sm focus:border-blue-400 outline-none w-48",type:"text"})})]}),c.jsx("div",{className:"overflow-x-auto flex-1 max-h-[400px]",children:S?c.jsxs("div",{className:"flex items-center justify-center py-20 text-gray-400",children:[c.jsx(uj,{className:"w-6 h-6 animate-spin mr-2"}),"加载中..."]}):he.length===0?c.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-8 text-center",children:[c.jsx("div",{className:"w-14 h-14 rounded-2xl bg-gray-100 flex items-center justify-center mb-4",children:c.jsx(uc,{className:"w-7 h-7 text-gray-300"})}),I?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"text-sm font-extrabold text-gray-900",children:"没有匹配的订单"}),c.jsxs("div",{className:"text-xs text-gray-400 mt-2 max-w-md",children:["当前共有 ",j.length," 单参与统计,但没有订单号、商品、买家匹配“",b,"”。"]})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"text-sm font-extrabold text-gray-900",children:"当前范围内没有参与统计的订单"}),c.jsxs("div",{className:"text-xs text-gray-400 mt-2 max-w-lg leading-6",children:["日期范围:",ne.startDate," 至 ",ne.endDate,"; 统计口径:待发货、已发货、已完成,且订单金额不为空。 当前统计卡片订单数:",n.revenue_stats.total_orders," 单。"]})]})]}):c.jsxs("table",{className:"w-full text-left border-collapse",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"bg-white text-gray-400 text-xs font-bold uppercase tracking-wider border-b border-gray-50",children:[c.jsx("th",{className:"px-6 py-4",children:"订单信息"}),c.jsx("th",{className:"px-6 py-4",children:"买家信息"}),c.jsx("th",{className:"px-6 py-4",children:"金额"}),c.jsx("th",{className:"px-6 py-4",children:"状态"}),c.jsx("th",{className:"px-6 py-4 text-right",children:"操作"})]})}),c.jsx("tbody",{className:"divide-y divide-gray-50",children:he.map(W=>c.jsxs("tr",{className:"hover:bg-[#FFFDE7]/50 transition-colors group",children:[c.jsx("td",{className:"px-6 py-4",children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"w-12 h-12 rounded-xl bg-gray-100 overflow-hidden shadow-sm border border-gray-100 flex-shrink-0",children:c.jsx(uc,{className:"w-full h-full text-gray-300 p-2"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"font-bold text-gray-900 text-sm line-clamp-1",children:W.item_title||W.item_id||"未知商品"}),c.jsx("div",{className:"text-xs text-gray-500 mt-1 font-mono",children:W.order_id}),c.jsxs("div",{className:"text-xs text-gray-400 mt-0.5",children:["数量: ",W.quantity||1]})]})]})}),c.jsxs("td",{className:"px-6 py-4",children:[c.jsx("div",{className:"text-sm font-bold text-gray-800",children:W.buyer_id}),W.created_at&&c.jsx("div",{className:"text-xs text-gray-400 mt-1",children:W.created_at})]}),c.jsxs("td",{className:"px-6 py-4 text-base font-extrabold text-gray-900 font-feature-settings-tnum",children:["¥",W.amount||"0.00"]}),c.jsx("td",{className:"px-6 py-4",children:c.jsx(TQ,{status:W.status||W.order_status||"unknown"})}),c.jsx("td",{className:"px-6 py-4 text-right",children:c.jsx("a",{href:`https://www.goofish.com/order-detail?orderId=${W.order_id}&role=seller`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex text-gray-400 hover:text-blue-600 p-2 rounded-xl hover:bg-blue-50 transition-colors",title:"查看闲鱼详情",children:c.jsx(uA,{className:"w-4 h-4"})})})]},W.order_id))})]})})]}),c.jsxs("div",{className:"ios-card p-6 rounded-xl bg-white",children:[c.jsx("h3",{className:"font-bold text-lg text-gray-900 mb-6",children:"商品金额分析 (TOP5)"}),ue.length===0?c.jsx("div",{className:"flex items-center justify-center h-[300px] text-gray-400",children:"暂无数据"}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"h-[300px] relative",children:c.jsx(yd,{width:"100%",height:"100%",children:c.jsxs(WS,{children:[c.jsx(Dy,{data:ue,cx:"50%",cy:"50%",innerRadius:60,outerRadius:100,paddingAngle:2,dataKey:"value",label:({name:W,payload:V})=>`${W} ${(V==null?void 0:V.percentage)||"0.0"}%`,children:ue.map((W,V)=>c.jsx(nl,{fill:W.color||E[V%E.length]},`cell-${V}`))}),c.jsx(Ev,{contentStyle:{backgroundColor:"#fff",border:"1px solid #e5e7eb",borderRadius:"6px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},formatter:W=>`¥${W.toLocaleString()}`})]})})}),c.jsx("div",{className:"space-y-3 mt-4",children:ue.map(W=>c.jsxs("div",{className:"flex justify-between items-center text-sm",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:W.color||E[ue.indexOf(W)%E.length]}}),c.jsx("span",{className:"text-gray-600 font-medium",children:W.name})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("span",{className:"font-bold text-gray-900",children:["¥",W.value.toLocaleString()]}),c.jsxs("span",{className:"text-xs text-gray-500 bg-gray-100 px-2 py-0.5 rounded",children:[W.percentage,"%"]})]})]},W.name))})]})]})]})]})},MQ=()=>{const[e,t]=x.useState([]),[n,r]=x.useState(!0),[l,s]=x.useState(""),[d,f]=x.useState(""),[m,h]=x.useState(!1),[v,y]=x.useState(""),[b,w]=x.useState("pending"),[j,_]=x.useState(""),[S,A]=x.useState(""),[C,M]=x.useState(""),[k,D]=x.useState(""),[E,$]=x.useState(null),[U,K]=x.useState(null),[T,re]=x.useState(null),[Z,pe]=x.useState([]),[fe,ce]=x.useState([]),[R,z]=x.useState({remark:"",cookie:"",auto_confirm:!1,pause_duration:0,username:"",login_password:"",show_browser:!1,showLoginPassword:!1}),[G,se]=x.useState({ai_enabled:!1,max_discount_percent:10,max_discount_amount:100,max_bargain_rounds:3,custom_prompts:""}),[ue,P]=x.useState(!1),Q=async()=>{try{const Y=await _D();t(ge=>ge.map(Pe=>{const Be=Y[Pe.id];return Be?{...Pe,runtime_state:Be.state,runtime_message:Be.message||"",runtime_connected:Be.connected,runtime_updated_at:Be.updated_at}:Pe}))}catch(Y){console.error("Failed to load account runtime statuses:",Y)}},ne=async()=>{r(!0);try{const Y=await Fy();let ge={};try{ge=await DD()}catch(Be){console.error("Failed to load AI settings:",Be)}const Pe=Y.map(Be=>{var Ve,Dt,ie,De,Ue;return{...Be,ai_enabled:((Ve=ge[Be.id])==null?void 0:Ve.ai_enabled)??!1,max_discount_percent:((Dt=ge[Be.id])==null?void 0:Dt.max_discount_percent)??10,max_discount_amount:((ie=ge[Be.id])==null?void 0:ie.max_discount_amount)??100,max_bargain_rounds:((De=ge[Be.id])==null?void 0:De.max_bargain_rounds)??3,custom_prompts:((Ue=ge[Be.id])==null?void 0:Ue.custom_prompts)??""}});t(Pe),window.setTimeout(Q,0)}catch(Y){console.error("Failed to load accounts:",Y)}finally{r(!1)}};x.useEffect(()=>{ne();const Y=window.setInterval(Q,1e4);return()=>window.clearInterval(Y)},[]);const I=Y=>{if(!Y.enabled||Y.runtime_state==="disabled")return{label:"已停用",badge:"bg-gray-100 text-gray-500",dot:"bg-gray-300"};switch(Y.runtime_state){case"online":return{label:"在线",badge:"bg-green-100 text-green-700",dot:"bg-green-500"};case"starting":case"connecting":return{label:"连接中",badge:"bg-blue-100 text-blue-700",dot:"bg-blue-500"};case"reconnecting":return{label:"重连中",badge:"bg-amber-100 text-amber-700",dot:"bg-amber-500"};case"auth_expired":return{label:"登录已失效",badge:"bg-red-100 text-red-700",dot:"bg-red-500"};case"verification_required":return{label:"需要验证",badge:"bg-orange-100 text-orange-700",dot:"bg-orange-500"};case"error":case"stopped":return{label:"运行异常",badge:"bg-red-100 text-red-700",dot:"bg-red-500"};default:return{label:"状态检测中",badge:"bg-gray-100 text-gray-600",dot:"bg-gray-400"}}},he=async(Y,ge)=>{await AD(Y,!ge),ne()},be=async Y=>{confirm("确认删除该账号吗?")&&(await OD(Y),ne())},_e=async Y=>{f(Y.id);try{const ge=await TD(Y.id);ge!=null&&ge.profile_error&&alert("资料刷新失败:"+ge.profile_error),await ne()}catch(ge){console.error("刷新账号资料失败:",ge),alert((ge==null?void 0:ge.message)||"刷新账号资料失败,请先重新授权该账号")}finally{f("")}},W=async Y=>{re(Y),z({remark:Y.remark||Y.note||"",cookie:Y.cookie||Y.value||"",auto_confirm:Y.auto_confirm||!1,pause_duration:Y.pause_duration||0,username:Y.username||"",login_password:Y.login_password||"",show_browser:Y.show_browser||!1,showLoginPassword:!1}),K("edit");try{const[ge,Pe]=await Promise.all([jA(),fP(Y.id).catch(()=>[])]);pe(ge.data||[]),ce(Pe||[])}catch(ge){console.error("加载通知渠道绑定失败",ge),pe([]),ce([])}},V=async Y=>{re(Y),P(!0);try{const ge=await sP(Y.id);se({ai_enabled:ge.ai_enabled??!1,max_discount_percent:ge.max_discount_percent??10,max_discount_amount:ge.max_discount_amount??100,max_bargain_rounds:ge.max_bargain_rounds??3,custom_prompts:ge.custom_prompts??""})}catch(ge){console.error("Failed to load AI settings:",ge)}finally{P(!1)}K("ai-settings")},ye=async()=>{if(T){P(!0);try{const Y=[];R.remark!==(T.remark||T.note||"")&&Y.push(ED(T.id,R.remark)),R.cookie&&R.cookie!==(T.cookie||T.value||"")&&Y.push(gj(T.id,R.cookie)),R.auto_confirm!==T.auto_confirm&&Y.push(kD(T.id,R.auto_confirm)),R.pause_duration!==(T.pause_duration||0)&&Y.push(CD(T.id,R.pause_duration)),(R.username!==(T.username||"")||R.login_password!==(T.login_password||"")||R.show_browser!==(T.show_browser||!1))&&Y.push(MD(T.id,{username:R.username,login_password:R.login_password,show_browser:R.show_browser})),Y.push(mP(T.id,fe)),await Promise.all(Y),K(null),ne()}catch(Y){console.error("更新账号失败:",Y),alert("更新失败,请重试")}finally{P(!1)}}},xe=async()=>{if(T){P(!0);try{await oP(T.id,G),K(null),ne()}catch(Y){console.error("更新AI设置失败:",Y),alert("更新失败,请重试")}finally{P(!1)}}},ae=async(Y,ge,Pe)=>{if(Pe){if(ge&&ge!==Pe.id&&!confirm(`扫码返回的账号ID是 ${ge},当前要重新授权的是 ${Pe.id}。确认用本次扫码结果覆盖当前账号授权吗?`))throw new Error("已取消覆盖当前账号授权");return await gj(Pe.id,Y),Pe.id}if(!ge)throw new Error("扫码结果缺少账号ID,无法添加账号");return await wD(ge,Y),ge},Le=async Y=>{const ge=Y||null;$(ge),h(!0),w("loading"),y(""),D(""),_(""),A(""),M("");try{const Pe=await ND();if(Pe.success&&Pe.qr_code_url&&Pe.session_id){y(Pe.qr_code_url),D(Pe.session_id),w("waiting");const Be=setInterval(async()=>{const Ve=await SD(Pe.session_id);if(Ve.status==="success"){if(clearInterval(Be),w("success"),Ve.cookies&&Ve.unb)try{await ae(Ve.cookies,Ve.unb,ge)}catch(Dt){console.error("保存扫码授权失败",Dt),w("error")}setTimeout(()=>{h(!1),ne()},1e3)}else Ve.status==="scanned"?w("waiting"):Ve.status==="expired"||Ve.status==="cancelled"||Ve.status==="error"||Ve.status==="not_found"?(clearInterval(Be),w("error")):Ve.status==="verification_required"&&(w("verification"),_(Ve.verification_url||""),Ve.face_qr_url&&M(Ve.face_qr_url),Ve.verification_screenshot&&A(Ve.verification_screenshot))},2e3)}}catch{w("error")}};if(n)return c.jsx("div",{className:"p-20 flex justify-center",children:c.jsx(Yn,{className:"w-8 h-8 text-[#0094f7] animate-spin"})});const Ce=e.filter(Y=>{const ge=l.trim().toLowerCase();return ge?[Y.id,Y.nickname,Y.remark,Y.note,Y.username,Y.runtime_message].some(Pe=>(Pe||"").toLowerCase().includes(ge)):!0});return c.jsxs("div",{className:"space-y-8 animate-fade-in relative",children:[c.jsxs("div",{className:"flex flex-col xl:flex-row xl:justify-between xl:items-end gap-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-4xl font-extrabold text-gray-900 tracking-tight",children:"账号管理"}),c.jsx("p",{className:"text-gray-500 mt-2 font-medium",children:"管理您的闲鱼授权账号及设置。建议给账号填写备注,便于多账号区分。"})]}),c.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[c.jsx("input",{value:l,onChange:Y=>s(Y.target.value),placeholder:"搜索昵称 / 备注 / 账号ID",className:"ios-input px-4 py-3 rounded-2xl text-sm w-full sm:w-72"}),c.jsxs("button",{onClick:()=>Le(),className:"ios-btn-primary flex items-center gap-2 px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 transition-transform hover:scale-105 active:scale-95",children:[c.jsx(Qp,{className:"w-5 h-5"}),"扫码添加新账号"]})]})]}),c.jsxs("div",{className:"rounded-2xl border border-blue-100 bg-blue-50 px-5 py-4 text-sm text-blue-900 flex flex-col md:flex-row md:items-center md:justify-between gap-2",children:[c.jsxs("div",{className:"font-bold",children:["当前显示 ",Ce.length," / ",e.length," 个账号"]}),c.jsx("div",{className:"text-blue-700",children:"如果某个账号只显示 ID,点该账号右侧“刷新资料”;若刷新失败,先点二维码重新授权。"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-6",children:[Ce.map(Y=>{const ge=I(Y),Pe=Y.runtime_state==="auth_expired"||Y.runtime_state==="verification_required";return c.jsxs("div",{className:"ios-card p-6 rounded-xl flex flex-col lg:flex-row lg:items-center justify-between gap-5 group hover:border-[#0094f7] transition-all duration-300",children:[c.jsxs("div",{className:"flex items-center gap-5 sm:gap-8 min-w-0",children:[c.jsxs("div",{className:"relative",children:[Y.avatar_url?c.jsx("img",{src:Y.avatar_url,alt:Y.nickname||"账号头像",className:"w-20 h-20 rounded-full object-cover shadow-md ring-4 ring-white bg-gray-100"}):c.jsx("div",{className:"w-20 h-20 rounded-full bg-gray-100 text-gray-400 shadow-md ring-4 ring-white flex items-center justify-center",children:c.jsx(Bv,{className:"w-9 h-9"})}),c.jsx("div",{className:`absolute -bottom-1 -right-1 w-6 h-6 rounded-full border-4 border-white flex items-center justify-center ${ge.dot}`,children:Y.runtime_state==="online"&&c.jsx(ci,{className:"w-3 h-3 text-white"})})]}),c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-1",children:[c.jsx("h3",{className:"text-xl font-extrabold text-gray-900 break-words",children:Y.nickname||Y.remark||`账号 ${Y.id.substring(0,6)}...`}),c.jsx("span",{className:`px-2.5 py-0.5 rounded-lg text-xs font-bold ${ge.badge}`,children:ge.label}),Y.ai_enabled&&c.jsxs("span",{className:"px-2.5 py-0.5 rounded-lg bg-purple-100 text-purple-700 text-xs font-bold flex items-center gap-1",children:[c.jsx(ps,{className:"w-3 h-3"})," AI"]}),Y.profile_error&&c.jsxs("span",{className:"px-2.5 py-0.5 rounded-lg bg-amber-100 text-amber-700 text-xs font-bold flex items-center gap-1",title:Y.profile_error,children:[c.jsx($d,{className:"w-3 h-3"})," 资料未同步"]})]}),c.jsxs("div",{className:"text-sm text-gray-500 font-medium mb-3 space-y-1",children:[c.jsx("p",{children:Y.remark||Y.note||"暂无备注"}),c.jsxs("p",{className:"font-mono text-xs text-gray-400",children:["ID: ",Y.id]})]}),Y.runtime_message&&Y.runtime_state!=="online"&&Y.runtime_state!=="disabled"&&c.jsxs("div",{className:`mb-3 flex flex-wrap items-center gap-2 text-sm font-medium ${Pe?"text-red-700":"text-amber-700"}`,children:[c.jsx($d,{className:"w-4 h-4 flex-shrink-0"}),c.jsx("span",{children:Y.runtime_message}),Pe&&c.jsxs("button",{type:"button",onClick:()=>Le(Y),className:"inline-flex items-center gap-1.5 rounded-lg bg-red-50 px-2.5 py-1 text-xs font-bold text-red-700 hover:bg-red-100",children:[c.jsx(Qp,{className:"w-3.5 h-3.5"})," 重新授权"]})]}),c.jsxs("div",{className:"flex gap-2",children:[Y.auto_confirm&&c.jsxs("span",{className:"text-xs bg-blue-50 text-blue-700 px-3 py-1.5 rounded-lg font-bold flex items-center gap-1.5",children:[c.jsx(ci,{className:"w-3 h-3"})," 自动确认发货"]}),Y.pause_duration>0&&c.jsxs("span",{className:"text-xs bg-blue-50 text-blue-700 px-3 py-1.5 rounded-lg font-bold flex items-center gap-1.5",children:[c.jsx(dj,{className:"w-3 h-3"})," 暂停",Y.pause_duration,"分钟"]})]})]})]}),c.jsxs("div",{className:"flex items-center gap-3 self-end lg:self-auto flex-shrink-0",children:[c.jsx("button",{onClick:()=>_e(Y),disabled:d===Y.id,className:"p-3 rounded-xl transition-colors text-gray-600 hover:bg-gray-100 disabled:opacity-50",title:"刷新昵称和头像",children:c.jsx(pr,{className:`w-5 h-5 ${d===Y.id?"animate-spin":""}`})}),c.jsx("button",{onClick:()=>Le(Y),className:`p-3 rounded-xl transition-colors ${Pe?"text-red-600 bg-red-50 hover:bg-red-100":"text-blue-600 hover:bg-blue-50"}`,title:"重新扫码授权当前账号",children:c.jsx(Qp,{className:"w-5 h-5"})}),c.jsx("button",{onClick:()=>W(Y),className:"p-3 rounded-xl hover:bg-gray-100 transition-colors text-gray-600",title:"编辑账号",children:c.jsx(mA,{className:"w-5 h-5"})}),c.jsx("button",{onClick:()=>V(Y),className:"p-3 rounded-xl hover:bg-purple-100 transition-colors text-purple-600",title:"AI设置",children:c.jsx(ps,{className:"w-5 h-5"})}),c.jsx("button",{onClick:()=>he(Y.id,Y.enabled),className:`p-3 rounded-xl transition-colors ${Y.enabled?"text-green-600 hover:bg-green-50":"text-gray-400 hover:bg-gray-100"}`,title:Y.enabled?"停用账号":"启用账号",children:c.jsx(YM,{className:"w-5 h-5"})}),c.jsx("button",{onClick:()=>be(Y.id),className:"p-3 rounded-xl hover:bg-red-100 transition-colors text-red-500",children:c.jsx(xa,{className:"w-5 h-5"})})]})]},Y.id)}),e.length===0&&c.jsxs("div",{className:"ios-card p-12 text-center",children:[c.jsx("div",{className:"w-20 h-20 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4",children:c.jsx(Bv,{className:"w-10 h-10 text-gray-400"})}),c.jsx("h3",{className:"text-lg font-bold text-gray-900",children:"暂无账号"}),c.jsx("p",{className:"text-gray-500 mt-1",children:"请点击右上角扫码添加您的闲鱼账号"})]}),e.length>0&&Ce.length===0&&c.jsxs("div",{className:"ios-card p-12 text-center",children:[c.jsx("h3",{className:"text-lg font-bold text-gray-900",children:"没有匹配的账号"}),c.jsx("p",{className:"text-gray-500 mt-1",children:"换一个关键词搜索昵称、备注或账号ID。"})]})]}),m&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container relative",style:{maxWidth:"24rem"},children:[c.jsx("button",{onClick:()=>h(!1),className:"absolute top-4 right-4 z-10 w-9 h-9 flex items-center justify-center bg-gray-100 hover:bg-gray-200 rounded-full transition-colors",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-600"})}),c.jsx("div",{className:"modal-body",children:c.jsxs("div",{className:"text-center",children:[c.jsx("h3",{className:"text-2xl font-extrabold text-gray-900 mb-2",children:E?"重新授权账号":"扫码添加账号"}),c.jsx("p",{className:"text-gray-500 mb-8 font-medium",children:E?`请用闲鱼APP扫码,为「${E.nickname||E.remark||E.id}」刷新授权`:"请打开闲鱼APP扫描下方二维码"}),c.jsxs("div",{className:"w-64 h-64 bg-[#F7F8FA] rounded-xl mx-auto flex items-center justify-center overflow-hidden border-4 border-white shadow-inner mb-8 relative",children:[b==="loading"&&c.jsx(Yn,{className:"w-10 h-10 text-[#0094f7] animate-spin"}),b==="waiting"&&c.jsx("img",{src:v,alt:"QR Code",className:"w-full h-full p-2"}),b==="success"&&c.jsxs("div",{className:"absolute inset-0 bg-white/95 flex flex-col items-center justify-center text-green-600 animate-fade-in",children:[c.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:c.jsx(ci,{className:"w-8 h-8"})}),c.jsx("span",{className:"font-bold text-lg",children:"登录成功"})]}),b==="error"&&c.jsxs("div",{className:"flex flex-col items-center",children:[c.jsx("span",{className:"text-red-500 font-bold mb-2",children:"获取失败"}),c.jsxs("button",{onClick:()=>Le(E||void 0),className:"text-xs bg-gray-200 px-3 py-1 rounded-full flex items-center gap-1 hover:bg-gray-300",children:[c.jsx(pr,{className:"w-3 h-3"})," 重试"]})]}),b==="verification"&&c.jsxs("div",{className:"flex flex-col items-center px-4",children:[c.jsx("span",{className:"font-bold text-gray-900 mb-2",children:"需要安全验证"}),c.jsx("span",{className:"text-xs text-gray-500 mb-3 text-center",children:C?"请用手机闲鱼扫描下方二维码完成人脸验证,验证通过后将自动登录。":"正在准备验证二维码,请保持页面打开。"}),C?c.jsx("img",{src:C,alt:"人脸验证二维码",className:"w-full max-w-[210px] rounded-xl border bg-white p-2 mb-2"}):S?c.jsx("img",{src:S,alt:"验证页面",className:"w-full rounded-xl border mb-2",style:{maxHeight:200,objectFit:"contain"}}):c.jsx("div",{className:"w-full h-32 bg-gray-100 rounded-xl flex items-center justify-center mb-2",children:c.jsx(Yn,{className:"w-6 h-6 animate-spin text-gray-400"})}),c.jsx("span",{className:"text-xs text-gray-400",children:"等待手机验证完成,无需点击确认。"})]})]}),c.jsx("p",{className:"text-xs text-gray-400 font-medium bg-gray-50 py-2 rounded-xl",children:"二维码有效期为5分钟,请尽快扫码。"})]})})]})}),document.body),U==="edit"&&T&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container",style:{maxWidth:"600px"},children:[c.jsxs("div",{className:"modal-header",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"编辑账号"}),c.jsx("p",{className:"text-sm text-gray-500 mt-1",children:T.nickname||T.remark||T.id})]}),c.jsx("button",{onClick:()=>K(null),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors flex-shrink-0",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-500"})})]}),c.jsxs("div",{className:"modal-body space-y-6",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"账号ID"}),c.jsx("input",{type:"text",value:T.id,disabled:!0,className:"w-full ios-input px-4 py-3 rounded-xl bg-gray-50 text-gray-500"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"备注"}),c.jsx("input",{type:"text",value:R.remark,onChange:Y=>z({...R,remark:Y.target.value}),placeholder:"为账号添加备注",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"Cookie"}),c.jsx("textarea",{value:R.cookie,onChange:Y=>z({...R,cookie:Y.target.value}),placeholder:"更新账号Cookie",className:"w-full ios-input px-4 py-3 rounded-xl h-32 resize-none font-mono text-xs"}),c.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["当前Cookie长度: ",R.cookie.length," 字符"]})]}),c.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"font-bold text-gray-900 flex items-center gap-2",children:[c.jsx(ci,{className:"w-4 h-4 text-green-500"}),"自动确认发货"]}),c.jsx("div",{className:"text-xs text-gray-500",children:"自动将闲鱼订单标记为已发货"})]}),c.jsx("button",{type:"button",onClick:()=>z({...R,auto_confirm:!R.auto_confirm}),className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${R.auto_confirm?"bg-[#0094f7]":"bg-gray-300"}`,children:c.jsx("span",{className:`absolute left-1 top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 ${R.auto_confirm?"translate-x-6":"translate-x-0"}`})})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-sm font-bold text-gray-700 mb-2 flex items-center gap-2",children:[c.jsx(dj,{className:"w-4 h-4 text-blue-500"}),"暂停处理时长(分钟)"]}),c.jsx("input",{type:"number",value:R.pause_duration,onChange:Y=>z({...R,pause_duration:parseInt(Y.target.value)||0}),placeholder:"0",min:"0",max:"1440",className:"w-full ios-input px-4 py-3 rounded-xl"}),c.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"设置后会暂停处理该账号的订单,到时间后自动恢复"})]}),c.jsxs("div",{className:"border-t border-gray-200 pt-6",children:[c.jsxs("h3",{className:"text-lg font-bold text-gray-900 mb-4 flex items-center gap-2",children:[c.jsx(jM,{className:"w-5 h-5 text-blue-500"}),"登录信息"]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"用户名"}),c.jsx("input",{type:"text",value:R.username,onChange:Y=>z({...R,username:Y.target.value}),placeholder:"闲鱼账号/手机号",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"登录密码"}),c.jsxs("div",{className:"relative",children:[c.jsx("input",{type:R.showLoginPassword?"text":"password",value:R.login_password,onChange:Y=>z({...R,login_password:Y.target.value}),placeholder:"用于自动登录",className:"w-full ios-input px-4 py-3 rounded-xl pr-12"}),c.jsx("button",{type:"button",onClick:()=>z({...R,showLoginPassword:!R.showLoginPassword}),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:R.showLoginPassword?c.jsx(ic,{className:"w-5 h-5"}):c.jsx(xs,{className:"w-5 h-5"})})]})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-bold text-gray-900",children:"登录时显示浏览器"}),c.jsx("div",{className:"text-xs text-gray-500",children:"调试时可开启查看登录过程"})]}),c.jsx("button",{type:"button",onClick:()=>z({...R,show_browser:!R.show_browser}),className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${R.show_browser?"bg-[#0094f7]":"bg-gray-300"}`,children:c.jsx("span",{className:`absolute left-1 top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 ${R.show_browser?"translate-x-6":"translate-x-0"}`})})]})]})]}),Z.length>0&&c.jsxs("div",{className:"border-t border-gray-200 pt-6",children:[c.jsxs("h3",{className:"text-lg font-bold text-gray-900 mb-1 flex items-center gap-2",children:[c.jsx(gs,{className:"w-5 h-5 text-blue-500"}),"通知渠道绑定"]}),c.jsx("p",{className:"text-xs text-gray-500 mb-4",children:"勾选后,该账号的 token 失效、自动恢复失败、风控验证等事件会推送到这些渠道"}),c.jsx("div",{className:"space-y-2",children:Z.map(Y=>{const ge=fe.includes(Number(Y.id));return c.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-xl border border-gray-200 hover:bg-gray-50 cursor-pointer transition-colors",children:[c.jsx("button",{type:"button",onClick:()=>{ce(Pe=>ge?Pe.filter(Be=>Be!==Number(Y.id)):[...Pe,Number(Y.id)])},className:`w-5 h-5 rounded-md border-2 flex items-center justify-center transition-colors flex-shrink-0 ${ge?"bg-[#0094f7] border-[#0094f7]":"bg-white border-gray-300"}`,children:ge&&c.jsx(ci,{className:"w-3.5 h-3.5 text-white"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"font-bold text-gray-900 text-sm",children:Y.name}),c.jsxs("div",{className:"text-xs text-gray-500",children:[Y.type,Y.enabled?"":" · 已停用"]})]})]},Y.id)})})]})]}),c.jsx("div",{className:"modal-footer",children:c.jsxs("div",{className:"flex gap-3 w-full",children:[c.jsx("button",{onClick:()=>K(null),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",disabled:ue,children:"取消"}),c.jsxs("button",{onClick:ye,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",disabled:ue,children:[ue?c.jsx(Yn,{className:"w-4 h-4 animate-spin"}):c.jsx(Sa,{className:"w-4 h-4"}),ue?"保存中...":"保存"]})]})})]})}),document.body),U==="ai-settings"&&T&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container",style:{maxWidth:"600px"},children:[c.jsxs("div",{className:"modal-header",children:[c.jsxs("div",{children:[c.jsxs("h3",{className:"text-2xl font-extrabold text-gray-900 flex items-center gap-2",children:[c.jsx(ps,{className:"w-6 h-6 text-purple-500"}),"AI助手设置"]}),c.jsx("p",{className:"text-sm text-gray-500 mt-1",children:T.nickname||T.remark||T.id})]}),c.jsx("button",{onClick:()=>K(null),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors flex-shrink-0",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-500"})})]}),c.jsxs("div",{className:"modal-body space-y-6",children:[c.jsxs("div",{className:"flex items-center justify-between p-4 bg-purple-50 rounded-xl",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"font-bold text-gray-900 flex items-center gap-2",children:[c.jsx(ps,{className:"w-4 h-4 text-purple-500"}),"启用AI自动回复"]}),c.jsx("div",{className:"text-xs text-gray-500",children:"AI将自动处理买家的砍价消息"})]}),c.jsx("button",{type:"button",onClick:()=>se({...G,ai_enabled:!G.ai_enabled}),className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${G.ai_enabled?"bg-[#0094f7]":"bg-gray-300"}`,children:c.jsx("span",{className:`absolute left-1 top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 ${G.ai_enabled?"translate-x-6":"translate-x-0"}`})})]}),c.jsxs("div",{className:"border-t border-gray-200 pt-6",children:[c.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-4",children:"砍价策略"}),c.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"最大折扣比例 (%)"}),c.jsx("input",{type:"number",value:G.max_discount_percent,onChange:Y=>se({...G,max_discount_percent:parseInt(Y.target.value)||0}),className:"w-full ios-input px-4 py-3 rounded-xl",min:"0",max:"100"}),c.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"例如:10表示最多降价10%"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"最大折扣金额 (元)"}),c.jsx("input",{type:"number",value:G.max_discount_amount,onChange:Y=>se({...G,max_discount_amount:parseInt(Y.target.value)||0}),className:"w-full ios-input px-4 py-3 rounded-xl",min:"0"}),c.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"例如:100表示最多降价100元"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"最大砍价轮次"}),c.jsx("input",{type:"number",value:G.max_bargain_rounds,onChange:Y=>se({...G,max_bargain_rounds:parseInt(Y.target.value)||1}),className:"w-full ios-input px-4 py-3 rounded-xl",min:"1",max:"10"}),c.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"买家最多可以砍价的次数"})]})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"自定义提示词(可选)"}),c.jsx("textarea",{value:G.custom_prompts,onChange:Y=>se({...G,custom_prompts:Y.target.value}),placeholder:`输入自定义的AI回复规则或风格指引... + +例如:回复时保持礼貌专业、使用简洁的语言、强调产品质量等`,className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none"})]}),c.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4",children:[c.jsxs("h4",{className:"font-bold text-blue-900 mb-2 flex items-center gap-2",children:[c.jsx(Gy,{className:"w-4 h-4"}),"AI如何工作"]}),c.jsxs("ul",{className:"text-xs text-blue-800 space-y-1",children:[c.jsx("li",{children:"• 自动识别买家的砍价请求"}),c.jsx("li",{children:"• 根据设定的策略智能回复"}),c.jsx("li",{children:"• 在合理范围内同意降价或礼貌拒绝"}),c.jsx("li",{children:"• 保持专业友好的沟通风格"})]})]})]}),c.jsx("div",{className:"modal-footer",children:c.jsxs("div",{className:"flex gap-3 w-full",children:[c.jsx("button",{onClick:()=>K(null),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",disabled:ue,children:"取消"}),c.jsxs("button",{onClick:xe,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",disabled:ue,children:[ue?c.jsx(Yn,{className:"w-4 h-4 animate-spin"}):c.jsx(Sa,{className:"w-4 h-4"}),ue?"保存中...":"保存"]})]})})]})}),document.body)]})},QS=({status:e})=>{const t={processing:"bg-blue-100 text-blue-800",pending_ship:"bg-[#0094f7] text-white",shipped:"bg-blue-100 text-blue-700",completed:"bg-green-100 text-green-700",cancelled:"bg-gray-100 text-gray-500",refunding:"bg-red-100 text-red-600"},n={processing:"处理中",pending_ship:"待发货",shipped:"已发货",completed:"已完成",cancelled:"已取消",refunding:"退款中"};return c.jsx("span",{className:`px-3 py-1.5 rounded-lg text-xs font-bold ${t[e]||t.cancelled}`,children:n[e]||e})},DQ=()=>{const[e,t]=x.useState([]),[n,r]=x.useState([]),[l,s]=x.useState([]),[d,f]=x.useState({}),[m,h]=x.useState("all"),[v,y]=x.useState(""),[b,w]=x.useState(1),[j,_]=x.useState(1),[S,A]=x.useState(!1),[C,M]=x.useState(!1),[k,D]=x.useState(!1),[E,$]=x.useState(!1),[U,K]=x.useState(null),[T,re]=x.useState(null),[Z,pe]=x.useState({}),[fe,ce]=x.useState(!1),[R,z]=x.useState(""),[G,se]=x.useState(!1),[ue,P]=x.useState(null),[Q,ne]=x.useState(null),[I,he]=x.useState(null),[be,_e]=x.useState(null),W=ie=>{if(!v.trim())return ie;const De=v.toLowerCase().trim();return ie.filter(Ue=>{var B,Te,lt,Zr,Qn,$n;return((B=Ue.order_id)==null?void 0:B.toLowerCase().includes(De))||((Te=Ue.item_id)==null?void 0:Te.toLowerCase().includes(De))||((lt=Ue.buyer_id)==null?void 0:lt.toLowerCase().includes(De))||((Zr=Ue.item_title)==null?void 0:Zr.toLowerCase().includes(De))||((Qn=Ue.receiver_name)==null?void 0:Qn.toLowerCase().includes(De))||(($n=Ue.receiver_phone)==null?void 0:$n.toLowerCase().includes(De))})},V=async()=>{A(!0);try{if(v.trim()){let ie=[],De=1,Ue=!0;for(;Ue;){const B=await xj(void 0,m,De,100);ie=[...ie,...B.data],Ue=De{t(W(n))},[n,v]);const ye=(ie,De)=>{if(De&&De.trim())return De;if(d[ie])return d[ie];const Ue=l.find(B=>{if(De&&B.item_title){const Te=De.toLowerCase(),lt=B.item_title.toLowerCase();return lt.includes(Te)||Te.includes(lt)}return!1});return Ue!=null&&Ue.item_title?Ue.item_title:"未知商品"},xe=ie=>{const De={};ie.forEach(Ue=>{Ue.item_id&&(De[Ue.item_id]=Ue.item_title||Ue.item_id)}),f(De)};x.useEffect(()=>{V(),Ns().then(ie=>{s(ie),xe(ie)}).catch(ie=>{console.error("加载商品列表失败:",ie)})},[m,b,v]);const ae=async()=>{A(!0);try{const ie=await ID();await V(),ie!=null&&ie.message&&alert(ie.message)}catch(ie){console.error("同步订单失败:",ie),alert((ie==null?void 0:ie.message)||"同步失败,请重试")}finally{A(!1)}},Le=ie=>{z(ie),P(null),ce(!0)},Ce=async ie=>{var De;se(!0),P(null);try{const Ue=await RD([R],ie),B=(De=Ue==null?void 0:Ue.results)==null?void 0:De[0];B!=null&&B.success?(P({success:!0,message:B.message}),V()):P({success:!1,message:(B==null?void 0:B.message)||"发货失败"})}catch(Ue){P({success:!1,message:(Ue==null?void 0:Ue.message)||"请求失败"})}finally{se(!1)}},Y=ie=>{K(ie),M(!0)},ge=ie=>{re({...ie}),D(!0)},Pe=async()=>{if(!(!T||!T.order_id))try{const ie={};T.status!==void 0&&(ie.order_status=T.status),T.buyer_id!==void 0&&(ie.buyer_id=T.buyer_id),T.amount!==void 0&&(ie.amount=T.amount),T.receiver_name!==void 0&&(ie.receiver_name=T.receiver_name),T.receiver_phone!==void 0&&(ie.receiver_phone=T.receiver_phone),T.receiver_address!==void 0&&(ie.receiver_address=T.receiver_address),T.item_id!==void 0&&(ie.item_id=T.item_id),T.quantity!==void 0&&(ie.quantity=T.quantity),await PD(T.order_id,ie),D(!1),re(null),V()}catch(ie){console.error("更新订单失败:",ie),alert("更新失败,请重试")}},Be=async()=>{if(Q)try{const ie=new FormData;ie.append("file",Q),await LD(ie),$(!1),ne(null),V(),alert("订单导入成功")}catch(ie){alert((ie==null?void 0:ie.message)||"导入失败,请检查文件格式")}},Ve=async ie=>{he(ie);try{const De=await $D(ie);De.success?await V():alert(De.message||"同步失败")}catch(De){console.error("同步订单失败:",De),alert((De==null?void 0:De.message)||"同步失败,请重试")}finally{he(null)}},Dt=async ie=>{if(confirm("确认删除该订单吗?删除后无法恢复。")){_e(ie);try{await zD(ie),r(De=>De.filter(Ue=>Ue.order_id!==ie))}catch(De){console.error("删除订单失败:",De),alert((De==null?void 0:De.message)||"删除失败,请重试"),await V()}finally{_e(null)}}};return c.jsxs("div",{className:"space-y-6 animate-fade-in",children:[c.jsxs("div",{className:"flex flex-col md:flex-row justify-between md:items-end gap-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-4xl font-extrabold text-gray-900 tracking-tight",children:"订单中心"}),c.jsx("p",{className:"text-gray-500 mt-2 font-medium",children:"查看所有闲鱼交易记录与状态。"})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{onClick:V,className:"p-3 rounded-2xl bg-white border border-gray-100 text-gray-600 hover:bg-gray-50 hover:text-black transition-colors shadow-sm",children:c.jsx(pr,{className:`w-5 h-5 ${S?"animate-spin":""}`})}),c.jsxs("button",{onClick:()=>$(!0),className:"px-5 py-3 rounded-2xl font-bold bg-gray-900 text-white hover:bg-gray-800 transition-colors text-sm flex items-center gap-2 shadow-lg",children:[c.jsx(ja,{className:"w-4 h-4"}),"插入订单"]}),c.jsxs("button",{onClick:ae,className:"ios-btn-primary px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 text-sm flex items-center gap-2",children:[c.jsx(yj,{className:"w-5 h-5"}),"一键同步订单"]})]})]}),c.jsxs("div",{className:"ios-card rounded-xl overflow-hidden shadow-lg border-0 bg-white",children:[c.jsxs("div",{className:"p-4 border-b border-gray-50 flex flex-col md:flex-row gap-4 justify-between items-center bg-[#FAFAFA]",children:[c.jsx("div",{className:"flex gap-1 p-1 bg-gray-200/50 rounded-xl overflow-x-auto max-w-full",children:[{k:"all",v:"全部"},{k:"shipped",v:"已发货"},{k:"pending_ship",v:"待发货"},{k:"cancelled",v:"已取消"},{k:"refunding",v:"其他"}].map(ie=>c.jsx("button",{onClick:()=>{h(ie.k),w(1),y("")},className:`px-5 py-2 rounded-lg text-sm font-bold transition-all whitespace-nowrap ${m===ie.k?"bg-white text-black shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:ie.v},ie.k))}),c.jsxs("div",{className:"relative w-full md:w-auto group",children:[c.jsx(WM,{className:"w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 group-focus-within:text-[#0094f7] transition-colors"}),c.jsx("input",{type:"text",placeholder:"搜索订单号/商品/买家...",value:v,onChange:ie=>{y(ie.target.value),w(1)},className:"ios-input pl-10 pr-4 py-2.5 rounded-xl w-64 bg-white border-none shadow-sm focus:ring-0"})]})]}),c.jsx("div",{className:"overflow-x-auto min-h-[400px]",children:c.jsxs("table",{className:"w-full text-left border-collapse table-fixed",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"bg-white text-gray-400 text-xs font-bold uppercase tracking-wider border-b border-gray-50",children:[c.jsx("th",{className:"px-6 py-5",style:{width:"28%"},children:"订单信息"}),c.jsx("th",{className:"px-6 py-5",style:{width:"26%"},children:"买家信息"}),c.jsx("th",{className:"px-6 py-5",style:{width:"11%"},children:"实付金额"}),c.jsx("th",{className:"px-6 py-5",style:{width:"13%"},children:"当前状态"}),c.jsx("th",{className:"px-6 py-5 text-right",style:{width:"22%"},children:"操作"})]})}),c.jsx("tbody",{className:"divide-y divide-gray-50",children:e.map(ie=>c.jsxs("tr",{className:"hover:bg-[#FFFDE7]/50 transition-colors group",children:[c.jsx("td",{className:"px-6 py-5",children:c.jsxs("div",{className:"flex items-center gap-5",children:[c.jsx("div",{className:"w-14 h-14 rounded-xl bg-gray-100 overflow-hidden shadow-sm border border-gray-100 flex-shrink-0",children:ie.item_image?c.jsx("img",{src:ie.item_image,alt:"",className:"w-full h-full object-cover"}):c.jsx("div",{className:"w-full h-full flex items-center justify-center text-gray-300",children:c.jsx(uc,{})})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"font-bold text-gray-900 line-clamp-1 text-sm",children:ye(ie.item_id,ie.item_title)}),c.jsxs("div",{className:"text-xs text-gray-500 mt-1 font-medium",children:["订单ID: ",ie.order_id]}),c.jsxs("div",{className:"text-xs text-gray-400 mt-0.5",children:["数量: ",ie.quantity," • ",ie.created_at]})]})]})}),c.jsx("td",{className:"px-6 py-5",children:c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("div",{className:"text-xs text-gray-500",children:"买家ID"}),c.jsx("div",{className:"text-sm font-bold text-gray-800",children:ie.buyer_id}),ie.receiver_name&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"text-xs text-gray-500",children:"收货人"}),c.jsx("div",{className:"text-xs text-gray-600",children:ie.receiver_name})]}),ie.receiver_phone&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"text-xs text-gray-500",children:"联系电话"}),c.jsx("div",{className:"text-xs text-gray-600 font-mono",children:ie.receiver_phone})]}),ie.receiver_address&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"text-xs text-gray-500",children:"收货地址"}),c.jsx("div",{className:"text-xs text-gray-600 line-clamp-1",children:ie.receiver_address})]})]})}),c.jsx("td",{className:"px-6 py-5 text-base font-extrabold text-gray-900 font-feature-settings-tnum",children:ie.amount?`¥${ie.amount}`:c.jsx("span",{className:"text-xs text-amber-600 font-bold",children:"待获取"})}),c.jsx("td",{className:"px-6 py-5",children:c.jsx(QS,{status:ie.status})}),c.jsxs("td",{className:"px-6 py-5 text-right",children:[ie.status==="pending_ship"&&c.jsx("button",{onClick:()=>Le(ie.order_id),className:"mr-2 text-white bg-black hover:bg-gray-800 shadow-lg shadow-gray-200 text-xs font-bold px-3 py-2 rounded-xl transition-all active:scale-95",children:"立即发货"}),c.jsx("a",{href:`https://www.goofish.com/order-detail?orderId=${ie.order_id}&role=seller`,target:"_blank",rel:"noopener noreferrer",className:"mr-2 inline-flex text-gray-400 hover:text-blue-600 p-2 rounded-xl hover:bg-blue-50 transition-colors",title:"查看闲鱼详情",children:c.jsx(uA,{className:"w-4 h-4"})}),c.jsx("button",{onClick:()=>Y(ie),className:"mr-2 text-gray-400 hover:text-blue-600 p-2 rounded-xl hover:bg-blue-50 transition-colors",title:"查看详情",children:c.jsx(xs,{className:"w-4 h-4"})}),c.jsx("button",{onClick:()=>ge(ie),className:"mr-2 text-gray-400 hover:text-black p-2 rounded-xl hover:bg-gray-100 transition-colors",title:"编辑订单",children:c.jsx(bs,{className:"w-4 h-4"})}),c.jsx("button",{onClick:()=>Ve(ie.order_id),disabled:I===ie.order_id,className:"mr-2 text-gray-400 hover:text-green-600 p-2 rounded-xl hover:bg-green-50 transition-colors disabled:opacity-50",title:"同步订单",children:c.jsx(pr,{className:`w-4 h-4 ${I===ie.order_id?"animate-spin":""}`})}),c.jsx("button",{onClick:()=>Dt(ie.order_id),disabled:be===ie.order_id,className:"text-gray-400 hover:text-red-500 p-2 rounded-xl hover:bg-red-50 transition-colors disabled:opacity-50",title:"删除订单",children:c.jsx(xa,{className:"w-4 h-4"})})]})]},ie.id))})]})}),c.jsxs("div",{className:"p-4 border-t border-gray-50 flex items-center justify-between bg-white",children:[c.jsxs("div",{className:"text-sm text-gray-500 font-medium pl-2",children:["第 ",b," 页 / 共 ",j," 页"]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{disabled:b<=1,onClick:()=>w(ie=>ie-1),className:"p-2.5 rounded-xl bg-gray-50 hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed text-gray-600 transition-colors",children:c.jsx(FT,{className:"w-5 h-5"})}),c.jsx("button",{disabled:b>=j,onClick:()=>w(ie=>ie+1),className:"p-2.5 rounded-xl bg-gray-50 hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed text-gray-600 transition-colors",children:c.jsx(WT,{className:"w-5 h-5"})})]})]})]}),C&&U&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container",children:[c.jsx("div",{className:"modal-header",children:c.jsxs("div",{className:"flex items-center justify-between w-full",children:[c.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"订单详情"}),c.jsx("button",{onClick:()=>M(!1),className:"p-2 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-600"})})]})}),c.jsxs("div",{className:"modal-body space-y-6",children:[c.jsxs("div",{className:"space-y-4",children:[c.jsx("h4",{className:"text-lg font-bold text-gray-800",children:"订单信息"}),c.jsxs("div",{className:"grid grid-cols-2 gap-4 p-4 bg-gray-50 rounded-xl",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"订单号"}),c.jsx("div",{className:"font-mono text-sm font-bold text-gray-900",children:U.order_id})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"状态"}),c.jsx(QS,{status:U.status})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"实付金额"}),c.jsx("div",{className:"text-lg font-extrabold text-gray-900",children:U.amount?`¥${U.amount}`:"待获取"})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"数量"}),c.jsx("div",{className:"font-bold text-gray-900",children:U.quantity})]}),c.jsxs("div",{className:"col-span-2",children:[c.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"创建时间"}),c.jsx("div",{className:"text-sm font-medium text-gray-700",children:U.created_at})]})]})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsx("h4",{className:"text-lg font-bold text-gray-800",children:"商品信息"}),c.jsxs("div",{className:"p-4 bg-gray-50 rounded-xl flex items-center gap-4",children:[U.item_image&&c.jsx("img",{src:U.item_image,alt:"",className:"w-20 h-20 rounded-xl object-cover border border-gray-200"}),c.jsxs("div",{className:"flex-1",children:[c.jsx("div",{className:"font-bold text-gray-900 mb-1",children:ye(U.item_id,U.item_title)}),c.jsxs("div",{className:"text-sm text-gray-500",children:["商品ID: ",U.item_id]}),U.item_price&&c.jsxs("div",{className:"text-sm text-gray-500 mt-1",children:["标价: ¥",U.item_price]})]})]})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsx("h4",{className:"text-lg font-bold text-gray-800",children:"买家信息"}),c.jsxs("div",{className:"p-4 bg-gray-50 rounded-xl space-y-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"买家ID"}),c.jsx("div",{className:"font-bold text-gray-900",children:U.buyer_id})]}),U.receiver_name&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"收货人"}),c.jsx("div",{className:"font-medium text-gray-700",children:U.receiver_name})]}),U.receiver_phone&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"联系电话"}),c.jsx("div",{className:"font-mono text-sm text-gray-700",children:U.receiver_phone})]}),U.receiver_address&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"收货地址"}),c.jsx("div",{className:"text-sm text-gray-700",children:U.receiver_address})]})]})]})]}),c.jsx("div",{className:"modal-footer",children:c.jsxs("div",{className:"flex gap-3 w-full",children:[c.jsx("button",{onClick:()=>M(!1),className:"flex-1 px-6 py-3 rounded-xl bg-gray-100 hover:bg-gray-200 text-gray-800 font-bold transition-colors",children:"关闭"}),U.status==="pending_ship"&&c.jsx("button",{onClick:()=>{M(!1),Le(U.order_id)},className:"flex-1 px-6 py-3 rounded-xl ios-btn-primary font-bold shadow-lg shadow-blue-200",children:"立即发货"})]})})]})}),document.body),E&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container",children:[c.jsx("div",{className:"modal-header",children:c.jsxs("div",{className:"flex items-center justify-between w-full",children:[c.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"插入订单"}),c.jsx("button",{onClick:()=>$(!1),className:"p-2 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-600"})})]})}),c.jsxs("div",{className:"modal-body space-y-5",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"选择Excel文件"}),c.jsx("input",{type:"file",accept:".xlsx,.csv,.tsv,.json",onChange:ie=>{var De;return ne(((De=ie.target.files)==null?void 0:De[0])||null)},className:"w-full ios-input px-4 py-3 rounded-xl text-sm"}),c.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"支持 .xlsx、.csv、.tsv、.json 格式"})]}),Q&&c.jsx("div",{className:"p-3 bg-blue-50 rounded-xl",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(tc,{className:"w-4 h-4 text-blue-600"}),c.jsx("span",{className:"text-sm font-medium text-blue-900",children:Q.name})]})})]}),c.jsx("div",{className:"modal-footer",children:c.jsxs("div",{className:"flex gap-3 w-full",children:[c.jsx("button",{onClick:()=>$(!1),className:"flex-1 px-6 py-3 rounded-xl bg-gray-100 hover:bg-gray-200 text-gray-800 font-bold transition-colors",children:"取消"}),c.jsx("button",{onClick:Be,disabled:!Q,className:"flex-1 px-6 py-3 rounded-xl ios-btn-primary font-bold shadow-lg shadow-blue-200 disabled:opacity-50",children:"导入订单"})]})})]})}),document.body),fe&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container",style:{maxWidth:"480px"},children:[c.jsx("div",{className:"modal-header",children:c.jsxs("div",{className:"flex items-center justify-between w-full",children:[c.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"立即发货"}),c.jsx("button",{onClick:()=>{ce(!1),P(null)},className:"p-2 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-600"})})]})}),c.jsxs("div",{className:"modal-body space-y-4",children:[c.jsx("p",{className:"text-sm text-gray-600",children:"请选择发货方式:"}),c.jsx("button",{onClick:()=>Ce("status_only"),disabled:G,className:"w-full text-left p-4 rounded-xl border-2 border-gray-200 hover:border-gray-400 hover:bg-gray-50 transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:"w-10 h-10 rounded-xl bg-blue-100 flex items-center justify-center flex-shrink-0 mt-0.5",children:c.jsx(yj,{className:"w-5 h-5 text-blue-600"})}),c.jsxs("div",{children:[c.jsx("div",{className:"font-bold text-gray-900 text-sm",children:"仅修改闲鱼发货状态"}),c.jsx("div",{className:"text-xs text-gray-500 mt-1 leading-relaxed",children:'不实际扣除或发送卡券,仅在闲鱼平台将订单标记为"已发货"。 适用于已经给客户发过货、只是忘记在闲鱼修改状态的情况。'})]})]})}),c.jsx("button",{onClick:()=>Ce("full_delivery"),disabled:G,className:"w-full text-left p-4 rounded-xl border-2 border-gray-200 hover:border-[#0094f7] hover:bg-blue-50 transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:"w-10 h-10 rounded-xl bg-blue-100 flex items-center justify-center flex-shrink-0 mt-0.5",children:c.jsx(uc,{className:"w-5 h-5 text-blue-700"})}),c.jsxs("div",{children:[c.jsx("div",{className:"font-bold text-gray-900 text-sm",children:"完整发货(匹配卡券并发送)"}),c.jsx("div",{className:"text-xs text-gray-500 mt-1 leading-relaxed",children:"自动匹配发货规则、获取卡券、发送卡券信息给买家,并修改发货状态。 适用于订单既没有发送卡券给买家、也没有修改发货状态的情况。"})]})]})}),G&&c.jsxs("div",{className:"flex items-center justify-center gap-2 py-3",children:[c.jsx(pr,{className:"w-4 h-4 animate-spin text-gray-500"}),c.jsx("span",{className:"text-sm text-gray-500",children:"正在处理中..."})]}),ue&&c.jsxs("div",{className:`p-3 rounded-xl text-sm ${ue.success?"bg-green-50 text-green-800":"bg-red-50 text-red-800"}`,children:[ue.success?"✓ ":"✗ ",ue.message]})]}),c.jsx("div",{className:"modal-footer",children:c.jsx("button",{onClick:()=>{ce(!1),P(null)},className:"w-full px-6 py-3 rounded-xl bg-gray-100 hover:bg-gray-200 text-gray-800 font-bold transition-colors",children:ue!=null&&ue.success?"完成":"取消"})})]})}),document.body),k&&T&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container",children:[c.jsx("div",{className:"modal-header",children:c.jsxs("div",{className:"flex items-center justify-between w-full",children:[c.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"编辑订单"}),c.jsx("button",{onClick:()=>D(!1),className:"p-2 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-600"})})]})}),c.jsxs("div",{className:"modal-body space-y-5",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"订单号"}),c.jsx("input",{type:"text",value:T.order_id,disabled:!0,className:"w-full ios-input px-4 py-3 rounded-xl bg-gray-50 text-gray-500"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"订单状态"}),c.jsxs("select",{value:T.status,onChange:ie=>re({...T,status:ie.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[c.jsx("option",{value:"processing",children:"处理中"}),c.jsx("option",{value:"pending_ship",children:"待发货"}),c.jsx("option",{value:"shipped",children:"已发货"}),c.jsx("option",{value:"completed",children:"已完成"}),c.jsx("option",{value:"cancelled",children:"已取消"}),c.jsx("option",{value:"refunding",children:"退款中"})]})]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"买家ID"}),c.jsx("input",{type:"text",value:T.buyer_id,onChange:ie=>re({...T,buyer_id:ie.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"实付金额"}),c.jsx("input",{type:"number",value:T.amount,onChange:ie=>re({...T,amount:parseFloat(ie.target.value)}),className:"w-full ios-input px-4 py-3 rounded-xl"})]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"收货人"}),c.jsx("input",{type:"text",value:T.receiver_name||"",onChange:ie=>re({...T,receiver_name:ie.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"联系电话"}),c.jsx("input",{type:"text",value:T.receiver_phone||"",onChange:ie=>re({...T,receiver_phone:ie.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"收货地址"}),c.jsx("textarea",{value:T.receiver_address||"",onChange:ie=>re({...T,receiver_address:ie.target.value}),rows:2,className:"w-full ios-input px-4 py-3 rounded-xl resize-none"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"商品标题"}),c.jsx("input",{type:"text",value:T.item_title||"",onChange:ie=>re({...T,item_title:ie.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl"})]})]}),c.jsx("div",{className:"modal-footer",children:c.jsxs("div",{className:"flex gap-3 w-full",children:[c.jsx("button",{onClick:()=>D(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),c.jsxs("button",{onClick:Pe,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[c.jsx(Sa,{className:"w-4 h-4"}),"保存更改"]})]})})]})}),document.body)]})},JS=()=>({name:"",type:"data",content:"",description:"",enabled:!0,delay_seconds:0,api_method:"GET",api_timeout:10,api_headers:"",api_params:""}),PQ=()=>{const[e,t]=x.useState([]),[n,r]=x.useState(!1),[l,s]=x.useState(!1),[d,f]=x.useState(null),[m,h]=x.useState({}),[v,y]=x.useState(JS),[b,w]=x.useState(!1),[j,_]=x.useState("create"),[S,A]=x.useState(null),[C,M]=x.useState(null),[k,D]=x.useState(!1),[E,$]=x.useState(""),[U,K]=x.useState(""),[T,re]=x.useState(null);x.useEffect(()=>{va().then(t)},[]);const Z=({type:I})=>{switch(I){case"text":return c.jsx(mj,{className:"w-5 h-5 text-blue-500"});case"image":return c.jsx(hj,{className:"w-5 h-5 text-purple-500"});case"api":return c.jsx(fj,{className:"w-5 h-5 text-blue-500"});default:return c.jsx(Lv,{className:"w-5 h-5 text-gray-500"})}},pe=I=>{var he,be,_e,W,V;f(I),h({id:I.id,name:I.name||"",type:I.type||"text",api_url:((he=I.api_config)==null?void 0:he.url)||"",api_method:((be=I.api_config)==null?void 0:be.method)||"GET",api_timeout:((_e=I.api_config)==null?void 0:_e.timeout)||10,api_headers:((W=I.api_config)==null?void 0:W.headers)||"",api_params:((V=I.api_config)==null?void 0:V.params)||"",text_content:I.text_content||"",data_content:I.data_content||"",image_url:I.image_url||"",delay_seconds:I.delay_seconds||0,description:I.description||"",enabled:I.enabled}),r(!0)},fe=async()=>{var I,he,be,_e,W,V,ye,xe;if(d){if(!((I=m.name)!=null&&I.trim())){alert("请输入卡密名称");return}if(!m.type){alert("请选择卡密类型");return}try{const ae={name:m.name.trim(),type:m.type,description:(he=m.description)==null?void 0:he.trim(),delay_seconds:m.delay_seconds||0,enabled:m.enabled??!0};m.type==="api"?ae.api_config={url:(be=m.api_url)==null?void 0:be.trim(),method:m.api_method,timeout:m.api_timeout||10,headers:((_e=m.api_headers)==null?void 0:_e.trim())||void 0,params:((W=m.api_params)==null?void 0:W.trim())||void 0}:m.type==="text"?ae.text_content=((V=m.text_content)==null?void 0:V.trim())||"":m.type==="data"?ae.data_content=((ye=m.data_content)==null?void 0:ye.trim())||"":m.type==="image"&&(ae.image_url=((xe=m.image_url)==null?void 0:xe.trim())||""),await wj(d.id,ae),r(!1),va().then(t)}catch(ae){console.error("更新卡密失败:",ae),alert("更新失败,请重试")}}},ce=async I=>{if(confirm("确认删除该卡密吗?"))try{await KD(I),va().then(t)}catch(he){console.error("删除卡密失败:",he),alert("删除失败,请重试")}},R=async()=>{if(!v.name.trim()){alert("请输入卡密名称");return}if(!v.content.trim()){alert(v.type==="api"?"请输入 API 地址":"请输入卡密内容");return}try{const I={name:v.name.trim(),type:v.type,description:v.description.trim(),enabled:v.enabled,delay_seconds:v.delay_seconds};v.type==="text"&&(I.text_content=v.content.trim()),v.type==="data"&&(I.data_content=v.content.trim()),v.type==="image"&&(I.image_url=v.content.trim()),v.type==="api"&&(I.api_config={url:v.content.trim(),method:v.api_method,timeout:v.api_timeout,headers:v.api_headers.trim()||void 0,params:v.api_params.trim()||void 0}),await qD(I),s(!1),y(JS()),va().then(t)}catch(I){console.error("添加卡密失败:",I),alert("添加失败,请重试")}},z=async I=>{try{await wj(I.id,{...I,enabled:!I.enabled}),va().then(t)}catch(he){console.error("切换状态失败:",he)}},G=async I=>{try{await navigator.clipboard.writeText(String(I)),alert(`已复制卡密组ID:${I}`)}catch{prompt("复制卡密组ID",String(I))}},se=e.filter(I=>I.type==="data"),ue=()=>{const be=[["名称","类型","内容","描述","启用","延迟秒","多规格","规格名","规格值"],...[["VIP月卡","data",`VIP-MONTH-001 +VIP-MONTH-002 +VIP-MONTH-003`,"按行消费的卡密队列","是","0","否","",""],["感谢文案","text","感谢购买,如有问题联系客服~","固定文本","是","0","否","",""],["教程图","image","https://cdn.example.com/tutorial.jpg","图片URL","是","0","否","",""]]].map(ye=>ye.map(xe=>`"${String(xe).replace(/"/g,'""')}"`).join(",")).join(` +`),_e=new Blob(["\uFEFF"+be],{type:"text/csv;charset=utf-8"}),W=URL.createObjectURL(_e),V=document.createElement("a");V.href=W,V.download="卡密组批量导入模板.csv",document.body.appendChild(V),V.click(),V.remove(),URL.revokeObjectURL(W)},P=async()=>{if(S){D(!0),M(null);try{const I=await YD(S);if(M(I),I.created>0){const he=await va();t(he)}}catch(I){M({error:(I==null?void 0:I.message)||"上传失败"})}finally{D(!1)}}},Q=async()=>{if(!(!E||!U.trim())){D(!0),re(null);try{const I=await GD(E,U);re({added:I.added}),K("");const he=await va();t(he)}catch(I){alert("追加失败:"+((I==null?void 0:I.message)||"未知错误"))}finally{D(!1)}}},ne=()=>{var I;_("create"),A(null),M(null),$((I=se[0])!=null&&I.id?String(se[0].id):""),K(""),re(null),w(!0)};return c.jsxs("div",{className:"space-y-6 animate-fade-in",children:[c.jsxs("div",{className:"flex flex-col md:flex-row justify-between md:items-end gap-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-4xl font-extrabold text-gray-900 tracking-tight",children:"卡密库存"}),c.jsx("p",{className:"text-gray-500 mt-2 font-medium",children:"管理自动发货的卡密、链接或图片资源。"})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("button",{onClick:ne,className:"px-4 py-3 bg-gray-100 hover:bg-gray-200 rounded-2xl font-bold text-gray-700 flex items-center gap-2 transition-colors",children:[c.jsx(tc,{className:"w-5 h-5"}),"批量导入"]}),c.jsxs("button",{onClick:()=>s(!0),className:"ios-btn-primary flex items-center gap-2 px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 transition-transform hover:scale-105 active:scale-95",children:[c.jsx(ja,{className:"w-5 h-5"}),"添加新卡密"]})]})]}),c.jsxs("div",{className:"ios-card rounded-xl overflow-hidden shadow-lg border-0 bg-white",children:[c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("table",{className:"w-full text-left border-collapse",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"bg-white text-gray-400 text-xs font-bold uppercase tracking-wider border-b border-gray-50",children:[c.jsx("th",{className:"px-8 py-5 w-[18%]",children:"卡密名称"}),c.jsx("th",{className:"px-6 py-5 w-[12%]",children:"卡密组ID"}),c.jsx("th",{className:"px-6 py-5 w-[10%]",children:"类型"}),c.jsx("th",{className:"px-6 py-5 w-[22%]",children:"内容/库存"}),c.jsx("th",{className:"px-6 py-5 w-[18%]",children:"描述"}),c.jsx("th",{className:"px-6 py-5 w-[10%]",children:"状态"}),c.jsx("th",{className:"px-6 py-5 w-[10%] text-right",children:"操作"})]})}),c.jsx("tbody",{className:"divide-y divide-gray-50",children:e.map(I=>{let he="";return I.type==="data"&&I.data_content?he=`库存: ${I.data_content.split(` +`).filter(_e=>_e.trim()).length} 条`:I.type==="text"&&I.text_content?he=I.text_content.substring(0,20)+(I.text_content.length>20?"...":""):I.type==="api"&&I.api_config?he=I.api_config.url:I.type==="image"&&I.image_url&&(he="图片链接"),c.jsxs("tr",{className:"hover:bg-[#FFFDE7]/50 transition-colors group",children:[c.jsx("td",{className:"px-8 py-5",children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"p-2 bg-gray-50 rounded-xl group-hover:bg-white transition-colors",children:c.jsx(Z,{type:I.type})}),c.jsx("span",{className:"font-bold text-gray-900",children:I.name})]})}),c.jsx("td",{className:"px-6 py-5",children:c.jsxs("button",{onClick:()=>G(I.id),className:"inline-flex items-center gap-2 rounded-xl bg-gray-100 px-3 py-2 font-mono text-xs font-extrabold text-gray-700 hover:bg-gray-200 transition-colors",title:"复制卡密组ID,用于批量铺货表格",children:[I.id,c.jsx(lM,{className:"w-3.5 h-3.5"})]})}),c.jsx("td",{className:"px-6 py-5",children:c.jsx("span",{className:`px-3 py-1.5 rounded-lg text-xs font-bold ${I.type==="text"?"bg-blue-50 text-blue-600":I.type==="data"?"bg-purple-50 text-purple-600":I.type==="api"?"bg-blue-50 text-blue-600":"bg-pink-50 text-pink-600"}`,children:I.type==="text"?"文本":I.type==="data"?"批量":I.type==="api"?"API":"图片"})}),c.jsx("td",{className:"px-6 py-5",children:c.jsx("span",{className:"text-sm text-gray-600 font-mono block truncate",title:he,children:he})}),c.jsx("td",{className:"px-6 py-5",children:c.jsx("span",{className:"text-sm text-gray-500 block max-w-[200px] truncate",title:I.description||"-",children:I.description||"-"})}),c.jsx("td",{className:"px-6 py-5",children:c.jsx("button",{onClick:()=>z(I),className:`w-12 h-8 rounded-full relative transition-colors ${I.enabled?"bg-green-500":"bg-gray-300"}`,children:c.jsx("div",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-sm transition-transform ${I.enabled?"left-5":"left-1"}`})})}),c.jsx("td",{className:"px-6 py-5",children:c.jsxs("div",{className:"flex items-center justify-end gap-2",children:[c.jsx("button",{onClick:()=>pe(I),className:"p-2 text-gray-400 hover:text-black hover:bg-gray-100 rounded-xl transition-colors",title:"编辑",children:c.jsx(bs,{className:"w-4 h-4"})}),c.jsx("button",{onClick:()=>ce(I.id),className:"p-2 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",children:c.jsx(xa,{className:"w-5 h-5"})})]})})]},I.id)})})]})}),e.length===0&&c.jsxs("div",{className:"py-20 text-center text-gray-400",children:[c.jsx(fA,{className:"w-12 h-12 mx-auto mb-4 opacity-30"}),c.jsx("p",{children:"暂无卡密配置,请点击右上角添加。"})]})]}),n&&d&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container",children:[c.jsxs("div",{className:"modal-header",children:[c.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"编辑卡密"}),c.jsx("button",{onClick:()=>r(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-500"})})]}),c.jsx("div",{className:"modal-body",children:c.jsxs("div",{className:"space-y-5",children:[c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsxs("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:["卡密名称 ",c.jsx("span",{className:"text-red-500",children:"*"})]}),c.jsx("input",{type:"text",value:m.name||"",onChange:I=>h({...m,name:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"例如:游戏点卡、会员卡等"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡券类型"}),c.jsxs("select",{value:m.type||"text",onChange:I=>h({...m,type:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[c.jsx("option",{value:"",children:"请选择类型"}),c.jsx("option",{value:"text",children:"固定文字"}),c.jsx("option",{value:"data",children:"批量数据"}),c.jsx("option",{value:"api",children:"API接口"}),c.jsx("option",{value:"image",children:"图片"})]})]})]}),m.type==="api"&&c.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 space-y-4 bg-gray-50",children:[c.jsx("h3",{className:"font-bold text-gray-900",children:"API 配置"}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"API 地址"}),c.jsx("input",{type:"url",value:m.api_url||"",onChange:I=>h({...m,api_url:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https://api.example.com/get-card"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"请求方法"}),c.jsxs("select",{value:m.api_method||"GET",onChange:I=>h({...m,api_method:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[c.jsx("option",{value:"GET",children:"GET"}),c.jsx("option",{value:"POST",children:"POST"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"超时时间(秒)"}),c.jsx("input",{type:"number",value:m.api_timeout||10,onChange:I=>h({...m,api_timeout:parseInt(I.target.value)||10}),className:"w-full ios-input px-4 py-3 rounded-xl",min:"1",max:"60"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"请求头(JSON 格式)"}),c.jsx("textarea",{value:m.api_headers||"",onChange:I=>h({...m,api_headers:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-20 resize-none font-mono text-sm",placeholder:'{"Authorization": "Bearer token"}'})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"请求参数(JSON 格式)"}),c.jsx("textarea",{value:m.api_params||"",onChange:I=>h({...m,api_params:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-20 resize-none font-mono text-sm",placeholder:'{"type": "card", "count": 1}'})]})]}),m.type==="text"&&c.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 bg-gray-50",children:[c.jsx("h3",{className:"font-bold text-gray-900 mb-3",children:"固定文字配置"}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"文字内容"}),c.jsx("textarea",{value:m.text_content||"",onChange:I=>h({...m,text_content:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-32 resize-none",placeholder:"请输入要发送的固定文字内容..."})]})]}),m.type==="data"&&c.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 bg-gray-50",children:[c.jsx("h3",{className:"font-bold text-gray-900 mb-3",children:"批量数据配置"}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"数据内容(一行一个)"}),c.jsx("textarea",{value:m.data_content||"",onChange:I=>h({...m,data_content:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-80 resize-none font-mono text-sm",placeholder:`请输入数据,每行一个: +卡号1:密码1 +卡号2:密码2 +或者 +兑换码1 +兑换码2`}),c.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"支持格式:卡号:密码 或 单独的兑换码"}),c.jsxs("p",{className:"text-xs text-gray-500",children:["当前库存:",c.jsx("span",{className:"font-bold text-blue-600",children:m.data_content?m.data_content.split(` +`).filter(I=>I.trim()).length:0})," 条"]})]})]}),m.type==="image"&&c.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 bg-gray-50",children:[c.jsx("h3",{className:"font-bold text-gray-900 mb-3",children:"图片配置"}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片 URL"}),c.jsx("input",{type:"url",value:m.image_url||"",onChange:I=>h({...m,image_url:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl font-mono text-sm",placeholder:"https://example.com/image.png"}),c.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"输入图片卡密的 URL 地址"})]}),m.image_url&&c.jsxs("div",{className:"mt-3",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片预览"}),c.jsx("img",{src:m.image_url,alt:"预览",className:"max-w-full max-h-48 rounded-xl border border-gray-200",onError:I=>{I.currentTarget.src="https://via.placeholder.com/400x200?text=图片加载失败"}})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"延时发货时间(秒)"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{type:"number",value:m.delay_seconds||0,onChange:I=>h({...m,delay_seconds:parseInt(I.target.value)||0}),className:"flex-1 ios-input px-4 py-3 rounded-xl",min:"0",max:"3600",placeholder:"0"}),c.jsx("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:"秒"})]}),c.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"0表示立即发货,最大3600秒(1小时)"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"备注信息"}),c.jsx("textarea",{value:m.description||"",onChange:I=>h({...m,description:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-40 resize-none",placeholder:"可选的备注信息"})]}),c.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[c.jsx("span",{className:"font-bold text-gray-900",children:"启用状态"}),c.jsx("button",{type:"button",onClick:()=>h({...m,enabled:!m.enabled}),className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${m.enabled?"bg-[#0094f7]":"bg-gray-300"}`,children:c.jsx("span",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 block ${m.enabled?"translate-x-7":"translate-x-1"}`})})]})]})}),c.jsx("div",{className:"modal-footer",children:c.jsxs("div",{className:"flex gap-3 w-full",children:[c.jsx("button",{onClick:()=>r(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),c.jsxs("button",{onClick:fe,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[c.jsx(Sa,{className:"w-4 h-4"}),"保存更改"]})]})})]})}),document.body),l&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container",style:{maxWidth:"780px"},children:[c.jsxs("div",{className:"modal-header flex items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"添加新卡密"}),c.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"选择交付方式并录入自动发货内容"})]}),c.jsx("button",{onClick:()=>s(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors flex-shrink-0",title:"关闭",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-500"})})]}),c.jsx("div",{className:"modal-body",children:c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"卡密名称"}),c.jsx("input",{type:"text",value:v.name,onChange:I=>y({...v,name:I.target.value}),placeholder:"例如:VIP会员卡密",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"类型"}),c.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[c.jsxs("button",{type:"button",onClick:()=>y({...v,type:"data",content:""}),className:`p-3 rounded-xl font-bold transition-all ${v.type==="data"?"bg-[#0094f7] text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:[c.jsx(Lv,{className:"w-5 h-5 mx-auto mb-1"}),"批量库存"]}),c.jsxs("button",{type:"button",onClick:()=>y({...v,type:"text",content:""}),className:`p-3 rounded-xl font-bold transition-all ${v.type==="text"?"bg-[#0094f7] text-white":"bg-gray-100 text-gray-600"}`,children:[c.jsx(mj,{className:"w-5 h-5 mx-auto mb-1"}),"文本"]}),c.jsxs("button",{type:"button",onClick:()=>y({...v,type:"image",content:""}),className:`p-3 rounded-xl font-bold transition-all ${v.type==="image"?"bg-[#0094f7] text-white":"bg-gray-100 text-gray-600"}`,children:[c.jsx(hj,{className:"w-5 h-5 mx-auto mb-1"}),"图片"]}),c.jsxs("button",{type:"button",onClick:()=>y({...v,type:"api",content:""}),className:`p-3 rounded-xl font-bold transition-all ${v.type==="api"?"bg-[#0094f7] text-white":"bg-gray-100 text-gray-600"}`,children:[c.jsx(fj,{className:"w-5 h-5 mx-auto mb-1"}),"API"]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:v.type==="data"?"库存内容(一行一个)":v.type==="text"?"固定回复内容":v.type==="image"?"图片 URL":"API 地址"}),v.type==="api"?c.jsx("input",{type:"url",value:v.content,onChange:I=>y({...v,content:I.target.value}),placeholder:"https://api.example.com/get-code",className:"w-full ios-input px-4 py-3 rounded-xl"}):v.type==="image"?c.jsx("input",{type:"url",value:v.content,onChange:I=>y({...v,content:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"https://example.com/card.png"}):c.jsx("textarea",{value:v.content,onChange:I=>y({...v,content:I.target.value}),className:`w-full ios-input px-4 py-3 rounded-xl resize-none text-sm ${v.type==="data"?"h-48 font-mono":"h-32"}`,placeholder:v.type==="data"?`CODE-123456 +CODE-789012 +...`:"请输入每次发货时发送的固定文字"}),v.type==="data"&&c.jsxs("p",{className:"text-xs text-gray-500",children:["当前库存:",c.jsx("span",{className:"font-bold text-[#0094f7]",children:v.content.split(` +`).filter(I=>I.trim()).length})," 条"]})]}),v.type==="api"&&c.jsxs("div",{className:"border-t border-gray-100 pt-5 space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求方法"}),c.jsxs("select",{value:v.api_method,onChange:I=>y({...v,api_method:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[c.jsx("option",{value:"GET",children:"GET"}),c.jsx("option",{value:"POST",children:"POST"})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"超时时间(秒)"}),c.jsx("input",{type:"number",min:"1",max:"60",value:v.api_timeout,onChange:I=>y({...v,api_timeout:parseInt(I.target.value)||10}),className:"w-full ios-input px-4 py-3 rounded-xl"})]})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求头(JSON)"}),c.jsx("textarea",{value:v.api_headers,onChange:I=>y({...v,api_headers:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-24 resize-none font-mono text-xs",placeholder:'{"Authorization":"Bearer token"}'})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"请求参数(JSON)"}),c.jsx("textarea",{value:v.api_params,onChange:I=>y({...v,api_params:I.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl h-24 resize-none font-mono text-xs",placeholder:'{"order_id":"{order_id}"}'})]})]})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_180px] gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"描述"}),c.jsx("input",{value:v.description,onChange:I=>y({...v,description:I.target.value}),placeholder:"卡密用途描述(可选)",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"延时发货(秒)"}),c.jsx("input",{type:"number",value:v.delay_seconds,onChange:I=>y({...v,delay_seconds:parseInt(I.target.value)||0}),className:"w-full ios-input px-4 py-3 rounded-xl",min:"0",max:"3600"})]})]})]})}),c.jsx("div",{className:"modal-footer",children:c.jsxs("div",{className:"flex gap-3 w-full",children:[c.jsx("button",{onClick:()=>s(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),c.jsxs("button",{onClick:R,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[c.jsx(ja,{className:"w-4 h-4"}),"添加卡密"]})]})})]})}),document.body),b&&It.createPortal(c.jsx("div",{className:"modal-overlay",children:c.jsxs("div",{className:"modal-container",style:{maxWidth:"40rem"},children:[c.jsxs("div",{className:"px-6 py-5 border-b border-gray-100 flex items-center justify-between",children:[c.jsx("h3",{className:"text-xl font-extrabold text-gray-900",children:"批量导入卡密"}),c.jsx("button",{onClick:()=>w(!1),className:"w-10 h-10 rounded-2xl bg-gray-100 hover:bg-gray-200 flex items-center justify-center",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-600"})})]}),c.jsxs("div",{className:"px-6 py-5 space-y-5",children:[c.jsxs("div",{className:"flex flex-wrap gap-2 p-2 bg-gray-100/50 rounded-2xl",children:[c.jsxs("button",{onClick:()=>_("create"),className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${j==="create"?"bg-[#0094f7] text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[c.jsx(CM,{className:"w-4 h-4"}),"批量创建卡密组"]}),c.jsxs("button",{onClick:()=>_("append"),className:`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${j==="append"?"bg-[#0094f7] text-white shadow-md":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[c.jsx(tc,{className:"w-4 h-4"}),"往单个组充卡密"]})]}),j==="create"?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"rounded-xl bg-blue-50 border border-blue-100 p-4 text-xs text-blue-900 leading-5",children:["上传表格,每行一个卡密组。表头:",c.jsx("code",{className:"bg-blue-100/70 px-1.5 py-0.5 rounded",children:"名称,类型,内容,描述,启用,延迟秒,多规格,规格名,规格值"}),'。 类型填 text/data/image/api;data 类型的"内容"按行存卡密(CSV 单元格内换行需用引号包裹)。']}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("button",{onClick:ue,className:"px-4 py-2.5 bg-gray-100 hover:bg-gray-200 rounded-xl font-bold text-gray-700 flex items-center gap-2 text-sm transition-colors",children:[c.jsx(vM,{className:"w-4 h-4"}),"下载模板"]}),c.jsxs("label",{className:"flex-1 px-4 py-2.5 bg-gray-100 hover:bg-gray-200 rounded-xl font-bold text-gray-700 flex items-center gap-2 text-sm cursor-pointer transition-colors",children:[c.jsx(tc,{className:"w-4 h-4"}),S?S.name:"选择 .xlsx / .csv / .tsv",c.jsx("input",{type:"file",accept:".xlsx,.csv,.tsv",className:"hidden",onChange:I=>{var he;return A(((he=I.target.files)==null?void 0:he[0])||null)}})]})]}),C&&!C.error&&c.jsxs("div",{className:"rounded-xl border border-gray-200 p-4 space-y-2",children:[c.jsxs("div",{className:"text-sm font-bold text-gray-900",children:["共 ",C.total," 行 · 成功 ",C.created," · 失败 ",C.failed]}),C.failed>0&&c.jsx("div",{className:"max-h-48 overflow-y-auto space-y-1",children:C.rows.filter(I=>!I.success).map(I=>c.jsxs("div",{className:"text-xs text-red-600",children:["第 ",I.row_no," 行「",I.name,"」:",I.error]},I.row_no))})]})]}):c.jsx("div",{className:"space-y-4",children:se.length===0?c.jsx("div",{className:"rounded-xl bg-amber-50 border border-amber-200 p-4 text-sm text-amber-800",children:"暂无 data(批量卡密)类型的卡密组,请先创建一个再充卡密。"}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"选择卡密组"}),c.jsx("select",{value:E,onChange:I=>$(I.target.value),className:"w-full ios-input px-4 py-3 rounded-xl text-sm",children:se.map(I=>c.jsxs("option",{value:String(I.id),children:[I.name,"(ID: ",I.id,")"]},I.id))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"卡密号(每行一个)"}),c.jsx("textarea",{value:U,onChange:I=>K(I.target.value),placeholder:`VIP-001 +VIP-002 +VIP-003`,className:"w-full ios-input px-4 py-3 rounded-xl text-sm font-mono h-40 resize-y"}),c.jsx("p",{className:"text-xs text-gray-500",children:"一行一个卡密号,空行自动忽略。会追加到该组现有库存末尾。"})]}),T&&c.jsxs("div",{className:"rounded-xl bg-green-50 border border-green-200 p-3 text-sm text-green-700 font-bold",children:["已追加 ",T.added," 个卡密"]})]})})]}),c.jsxs("div",{className:"px-6 py-4 border-t border-gray-100 flex items-center justify-end gap-3",children:[c.jsx("button",{onClick:()=>w(!1),className:"px-5 py-2.5 rounded-xl bg-gray-100 hover:bg-gray-200 font-bold text-gray-700 transition-colors",children:"关闭"}),j==="create"?c.jsxs("button",{onClick:P,disabled:!S||k,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[k?c.jsx(Yn,{className:"w-4 h-4 animate-spin"}):c.jsx(tc,{className:"w-4 h-4"}),k?"处理中...":"上传创建"]}):c.jsxs("button",{onClick:Q,disabled:!E||!U.trim()||k||se.length===0,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[k?c.jsx(Yn,{className:"w-4 h-4 animate-spin"}):c.jsx(ja,{className:"w-4 h-4"}),k?"处理中...":"追加卡密"]})]})]})}),document.body)]})},zQ=e=>{const t=String(e||"").trim();return t?/^[¥¥]/.test(t)?t:`¥${t}`:"-"},IQ=({onConfigureDelivery:e})=>{const[t,n]=x.useState([]),[r,l]=x.useState([]),[s,d]=x.useState([]),[f,m]=x.useState(""),[h,v]=x.useState(!1),[y,b]=x.useState(!1),[w,j]=x.useState(!1),[_,S]=x.useState(!1),[A,C]=x.useState(!1),[M,k]=x.useState(!1),[D,E]=x.useState(!1),[$,U]=x.useState("upload"),[K,T]=x.useState(null),[re,Z]=x.useState(null),[pe,fe]=x.useState(null),[ce,R]=x.useState(null),[z,G]=x.useState(null),[se,ue]=x.useState({}),[P,Q]=x.useState({cookie_id:"",item_id:"",item_title:"",item_price:"",item_image:""}),[ne,I]=x.useState({cookie_id:"",title:"",description:"",price:"",original_price:"",quantity:"1",postage_mode:"free",postage:"",images:[]}),he=async()=>{const B=await Ns();n(B)},be=async()=>{l(await Rd())};x.useEffect(()=>{Promise.all([Fy(),Ns(),Rd()]).then(([B,Te,lt])=>{d(B),n(Te),l(lt)}).catch(B=>console.error("加载商品配置失败:",B))},[]),x.useEffect(()=>{if(!D||!(ce!=null&&ce.id)||ce.status!=="running")return;const B=window.setInterval(async()=>{try{const Te=await cd(ce.id);R(Te),Te.status!=="running"&&(U("done"),await he(),await be())}catch(Te){console.error("刷新批量铺货进度失败:",Te)}},3e3);return()=>window.clearInterval(B)},[D,ce==null?void 0:ce.id,ce==null?void 0:ce.status]);const _e=async()=>{if(!f)return alert("请先选择账号");v(!0);try{const B=await VD(f);await he(),alert((B==null?void 0:B.message)||"商品同步完成")}catch(B){console.error("同步商品失败:",B),alert((B==null?void 0:B.message)||"同步失败,请重试")}finally{v(!1)}},W=B=>{G(B),ue({...B}),S(!0)},V=async()=>{if(z)try{await tP(z.cookie_id,z.item_id,{item_title:se.item_title||"",item_description:se.item_description||"",item_category:se.item_category||"",item_price:se.item_price||"",item_detail:se.item_detail||z.item_detail||""}),await he(),await be(),S(!1),G(null)}catch(B){console.error("更新商品失败:",B),alert("更新失败,请重试")}},ye=async B=>{if(confirm(`确认删除商品"${B.item_title}"吗?`))try{await FD(B.cookie_id,B.item_id),n(Te=>Te.filter(lt=>!(lt.cookie_id===B.cookie_id&<.item_id===B.item_id)))}catch(Te){console.error("删除商品失败:",Te),alert("删除失败,请重试")}},xe=async()=>{try{if(!P.cookie_id||!P.item_id){alert("请选择账号并填写商品ID");return}await XD(P.cookie_id,{item_id:P.item_id,item_title:P.item_title,item_price:P.item_price,item_detail:P.item_image?JSON.stringify({item_image:P.item_image}):""}),await he(),C(!1),Q({cookie_id:"",item_id:"",item_title:"",item_price:"",item_image:""})}catch(B){console.error("添加商品失败:",B),alert("添加失败,请重试")}},ae=async()=>{if(!ne.cookie_id)return alert("请选择发布账号");if(!ne.title.trim())return alert("请填写商品标题");if(!ne.price.trim())return alert("请填写商品价格");if(!ne.quantity||Number(ne.quantity)<=0)return alert("库存数量必须大于 0");if(ne.images.length===0)return alert("至少上传 1 张商品图片");if(ne.postage_mode==="fixed"&&!ne.postage.trim())return alert("请填写一口价邮费");b(!0);try{const B=await WD(ne);if(await he(),k(!1),I({cookie_id:f||"",title:"",description:"",price:"",original_price:"",quantity:"1",postage_mode:"free",postage:"",images:[]}),B!=null&&B.item_id){const Te={id:B.item_id,cookie_id:ne.cookie_id,item_id:B.item_id,item_title:B.item_title||ne.title,item_price:B.item_price||ne.price,item_image:B.item_image};e(Te),alert("商品发布成功,ID: "+B.item_id+",已为你打开发货规则配置")}else alert("商品发布成功")}catch(B){console.error("发布商品失败:",B);const Te=B==null?void 0:B.payload;if((Te==null?void 0:Te.code)==="stock_permission_missing"){alert("发布失败:该账号没有库存发布权限,无法按库存数量发布商品。请换账号或先在闲鱼确认库存能力。");return}alert((B==null?void 0:B.message)||"发布失败,请重试")}finally{b(!1)}},Le=()=>{U("upload"),fe(null),R(null),T(null),Z(null),E(!0)},Ce=async()=>{if(!K)return alert("请先上传商品表格");if(!f)return alert("请先选择默认发布账号");j(!0);try{const B=await ZD({file:K,imagesZip:re,defaultCookieId:f});fe(B),R(null),U("preview")}catch(B){console.error("批量铺货预检失败:",B),alert((B==null?void 0:B.message)||"预检失败,请检查表格和图片 zip")}finally{j(!1)}},Y=async()=>{if(pe!=null&&pe.preview_id){if(pe.valid<=0)return alert("没有可发布的商品行");j(!0);try{const B=await QD(pe.preview_id),Te=await cd(B.batch_id||pe.preview_id);R(Te),U(Te.status==="running"?"running":"done")}catch(B){console.error("启动批量铺货失败:",B),alert((B==null?void 0:B.message)||"启动发布任务失败")}finally{j(!1)}}},ge=async()=>{if(ce!=null&&ce.id&&confirm("确认取消当前批量铺货任务吗?正在发布的单个商品可能会继续完成。")){j(!0);try{await JD(ce.id),R(await cd(ce.id)),U("done")}catch(B){alert((B==null?void 0:B.message)||"取消失败")}finally{j(!1)}}},Pe=async()=>{if(ce!=null&&ce.id){j(!0);try{await eP(ce.id),R(await cd(ce.id)),U("running")}catch(B){alert((B==null?void 0:B.message)||"重试失败")}finally{j(!1)}}},Be=()=>{const lt=[["账号ID","标题","描述","价格","原价","库存","邮费模式","邮费","图片","付款发货启用","付款发货内容","评价赠品启用","评价赠品内容","求评价启用","求评价等待小时","求评价文案","求评价最多次数"],...[["","会员组合包自动发货","下单后发送主卡和附赠卡。","19.90","29.90","10","free","","images/bundle-1.jpg;images/bundle-2.jpg","是","101:1;102:1","是","201:1;202:2","是","72","亲,满意的话麻烦给个评价,谢谢~","1"],["","普通商品","仅发布商品,不创建自动化规则。","49.90","","10","fixed","8.00","https://example.com/product.jpg","否","","否","","否","","",""]]].map(wi=>wi.map(xl=>`"${String(xl).replace(/"/g,'""')}"`).join(",")).join(` +`),Zr=new Blob(["\uFEFF"+lt],{type:"text/csv;charset=utf-8"}),Qn=URL.createObjectURL(Zr),$n=document.createElement("a");$n.href=Qn,$n.download="批量铺货模板.csv",document.body.appendChild($n),$n.click(),$n.remove(),URL.revokeObjectURL(Qn)},Ve=()=>{Q(B=>({...B,cookie_id:f||B.cookie_id})),C(!0)},Dt=()=>{I(B=>({...B,cookie_id:f||B.cookie_id})),k(!0)},ie=B=>r.filter(Te=>Te.cookie_id===B.cookie_id&&Te.item_id===B.item_id),De=B=>{switch(B){case"preview":return"待确认";case"pending":return"等待中";case"running":return"发布中";case"success":return"成功";case"failed":return"失败";case"completed":return"已完成";case"canceled":return"已取消";default:return B||"-"}},Ue=B=>{switch(B){case"success":case"completed":return"bg-emerald-50 text-emerald-700 border-emerald-100";case"failed":return"bg-red-50 text-red-700 border-red-100";case"running":return"bg-blue-50 text-blue-700 border-blue-100";case"canceled":return"bg-gray-100 text-gray-600 border-gray-200";default:return"bg-amber-50 text-amber-700 border-amber-100"}};return c.jsxs("div",{className:"space-y-6 animate-fade-in",children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-3xl font-bold text-gray-900",children:"商品管理"}),c.jsx("p",{className:"text-gray-500 mt-2 text-sm",children:"监控并管理所有账号下的闲鱼商品。"})]}),c.jsxs("div",{className:"flex gap-3",children:[c.jsxs("select",{className:"ios-input px-4 py-3 rounded-xl text-sm",value:f,onChange:B=>m(B.target.value),children:[c.jsx("option",{value:"",children:"选择账号以同步"}),s.map(B=>c.jsx("option",{value:B.id,children:B.nickname},B.id))]}),c.jsxs("button",{onClick:_e,disabled:h||!f,className:"ios-btn-primary flex items-center gap-2 px-6 py-3 rounded-2xl font-bold shadow-lg shadow-blue-200 disabled:opacity-50",children:[c.jsx(pr,{className:`w-4 h-4 ${h?"animate-spin":""}`}),"同步商品"]}),c.jsxs("button",{onClick:Ve,className:"px-5 py-3 rounded-2xl font-bold bg-gray-900 text-white hover:bg-gray-800 transition-colors flex items-center gap-2 shadow-lg",children:[c.jsx(ja,{className:"w-4 h-4"}),"添加商品"]}),c.jsxs("button",{onClick:Dt,className:"px-5 py-3 rounded-2xl font-bold bg-emerald-600 text-white hover:bg-emerald-700 transition-colors flex items-center gap-2 shadow-lg shadow-emerald-100",children:[c.jsx(Zp,{className:"w-4 h-4"}),"发布商品"]}),c.jsxs("button",{onClick:Le,className:"px-5 py-3 rounded-2xl font-bold bg-blue-600 text-white hover:bg-blue-700 transition-colors flex items-center gap-2 shadow-lg shadow-blue-100",children:[c.jsx(od,{className:"w-4 h-4"}),"批量铺货"]})]})]}),c.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4",children:[t.map(B=>{const Te=ie(B),lt=Te.length>0;return c.jsxs("div",{className:"ios-card p-3 rounded-2xl hover:shadow-lg transition-all group relative flex flex-col",children:[c.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:[c.jsx("button",{onClick:()=>W(B),className:"p-1.5 bg-white/90 backdrop-blur rounded-lg shadow-md text-gray-600 hover:bg-[#0094f7] hover:text-white transition-colors",title:"编辑",children:c.jsx(bs,{className:"w-3.5 h-3.5"})}),c.jsx("button",{onClick:()=>ye(B),className:"p-1.5 bg-white/90 backdrop-blur rounded-lg shadow-md hover:bg-red-100 text-red-500 transition-colors",title:"删除",children:c.jsx(xa,{className:"w-3.5 h-3.5"})})]}),c.jsxs("div",{className:"aspect-square bg-gray-100 rounded-xl mb-2.5 overflow-hidden relative",children:[B.item_image?c.jsx("img",{src:B.item_image,alt:"",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"}):c.jsx("div",{className:"w-full h-full flex items-center justify-center text-gray-300",children:c.jsx(sA,{className:"w-8 h-8"})}),c.jsx("div",{className:"absolute top-1.5 left-1.5 bg-black/50 backdrop-blur-md text-white text-[10px] font-bold px-1.5 py-0.5 rounded-md",children:zQ(B.item_price)})]}),c.jsx("h3",{className:"font-bold text-gray-900 line-clamp-2 text-xs mb-1.5 h-8 leading-4",children:B.item_title}),c.jsxs("div",{className:"flex justify-between items-center text-[10px] text-gray-500 mb-2",children:[c.jsxs("span",{className:"bg-gray-100 px-1.5 py-0.5 rounded truncate max-w-[80px]",children:["ID: ",B.item_id]}),c.jsxs("span",{className:`inline-flex items-center gap-1 font-bold ${lt?"text-emerald-600":"text-amber-600"}`,children:[lt?c.jsx(oA,{className:"w-3 h-3"}):c.jsx(eM,{className:"w-3 h-3"}),lt?`${Te.length} 规则`:"未配置"]})]}),c.jsx("div",{className:"space-y-2 mt-auto",children:c.jsxs("button",{onClick:()=>e(B),className:`w-full flex items-center justify-between gap-1 px-2.5 py-2 rounded-lg text-[11px] font-extrabold transition-all ${lt?"bg-gray-900 text-white hover:bg-black":"bg-[#0094f7] text-white hover:bg-[#0071e3] shadow-md shadow-blue-100"}`,children:[c.jsxs("span",{className:"flex items-center gap-1.5",children:[c.jsx(EM,{className:"w-3.5 h-3.5"}),lt?"查看发货规则":"关联发货规则"]}),c.jsx(Rv,{className:"w-3.5 h-3.5"})]})})]},`${B.cookie_id}-${B.item_id}`)}),t.length===0&&c.jsxs("div",{className:"col-span-full py-20 text-center text-gray-400",children:[c.jsx(pA,{className:"w-12 h-12 mx-auto mb-4 opacity-30"}),"暂无商品数据,请选择账号进行同步"]})]}),_&&z&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container",style:{maxWidth:"560px"},children:[c.jsxs("div",{className:"modal-header flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-xl font-extrabold text-gray-900",children:"编辑商品"}),c.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["ID: ",z.item_id]})]}),c.jsx("button",{onClick:()=>S(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-500"})})]}),c.jsxs("div",{className:"modal-body space-y-4",children:[c.jsx("input",{className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"商品标题",value:se.item_title||"",onChange:B=>ue({...se,item_title:B.target.value})}),c.jsx("input",{className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"价格",value:se.item_price||"",onChange:B=>ue({...se,item_price:B.target.value})}),c.jsx("input",{className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"分类",value:se.item_category||"",onChange:B=>ue({...se,item_category:B.target.value})}),c.jsx("textarea",{className:"w-full ios-input px-4 py-3 rounded-xl h-28 resize-none",placeholder:"描述",value:se.item_description||"",onChange:B=>ue({...se,item_description:B.target.value})})]}),c.jsx("div",{className:"modal-footer",children:c.jsxs("button",{onClick:V,className:"w-full ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[c.jsx(Sa,{className:"w-4 h-4"}),"保存"]})})]})}),document.body),A&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container",style:{maxWidth:"720px"},children:[c.jsxs("div",{className:"modal-header flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-xl font-extrabold text-gray-900",children:"添加商品"}),c.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"手动建立商品与自动发货规则的关联"})]}),c.jsx("button",{onClick:()=>C(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors",title:"关闭",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-500"})})]}),c.jsxs("div",{className:"modal-body space-y-5",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"所属账号"}),c.jsxs("select",{className:"w-full ios-input px-4 py-3 rounded-xl",value:P.cookie_id,onChange:B=>Q({...P,cookie_id:B.target.value}),children:[c.jsx("option",{value:"",children:"选择账号"}),s.map(B=>c.jsx("option",{value:B.id,children:B.nickname||B.remark||B.id},B.id))]})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"商品 ID"}),c.jsx("input",{className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"输入闲鱼商品 ID",value:P.item_id,onChange:B=>Q({...P,item_id:B.target.value})})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"商品价格"}),c.jsx("input",{className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"例如 99.00",value:P.item_price,onChange:B=>Q({...P,item_price:B.target.value})})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"商品标题"}),c.jsx("input",{className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"输入商品标题",value:P.item_title,onChange:B=>Q({...P,item_title:B.target.value})})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"图片 URL"}),c.jsx("input",{className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"https://...",value:P.item_image,onChange:B=>Q({...P,item_image:B.target.value})})]})]}),c.jsx("div",{className:"modal-footer",children:c.jsxs("button",{onClick:xe,className:"w-full ios-btn-primary px-6 py-3.5 rounded-xl font-bold flex items-center justify-center gap-2",children:[c.jsx(ja,{className:"w-4 h-4"}),"添加商品"]})})]})}),document.body),M&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container",style:{maxWidth:"820px"},children:[c.jsxs("div",{className:"modal-header flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-xl font-extrabold text-gray-900",children:"发布商品到闲鱼"}),c.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"普通单规格发布;库存数量会写入闲鱼发布参数,用于判断账号库存能力。"})]}),c.jsx("button",{onClick:()=>k(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors",title:"关闭",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-500"})})]}),c.jsxs("div",{className:"modal-body space-y-5",children:[c.jsx("div",{className:"rounded-2xl border border-amber-200 bg-amber-50 p-4 text-sm text-amber-800 leading-6",children:"发布时必须填写库存。若账号没有库存发布能力,后端会返回明确的“库存权限不足”错误,不会误报为普通发布失败。"}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"发布账号"}),c.jsxs("select",{className:"w-full ios-input px-4 py-3 rounded-xl",value:ne.cookie_id,onChange:B=>I({...ne,cookie_id:B.target.value}),children:[c.jsx("option",{value:"",children:"选择账号"}),s.map(B=>c.jsx("option",{value:B.id,children:B.nickname||B.remark||B.id},B.id))]})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"商品标题"}),c.jsx("input",{className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"例如:会员月卡自动发货",value:ne.title,onChange:B=>I({...ne,title:B.target.value})})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"库存数量"}),c.jsx("input",{className:"w-full ios-input px-4 py-3 rounded-xl",type:"number",min:"1",placeholder:"必须大于 0",value:ne.quantity,onChange:B=>I({...ne,quantity:B.target.value})})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"商品描述"}),c.jsx("textarea",{className:"w-full ios-input px-4 py-3 rounded-xl h-28 resize-none",placeholder:"描述会用于自动识别类目;留空时使用标题",value:ne.description,onChange:B=>I({...ne,description:B.target.value})})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"售价"}),c.jsx("input",{className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"99.00",value:ne.price,onChange:B=>I({...ne,price:B.target.value})})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"原价(可选)"}),c.jsx("input",{className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"129.00",value:ne.original_price,onChange:B=>I({...ne,original_price:B.target.value})})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"运费方式"}),c.jsxs("select",{className:"w-full ios-input px-4 py-3 rounded-xl",value:ne.postage_mode,onChange:B=>I({...ne,postage_mode:B.target.value}),children:[c.jsx("option",{value:"free",children:"包邮"}),c.jsx("option",{value:"distance",children:"按距离计费"}),c.jsx("option",{value:"fixed",children:"一口价邮费"}),c.jsx("option",{value:"none",children:"无需邮寄"})]})]})]}),ne.postage_mode==="fixed"&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"一口价邮费"}),c.jsx("input",{className:"w-full ios-input px-4 py-3 rounded-xl",placeholder:"例如 8.00",value:ne.postage,onChange:B=>I({...ne,postage:B.target.value})})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"商品图片(1-9 张)"}),c.jsxs("label",{className:"flex min-h-[120px] cursor-pointer flex-col items-center justify-center rounded-2xl border-2 border-dashed border-gray-200 bg-gray-50 px-4 py-6 text-center hover:border-emerald-300 hover:bg-emerald-50/50 transition-colors",children:[c.jsx(od,{className:"w-8 h-8 text-emerald-600 mb-2"}),c.jsx("span",{className:"text-sm font-bold text-gray-800",children:"选择图片"}),c.jsx("span",{className:"text-xs text-gray-500 mt-1",children:ne.images.length?"已选择 "+ne.images.length+" 张":"支持 JPG / PNG / GIF"}),c.jsx("input",{className:"hidden",type:"file",accept:"image/*",multiple:!0,onChange:B=>I({...ne,images:Array.from(B.target.files||[]).slice(0,9)})})]}),ne.images.length>0&&c.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-3",children:ne.images.map((B,Te)=>c.jsx("div",{className:"aspect-square rounded-xl bg-gray-100 overflow-hidden border border-gray-100",children:c.jsx("img",{src:URL.createObjectURL(B),alt:"",className:"w-full h-full object-cover"})},B.name+Te))})]})]}),c.jsx("div",{className:"modal-footer",children:c.jsxs("button",{disabled:y,onClick:ae,className:"w-full bg-emerald-600 hover:bg-emerald-700 disabled:opacity-60 text-white px-6 py-3.5 rounded-xl font-bold flex items-center justify-center gap-2",children:[c.jsx(Zp,{className:"w-4 h-4"}),y?"正在发布...":"发布到闲鱼"]})})]})}),document.body),D&&It.createPortal(c.jsx("div",{className:"modal-overlay-centered",children:c.jsxs("div",{className:"modal-container",style:{maxWidth:"980px"},children:[c.jsxs("div",{className:"modal-header flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-xl font-extrabold text-gray-900",children:"批量铺货"}),c.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"上传商品表格和图片 zip,先预检,再逐条发布到闲鱼。"})]}),c.jsx("button",{onClick:()=>E(!1),className:"p-2 rounded-xl hover:bg-gray-100 transition-colors",title:"关闭",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-500"})})]}),c.jsxs("div",{className:"modal-body space-y-5",children:[c.jsx("div",{className:"grid grid-cols-4 gap-2",children:[["upload","1 上传"],["preview","2 预检"],["running","3 发布"],["done","4 结果"]].map(([B,Te])=>c.jsx("div",{className:`rounded-xl px-3 py-2 text-center text-xs font-extrabold border ${$===B?"bg-blue-600 text-white border-blue-600":"bg-gray-50 text-gray-500 border-gray-100"}`,children:Te},B))}),$==="upload"&&c.jsxs("div",{className:"space-y-5",children:[c.jsx("div",{className:"rounded-2xl border border-blue-100 bg-blue-50 p-4 text-sm text-blue-900 leading-6",children:c.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-extrabold",children:"先下载模板,再按字段填写。"}),c.jsxs("div",{children:["图片字段写 zip 内相对路径,多个图片用英文分号分隔,例如 ",c.jsx("span",{className:"font-mono font-bold",children:"images/a.jpg;images/b.jpg"}),"。也支持直接填写图片 URL。"]})]}),c.jsx("button",{type:"button",onClick:Be,className:"shrink-0 rounded-xl bg-blue-600 px-4 py-2 text-sm font-extrabold text-white hover:bg-blue-700",children:"下载CSV模板"})]})}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700",children:"默认发布账号"}),c.jsxs("select",{className:"w-full ios-input px-4 py-3 rounded-xl",value:f,onChange:B=>m(B.target.value),children:[c.jsx("option",{value:"",children:"选择账号"}),s.map(B=>c.jsx("option",{value:B.id,children:B.nickname||B.remark||B.id},B.id))]}),c.jsx("p",{className:"text-xs text-gray-500",children:"表格中“账号ID”为空时,会使用这里选择的账号。"})]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("label",{className:"flex min-h-[150px] cursor-pointer flex-col items-center justify-center rounded-2xl border-2 border-dashed border-gray-200 bg-gray-50 px-4 py-6 text-center hover:border-blue-300 hover:bg-blue-50 transition-colors",children:[c.jsx(od,{className:"w-9 h-9 text-blue-600 mb-3"}),c.jsx("span",{className:"text-sm font-extrabold text-gray-900",children:"上传商品表格"}),c.jsx("span",{className:"text-xs text-gray-500 mt-1",children:K?K.name:"支持 .xlsx / .csv / .tsv"}),c.jsx("input",{className:"hidden",type:"file",accept:".xlsx,.csv,.tsv",onChange:B=>{var Te;return T(((Te=B.target.files)==null?void 0:Te[0])||null)}})]}),c.jsxs("label",{className:"flex min-h-[150px] cursor-pointer flex-col items-center justify-center rounded-2xl border-2 border-dashed border-gray-200 bg-gray-50 px-4 py-6 text-center hover:border-emerald-300 hover:bg-emerald-50 transition-colors",children:[c.jsx(od,{className:"w-9 h-9 text-emerald-600 mb-3"}),c.jsx("span",{className:"text-sm font-extrabold text-gray-900",children:"上传图片 zip(可选)"}),c.jsx("span",{className:"text-xs text-gray-500 mt-1",children:re?re.name:"表格图片字段使用 zip 内相对路径"}),c.jsx("input",{className:"hidden",type:"file",accept:".zip",onChange:B=>{var Te;return Z(((Te=B.target.files)==null?void 0:Te[0])||null)}})]})]}),c.jsxs("div",{className:"rounded-2xl bg-gray-50 border border-gray-100 p-4 space-y-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-extrabold text-gray-900",children:"字段说明"}),c.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"照着下面的“什么时候填写”处理即可。预检发现问题时,会指出具体哪一行需要修改。"})]}),c.jsxs("div",{className:"rounded-xl border border-blue-100 bg-blue-50 p-4 text-xs text-blue-950",children:[c.jsx("div",{className:"text-sm font-extrabold",children:"“付款后发送的卡密”怎么填"}),c.jsxs("div",{className:"mt-3 grid grid-cols-1 gap-3 lg:grid-cols-3",children:[c.jsxs("div",{className:"rounded-lg bg-white/80 p-3",children:[c.jsx("code",{className:"font-bold text-blue-700",children:"101"}),c.jsx("p",{className:"mt-1 leading-5",children:"从卡密组 101 立即发送 1 份。卡密组 ID 可以在“卡密库存”页面查看。"})]}),c.jsxs("div",{className:"rounded-lg bg-white/80 p-3",children:[c.jsx("code",{className:"font-bold text-blue-700",children:"101:2"}),c.jsx("p",{className:"mt-1 leading-5",children:"每购买 1 件,就从卡密组 101 发送 2 份。买家购买 3 件时会发送 6 份。"})]}),c.jsxs("div",{className:"rounded-lg bg-white/80 p-3",children:[c.jsx("code",{className:"font-bold text-blue-700",children:"101:1:0;102:2:3"}),c.jsx("p",{className:"mt-1 leading-5",children:"先立即发送卡密组 101 的 1 份,再等待 3 秒发送卡密组 102 的 2 份。"})]})]}),c.jsxs("p",{className:"mt-3 leading-5 text-blue-800",children:["每一组依次写“卡密组 ID : 每件发送几份 : 等待几秒”。份数不写时按 1 份处理,等待时间不写时立即发送。需要发送多种卡密时,用英文分号 ",c.jsx("code",{className:"font-bold",children:";"})," 隔开。"]})]}),c.jsx("div",{className:"overflow-x-auto rounded-xl border border-gray-100 bg-white",children:c.jsxs("table",{className:"w-full text-left text-xs",children:[c.jsx("thead",{className:"bg-gray-50 text-gray-500",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-3 py-2",children:"字段"}),c.jsx("th",{className:"px-3 py-2",children:"什么时候填写"}),c.jsx("th",{className:"px-3 py-2",children:"填写方法"})]})}),c.jsx("tbody",{className:"divide-y divide-gray-50 text-gray-700",children:[["账号ID","没有在上方选择默认账号时填写","填写账号 ID;已经选择默认账号时可以留空"],["标题","每个商品都要填","填写买家能看到的商品标题"],["描述","可以留空","留空时会使用商品标题作为描述"],["价格","每个商品都要填","只填数字,例如 19.90"],["原价","可以留空","需要展示划线原价时填写,例如 29.90"],["库存","可以留空","留空按 1 件处理;填写时必须大于 0"],["邮费模式","可以留空","留空表示包邮;包邮填 free,固定邮费填 fixed"],["邮费","邮费模式填 fixed 时填写","只填数字,例如 8.00"],["图片","每个商品都要填","填写 zip 内图片路径或图片网址;多张图片用英文分号隔开"],["付款后自动发货","需要付款后自动发货时填写","填“是”表示开启;不需要时填“否”或留空"],["付款后发送的卡密","“付款后自动发货”填“是”时填写","从“卡密库存”页面取得卡密组 ID,按上方示例填写"],["评价后发送赠品","需要评价赠品时填写","填“是”表示开启;不需要时填“否”或留空"],["评价后发送的卡密","“评价后发送赠品”填“是”时填写","格式和付款后发送的卡密相同,也可以同时发送多个卡密组"],["超时未评价时提醒","需要自动求评价时填写","填“是”表示开启;不需要时填“否”或留空"],["发货几小时后提醒","“超时未评价时提醒”填“是”时填写","填写等待小时数;留空按 72 小时处理"],["提醒内容","“超时未评价时提醒”填“是”时填写","填写要发送给买家的求评价消息"],["最多提醒几次","可以留空","留空只提醒 1 次"]].map(([B,Te,lt])=>c.jsxs("tr",{children:[c.jsx("td",{className:"px-3 py-2 font-bold text-gray-900 whitespace-nowrap",children:B}),c.jsx("td",{className:`px-3 py-2 min-w-[210px] font-bold ${Te==="每个商品都要填"?"text-red-600":Te==="可以留空"?"text-gray-500":"text-amber-700"}`,children:Te}),c.jsx("td",{className:"px-3 py-2 min-w-[260px]",children:lt})]},B))})]})})]})]}),$==="preview"&&pe&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[c.jsxs("div",{className:"rounded-2xl bg-gray-50 p-4 border border-gray-100",children:[c.jsx("div",{className:"text-xs font-bold text-gray-500",children:"总行数"}),c.jsx("div",{className:"text-2xl font-extrabold text-gray-900 mt-1",children:pe.total})]}),c.jsxs("div",{className:"rounded-2xl bg-emerald-50 p-4 border border-emerald-100",children:[c.jsx("div",{className:"text-xs font-bold text-emerald-700",children:"可发布"}),c.jsx("div",{className:"text-2xl font-extrabold text-emerald-700 mt-1",children:pe.valid})]}),c.jsxs("div",{className:"rounded-2xl bg-red-50 p-4 border border-red-100",children:[c.jsx("div",{className:"text-xs font-bold text-red-700",children:"有问题"}),c.jsx("div",{className:"text-2xl font-extrabold text-red-700 mt-1",children:pe.invalid})]})]}),c.jsx("div",{className:"max-h-[380px] overflow-y-auto rounded-2xl border border-gray-100",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"sticky top-0 bg-white text-xs text-gray-400 border-b border-gray-100",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-3",children:"行号"}),c.jsx("th",{className:"px-4 py-3",children:"状态"}),c.jsx("th",{className:"px-4 py-3",children:"标题"}),c.jsx("th",{className:"px-4 py-3",children:"价格/库存"}),c.jsx("th",{className:"px-4 py-3",children:"图片"}),c.jsx("th",{className:"px-4 py-3",children:"问题"})]})}),c.jsx("tbody",{className:"divide-y divide-gray-50",children:pe.rows.map(B=>{var Te,lt;return c.jsxs("tr",{className:"hover:bg-gray-50",children:[c.jsx("td",{className:"px-4 py-3 font-mono text-xs",children:B.row_no}),c.jsx("td",{className:"px-4 py-3",children:c.jsx("span",{className:`inline-flex px-2 py-1 rounded-lg border text-xs font-extrabold ${B.valid?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-red-50 text-red-700 border-red-100"}`,children:B.valid?"可发布":"需修正"})}),c.jsx("td",{className:"px-4 py-3 font-bold text-gray-900 max-w-[240px] truncate",children:B.title||"-"}),c.jsxs("td",{className:"px-4 py-3 text-gray-600",children:["¥",B.price||"-"," / ",B.quantity||1]}),c.jsxs("td",{className:"px-4 py-3 text-gray-600",children:[((Te=B.images)==null?void 0:Te.length)||0," 张"]}),c.jsx("td",{className:"px-4 py-3 text-red-600 text-xs max-w-[280px]",children:((lt=B.errors)==null?void 0:lt.join(";"))||"-"})]},B.row_no)})})]})})]}),($==="running"||$==="done")&&ce&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[c.jsxs("div",{className:`rounded-2xl p-4 border ${Ue(ce.status)}`,children:[c.jsx("div",{className:"text-xs font-bold opacity-70",children:"任务状态"}),c.jsx("div",{className:"text-xl font-extrabold mt-1",children:De(ce.status)})]}),c.jsxs("div",{className:"rounded-2xl bg-gray-50 p-4 border border-gray-100",children:[c.jsx("div",{className:"text-xs font-bold text-gray-500",children:"总数"}),c.jsx("div",{className:"text-xl font-extrabold text-gray-900 mt-1",children:ce.total})]}),c.jsxs("div",{className:"rounded-2xl bg-emerald-50 p-4 border border-emerald-100",children:[c.jsx("div",{className:"text-xs font-bold text-emerald-700",children:"成功"}),c.jsx("div",{className:"text-xl font-extrabold text-emerald-700 mt-1",children:ce.success})]}),c.jsxs("div",{className:"rounded-2xl bg-red-50 p-4 border border-red-100",children:[c.jsx("div",{className:"text-xs font-bold text-red-700",children:"失败"}),c.jsx("div",{className:"text-xl font-extrabold text-red-700 mt-1",children:ce.failed})]}),c.jsxs("div",{className:"rounded-2xl bg-blue-50 p-4 border border-blue-100",children:[c.jsx("div",{className:"text-xs font-bold text-blue-700",children:"等待"}),c.jsx("div",{className:"text-xl font-extrabold text-blue-700 mt-1",children:ce.pending})]})]}),c.jsx("div",{className:"max-h-[420px] overflow-y-auto rounded-2xl border border-gray-100",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"sticky top-0 bg-white text-xs text-gray-400 border-b border-gray-100",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-3",children:"行号"}),c.jsx("th",{className:"px-4 py-3",children:"状态"}),c.jsx("th",{className:"px-4 py-3",children:"标题"}),c.jsx("th",{className:"px-4 py-3",children:"商品ID"}),c.jsx("th",{className:"px-4 py-3",children:"错误原因"})]})}),c.jsx("tbody",{className:"divide-y divide-gray-50",children:ce.rows.map(B=>c.jsxs("tr",{className:"hover:bg-gray-50",children:[c.jsx("td",{className:"px-4 py-3 font-mono text-xs",children:B.row_no}),c.jsx("td",{className:"px-4 py-3",children:c.jsx("span",{className:`inline-flex px-2 py-1 rounded-lg border text-xs font-extrabold ${Ue(B.status)}`,children:De(B.status)})}),c.jsx("td",{className:"px-4 py-3 font-bold text-gray-900 max-w-[260px] truncate",children:B.title}),c.jsx("td",{className:"px-4 py-3 text-xs font-mono",children:B.item_url?c.jsx("a",{href:B.item_url,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline",children:B.item_id}):B.item_id||"-"}),c.jsx("td",{className:"px-4 py-3 text-red-600 text-xs max-w-[340px]",children:B.error_message||"-"})]},B.id))})]})})]})]}),c.jsxs("div",{className:"modal-footer",children:[$==="upload"&&c.jsxs("button",{disabled:w||!K||!f,onClick:Ce,className:"w-full ios-btn-primary px-6 py-3.5 rounded-xl font-bold flex items-center justify-center gap-2 disabled:opacity-50",children:[c.jsx(pr,{className:`w-4 h-4 ${w?"animate-spin":""}`}),w?"正在预检...":"开始预检"]}),$==="preview"&&pe&&c.jsxs("div",{className:"flex gap-3 w-full",children:[c.jsx("button",{disabled:w,onClick:()=>U("upload"),className:"flex-1 px-6 py-3.5 rounded-xl bg-gray-100 hover:bg-gray-200 text-gray-800 font-bold",children:"返回修改"}),c.jsxs("button",{disabled:w||pe.valid<=0,onClick:Y,className:"flex-1 ios-btn-primary px-6 py-3.5 rounded-xl font-bold flex items-center justify-center gap-2 disabled:opacity-50",children:[c.jsx(Zp,{className:"w-4 h-4"}),w?"启动中...":`确认发布 ${pe.valid} 个商品`]})]}),($==="running"||$==="done")&&ce&&c.jsxs("div",{className:"flex gap-3 w-full",children:[ce.status==="running"?c.jsx("button",{disabled:w,onClick:ge,className:"flex-1 px-6 py-3.5 rounded-xl bg-gray-900 text-white hover:bg-black font-bold",children:"取消任务"}):c.jsx("button",{onClick:()=>window.open(`/items/publish-batches/${ce.id}/result.csv`,"_blank"),className:"flex-1 px-6 py-3.5 rounded-xl bg-gray-900 text-white hover:bg-black font-bold",children:"下载结果"}),ce.failed>0&&ce.status!=="running"&&c.jsxs("button",{disabled:w,onClick:Pe,className:"flex-1 ios-btn-primary px-6 py-3.5 rounded-xl font-bold flex items-center justify-center gap-2",children:[c.jsx(pr,{className:`w-4 h-4 ${w?"animate-spin":""}`}),"重试失败项"]}),ce.status!=="running"&&c.jsx("button",{onClick:()=>{E(!1),he(),be()},className:"flex-1 px-6 py-3.5 rounded-xl bg-gray-100 hover:bg-gray-200 text-gray-800 font-bold",children:"完成"})]})]})]})}),document.body)]})},eA="https://dashscope.aliyuncs.com/compatible-mode/v1",$Q=()=>{const[e,t]=x.useState(null),[n,r]=x.useState(!1),[l,s]=x.useState(!1),[d,f]=x.useState([]),[m,h]=x.useState(!1),[v,y]=x.useState(""),[b,w]=x.useState(!1),j=x.useRef(null),[_,S]=x.useState(!1),[A,C]=x.useState(!1),[M,k]=x.useState(!1),[D,E]=x.useState(!1),[$,U]=x.useState(null),[K,T]=x.useState({new_username:"",current_password:"",new_password:"",confirm_password:""});x.useEffect(()=>{Z(),gA().then(z=>{z.username&&T(G=>({...G,new_username:z.username||""}))}).catch(()=>{})},[]),x.useEffect(()=>{const z=G=>{var se;(se=j.current)!=null&&se.contains(G.target)||w(!1)};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);const re=async(z,G=!1)=>{const se=z||e,ue=(se==null?void 0:se.ai_api_url)||(se==null?void 0:se.ai_base_url)||eA;h(!0),y("");try{const P=await cP(ue,(se==null?void 0:se.ai_api_key)||"");f(P),w(G&&P.length>0),!(se!=null&&se.ai_model)&&P.length>0&&t(Q=>Q&&{...Q,ai_model:P[0]})}catch(P){f([]),w(!1),y(P.message||"读取模型失败")}finally{h(!1)}},Z=()=>{r(!0),bA().then(z=>{t(z),re(z)}).finally(()=>r(!1))},pe=async()=>{if(e){s(!0);try{const{smtp_server:z,smtp_port:G,smtp_user:se,smtp_password:ue,smtp_from:P,...Q}=e;await wA(Q),alert("系统配置已保存")}catch(z){alert("保存失败:"+z.message)}finally{s(!1)}}},fe=async z=>{z.preventDefault(),U(null);const G=K.new_username.trim();if(G.length<3){U({type:"error",text:"用户名至少需要 3 个字符"});return}if(!K.current_password){U({type:"error",text:"请输入当前密码确认身份"});return}if(K.new_password&&K.new_password.length<8){U({type:"error",text:"新密码至少需要 8 个字符"});return}if(K.new_password!==K.confirm_password){U({type:"error",text:"两次输入的新密码不一致"});return}E(!0);try{const se=await bD({current_password:K.current_password,new_username:G,new_password:K.new_password||void 0});if(!se.success){U({type:"error",text:se.message||"登录凭据更新失败"});return}U({type:"success",text:se.message||"登录凭据已更新"}),window.setTimeout(()=>window.location.reload(),1400)}catch(se){U({type:"error",text:se.message||"登录凭据更新失败"})}finally{E(!1)}};if(!e)return c.jsx("div",{className:"p-8 text-center text-gray-400",children:"加载配置中..."});const ce=e.ai_model||"",R=d;return c.jsxs("div",{className:"max-w-6xl mx-auto space-y-8 animate-fade-in pb-24",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("div",{className:"w-12 h-12 bg-gray-100 rounded-2xl flex items-center justify-center",children:c.jsx(Gy,{className:"w-6 h-6 text-gray-600"})}),c.jsxs("div",{children:[c.jsx("h2",{className:"text-3xl font-extrabold text-gray-900",children:"系统设置"}),c.jsx("p",{className:"text-gray-500 mt-1 text-sm font-medium",children:"配置全局自动化规则与系统参数"})]})]}),c.jsxs("button",{onClick:Z,className:"px-4 py-2 bg-gray-100 hover:bg-gray-200 rounded-xl font-bold text-gray-700 flex items-center gap-2 transition-colors",children:[c.jsx(pr,{className:"w-4 h-4"}),"刷新"]})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[c.jsxs("div",{className:"space-y-8",children:[c.jsxs("section",{className:"space-y-4",children:[c.jsxs("h3",{className:"text-lg font-extrabold text-gray-800 flex items-center gap-2",children:[c.jsx("div",{className:"p-1.5 rounded-lg bg-gray-100 text-gray-600",children:c.jsx(cM,{className:"w-4 h-4"})}),"基础设置"]}),c.jsxs("div",{className:"ios-card rounded-xl p-6 bg-white space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-bold text-gray-900",children:"允许用户注册"}),c.jsx("div",{className:"text-xs text-gray-500 mt-1",children:"开启后允许新用户注册账号"})]}),c.jsx("button",{onClick:()=>t({...e,registration_enabled:!e.registration_enabled}),className:`w-14 h-8 rounded-full transition-all relative ${e.registration_enabled?"bg-[#0094f7]":"bg-gray-300"}`,children:c.jsx("div",{className:`w-6 h-6 bg-white rounded-full absolute top-1 transition-all shadow-md ${e.registration_enabled?"left-7":"left-1"}`})})]}),c.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-bold text-gray-900",children:"显示默认登录信息"}),c.jsx("div",{className:"text-xs text-gray-500 mt-1",children:"登录页面显示默认账号密码提示"})]}),c.jsx("button",{onClick:()=>t({...e,show_default_login_info:!e.show_default_login_info}),className:`w-14 h-8 rounded-full transition-all relative ${e.show_default_login_info?"bg-[#0094f7]":"bg-gray-300"}`,children:c.jsx("div",{className:`w-6 h-6 bg-white rounded-full absolute top-1 transition-all shadow-md ${e.show_default_login_info?"left-7":"left-1"}`})})]}),c.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-bold text-gray-900",children:"登录滑动验证码"}),c.jsx("div",{className:"text-xs text-gray-500 mt-1",children:"开启后账号密码登录需要完成滑动验证"})]}),c.jsx("button",{onClick:()=>t({...e,login_captcha_enabled:!e.login_captcha_enabled}),className:`w-14 h-8 rounded-full transition-all relative ${e.login_captcha_enabled?"bg-[#0094f7]":"bg-gray-300"}`,children:c.jsx("div",{className:`w-6 h-6 bg-white rounded-full absolute top-1 transition-all shadow-md ${e.login_captcha_enabled?"left-7":"left-1"}`})})]}),c.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-bold text-gray-900",children:"启用商品自动同步"}),c.jsx("div",{className:"text-xs text-gray-500 mt-1",children:"定时自动获取商品信息到本地数据库"})]}),c.jsx("button",{onClick:()=>t({...e,item_sync_enabled:!e.item_sync_enabled}),className:`w-14 h-8 rounded-full transition-all relative ${e.item_sync_enabled?"bg-[#0094f7]":"bg-gray-300"}`,children:c.jsx("div",{className:`w-6 h-6 bg-white rounded-full absolute top-1 transition-all shadow-md ${e.item_sync_enabled?"left-7":"left-1"}`})})]}),c.jsxs("div",{className:"space-y-3 px-4",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"商品同步间隔(分钟)"}),c.jsx("input",{type:"number",value:Math.round((e.item_sync_interval||600)/60),onChange:z=>{const G=parseInt(z.target.value)||10;t({...e,item_sync_interval:G*60})},className:"w-full ios-input px-4 py-3 rounded-xl",min:"1",max:"1440"}),c.jsx("p",{className:"text-xs text-gray-500",children:"建议:10-60分钟"})]}),c.jsxs("div",{className:"space-y-3 px-4",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"每次最多同步页数"}),c.jsx("input",{type:"number",value:e.item_sync_max_pages||5,onChange:z=>t({...e,item_sync_max_pages:parseInt(z.target.value)||5}),className:"w-full ios-input px-4 py-3 rounded-xl",min:"1",max:"50"}),c.jsx("p",{className:"text-xs text-gray-500",children:"每页20个商品"})]})]})]}),c.jsxs("section",{className:"space-y-4",children:[c.jsxs("h3",{className:"text-lg font-extrabold text-gray-800 flex items-center gap-2",children:[c.jsx("div",{className:"p-1.5 rounded-lg bg-[#0094f7] text-white",children:c.jsx(vA,{className:"w-4 h-4"})}),"AI 智能回复配置"]}),c.jsxs("div",{className:"ios-card rounded-xl p-6 bg-white space-y-6",children:[c.jsxs("div",{className:"space-y-3",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"API 地址"}),c.jsx("input",{type:"text",value:e.ai_api_url||eA,onChange:z=>t({...e,ai_api_url:z.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl text-sm",placeholder:"https://api.openai.com/v1"}),c.jsx("p",{className:"text-xs text-gray-500",children:"无需补全 /chat/completions"})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"API Key"}),c.jsxs("div",{className:"relative",children:[c.jsx("input",{type:_?"text":"password",value:e.ai_api_key||"",onChange:z=>t({...e,ai_api_key:z.target.value}),className:"w-full ios-input px-4 py-3 pr-12 rounded-xl font-mono text-sm",placeholder:"sk-..."}),c.jsx("button",{type:"button",onClick:()=>S(!_),className:"absolute right-3 top-1/2 -translate-y-1/2 p-2 text-gray-400 hover:text-gray-600 transition-colors",children:_?c.jsx(ic,{className:"w-4 h-4"}):c.jsx(xs,{className:"w-4 h-4"})})]})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"模型"}),c.jsxs("div",{ref:j,className:"relative flex flex-col sm:flex-row gap-2",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx("input",{value:ce,onFocus:()=>d.length>0&&w(!0),onChange:z=>{t({...e,ai_model:z.target.value}),d.length>0&&w(!0)},onKeyDown:z=>{z.key==="Escape"&&w(!1),z.key==="ArrowDown"&&d.length>0&&w(!0)},className:"w-full ios-input px-4 py-3 pr-10 rounded-xl",placeholder:"从接口读取或手动输入模型名"}),c.jsx("button",{type:"button",onClick:()=>d.length>0&&w(z=>!z),disabled:d.length===0,className:"absolute right-2 top-1/2 -translate-y-1/2 p-2 text-gray-400 hover:text-gray-600 disabled:opacity-30","aria-label":"展开模型列表",children:c.jsx(GT,{className:`w-4 h-4 transition-transform ${b?"rotate-180":""}`})}),b&&c.jsx("div",{className:"absolute left-0 right-0 top-[calc(100%+6px)] z-40 max-h-64 overflow-y-auto rounded-xl border border-gray-200 bg-white shadow-xl shadow-gray-200/70 py-1",children:R.length>0?R.map(z=>c.jsxs("button",{type:"button",onClick:()=>{t({...e,ai_model:z}),w(!1)},className:"w-full px-4 py-2.5 text-left text-sm text-gray-700 hover:bg-blue-50 hover:text-[#0094f7] flex items-center justify-between gap-3",children:[c.jsx("span",{className:"truncate",children:z}),z===ce&&c.jsx(ci,{className:"w-4 h-4 shrink-0 text-[#0094f7]"})]},z)):c.jsx("div",{className:"px-4 py-3 text-sm text-gray-400",children:"没有匹配的模型"})})]}),c.jsxs("button",{type:"button",onClick:()=>re(void 0,!0),disabled:m,className:"px-4 py-3 rounded-xl bg-gray-100 text-gray-700 hover:bg-gray-200 disabled:opacity-60 font-bold flex items-center justify-center gap-2 whitespace-nowrap",children:[c.jsx(pr,{className:`w-4 h-4 ${m?"animate-spin":""}`}),"读取模型"]})]}),v?c.jsx("p",{className:"text-xs text-red-500",children:v}):c.jsx("p",{className:"text-xs text-gray-500",children:d.length>0?`已从当前 API 地址读取到 ${d.length} 个模型`:"模型列表从当前 API 地址读取,也可以手动输入模型名"})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"默认自动回复内容"}),c.jsx("textarea",{className:"w-full ios-input px-4 py-3 rounded-xl min-h-[100px] text-sm resize-none",value:e.default_reply||"",onChange:z=>t({...e,default_reply:z.target.value}),placeholder:"设置默认的自动回复内容..."})]}),c.jsxs("div",{className:"p-3 bg-blue-50 rounded-xl text-xs text-blue-700",children:[c.jsx("strong",{children:"常见 AI 服务:"}),c.jsxs("ul",{className:"list-disc list-inside mt-1 space-y-0.5",children:[c.jsx("li",{children:"阿里云通义千问: https://dashscope.aliyuncs.com/compatible-mode/v1"}),c.jsx("li",{children:"OpenAI: https://api.openai.com/v1"})]})]})]})]})]}),c.jsx("div",{className:"space-y-8",children:c.jsxs("section",{className:"space-y-4",children:[c.jsxs("h3",{className:"text-lg font-extrabold text-gray-800 flex items-center gap-2",children:[c.jsx("div",{className:"p-1.5 rounded-lg bg-gray-900 text-white",children:c.jsx(pj,{className:"w-4 h-4"})}),"登录凭据"]}),c.jsxs("form",{onSubmit:fe,className:"ios-card rounded-xl p-6 bg-white space-y-5",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"登录用户名"}),c.jsxs("div",{className:"relative",children:[c.jsx(uD,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),c.jsx("input",{type:"text",value:K.new_username,onChange:z=>T({...K,new_username:z.target.value}),className:"w-full ios-input pl-11 pr-4 py-3 rounded-xl text-sm",autoComplete:"username"})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"当前密码"}),c.jsxs("div",{className:"relative",children:[c.jsx("input",{type:A?"text":"password",value:K.current_password,onChange:z=>T({...K,current_password:z.target.value}),className:"w-full ios-input px-4 py-3 pr-12 rounded-xl text-sm",placeholder:"用于确认当前身份",autoComplete:"current-password"}),c.jsx("button",{type:"button",onClick:()=>C(!A),className:"absolute right-3 top-1/2 -translate-y-1/2 p-2 text-gray-400 hover:text-gray-600",title:A?"隐藏密码":"显示密码",children:A?c.jsx(ic,{className:"w-4 h-4"}):c.jsx(xs,{className:"w-4 h-4"})})]})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"新密码"}),c.jsxs("div",{className:"relative",children:[c.jsx("input",{type:M?"text":"password",value:K.new_password,onChange:z=>T({...K,new_password:z.target.value}),className:"w-full ios-input px-4 py-3 pr-11 rounded-xl text-sm",placeholder:"不修改则留空",autoComplete:"new-password"}),c.jsx("button",{type:"button",onClick:()=>k(!M),className:"absolute right-2 top-1/2 -translate-y-1/2 p-2 text-gray-400 hover:text-gray-600",title:M?"隐藏密码":"显示密码",children:M?c.jsx(ic,{className:"w-4 h-4"}):c.jsx(xs,{className:"w-4 h-4"})})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"确认新密码"}),c.jsx("input",{type:M?"text":"password",value:K.confirm_password,onChange:z=>T({...K,confirm_password:z.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl text-sm",placeholder:"再次输入新密码",autoComplete:"new-password"})]})]}),$&&c.jsxs("div",{className:`flex items-start gap-2 rounded-xl px-3 py-2.5 text-sm font-medium ${$.type==="success"?"bg-green-50 text-green-700":"bg-red-50 text-red-700"}`,children:[c.jsx(hA,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),c.jsx("span",{children:$.text})]}),c.jsxs("button",{type:"submit",disabled:D||!K.new_username||!K.current_password,className:"w-full bg-gray-900 hover:bg-black text-white px-5 py-3 rounded-xl font-bold text-sm flex items-center justify-center gap-2 transition-colors disabled:opacity-40",children:[c.jsx(pj,{className:"w-4 h-4"}),D?"正在更新...":"更新登录凭据"]})]})]})})]}),c.jsx("div",{className:"fixed bottom-10 right-10 z-30",children:c.jsxs("button",{onClick:pe,disabled:l,className:"ios-btn-primary px-10 py-5 rounded-xl text-lg shadow-2xl shadow-blue-200 flex items-center gap-3 transform hover:scale-105 active:scale-95 transition-all disabled:opacity-70",children:[c.jsx(Sa,{className:"w-6 h-6"}),l?"保存中...":"保存所有配置"]})})]})},Vi={order_paid:{label:"付款后自动发货",shortLabel:"自动发货",description:"闲鱼付款系统卡片进入自动化中心后,先发送卡密,成功后再确认发货。",flow:["付款系统卡片","匹配商品/规格","发送卡密","确认发货"],accent:"blue",icon:uc},buyer_reviewed:{label:"评价后发送赠品",shortLabel:"评价赠品",description:"闲鱼评价系统卡片进入自动化中心后,给买家发送赠品卡密。",flow:["评价系统卡片","匹配商品/规格","发送赠品"],accent:"emerald",icon:xM},review_missing_timeout:{label:"超时未评价求评价",shortLabel:"求评价",description:"计划任务扫描已发货未评价订单,到期后发送求评价文案。",flow:["计划任务扫描","已发货未评价","达到等待时间","发送提醒"],accent:"amber",icon:cA}},$v=["order_paid","buyer_reviewed","review_missing_timeout"],RQ="亲,商品使用满意的话,麻烦给个评价,谢谢~",Qo=()=>({spec_name:"",spec_value:"",card_id:0,delivery_count:1,enabled:!0}),a5=e=>{if(!e)return{};try{const t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}},fs=(e,t={})=>{const n=a5(e);return JSON.stringify({after_shipped_hours:Number(n.after_shipped_hours||72),max_attempts:Number(n.max_attempts||1),...t})},Jo=(e,t)=>{var r;const n=((r=Vi[e])==null?void 0:r.label)||"自动化规则";return t?`${n} - ${t}`:n},tA=e=>{const t=(e||"").trim();return t?Object.values(Vi).some(n=>t===n.label||t.startsWith(`${n.label} -`)):!0},ec=(e,t=0)=>{if(e==="review_missing_timeout")return[{action_type:"send_text",message_template:RQ,enabled:!0,sort_order:1}];const n={action_type:"send_card",card_id:t,delivery_count:1,enabled:!0,sort_order:1};return e==="order_paid"?[n,{action_type:"confirm_shipment",enabled:!0,sort_order:2}]:[n]},LQ=e=>{var n,r;if(e.trigger_type==="review_missing_timeout")return((r=(n=e.actions)==null?void 0:n.find(l=>l.action_type==="send_text"))==null?void 0:r.message_template)||"发送求评价文案";const t=(e.actions||[]).filter(l=>l.action_type==="send_card");return t.length?t.map(l=>l.card_name||`卡密 ${l.card_id}`).join(" / "):"未配置卡密库存"},nA=(e,t=!1)=>{const n={blue:t?"border-blue-500 bg-blue-50 text-blue-700":"border-blue-100 bg-blue-50/60 text-blue-700 hover:border-blue-300",emerald:t?"border-emerald-500 bg-emerald-50 text-emerald-700":"border-emerald-100 bg-emerald-50/60 text-emerald-700 hover:border-emerald-300",amber:t?"border-amber-500 bg-amber-50 text-amber-700":"border-amber-100 bg-amber-50/60 text-amber-700 hover:border-amber-300"};return n[e]||n.blue},BQ=e=>e?"bg-emerald-100 text-emerald-700":"bg-gray-200 text-gray-500",kd=e=>(e==null?void 0:e.nickname)||(e==null?void 0:e.remark)||(e==null?void 0:e.id)||"未知账号",UQ=e=>e===!0||e===1||e==="1",HQ=({initialDeliveryTarget:e,onDeliveryTargetHandled:t})=>{var $n,wi,xl;const[n,r]=x.useState("automation"),[l,s]=x.useState([]),[d,f]=x.useState([]),[m,h]=x.useState({}),[v,y]=x.useState([]),[b,w]=x.useState([]),[j,_]=x.useState([]),[S,A]=x.useState(!1),[C,M]=x.useState(""),[k,D]=x.useState(!1),[E,$]=x.useState(!1),[U,K]=x.useState(!1),[T,re]=x.useState(null),[Z,pe]=x.useState(null),[fe,ce]=x.useState({cookie_id:"",enabled:!1,reply_content:"",reply_once:!1,reply_image_url:""});v.find(q=>q.id===C);const R=x.useCallback(async()=>{const[q,ve,we,$e]=await Promise.all([Fy(),va(),Ns(),Nj()]);y(q),w(ve),_(we),h($e),M(We=>{var Jt;return We||((Jt=q[0])==null?void 0:Jt.id)||""})},[]),z=x.useCallback(async()=>{s(await Rd())},[]),G=x.useCallback(async()=>{if(!C){f([]);return}f(await aP(C))},[C]),se=x.useCallback(async()=>{h(await Nj())},[]),ue=x.useCallback(async()=>{A(!0);try{n==="automation"?await z():n==="reply"?await G():await se()}finally{A(!1)}},[n,z,se,G]);x.useEffect(()=>{R()},[R]),x.useEffect(()=>{ue()},[ue]);const P=x.useMemo(()=>l.filter(q=>!C||q.cookie_id===C),[l,C]),Q=x.useMemo(()=>v.filter(q=>!C||q.id===C),[v,C]),ne=x.useMemo(()=>{var ve;const q={order_paid:[],buyer_reviewed:[],review_missing_timeout:[]};for(const we of P)(ve=q[we.trigger_type])==null||ve.push(we);return q},[P]),I=x.useMemo(()=>{const q=(T==null?void 0:T.cookie_id)||C;return j.filter(ve=>ve.cookie_id===q)},[T==null?void 0:T.cookie_id,j,C]),he=x.useMemo(()=>{if(!(!(T!=null&&T.cookie_id)||!(T!=null&&T.item_id)))return j.find(q=>q.cookie_id===T.cookie_id&&q.item_id===T.item_id)},[T==null?void 0:T.cookie_id,T==null?void 0:T.item_id,j]),be=UQ(he==null?void 0:he.is_multi_spec),_e=(T==null?void 0:T.trigger_type)||"order_paid",W=Vi[_e],V=a5(T==null?void 0:T.config_json),ye=x.useCallback((q="order_paid",ve=C,we="")=>{const $e=j.find(Jt=>Jt.cookie_id===ve&&Jt.item_id===we),We=($e==null?void 0:$e.item_title)||we;return{name:Jo(q,We),trigger_type:q,cookie_id:ve,item_id:we,item_title:($e==null?void 0:$e.item_title)||"",item_keyword:We,card_group_id:0,priority:100,enabled:!0,config_json:q==="review_missing_timeout"?fs():"{}",actions:ec(q),variants:q==="review_missing_timeout"?[]:[Qo()]}},[j,C]),xe=x.useCallback(q=>{var we,$e;const ve=q.trigger_type||"order_paid";re({...q,trigger_type:ve,config_json:ve==="review_missing_timeout"?fs(q.config_json):q.config_json||"{}",actions:(we=q.actions)!=null&&we.length?q.actions.map(We=>({...We})):ec(ve,q.card_group_id),variants:($e=q.variants)!=null&&$e.length?q.variants.map(We=>({...We})):ve==="review_missing_timeout"?[]:[Qo()]}),D(!0)},[]);x.useEffect(()=>{if(!e)return;let q=!1;return(async()=>{r("automation"),M(e.cookieId),A(!0);try{const[we,$e,We]=await Promise.all([Rd(),Ns(),va().catch(jt=>(console.warn("加载卡密库存失败,不阻断打开自动化规则",jt),[]))]);if(q)return;s(we),_($e),w(We);const Jt=we.find(jt=>jt.cookie_id===e.cookieId&&jt.item_id===e.itemId&&jt.trigger_type==="order_paid");if(Jt)xe(Jt);else{const jt=$e.find(Cr=>Cr.cookie_id===e.cookieId&&Cr.item_id===e.itemId);re({...ye("order_paid",e.cookieId,e.itemId),item_title:(jt==null?void 0:jt.item_title)||"",item_keyword:(jt==null?void 0:jt.item_title)||e.itemId,name:Jo("order_paid",(jt==null?void 0:jt.item_title)||e.itemId)}),D(!0)}}catch(we){console.error("打开商品自动化规则失败",we),alert("无法加载该商品的自动化规则")}finally{q||(A(!1),t==null||t())}})(),()=>{q=!0}},[ye,e,t,xe]);const ae=(q="order_paid")=>{if(!C){alert("请先选择账号");return}re(ye(q)),D(!0)},Le=q=>{var $e,We,Jt,jt,Cr;if(!T)return;const ve=((We=($e=T.variants)==null?void 0:$e.find(_t=>_t.card_id))==null?void 0:We.card_id)||((jt=(Jt=T.actions)==null?void 0:Jt.find(_t=>_t.action_type==="send_card"))==null?void 0:jt.card_id)||T.card_group_id||0,we=(he==null?void 0:he.item_title)||T.item_title||T.item_id||"";re({...T,trigger_type:q,name:tA(T.name)?Jo(q,we):T.name,card_group_id:ve,config_json:q==="review_missing_timeout"?fs(T.config_json):"{}",actions:ec(q,ve),variants:q==="review_missing_timeout"?[]:(Cr=T.variants)!=null&&Cr.length?T.variants:[{...Qo(),card_id:ve}]})},Ce=q=>{if(!T)return;const ve=j.find($e=>$e.cookie_id===(T.cookie_id||C)&&$e.item_id===q),we=(ve==null?void 0:ve.item_title)||q;re({...T,item_id:q,item_title:(ve==null?void 0:ve.item_title)||"",item_keyword:we,name:tA(T.name)?Jo(_e,we):T.name})},Y=($n=T==null?void 0:T.variants)!=null&&$n.length?T.variants:[Qo()],ge=(q,ve)=>{var $e;if(!T)return;const we=Y.map((We,Jt)=>Jt===q?{...We,...ve}:We);re({...T,variants:we,card_group_id:(($e=we[0])==null?void 0:$e.card_id)||0})},Pe=()=>{if(!T)return;const q=Y[Y.length-1];re({...T,variants:[...Y,{...Qo(),spec_name:be&&(q==null?void 0:q.spec_name)||"",spec_value:be&&(q==null?void 0:q.spec_value)||""}]})},Be=async()=>{var $e,We,Jt,jt,Cr;if(!T)return;const q=T.trigger_type||"order_paid";if(!T.cookie_id){alert("请选择账号");return}const ve=($e=T.variants)!=null&&$e.length?T.variants:[];if(q!=="review_missing_timeout"){if(!ve.length||ve.some(_t=>!_t.card_id)){alert(q==="buyer_reviewed"?"请选择评价赠品卡密库存":"请选择发货卡密库存");return}if(be&&ve.some(_t=>!_t.spec_name.trim()||!_t.spec_value.trim())){alert("多规格商品必须填写每一行的规格名称和规格值");return}}if(q==="review_missing_timeout"&&!(((Jt=(We=T.actions)==null?void 0:We.find(bl=>bl.action_type==="send_text"))==null?void 0:Jt.message_template)||"").trim()){alert("请填写求评价文案");return}const we=q==="review_missing_timeout"?[]:ve.map(_t=>({..._t,spec_name:be?_t.spec_name.trim():"",spec_value:be?_t.spec_value.trim():"",delivery_count:Math.max(1,Number(_t.delivery_count)||1),enabled:_t.enabled!==!1}));try{await jj({...T,trigger_type:q,name:(T.name||"").trim()||Jo(q,(he==null?void 0:he.item_title)||T.item_id||""),config_json:q==="review_missing_timeout"?fs(T.config_json):T.config_json||"{}",actions:(jt=T.actions)!=null&&jt.length?T.actions:ec(q,((Cr=we[0])==null?void 0:Cr.card_id)||T.card_group_id||0),variants:we}),D(!1),await Promise.all([z(),R()]),alert("保存成功")}catch(_t){console.error("保存自动化规则失败:",_t),alert("保存失败:"+_t.message)}},Ve=async q=>{if(confirm("确定删除该自动化规则吗?"))try{await rP(q),await z(),alert("删除成功")}catch(ve){alert("删除失败:"+ve.message)}},Dt=async q=>{try{await jj({...q,enabled:!q.enabled}),await z()}catch(ve){alert("操作失败:"+ve.message)}},ie=()=>{if(!C){alert("请先选择账号");return}pe({keyword:"",reply_content:"",match_type:"exact",enabled:!0}),$(!0)},De=async()=>{var q,ve;if(!(!Z||!C)){if(!((q=Z.keyword)!=null&&q.trim())||!((ve=Z.reply_content)!=null&&ve.trim())){alert("请填写关键词和回复内容");return}try{await iP({...Z,match_type:Z.match_type||"exact",enabled:!0},C),$(!1),await G(),alert("保存成功")}catch(we){alert("保存失败:"+we.message)}}},Ue=async q=>{if(!(!C||!confirm("确定删除该回复规则吗?")))try{await lP(q,C),await G(),alert("删除成功")}catch(ve){alert("删除失败:"+ve.message)}},B=async(q=C)=>{if(!q){alert("请先选择账号");return}try{const ve=await pP(q);ce({cookie_id:q,enabled:ve.enabled,reply_content:ve.reply_content,reply_once:ve.reply_once,reply_image_url:ve.reply_image_url||""})}catch{ce({cookie_id:q,enabled:!1,reply_content:"",reply_once:!1,reply_image_url:""})}K(!0)},Te=async()=>{if(!fe.cookie_id){alert("请先选择账号");return}if(fe.enabled&&!fe.reply_content.trim()&&!fe.reply_image_url.trim()){alert("启用默认回复时,请填写回复内容或图片 URL");return}try{await vP(fe.cookie_id,{enabled:fe.enabled,reply_content:fe.reply_content,reply_once:fe.reply_once,reply_image_url:fe.reply_image_url}),K(!1),await se(),alert("保存成功")}catch(q){alert("保存失败:"+q.message)}},lt=async q=>{if(confirm("确定删除该账号默认回复吗?"))try{await yP(q),await se(),alert("删除成功")}catch(ve){alert("删除失败:"+ve.message)}},Zr=async q=>{if(confirm("确定清空该账号的默认回复记录吗?清空后可重新对所有会话使用“只回复一次”。"))try{await gP(q),alert("清空成功")}catch(ve){alert("清空失败:"+ve.message)}},Qn=n==="automation"?"新建自动化":n==="reply"?"新增关键词":"编辑默认回复";return c.jsxs("div",{className:"space-y-8 animate-fade-in",children:[c.jsxs("div",{className:"flex flex-col md:flex-row justify-between md:items-end gap-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-4xl font-extrabold text-gray-900 tracking-tight",children:"自动化规则"}),c.jsx("p",{className:"text-gray-500 mt-2 font-medium",children:"系统通知卡片只进入自动化判断;买家消息进入关键词、默认或 AI 回复。"})]}),c.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[c.jsxs("select",{value:C,onChange:q=>M(q.target.value),className:"ios-input px-4 py-3 rounded-2xl text-sm min-w-64",children:[c.jsx("option",{value:"",children:"全部账号"}),v.map(q=>c.jsx("option",{value:q.id,children:kd(q)},q.id))]}),c.jsxs("button",{onClick:ue,className:"px-4 py-3 rounded-2xl font-bold bg-gray-100 hover:bg-gray-200 text-gray-700 flex items-center justify-center gap-2 transition-colors",children:[c.jsx(pr,{className:`w-4 h-4 ${S?"animate-spin":""}`}),"刷新"]}),c.jsxs("button",{onClick:n==="automation"?()=>ae("order_paid"):n==="reply"?ie:()=>void B(),disabled:!C,className:"ios-btn-primary px-5 py-3 rounded-2xl text-sm font-extrabold flex items-center justify-center gap-2 disabled:opacity-50",children:[c.jsx(ja,{className:"w-4 h-4"}),Qn]})]})]}),c.jsx("div",{className:"flex flex-wrap gap-2 p-2 bg-gray-100/50 rounded-2xl",children:[{id:"automation",label:"交易自动化",icon:Uv},{id:"reply",label:"关键词回复",icon:Cd},{id:"default",label:"账号默认回复",icon:ps}].map(q=>{const ve=q.icon;return c.jsxs("button",{onClick:()=>r(q.id),className:`inline-flex items-center gap-2 px-5 py-2.5 rounded-xl text-sm font-bold transition-all ${n===q.id?"bg-[#0094f7] text-white shadow-md":"bg-white text-gray-600 hover:text-black hover:bg-gray-50"}`,children:[c.jsx(ve,{className:"w-4 h-4"}),q.label]},q.id)})}),n==="automation"&&c.jsxs("div",{className:"grid grid-cols-1 2xl:grid-cols-[360px_1fr] gap-6",children:[c.jsxs("aside",{className:"space-y-4",children:[c.jsxs("div",{className:"bg-white rounded-xl p-5 border border-gray-100 shadow-sm",children:[c.jsx("h3",{className:"font-black text-gray-900 mb-1",children:"新建规则"}),c.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"先选自动化类型,再配置对应动作。"}),c.jsx("div",{className:"space-y-3",children:$v.map(q=>{const ve=Vi[q],we=ve.icon;return c.jsx("button",{type:"button",onClick:()=>ae(q),className:`w-full text-left rounded-2xl border p-4 transition-colors ${nA(ve.accent)}`,children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:"w-10 h-10 rounded-xl bg-white/80 flex items-center justify-center shrink-0",children:c.jsx(we,{className:"w-5 h-5"})}),c.jsxs("div",{children:[c.jsx("div",{className:"font-extrabold",children:ve.label}),c.jsx("div",{className:"text-xs opacity-75 mt-1 leading-5",children:ve.description})]})]})},q)})})]}),c.jsxs("div",{className:"bg-white rounded-xl p-5 border border-gray-100 shadow-sm",children:[c.jsx("h3",{className:"font-black text-gray-900 mb-4",children:"规则概览"}),c.jsx("div",{className:"space-y-3",children:$v.map(q=>{const ve=Vi[q],we=ve.icon;return c.jsxs("div",{className:"flex items-center justify-between rounded-2xl bg-gray-50 p-3",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(we,{className:"w-4 h-4 text-gray-500"}),c.jsx("span",{className:"text-sm font-bold text-gray-700",children:ve.shortLabel})]}),c.jsx("span",{className:"text-sm font-black text-gray-900",children:ne[q].length})]},q)})})]})]}),c.jsx("section",{className:"space-y-4",children:P.length===0?c.jsxs("div",{className:"bg-white rounded-xl border border-dashed border-gray-200 p-16 text-center",children:[c.jsx(Uv,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),c.jsx("h3",{className:"text-xl font-black text-gray-900",children:"还没有自动化规则"}),c.jsx("p",{className:"text-gray-500 mt-2",children:"从左侧选择一个模板开始配置。"})]}):P.map(q=>{const ve=Vi[q.trigger_type],we=ve.icon;return c.jsx("article",{className:"bg-white rounded-xl border border-gray-100 p-5 shadow-sm hover:shadow-lg transition-all",children:c.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4",children:[c.jsxs("div",{className:"flex items-start gap-4 min-w-0",children:[c.jsx("div",{className:`w-12 h-12 rounded-2xl flex items-center justify-center shrink-0 ${nA(ve.accent,!0)}`,children:c.jsx(we,{className:"w-5 h-5"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[c.jsx("h3",{className:"text-lg font-black text-gray-900 truncate",children:q.name}),c.jsx("span",{className:`px-2.5 py-1 rounded-full text-xs font-bold ${BQ(q.enabled)}`,children:q.enabled?"已启用":"已禁用"})]}),c.jsxs("div",{className:"flex flex-wrap gap-2 text-xs font-bold",children:[c.jsx("span",{className:"px-2.5 py-1 rounded-lg bg-gray-100 text-gray-600",children:ve.label}),c.jsx("span",{className:"px-2.5 py-1 rounded-lg bg-gray-100 text-gray-600",children:q.item_title||q.item_id||"账号级规则"}),c.jsx("span",{className:"px-2.5 py-1 rounded-lg bg-blue-50 text-blue-700",children:LQ(q)})]})]})]}),c.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[c.jsxs("button",{onClick:()=>xe(q),className:"px-4 py-2 rounded-xl bg-gray-100 hover:bg-gray-200 text-gray-700 text-sm font-bold flex items-center gap-2",children:[c.jsx(bs,{className:"w-4 h-4"}),"编辑"]}),c.jsx("button",{onClick:()=>Dt(q),className:`px-4 py-2 rounded-xl text-sm font-bold ${q.enabled?"bg-amber-50 text-amber-700 hover:bg-amber-100":"bg-emerald-50 text-emerald-700 hover:bg-emerald-100"}`,children:q.enabled?"禁用":"启用"}),c.jsx("button",{onClick:()=>Ve(q.id),className:"p-2.5 rounded-xl text-red-500 hover:bg-red-50",title:"删除",children:c.jsx(xa,{className:"w-4 h-4"})})]})]})},q.id)})})]}),n==="reply"&&c.jsxs("section",{className:"bg-white rounded-xl border border-gray-100 p-6 shadow-sm",children:[c.jsxs("div",{className:"flex items-center gap-2 text-sm text-blue-700 bg-blue-50 px-4 py-2 rounded-xl mb-5 w-fit",children:[c.jsx($d,{className:"w-4 h-4"}),"这里只处理买家用户消息;系统通知不会进入关键词或 AI 回复。"]}),c.jsxs("div",{className:"space-y-3",children:[d.map(q=>c.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between p-5 rounded-2xl border border-gray-100 bg-[#F7F8FA] hover:bg-white hover:shadow-lg transition-all gap-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[c.jsx("span",{className:"px-3 py-1 bg-black text-white rounded-lg text-xs font-bold",children:q.match_type==="exact"?"精确匹配":"模糊包含"}),c.jsxs("h3",{className:"font-bold text-gray-900",children:["“",q.keyword,"”"]})]}),c.jsx("div",{className:"bg-white p-3 rounded-xl border border-gray-100 text-sm text-gray-600 leading-relaxed",children:q.reply_content})]}),c.jsxs("div",{className:"flex items-center gap-3 border-t md:border-t-0 md:border-l border-gray-200 pt-4 md:pt-0 md:pl-6",children:[c.jsx("button",{onClick:()=>{pe({...q}),$(!0)},className:"p-2 text-gray-400 hover:text-black hover:bg-gray-100 rounded-xl transition-colors",title:"编辑",children:c.jsx(bs,{className:"w-4 h-4"})}),c.jsx("button",{onClick:()=>Ue(q.id),className:"p-2 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",title:"删除",children:c.jsx(xa,{className:"w-5 h-5"})})]})]},q.id)),d.length===0&&c.jsx("div",{className:"text-center py-20 text-gray-400",children:"暂无关键词回复规则"})]})]}),n==="default"&&c.jsxs("section",{className:"bg-white rounded-xl border border-gray-100 p-6 shadow-sm",children:[c.jsxs("div",{className:"flex items-center gap-2 text-sm text-blue-700 bg-blue-50 px-4 py-2 rounded-xl mb-5 w-fit",children:[c.jsx($d,{className:"w-4 h-4"}),"默认回复只处理买家用户消息;关键词未命中且 AI 未接管时才会使用。"]}),c.jsxs("div",{className:"space-y-3",children:[Q.map(q=>{const ve=m[q.id],we=!!(ve!=null&&ve.enabled);return c.jsxs("div",{className:`flex flex-col md:flex-row md:items-center justify-between p-5 rounded-2xl border transition-all gap-4 ${we?"border-purple-100 bg-purple-50/50 hover:bg-white hover:shadow-lg":"border-gray-100 bg-[#F7F8FA] hover:bg-white hover:shadow-lg"}`,children:[c.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[c.jsx("div",{className:`w-12 h-12 rounded-2xl flex items-center justify-center ${we?"bg-purple-600 text-white":"bg-gray-200 text-gray-400"}`,children:c.jsx(ps,{className:"w-5 h-5"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[c.jsx("h3",{className:"font-bold text-gray-900 text-lg truncate",children:kd(q)}),c.jsx("span",{className:`px-2 py-0.5 rounded-lg text-xs font-bold ${we?"bg-green-100 text-green-700":"bg-gray-200 text-gray-500"}`,children:we?"已启用":"未启用"}),(ve==null?void 0:ve.reply_once)&&c.jsx("span",{className:"px-2 py-0.5 rounded-lg text-xs font-bold bg-purple-100 text-purple-700",children:"只回复一次"})]}),c.jsx("div",{className:"text-sm text-gray-600 line-clamp-2",children:we?ve.reply_content||ve.reply_image_url||"已配置默认回复":"未配置默认回复"})]})]}),c.jsxs("div",{className:"flex items-center gap-3 border-t md:border-t-0 md:border-l border-gray-200 pt-4 md:pt-0 md:pl-6",children:[c.jsx("button",{onClick:()=>void B(q.id),className:"p-2 text-gray-400 hover:text-black hover:bg-gray-100 rounded-xl transition-colors",title:"编辑",children:c.jsx(bs,{className:"w-4 h-4"})}),we&&c.jsxs(c.Fragment,{children:[c.jsx("button",{onClick:()=>void Zr(q.id),className:"px-3 py-2 text-xs font-bold text-blue-600 hover:bg-blue-50 rounded-xl transition-colors",children:"清空记录"}),c.jsx("button",{onClick:()=>void lt(q.id),className:"p-2 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",title:"删除",children:c.jsx(xa,{className:"w-5 h-5"})})]})]})]},q.id)}),Q.length===0&&c.jsx("div",{className:"text-center py-20 text-gray-400",children:"暂无账号"})]})]}),k&&T&&It.createPortal(c.jsx("div",{className:"modal-overlay",children:c.jsxs("div",{className:"modal-container",style:{maxWidth:"72rem",maxHeight:"92vh"},children:[c.jsxs("div",{className:"px-6 py-5 border-b border-gray-100 flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-2xl font-black text-gray-900",children:T.id?"编辑自动化规则":"新建自动化规则"}),c.jsx("p",{className:"text-sm text-gray-500 mt-1",children:W.description})]}),c.jsx("button",{onClick:()=>D(!1),className:"w-10 h-10 rounded-2xl bg-gray-100 hover:bg-gray-200 flex items-center justify-center",title:"关闭",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-600"})})]}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[320px_1fr] min-h-0",children:[c.jsxs("aside",{className:"bg-slate-900 text-white p-5 overflow-y-auto",children:[c.jsx("div",{className:"text-xs font-bold text-slate-400 mb-3",children:"选择自动化类型"}),c.jsx("div",{className:"space-y-3",children:$v.map(q=>{const ve=Vi[q],we=ve.icon,$e=_e===q;return c.jsx("button",{type:"button",onClick:()=>Le(q),className:`w-full rounded-2xl p-4 text-left border transition-all ${$e?"bg-white text-slate-950 border-white":"bg-white/5 text-white border-white/10 hover:bg-white/10"}`,children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(we,{className:`w-5 h-5 mt-0.5 ${$e?"text-[#0094f7]":"text-white"}`}),c.jsxs("div",{children:[c.jsx("div",{className:"font-black",children:ve.label}),c.jsx("div",{className:`text-xs mt-1 leading-5 ${$e?"text-gray-500":"text-gray-400"}`,children:ve.description})]})]})},q)})}),c.jsxs("div",{className:"mt-6 rounded-2xl bg-white/5 border border-white/10 p-4",children:[c.jsx("div",{className:"text-xs font-bold text-slate-400 mb-3",children:"执行流程"}),c.jsx("div",{className:"space-y-3",children:W.flow.map((q,ve)=>c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"w-6 h-6 rounded-full bg-white text-slate-950 text-xs font-black flex items-center justify-center",children:ve+1}),c.jsx("span",{className:"text-sm font-bold text-gray-100",children:q})]},q))})]})]}),c.jsx("div",{className:"p-6 overflow-y-auto bg-[#F7F8FA]",children:c.jsxs("div",{className:"space-y-5",children:[c.jsxs("section",{className:"bg-white rounded-3xl border border-gray-100 p-5",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[c.jsx(oA,{className:"w-5 h-5 text-[#0094f7]"}),c.jsx("h4",{className:"font-black text-gray-900",children:"生效范围"})]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"md:col-span-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"规则名称"}),c.jsx("input",{type:"text",value:T.name||"",onChange:q=>re({...T,name:q.target.value}),placeholder:"不填时按类型和商品自动生成",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"闲鱼账号"}),c.jsxs("select",{value:T.cookie_id||"",onChange:q=>re({...T,cookie_id:q.target.value,item_id:"",item_title:"",item_keyword:""}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[c.jsx("option",{value:"",children:"选择账号"}),v.map(q=>c.jsx("option",{value:q.id,children:kd(q)},q.id))]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"关联商品"}),c.jsxs("select",{value:T.item_id||"",onChange:q=>Ce(q.target.value),className:"w-full ios-input px-4 py-3 rounded-xl",children:[c.jsx("option",{value:"",children:"账号级规则(不限定商品)"}),I.map(q=>c.jsx("option",{value:q.item_id,children:q.item_title||q.item_id},`${q.cookie_id}-${q.item_id}`))]})]})]}),he&&_e!=="review_missing_timeout"&&c.jsxs("div",{className:"mt-4 rounded-2xl bg-gray-50 border border-gray-100 p-4",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[c.jsx("span",{className:"px-3 py-1.5 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:he.item_title||he.item_id}),c.jsx("span",{className:`px-3 py-1.5 rounded-lg text-xs font-bold ${be?"bg-blue-50 text-blue-700":"bg-gray-100 text-gray-500"}`,children:be?"多规格商品":"普通商品"}),c.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs font-bold bg-emerald-50 text-emerald-700",children:"按订单购买数量自动发货"})]}),c.jsx("p",{className:"text-xs leading-5 text-gray-500",children:"多规格状态来自闲鱼商品本身,发布后不能在这里修改;系统会在买家付款后读取订单详情,按实际购买规格和数量匹配下面的发货规则。"})]})]}),_e!=="review_missing_timeout"?c.jsxs("section",{className:"bg-white rounded-3xl border border-gray-100 p-5",children:[c.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(NM,{className:"w-5 h-5 text-[#0094f7]"}),c.jsx("h4",{className:"font-black text-gray-900",children:_e==="buyer_reviewed"?"赠品库存":"发货库存"})]}),c.jsx("p",{className:"text-sm text-gray-500 mt-1",children:be?"每条发货内容绑定一个订单规格;同一规格可添加多条内容并全部发送。":"可添加多条发货内容,买家付款后会按顺序全部发送。"})]}),c.jsxs("button",{type:"button",onClick:Pe,className:"px-3 py-2 rounded-xl bg-gray-900 text-white text-xs font-bold hover:bg-black flex items-center gap-1.5",children:[c.jsx(ja,{className:"w-3.5 h-3.5"}),"添加发货内容"]})]}),c.jsx("div",{className:"space-y-3",children:Y.map((q,ve)=>c.jsxs("div",{className:`grid grid-cols-1 gap-3 items-end rounded-2xl border border-gray-200 p-4 ${be?"md:grid-cols-[1fr_1fr_1.4fr_110px_40px]":"md:grid-cols-[1.4fr_110px_40px]"}`,children:[be&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-bold text-gray-600 mb-2",children:"规格名称"}),c.jsx("input",{value:q.spec_name,onChange:we=>ge(ve,{spec_name:we.target.value}),className:"w-full ios-input px-3 py-2.5 rounded-lg",placeholder:"例如:套餐"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-bold text-gray-600 mb-2",children:"规格值"}),c.jsx("input",{value:q.spec_value,onChange:we=>ge(ve,{spec_value:we.target.value}),className:"w-full ios-input px-3 py-2.5 rounded-lg",placeholder:"例如:30天"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-bold text-gray-600 mb-2",children:"卡密库存"}),c.jsxs("select",{value:q.card_id||"",onChange:we=>ge(ve,{card_id:Number(we.target.value)}),className:"w-full ios-input px-3 py-2.5 rounded-lg",children:[c.jsx("option",{value:"",children:"请选择卡密库存"}),b.filter(we=>we.enabled).map(we=>c.jsx("option",{value:we.id,children:we.name},we.id))]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-bold text-gray-600 mb-2",children:"每件份数"}),c.jsx("input",{type:"number",min:"1",max:"100",value:q.delivery_count,onChange:we=>ge(ve,{delivery_count:Math.max(1,Number(we.target.value)||1)}),className:"w-full ios-input px-3 py-2.5 rounded-lg"})]}),c.jsx("button",{type:"button",disabled:Y.length===1,onClick:()=>re({...T,variants:Y.filter((we,$e)=>$e!==ve)}),className:"w-10 h-10 flex items-center justify-center rounded-lg text-red-500 hover:bg-red-50 disabled:opacity-25",title:"删除发货内容",children:c.jsx(xa,{className:"w-4 h-4"})})]},q.id||ve))})]}):c.jsxs("section",{className:"bg-white rounded-3xl border border-gray-100 p-5",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[c.jsx(cA,{className:"w-5 h-5 text-amber-600"}),c.jsx("h4",{className:"font-black text-gray-900",children:"求评价计划"})]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"发货后等待小时"}),c.jsx("input",{type:"number",min:"1",value:Number(V.after_shipped_hours||72),onChange:q=>re({...T,config_json:fs(T.config_json,{after_shipped_hours:Math.max(1,Number(q.target.value)||72)})}),className:"w-full ios-input px-4 py-3 rounded-xl"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"最多求评次数"}),c.jsx("input",{type:"number",min:"1",value:Number(V.max_attempts||1),onChange:q=>re({...T,config_json:fs(T.config_json,{max_attempts:Math.max(1,Number(q.target.value)||1)})}),className:"w-full ios-input px-4 py-3 rounded-xl"})]}),c.jsxs("div",{className:"md:col-span-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"求评价文案"}),c.jsx("textarea",{value:((xl=(wi=T.actions)==null?void 0:wi.find(q=>q.action_type==="send_text"))==null?void 0:xl.message_template)||"",onChange:q=>{var ve;return re({...T,actions:((ve=T.actions)!=null&&ve.length?T.actions:ec("review_missing_timeout")).map(we=>we.action_type==="send_text"?{...we,message_template:q.target.value}:we)})},className:"w-full ios-input px-4 py-3 rounded-xl h-28 resize-none"})]})]})]}),c.jsx("section",{className:"bg-white rounded-3xl border border-gray-100 p-5",children:c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] gap-4 items-end",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"优先级"}),c.jsx("input",{type:"number",value:T.priority||100,onChange:q=>re({...T,priority:Number(q.target.value)||100}),min:"1",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),c.jsxs("label",{className:"h-[48px] flex items-center gap-3 px-4 bg-gray-50 rounded-xl text-sm font-bold text-gray-800",children:[c.jsx("input",{type:"checkbox",checked:T.enabled!==!1,onChange:q=>re({...T,enabled:q.target.checked}),className:"w-4 h-4 rounded"}),"启用规则"]})]})})]})})]}),c.jsxs("div",{className:"px-6 py-4 border-t border-gray-100 bg-white flex gap-3",children:[c.jsx("button",{onClick:()=>D(!1),className:"flex-1 px-6 py-3 rounded-2xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200",children:"取消"}),c.jsxs("button",{onClick:Be,className:"flex-1 ios-btn-primary px-6 py-3 rounded-2xl font-bold flex items-center justify-center gap-2",children:[c.jsx(Sa,{className:"w-4 h-4"}),"保存自动化规则"]})]})]})}),document.body),E&&Z&&It.createPortal(c.jsx("div",{className:"modal-overlay",children:c.jsxs("div",{className:"modal-container",children:[c.jsx("div",{className:"modal-header",children:c.jsxs("div",{className:"flex items-center justify-between w-full",children:[c.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:Z.id?"编辑回复规则":"新增回复规则"}),c.jsx("button",{onClick:()=>$(!1),className:"p-2 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-600"})})]})}),c.jsxs("div",{className:"modal-body space-y-5",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"关键词"}),c.jsx("input",{type:"text",value:Z.keyword||"",onChange:q=>pe({...Z,keyword:q.target.value}),placeholder:"买家发送的关键词",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"回复内容"}),c.jsx("textarea",{value:Z.reply_content||"",onChange:q=>pe({...Z,reply_content:q.target.value}),placeholder:"自动回复的内容",className:"w-full ios-input px-4 py-3 rounded-xl h-32 resize-none"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"匹配类型"}),c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsx("button",{type:"button",onClick:()=>pe({...Z,match_type:"exact"}),className:`p-3 rounded-xl font-bold transition-all ${Z.match_type!=="fuzzy"?"bg-[#0094f7] text-white":"bg-gray-100 text-gray-600"}`,children:"精确匹配"}),c.jsx("button",{type:"button",onClick:()=>pe({...Z,match_type:"fuzzy"}),className:`p-3 rounded-xl font-bold transition-all ${Z.match_type==="fuzzy"?"bg-[#0094f7] text-white":"bg-gray-100 text-gray-600"}`,children:"模糊包含"})]})]}),c.jsxs("div",{className:"flex gap-3 pt-4",children:[c.jsx("button",{onClick:()=>$(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),c.jsxs("button",{onClick:De,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[c.jsx(Yy,{className:"w-4 h-4"}),"保存规则"]})]})]})]})}),document.body),U&&It.createPortal(c.jsx("div",{className:"modal-overlay",children:c.jsxs("div",{className:"modal-container",children:[c.jsx("div",{className:"modal-header",children:c.jsxs("div",{className:"flex items-center justify-between w-full",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"账号默认回复"}),c.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"关键词和 AI 都未处理时,才会使用默认回复。"})]}),c.jsx("button",{onClick:()=>K(!1),className:"p-2 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors",title:"关闭",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-600"})})]})}),c.jsxs("div",{className:"modal-body space-y-5",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"闲鱼账号"}),c.jsxs("select",{value:fe.cookie_id,onChange:q=>ce({...fe,cookie_id:q.target.value}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[c.jsx("option",{value:"",children:"选择账号"}),v.map(q=>c.jsx("option",{value:q.id,children:kd(q)},q.id))]})]}),c.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-bold text-gray-900",children:"启用默认回复"}),c.jsx("div",{className:"text-xs text-gray-500 mt-1",children:"启用后,未命中关键词时自动发送"})]}),c.jsx("button",{type:"button",onClick:()=>ce({...fe,enabled:!fe.enabled}),className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${fe.enabled?"bg-[#0094f7]":"bg-gray-300"}`,children:c.jsx("span",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 block ${fe.enabled?"translate-x-7":"translate-x-1"}`})})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"回复内容"}),c.jsx("textarea",{value:fe.reply_content,onChange:q=>ce({...fe,reply_content:q.target.value}),placeholder:"输入默认回复内容",className:"w-full ios-input px-4 py-3 rounded-xl h-32 resize-none"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"回复图片 URL(可选)"}),c.jsx("input",{type:"text",value:fe.reply_image_url,onChange:q=>ce({...fe,reply_image_url:q.target.value}),placeholder:"https://example.com/image.jpg",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),c.jsxs("label",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl text-sm font-bold text-gray-800",children:[c.jsxs("span",{children:["只回复一次",c.jsx("span",{className:"block text-xs text-gray-500 font-medium mt-1",children:"同一会话只发送一次默认回复"})]}),c.jsx("input",{type:"checkbox",checked:fe.reply_once,onChange:q=>ce({...fe,reply_once:q.target.checked}),className:"w-4 h-4 rounded"})]}),c.jsxs("div",{className:"flex gap-3 pt-4",children:[c.jsx("button",{onClick:()=>K(!1),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),c.jsxs("button",{onClick:Te,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[c.jsx(Sa,{className:"w-4 h-4"}),"保存默认回复"]})]})]})]})}),document.body)]})},ms={bark:{label:"Bark",icon:gs,fields:[{key:"server_url",label:"Bark 服务器",placeholder:"https://api.day.app",required:!0},{key:"device_key",label:"Device Key",placeholder:"你的 Bark 设备 Key",required:!0},{key:"title",label:"标题(可选)",placeholder:"闲鱼助手"},{key:"sound",label:"铃声(可选)",placeholder:"default"},{key:"group",label:"分组(可选)",placeholder:"xianyu"}],guide:{steps:["App Store 搜索并安装 Bark(免费)","打开 Bark App,首页会显示一条测试 URL,形如 https://api.day.app//这是测试推送内容","URL 路径里 那一段就是 Device Key,复制填入","服务器地址默认 https://api.day.app,自建服务端则填自建域名"],urlFormat:"https://api.day.app/<你的key>/测试内容",note:"不需要 secret,Device Key 本身就是唯一凭证。"}},dingtalk:{label:"钉钉机器人",icon:Cd,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",required:!0},{key:"secret",label:"加签密钥",placeholder:"SEC...",help:"安全设置勾选「加签」后生成,SEC 开头"}],guide:{steps:["钉钉进入一个群(可建单人群)→ 右上角 群设置","机器人 → 添加机器人 → 选择「自定义机器人」","安全设置勾选「加签」","完成页同时展示 Webhook 地址和 SEC 开头的 Secret,两个都复制","Webhook URL 填上面,Secret 填加签密钥"],urlFormat:"https://oapi.dingtalk.com/robot/send?access_token=XXX",note:"加签密钥可选,但强烈建议启用,否则机器人可能被滥用。"}},feishu:{label:"飞书机器人",icon:Cd,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",required:!0},{key:"secret",label:"签名校验密钥",placeholder:"sec-...",help:"安全设置选「签名校验」后生成"}],guide:{steps:["飞书进入目标群 → 右上角 更多 → 设置","群机器人 → 添加机器人 → 自定义机器人","安全设置选择「签名校验」,复制生成的秘钥","完成会给 Webhook 地址,复制","Webhook URL 填上面,秘钥填签名校验密钥"],urlFormat:"https://open.feishu.cn/open-apis/bot/v2/hook/xxx",note:"签名密钥可选,建议启用。频率限制:单机器人 100 次/分钟。"}},wechat:{label:"企业微信机器人",icon:Cd,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",required:!0}],guide:{steps:["企业微信进入一个内部群 → 右上角 … → 群设置","找到「群机器人」(新版可能叫「消息推送」)","添加 → 选择自定义机器人","完成给 Webhook 地址(含 ?key=),复制填入"],urlFormat:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXX",note:"不需要 secret,URL 里的 key 就是唯一凭证,注意不要泄露。频率限制 20 条/分钟。"}},webhook:{label:"自定义 Webhook",icon:hD,fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://your-server/notify",required:!0}],guide:{steps:["仅适用于自己有服务器的用户:在你自己的机器上起一个 HTTP 接口收 JSON","系统会 POST 这个 URL,Content-Type: application/json","请求体固定为右侧 JSON 格式,按需解析 message 字段"],urlFormat:'{"message":"告警正文","timestamp":"2026-07-05 12:00:00","source":"xianyu-auto-reply"}',note:"若用 Server酱 / PushPlus 等第三方推送服务,格式不兼容,需写中间脚本转发,或改用对应专用渠道。"}},telegram:{label:"Telegram",icon:Yy,fields:[{key:"bot_token",label:"Bot Token",placeholder:"123456:ABC-DEF...",required:!0},{key:"chat_id",label:"Chat ID",placeholder:"-1001234567890 或你的用户 ID",required:!0}],guide:{steps:["在 Telegram 搜索 @BotFather,发送 /newbot,按提示创建机器人,拿到 Bot Token","把你的 Bot 拉进一个群,或私聊它发一条消息","浏览器访问 https://api.telegram.org/bot<你的Token>/getUpdates",'从返回 JSON 里找 "chat":{"id":xxx},xxx 就是 Chat ID(群是负数,私聊是正数)'],urlFormat:"Bot Token: 123456:ABC-DEF... Chat ID: -1001234567890",note:"群聊需先把 Bot 设为管理员才能发消息。"}},email:{label:"邮件",icon:dA,fields:[{key:"smtp_server",label:"SMTP 服务器",placeholder:"smtp.qq.com",required:!0},{key:"smtp_port",label:"SMTP 端口",placeholder:"587",type:"number",required:!0},{key:"smtp_user",label:"发件邮箱",placeholder:"you@qq.com",required:!0},{key:"smtp_password",label:"密码 / 授权码",type:"password",required:!0},{key:"from",label:"收件邮箱(可选)",placeholder:"留空则发给自己"}],guide:{steps:["QQ 邮箱:服务器 smtp.qq.com,端口 587,发件邮箱填你的 QQ 邮箱","QQ 邮箱密码栏填「授权码」不是 QQ 密码:QQ 邮箱设置 → 账号 → 开启 SMTP → 生成授权码","163 邮箱:smtp.163.com:587,同样使用授权码","Gmail:smtp.gmail.com:587,密码用「应用专用密码」"],note:"收件邮箱留空时,邮件会发到发件邮箱自己。"}}},qQ=()=>{const[e,t]=x.useState([]),[n,r]=x.useState(!0),[l,s]=x.useState(!1),[d,f]=x.useState(null),[m,h]=x.useState(!1),[v,y]=x.useState(""),[b,w]=x.useState(null),[j,_]=x.useState({}),[S,A]=x.useState(!1),[C,M]=x.useState(!1),[k,D]=x.useState({name:"",type:"bark",enabled:!0,config:{}}),E=async()=>{r(!0);try{const z=await jA();t(z.data||[])}catch(z){console.error("加载通知渠道失败",z)}finally{r(!1)}},$=async()=>{try{const z=await bA();_(z||{})}catch(z){console.error("加载 SMTP 配置失败",z)}},U=async()=>{A(!0);try{await wA({smtp_server:j.smtp_server||"",smtp_port:j.smtp_port||587,smtp_user:j.smtp_user||"",smtp_password:j.smtp_password||"",smtp_from:j.smtp_from||""}),K("success","SMTP 配置已保存")}catch(z){K("error",(z==null?void 0:z.message)||"保存失败")}finally{A(!1)}};x.useEffect(()=>{E(),$()},[]);const K=(z,G)=>{w({type:z,text:G}),window.setTimeout(()=>w(null),3e3)},T=()=>{f(null),D({name:"",type:"bark",enabled:!0,config:{}}),s(!0)},re=z=>{f(z),D({name:z.name,type:z.type,enabled:z.enabled,config:{...z.config||{}}}),s(!0)},Z=async()=>{const z=ms[k.type];for(const G of z.fields)if(G.required&&!String(k.config[G.key]||"").trim()){K("error",`请填写 ${G.label}`);return}if(!k.name.trim()){K("error","请填写渠道名称");return}h(!0);try{const G={name:k.name.trim(),type:k.type,config:k.config,enabled:k.enabled};d?await _j(d.id,G):await uP(G),s(!1),await E(),K("success",d?"已更新":"已创建")}catch(G){console.error("保存失败",G),K("error",(G==null?void 0:G.message)||"保存失败")}finally{h(!1)}},pe=async z=>{if(confirm(`确认删除渠道「${z.name}」吗?已绑定该渠道的账号会自动解绑。`))try{await dP(z.id),await E(),K("success","已删除")}catch(G){K("error",(G==null?void 0:G.message)||"删除失败")}},fe=async z=>{try{await _j(z.id,{name:z.name,type:z.type,config:z.config||{},enabled:!z.enabled}),t(G=>G.map(se=>se.id===z.id?{...se,enabled:!se.enabled}:se))}catch(G){K("error",(G==null?void 0:G.message)||"切换失败")}},ce=async z=>{y(z.id);try{await hP(z.id),K("success","测试通知已发送,请检查对应渠道")}catch(G){K("error",(G==null?void 0:G.message)||"发送失败")}finally{y("")}},R=ms[k.type];return c.jsxs("div",{className:"space-y-8 animate-fade-in",children:[c.jsxs("div",{className:"flex flex-col md:flex-row justify-between md:items-end gap-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-4xl font-extrabold text-gray-900 tracking-tight",children:"通知设置"}),c.jsx("p",{className:"text-gray-500 mt-2 font-medium",children:"配置通知渠道,账号异常时主动推送告警"})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("button",{onClick:E,className:"px-4 py-2 bg-gray-100 hover:bg-gray-200 rounded-xl font-bold text-gray-700 flex items-center gap-2 transition-colors",children:[c.jsx(pr,{className:"w-4 h-4"}),"刷新"]}),c.jsxs("button",{onClick:T,className:"ios-btn-primary px-5 py-2.5 rounded-xl font-bold flex items-center gap-2",children:[c.jsx(ja,{className:"w-4 h-4"}),"新建渠道"]})]})]}),c.jsx("div",{className:"ios-card rounded-xl p-5 bg-blue-50/50 border border-blue-100",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(gs,{className:"w-5 h-5 text-[#0094f7] mt-0.5 flex-shrink-0"}),c.jsxs("div",{className:"text-sm text-gray-700 leading-6",children:["配置通知渠道并在「账号管理 → 编辑」里绑定后,以下事件会主动推送到该账号绑定的渠道:",c.jsxs("ul",{className:"mt-2 space-y-1 text-gray-600",children:[c.jsxs("li",{children:["• ",c.jsx("strong",{children:"账号 session 失效"}),":系统正在尝试自动恢复(警告)"]}),c.jsxs("li",{children:["• ",c.jsx("strong",{children:"自动恢复失败"}),":账号已停止,需人工处理(严重)"]}),c.jsxs("li",{children:["• ",c.jsx("strong",{children:"触发风控验证"}),":可能需要扫码完成验证(警告)"]})]})]})]})}),n?c.jsx("div",{className:"flex justify-center py-20",children:c.jsx(Yn,{className:"w-8 h-8 text-[#0094f7] animate-spin"})}):e.length===0?c.jsxs("div",{className:"ios-card rounded-xl p-12 bg-white text-center",children:[c.jsx(gs,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),c.jsx("p",{className:"text-gray-500 font-medium",children:"还没有配置任何通知渠道"}),c.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"点击右上角「新建渠道」开始配置"})]}):c.jsx("div",{className:"space-y-3",children:e.map(z=>{const G=ms[z.type]||ms.webhook,se=G.icon;return c.jsxs("div",{className:"ios-card rounded-xl p-5 bg-white flex items-center gap-4",children:[c.jsx("div",{className:"w-11 h-11 rounded-xl bg-gray-100 flex items-center justify-center flex-shrink-0",children:c.jsx(se,{className:"w-5 h-5 text-gray-600"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-bold text-gray-900 truncate",children:z.name}),c.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-gray-100 text-gray-600 font-medium",children:G.label}),!z.enabled&&c.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-gray-100 text-gray-400 font-medium",children:"已停用"})]}),c.jsx("div",{className:"text-xs text-gray-500 mt-1 truncate",children:G.fields.map(ue=>{var P;return(P=z.config)==null?void 0:P[ue.key]}).filter(Boolean).map((ue,P)=>c.jsx("span",{className:"mr-3",children:String(ue).length>40?String(ue).slice(0,40)+"…":String(ue)},P))})]}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[c.jsx("button",{onClick:()=>fe(z),className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-colors ${z.enabled?"bg-green-50 text-green-700 hover:bg-green-100":"bg-gray-100 text-gray-500 hover:bg-gray-200"}`,children:z.enabled?"启用中":"已停用"}),c.jsxs("button",{onClick:()=>ce(z),disabled:v===z.id,className:"px-3 py-1.5 rounded-lg text-xs font-bold bg-blue-50 text-[#0094f7] hover:bg-blue-100 transition-colors flex items-center gap-1 disabled:opacity-50",children:[v===z.id?c.jsx(Yn,{className:"w-3 h-3 animate-spin"}):c.jsx(Yy,{className:"w-3 h-3"}),"测试"]}),c.jsx("button",{onClick:()=>re(z),className:"w-8 h-8 rounded-lg bg-gray-100 hover:bg-gray-200 flex items-center justify-center text-gray-600 transition-colors",title:"编辑",children:c.jsx(mA,{className:"w-4 h-4"})}),c.jsx("button",{onClick:()=>pe(z),className:"w-8 h-8 rounded-lg bg-red-50 hover:bg-red-100 flex items-center justify-center text-red-500 transition-colors",title:"删除",children:c.jsx(xa,{className:"w-4 h-4"})})]})]},z.id)})}),c.jsxs("section",{className:"ios-card rounded-xl p-6 bg-white space-y-5",children:[c.jsxs("div",{className:"flex items-start justify-between",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-lg font-extrabold text-gray-800",children:"SMTP 邮件配置"}),c.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"系统级邮件发送服务,用于注册验证码等邮件通知"})]}),c.jsx("div",{className:"p-2 rounded-xl bg-blue-50 text-blue-600",children:c.jsx(dA,{className:"w-5 h-5"})})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"SMTP 服务器"}),c.jsx("input",{type:"text",value:j.smtp_server||"",onChange:z=>_({...j,smtp_server:z.target.value}),placeholder:"smtp.qq.com",className:"w-full ios-input px-4 py-3 rounded-xl text-sm"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"SMTP 端口"}),c.jsx("input",{type:"number",value:j.smtp_port||587,onChange:z=>_({...j,smtp_port:parseInt(z.target.value)||587}),placeholder:"587",className:"w-full ios-input px-4 py-3 rounded-xl text-sm"})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"发件邮箱"}),c.jsx("input",{type:"email",value:j.smtp_user||"",onChange:z=>_({...j,smtp_user:z.target.value}),placeholder:"your-email@qq.com",className:"w-full ios-input px-4 py-3 rounded-xl text-sm"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"邮箱密码 / 授权码"}),c.jsxs("div",{className:"relative",children:[c.jsx("input",{type:C?"text":"password",value:j.smtp_password||"",onChange:z=>_({...j,smtp_password:z.target.value}),placeholder:"输入密码或授权码",className:"w-full ios-input px-4 py-3 pr-12 rounded-xl text-sm"}),c.jsx("button",{type:"button",onClick:()=>M(!C),className:"absolute right-3 top-1/2 -translate-y-1/2 p-2 text-gray-400 hover:text-gray-600 transition-colors",children:C?c.jsx(ic,{className:"w-4 h-4"}):c.jsx(xs,{className:"w-4 h-4"})})]}),c.jsx("p",{className:"text-xs text-gray-500",children:"QQ 邮箱需使用授权码(QQ 邮箱设置 → 账号 → 开启 SMTP → 生成授权码)"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"发件人显示名(可选)"}),c.jsx("input",{type:"text",value:j.smtp_from||"",onChange:z=>_({...j,smtp_from:z.target.value}),placeholder:"闲鱼自动回复系统",className:"w-full ios-input px-4 py-3 rounded-xl text-sm"})]}),c.jsxs("button",{onClick:U,disabled:S,className:"ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[S?c.jsx(Yn,{className:"w-4 h-4 animate-spin"}):c.jsx(Sa,{className:"w-4 h-4"}),S?"保存中...":"保存 SMTP 配置"]})]}),l&&It.createPortal(c.jsx("div",{className:"modal-overlay",children:c.jsxs("div",{className:"modal-container",style:{maxWidth:"36rem"},children:[c.jsxs("div",{className:"px-6 py-5 border-b border-gray-100 flex items-center justify-between",children:[c.jsx("h3",{className:"text-xl font-extrabold text-gray-900",children:d?"编辑通知渠道":"新建通知渠道"}),c.jsx("button",{onClick:()=>s(!1),className:"w-10 h-10 rounded-2xl bg-gray-100 hover:bg-gray-200 flex items-center justify-center",children:c.jsx(Xt,{className:"w-5 h-5 text-gray-600"})})]}),c.jsxs("div",{className:"px-6 py-5 space-y-5 overflow-y-auto flex-1 min-h-0",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"渠道名称"}),c.jsx("input",{type:"text",value:k.name,onChange:z=>D({...k,name:z.target.value}),placeholder:"例如:我的 Bark",className:"w-full ios-input px-4 py-3 rounded-xl text-sm"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-bold text-gray-800",children:"渠道类型"}),c.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-2",children:Object.keys(ms).map(z=>{const G=ms[z],se=G.icon,ue=k.type===z;return c.jsxs("button",{type:"button",onClick:()=>D({...k,type:z,config:{}}),className:`p-3 rounded-xl border-2 flex flex-col items-center gap-1.5 transition-all ${ue?"border-[#0094f7] bg-blue-50":"border-gray-100 hover:border-gray-300"}`,children:[c.jsx(se,{className:`w-5 h-5 ${ue?"text-[#0094f7]":"text-gray-500"}`}),c.jsx("span",{className:`text-xs font-bold ${ue?"text-[#0094f7]":"text-gray-600"}`,children:G.label})]},z)})})]}),c.jsxs("div",{className:"rounded-xl bg-amber-50 border border-amber-200 p-4 space-y-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(gs,{className:"w-4 h-4 text-amber-600"}),c.jsxs("span",{className:"text-sm font-bold text-amber-800",children:["如何获取 ",R.label," 配置?"]})]}),c.jsx("ol",{className:"space-y-1.5 text-xs text-amber-900/90 leading-5 list-decimal pl-5",children:R.guide.steps.map((z,G)=>c.jsx("li",{children:z},G))}),R.guide.urlFormat&&c.jsxs("div",{className:"text-xs text-amber-900/90",children:[c.jsx("span",{className:"font-bold",children:"格式示例:"}),c.jsx("code",{className:"mt-1 block bg-amber-100/70 px-2.5 py-1.5 rounded-lg break-all font-mono text-[11px]",children:R.guide.urlFormat})]}),R.guide.note&&c.jsxs("p",{className:"text-xs text-amber-800/80 leading-5 pt-1",children:["💡 ",R.guide.note]})]}),c.jsx("div",{className:"space-y-3",children:R.fields.map(z=>c.jsxs("div",{className:"space-y-2",children:[c.jsxs("label",{className:"block text-sm font-bold text-gray-800",children:[z.label,z.required&&c.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),c.jsx("input",{type:z.type==="password"?"password":z.type==="number"?"number":"text",value:String(k.config[z.key]||""),onChange:G=>D({...k,config:{...k.config,[z.key]:G.target.value}}),placeholder:z.placeholder,className:"w-full ios-input px-4 py-3 rounded-xl text-sm"}),z.help&&c.jsx("p",{className:"text-xs text-gray-500",children:z.help})]},z.key))}),c.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[c.jsx("button",{type:"button",onClick:()=>D({...k,enabled:!k.enabled}),className:`relative w-11 h-6 rounded-full transition-colors ${k.enabled?"bg-[#0094f7]":"bg-gray-300"}`,children:c.jsx("span",{className:`absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform ${k.enabled?"translate-x-5":""}`})}),c.jsx("span",{className:"text-sm font-bold text-gray-800",children:"启用此渠道"})]})]}),c.jsxs("div",{className:"px-6 py-4 border-t border-gray-100 flex items-center justify-end gap-3",children:[c.jsx("button",{onClick:()=>s(!1),className:"px-5 py-2.5 rounded-xl bg-gray-100 hover:bg-gray-200 font-bold text-gray-700 transition-colors",children:"取消"}),c.jsxs("button",{onClick:Z,disabled:m,className:"ios-btn-primary px-6 py-2.5 rounded-xl font-bold flex items-center gap-2 disabled:opacity-50",children:[m?c.jsx(Yn,{className:"w-4 h-4 animate-spin"}):c.jsx(ci,{className:"w-4 h-4"}),m?"保存中...":"保存"]})]})]})}),document.body),b&&c.jsxs("div",{className:"fixed bottom-8 left-1/2 -translate-x-1/2 z-[10000] px-5 py-3 rounded-xl shadow-lg font-bold text-sm flex items-center gap-2 animate-fade-in",style:{background:b.type==="success"?"#10b981":"#ef4444",color:"white"},children:[b.type==="success"?c.jsx(ci,{className:"w-4 h-4"}):c.jsx(Xt,{className:"w-4 h-4"}),b.text]})]})},i5={"/app/dashboard":"dashboard","/app/accounts":"accounts","/app/orders":"orders","/app/cards":"cards","/app/items":"items","/app/rules":"rules","/app/notifications":"notifications","/app/settings":"settings"},KQ=Object.fromEntries(Object.entries(i5).map(([e,t])=>[t,e])),rA=()=>i5[window.location.pathname]||"dashboard",YQ=/Win/i.test(navigator.platform||navigator.userAgent),GQ=()=>{const[e,t]=x.useState(!1),[n,r]=x.useState(rA),[l,s]=x.useState(!0),[d,f]=x.useState(!1),[m,h]=x.useState(""),[v,y]=x.useState(""),[b,w]=x.useState(!1),[j,_]=x.useState(""),[S,A]=x.useState(),C=D=>{const E=KQ[D];E&&E!==window.location.pathname&&window.history.pushState({},"",E),r(D)};x.useEffect(()=>{const D=()=>r(rA());return window.addEventListener("popstate",D),()=>window.removeEventListener("popstate",D)},[]),x.useEffect(()=>{gA().then(E=>{if((E==null?void 0:E.initialized)===!1){f(!0),t(!1);return}f(!1),E!=null&&E.authenticated&&t(!0)}).catch(()=>t(!1)).finally(()=>s(!1));const D=()=>t(!1);return window.addEventListener("auth:logout",D),()=>window.removeEventListener("auth:logout",D)},[]);const M=async D=>{D.preventDefault(),w(!0),_("");try{const E=await xD({username:m,password:v});E.success?t(!0):_(E.message||"登录失败")}catch(E){const $=E instanceof Error?E.message:String(E);_($||"登录失败")}finally{w(!1)}};if(l)return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-[#f5f5f7]",children:c.jsx(Yn,{className:"w-8 h-8 text-[#0094f7] animate-spin"})});if(d)return c.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-[#F4F5F7] p-4 relative overflow-hidden font-sans",children:[c.jsx("div",{className:"absolute top-[-10%] left-[-10%] w-[60%] h-[60%] bg-blue-200/40 rounded-full blur-[120px] animate-pulse"}),c.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[60%] h-[60%] bg-blue-200/30 rounded-full blur-[120px] animate-pulse",style:{animationDelay:"2s"}}),c.jsxs("div",{className:"bg-white/80 backdrop-blur-3xl p-8 md:p-12 rounded-xl shadow-[0_20px_60px_-15px_rgba(0,0,0,0.05)] w-full max-w-xl border border-white relative z-10 animate-fade-in",children:[c.jsxs("div",{className:"text-center mb-8",children:[c.jsx("div",{className:"w-24 h-24 bg-[#0094f7] squircle flex items-center justify-center mx-auto mb-6 transition-all duration-500 p-4",style:{filter:"drop-shadow(0 8px 20px rgba(0,148,247,0.3))"},children:c.jsx("img",{src:"/static/ydisks-logo.svg",alt:"Ydisks",className:"w-full h-full"})}),c.jsx("h2",{className:"text-3xl font-extrabold text-gray-900 mb-2 tracking-tight",children:"系统尚未初始化"}),c.jsx("p",{className:"text-gray-600 font-medium",children:"为避免默认口令风险,管理员必须通过服务器本机 CLI 初始化。"})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"p-4 rounded-2xl bg-gray-50 border border-gray-100",children:[c.jsx("div",{className:"text-sm font-bold text-gray-900 mb-2",children:"请在服务器上执行:"}),c.jsx("pre",{className:"text-xs bg-black text-white p-4 rounded-2xl overflow-x-auto",children:YQ?'.\\xianyu-server.exe -init-admin -db data\\xianyu_data.db -admin-password "请设置密码"':"./xianyu-server -init-admin -db data/xianyu_data.db -admin-password '请设置密码'"}),c.jsx("div",{className:"text-xs text-gray-500 mt-2",children:"完成后刷新页面即可进入登录。"})]}),c.jsxs("button",{type:"button",onClick:()=>window.location.reload(),className:"w-full ios-btn-primary h-14 rounded-2xl text-lg shadow-xl shadow-blue-200 mt-2 flex items-center justify-center gap-2 group",children:["我已初始化,刷新 ",c.jsx(Rv,{className:"w-5 h-5 group-hover:translate-x-1 transition-transform"})]})]}),c.jsx("div",{className:"mt-8 pt-6 border-t border-gray-100 text-center",children:c.jsx("span",{className:"text-xs text-gray-400 font-medium tracking-widest uppercase",children:"Secure Bootstrap"})})]})]});if(!e)return c.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-[#F4F5F7] p-4 relative overflow-hidden font-sans",children:[c.jsx("div",{className:"absolute top-[-10%] left-[-10%] w-[60%] h-[60%] bg-blue-200/40 rounded-full blur-[120px] animate-pulse"}),c.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[60%] h-[60%] bg-blue-200/30 rounded-full blur-[120px] animate-pulse",style:{animationDelay:"2s"}}),c.jsxs("div",{className:"bg-white/80 backdrop-blur-3xl p-8 md:p-12 rounded-xl shadow-[0_20px_60px_-15px_rgba(0,0,0,0.05)] w-full max-w-lg border border-white relative z-10 animate-fade-in",children:[c.jsxs("div",{className:"text-center mb-10",children:[c.jsx("div",{className:"w-24 h-24 bg-[#0094f7] squircle flex items-center justify-center mx-auto mb-6 transition-all duration-500 cursor-pointer group p-4",style:{filter:"drop-shadow(0 8px 20px rgba(0,148,247,0.3))"},children:c.jsx("img",{src:"/static/ydisks-logo.svg",alt:"Ydisks",className:"w-full h-full group-hover:scale-110 transition-transform"})}),c.jsx("h2",{className:"text-3xl font-extrabold text-gray-900 mb-2 tracking-tight",children:"欢迎回来"}),c.jsx("p",{className:"text-gray-500 font-medium",children:"Ydisks闲鱼助手 · 自动发货与管家系统"})]}),c.jsxs("form",{onSubmit:M,className:"space-y-5",children:[c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"relative group",children:[c.jsx(Bv,{className:"absolute left-5 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 group-focus-within:text-black transition-colors"}),c.jsx("input",{type:"text",placeholder:"管理员账号",value:m,onChange:D=>h(D.target.value),className:"w-full ios-input pl-14 pr-6 py-4.5 rounded-2xl text-base h-14"})]}),c.jsxs("div",{className:"relative group",children:[c.jsx(PM,{className:"absolute left-5 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 group-focus-within:text-black transition-colors"}),c.jsx("input",{type:"password",placeholder:"密码",value:v,onChange:D=>y(D.target.value),className:"w-full ios-input pl-14 pr-6 py-4.5 rounded-2xl text-base h-14"})]})]}),j&&c.jsxs("div",{className:"p-3 rounded-xl bg-red-50 text-red-500 text-sm text-center font-bold flex items-center justify-center gap-2",children:[c.jsx(hA,{className:"w-4 h-4"})," ",j]}),c.jsx("button",{type:"submit",disabled:b,className:"w-full ios-btn-primary h-14 rounded-2xl text-lg shadow-xl shadow-blue-200 mt-2 flex items-center justify-center gap-2 group disabled:opacity-70",children:b?c.jsx(Yn,{className:"w-5 h-5 animate-spin"}):c.jsxs(c.Fragment,{children:["立即登录 ",c.jsx(Rv,{className:"w-5 h-5 group-hover:translate-x-1 transition-transform"})]})})]}),c.jsx("div",{className:"mt-8 pt-6 border-t border-gray-100",children:c.jsx("div",{className:"mt-6 text-center",children:c.jsx("span",{className:"text-xs text-gray-400 font-medium tracking-widest uppercase",children:"Ydisks闲鱼助手 v1.0"})})})]})]});const k=()=>{switch(n){case"dashboard":return c.jsx(ZS,{});case"accounts":return c.jsx(MQ,{});case"orders":return c.jsx(DQ,{});case"cards":return c.jsx(PQ,{});case"items":return c.jsx(IQ,{onConfigureDelivery:D=>{A({cookieId:D.cookie_id,itemId:D.item_id,requestId:Date.now()}),C("rules")}});case"rules":return c.jsx(HQ,{initialDeliveryTarget:S,onDeliveryTargetHandled:()=>A(void 0)});case"notifications":return c.jsx(qQ,{});case"settings":return c.jsx($Q,{});default:return c.jsx(ZS,{})}};return c.jsxs("div",{className:"flex min-h-screen bg-[#F4F5F7] text-[#111]",children:[c.jsx(yD,{activeTab:n,onNavigate:C,onLogout:()=>{t(!1)}}),c.jsxs("main",{className:"flex-1 ml-64 p-8 md:p-12 overflow-y-auto h-screen relative scroll-smooth",children:[c.jsx("div",{className:"fixed top-0 right-0 w-[800px] h-[800px] bg-gradient-to-bl from-blue-50 to-transparent rounded-full blur-[120px] pointer-events-none -z-10 opacity-60"}),c.jsx("div",{className:"max-w-[1400px] mx-auto pb-10",children:k()})]})]})},l5=document.getElementById("root");if(!l5)throw new Error("Could not find root element to mount to");const VQ=DT.createRoot(l5);VQ.render(c.jsx(aA.StrictMode,{children:c.jsx(GQ,{})})); diff --git a/internal/webui/static/assets/index-CjhArDrm.css b/internal/webui/static/assets/index-CjhArDrm.css new file mode 100644 index 0000000..600cf20 --- /dev/null +++ b/internal/webui/static/assets/index-CjhArDrm.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}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;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.-bottom-1{bottom:-.25rem}.-right-1{right:-.25rem}.-right-6{right:-1.5rem}.-top-6{top:-1.5rem}.bottom-10{bottom:2.5rem}.bottom-8{bottom:2rem}.bottom-\[-10\%\]{bottom:-10%}.left-0{left:0}.left-0\.5{left:.125rem}.left-1{left:.25rem}.left-1\.5{left:.375rem}.left-1\/2{left:50%}.left-4{left:1rem}.left-5{left:1.25rem}.left-7{left:1.75rem}.left-\[-10\%\]{left:-10%}.right-0{right:0}.right-10{right:2.5rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-\[-10\%\]{right:-10%}.top-0{top:0}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-4{top:1rem}.top-\[-10\%\]{top:-10%}.top-\[calc\(100\%\+6px\)\]{top:calc(100% + 6px)}.-z-10{z-index:-10}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-\[10000\]{z-index:10000}.col-span-2{grid-column:span 2 / span 2}.col-span-full{grid-column:1 / -1}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-10{margin-bottom:2.5rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-2\.5{margin-bottom:.625rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-64{margin-left:16rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.contents{display:contents}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-28{height:7rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[350px\]{height:350px}.h-\[48px\]{height:48px}.h-\[60\%\]{height:60%}.h-\[800px\]{height:800px}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-\[380px\]{max-height:380px}.max-h-\[400px\]{max-height:400px}.max-h-\[420px\]{max-height:420px}.min-h-0{min-height:0px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[150px\]{min-height:150px}.min-h-\[400px\]{min-height:400px}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[10\%\]{width:10%}.w-\[12\%\]{width:12%}.w-\[18\%\]{width:18%}.w-\[22\%\]{width:22%}.w-\[60\%\]{width:60%}.w-\[800px\]{width:800px}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-64{min-width:16rem}.min-w-\[210px\]{min-width:210px}.min-w-\[260px\]{min-width:260px}.max-w-6xl{max-width:72rem}.max-w-\[1400px\]{max-width:1400px}.max-w-\[200px\]{max-width:200px}.max-w-\[210px\]{max-width:210px}.max-w-\[240px\]{max-width:240px}.max-w-\[260px\]{max-width:260px}.max-w-\[280px\]{max-width:280px}.max-w-\[340px\]{max-width:340px}.max-w-\[80px\]{max-width:80px}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.table-fixed{table-layout:fixed}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-1{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-5{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-6{--tw-translate-x: 1.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-7{--tw-translate-x: 1.75rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-\[1\.02\]{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}@keyframes spin{to{transform:rotate(360deg)}}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-gray-50>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(249 250 251 / var(--tw-divide-opacity, 1))}.self-end{align-self:flex-end}.self-center{align-self:center}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.scroll-smooth{scroll-behavior:smooth}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:6px}.rounded-2xl,.rounded-3xl{border-radius:10px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:7px}.rounded-md{border-radius:6px}.rounded-xl{border-radius:8px}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-b{border-bottom-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-\[\#0094f7\]{--tw-border-opacity: 1;border-color:rgb(0 148 247 / var(--tw-border-opacity, 1))}.border-amber-100{--tw-border-opacity: 1;border-color:rgb(254 243 199 / var(--tw-border-opacity, 1))}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-blue-100{--tw-border-opacity: 1;border-color:rgb(219 234 254 / var(--tw-border-opacity, 1))}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-600{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.border-emerald-100{--tw-border-opacity: 1;border-color:rgb(209 250 229 / var(--tw-border-opacity, 1))}.border-emerald-500{--tw-border-opacity: 1;border-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-50{--tw-border-opacity: 1;border-color:rgb(249 250 251 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-purple-100{--tw-border-opacity: 1;border-color:rgb(243 232 255 / var(--tw-border-opacity, 1))}.border-red-100{--tw-border-opacity: 1;border-color:rgb(254 226 226 / var(--tw-border-opacity, 1))}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-white\/10{border-color:#ffffff1a}.bg-\[\#0094f7\]{--tw-bg-opacity: 1;background-color:rgb(0 148 247 / var(--tw-bg-opacity, 1))}.bg-\[\#F4F5F7\]{--tw-bg-opacity: 1;background-color:rgb(244 245 247 / var(--tw-bg-opacity, 1))}.bg-\[\#F7F8FA\]{--tw-bg-opacity: 1;background-color:rgb(247 248 250 / var(--tw-bg-opacity, 1))}.bg-\[\#FAFAFA\]{--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity, 1))}.bg-\[\#f5f5f7\]{--tw-bg-opacity: 1;background-color:rgb(245 245 247 / var(--tw-bg-opacity, 1))}.bg-amber-100{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.bg-amber-100\/70{background-color:#fef3c7b3}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-50\/60{background-color:#fffbeb99}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-100\/70{background-color:#dbeafeb3}.bg-blue-200\/30{background-color:#bfdbfe4d}.bg-blue-200\/40{background-color:#bfdbfe66}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-50\/50{background-color:#eff6ff80}.bg-blue-50\/60{background-color:#eff6ff99}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-emerald-100{--tw-bg-opacity: 1;background-color:rgb(209 250 229 / var(--tw-bg-opacity, 1))}.bg-emerald-50{--tw-bg-opacity: 1;background-color:rgb(236 253 245 / var(--tw-bg-opacity, 1))}.bg-emerald-50\/60{background-color:#ecfdf599}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-100\/50{background-color:#f3f4f680}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-200\/50{background-color:#e5e7eb80}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-orange-100{--tw-bg-opacity: 1;background-color:rgb(255 237 213 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-pink-50{--tw-bg-opacity: 1;background-color:rgb(253 242 248 / var(--tw-bg-opacity, 1))}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-50{--tw-bg-opacity: 1;background-color:rgb(250 245 255 / var(--tw-bg-opacity, 1))}.bg-purple-50\/50{background-color:#faf5ff80}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/5{background-color:#ffffff0d}.bg-white\/80{background-color:#fffc}.bg-white\/90{background-color:#ffffffe6}.bg-white\/95{background-color:#fffffff2}.bg-opacity-10{--tw-bg-opacity: .1}.bg-gradient-to-bl{background-image:linear-gradient(to bottom left,var(--tw-gradient-stops))}.from-blue-50{--tw-gradient-from: #eff6ff var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 246 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-12{padding:3rem}.p-16{padding:4rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-20{padding:5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pb-10{padding-bottom:2.5rem}.pb-24{padding-bottom:6rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-14{padding-left:3.5rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-5{padding-left:1.25rem}.pr-10{padding-right:2.5rem}.pr-11{padding-right:2.75rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pt-1{padding-top:.25rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.uppercase{text-transform:uppercase}.leading-4{line-height:1rem}.leading-5{line-height:1.25rem}.leading-6{line-height:1.5rem}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#0094f7\]{--tw-text-opacity: 1;color:rgb(0 148 247 / var(--tw-text-opacity, 1))}.text-\[\#111\]{--tw-text-opacity: 1;color:rgb(17 17 17 / var(--tw-text-opacity, 1))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-amber-800\/80{color:#92400ecc}.text-amber-900\/90{color:#78350fe6}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-blue-950{--tw-text-opacity: 1;color:rgb(23 37 84 / var(--tw-text-opacity, 1))}.text-emerald-600{--tw-text-opacity: 1;color:rgb(5 150 105 / var(--tw-text-opacity, 1))}.text-emerald-700{--tw-text-opacity: 1;color:rgb(4 120 87 / var(--tw-text-opacity, 1))}.text-gray-100{--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-orange-700{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.text-pink-600{--tw-text-opacity: 1;color:rgb(219 39 119 / var(--tw-text-opacity, 1))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-950{--tw-text-opacity: 1;color:rgb(2 6 23 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\/30{color:#ffffff4d}.opacity-0{opacity:0}.opacity-10{opacity:.1}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_20px_60px_-15px_rgba\(0\,0\,0\,0\.05\)\]{--tw-shadow: 0 20px 60px -15px rgba(0,0,0,.05);--tw-shadow-colored: 0 20px 60px -15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[4px_0_24px_rgba\(0\,0\,0\,0\.02\)\]{--tw-shadow: 4px 0 24px rgba(0,0,0,.02);--tw-shadow-colored: 4px 0 24px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-blue-100{--tw-shadow-color: #dbeafe;--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-200{--tw-shadow-color: #bfdbfe;--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-100{--tw-shadow-color: #d1fae5;--tw-shadow: var(--tw-shadow-colored)}.shadow-gray-200{--tw-shadow-color: #e5e7eb;--tw-shadow: var(--tw-shadow-colored)}.shadow-gray-200\/70{--tw-shadow-color: rgb(229 231 235 / .7);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring-4{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-white{--tw-ring-opacity: 1;--tw-ring-color: rgb(255 255 255 / var(--tw-ring-opacity, 1))}.blur-2xl{--tw-blur: blur(40px);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-\[120px\]{--tw-blur: blur(120px);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: drop-shadow(0 1px 2px rgb(0 0 0 / .1)) drop-shadow(0 1px 1px rgb(0 0 0 / .06));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)}.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-3xl{--tw-backdrop-blur: blur(64px);-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-md{--tw-backdrop-blur: blur(12px);-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-sm{--tw-backdrop-blur: blur(4px);-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-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.squircle{-webkit-mask-image:url(/static/squircle.svg);mask-image:url(/static/squircle.svg);-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;border-radius:0}*{box-sizing:border-box;margin:0;padding:0}html,body,#root{height:100%;width:100%}body{font-family:-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;background-color:#f4f5f7;color:#fff;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ios-card{background:#fff;border-radius:8px;border:1px solid rgba(0,0,0,.02);box-shadow:0 8px 24px #0000000a;transition:transform .2s ease,box-shadow .2s ease}.ios-card:hover{box-shadow:0 12px 32px #0000000f}.ios-input{background:#f7f8fa;border:1px solid transparent;transition:all .3s cubic-bezier(.25,.8,.25,1);color:#111;font-weight:500}.ios-input:focus{background:#fff;border-color:#0094f7;box-shadow:0 0 0 4px #0094f74d;outline:none}.ios-input::-moz-placeholder{color:#9ca3af;font-weight:400}.ios-input::placeholder{color:#9ca3af;font-weight:400}.ios-btn-primary{background:#0094f7;color:#fff;font-weight:700;border:none;transition:all .2s cubic-bezier(.25,.8,.25,1);cursor:pointer}.ios-btn-primary:hover:not(:disabled){background:#0071e3;transform:translateY(-1px);box-shadow:0 8px 20px #0094f74d}.ios-btn-primary:active:not(:disabled){transform:translateY(1px);box-shadow:0 2px 8px #0094f733}.ios-btn-primary:disabled{background:#f0f0f0;color:#aaa;box-shadow:none;transform:none;cursor:not-allowed}.ios-btn-secondary{background:#f7f8fa;color:#fff;font-weight:600;border:1px solid transparent;transition:all .2s ease;cursor:pointer}.ios-btn-secondary:hover{background:#e5e7eb;border-color:#d1d5db}.ios-btn-danger{background:#fee2e2;color:#dc2626;font-weight:600;border:1px solid transparent;transition:all .2s ease;cursor:pointer}.ios-btn-danger:hover{background:#fecaca;border-color:#fca5a5}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#0000001a;border-radius:10px}::-webkit-scrollbar-thumb:hover{background:#0003}@keyframes fadeIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.animate-fade-in{animation:fadeIn .5s cubic-bezier(.16,1,.3,1) forwards}@keyframes slideUp{0%{opacity:0;transform:translateY(30px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}.animate-slide-up{animation:slideUp .3s cubic-bezier(.16,1,.3,1) forwards}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}::-moz-selection{background:#0094f7;color:#fff}::selection{background:#0094f7;color:#fff}.text-brand{color:#0094f7}.bg-brand{background-color:#0094f7}.border-brand{border-color:#0094f7}.status-badge{display:inline-flex;align-items:center;padding:4px 12px;border-radius:9999px;font-size:12px;font-weight:600}.status-badge-success{background-color:#d1fae5;color:#065f46}.status-badge-warning{background-color:#fef3c7;color:#92400e}.status-badge-error{background-color:#fee2e2;color:#991b1b}.status-badge-info{background-color:#dbeafe;color:#1e40af}.loading-skeleton{background:linear-gradient(90deg,#f3f4f6,#e5e7eb,#f3f4f6);background-size:200% 100%;animation:loading 1.5s ease-in-out infinite}@keyframes loading{0%{background-position:200% 0}to{background-position:-200% 0}}.modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9999;display:flex;align-items:center;justify-content:center;background-color:#0006;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);padding:1rem;overflow-y:auto}.modal-container{position:relative;width:100%;max-width:42rem;max-height:85vh;margin:auto;display:flex;flex-direction:column;background-color:#fff;border-radius:10px;box-shadow:0 25px 50px -12px #00000040;overflow:hidden}.modal-header{flex-shrink:0;padding:2rem 2rem 1.5rem;border-bottom:1px solid #F3F4F6;background-color:#fff;z-index:10}.modal-body{flex:1 1 auto;overflow-y:auto;overflow-x:hidden;padding:2rem}.modal-footer{flex-shrink:0;padding:1.5rem 2rem 2rem;border-top:1px solid #F3F4F6;background-color:#fff;z-index:10}.modal-container-lg{max-width:64rem}.modal-overlay-centered{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9999;display:flex;justify-content:center;background-color:#0006;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);padding:1rem;overflow-y:auto}.modal-overlay-centered .modal-container{position:relative;width:100%;max-width:42rem;max-height:85vh;margin:auto 0;display:flex;flex-direction:column;background-color:#fff;border-radius:10px;box-shadow:0 25px 50px -12px #00000040;overflow:hidden}@media(max-width:768px){.ios-card{border-radius:6px}.ios-input{font-size:16px}.modal-container{max-width:calc(100% - 2rem);max-height:90vh;border-radius:8px}.modal-header,.modal-body,.modal-footer{padding-left:1.5rem;padding-right:1.5rem}}.hover\:translate-y-\[-4px\]:hover{--tw-translate-y: -4px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[\#0094f7\]:hover{--tw-border-opacity: 1;border-color:rgb(0 148 247 / var(--tw-border-opacity, 1))}.hover\:border-amber-300:hover{--tw-border-opacity: 1;border-color:rgb(252 211 77 / var(--tw-border-opacity, 1))}.hover\:border-blue-300:hover{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity, 1))}.hover\:border-emerald-300:hover{--tw-border-opacity: 1;border-color:rgb(110 231 183 / var(--tw-border-opacity, 1))}.hover\:border-gray-300:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.hover\:border-gray-400:hover{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#0071e3\]:hover{--tw-bg-opacity: 1;background-color:rgb(0 113 227 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#0094f7\]:hover{--tw-bg-opacity: 1;background-color:rgb(0 148 247 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#FFFDE7\]\/50:hover{background-color:#fffde780}.hover\:bg-amber-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.hover\:bg-black:hover{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-50:hover{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-100:hover{--tw-bg-opacity: 1;background-color:rgb(209 250 229 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-50:hover{--tw-bg-opacity: 1;background-color:rgb(236 253 245 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-50\/50:hover{background-color:#ecfdf580}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-800:hover{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.hover\:bg-green-100:hover{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.hover\:bg-green-50:hover{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:text-\[\#0094f7\]:hover{--tw-text-opacity: 1;color:rgb(0 148 247 / var(--tw-text-opacity, 1))}.hover\:text-black:hover{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.hover\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\:text-gray-900:hover{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.hover\:text-green-600:hover{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-blue-400:focus{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-0:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-\[\#0094f7\]:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(0 148 247 / var(--tw-ring-opacity, 1))}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-25:disabled{opacity:.25}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.disabled\:opacity-70:disabled{opacity:.7}.group:focus-within .group-focus-within\:text-\[\#0094f7\]{--tw-text-opacity: 1;color:rgb(0 148 247 / var(--tw-text-opacity, 1))}.group:focus-within .group-focus-within\:text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:translate-x-1{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-105{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-125{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:opacity-100{opacity:1}@media(min-width:640px){.sm\:w-72{width:18rem}.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\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:grid-cols-\[1fr_180px\]{grid-template-columns:1fr 180px}.sm\:flex-row{flex-direction:row}.sm\:gap-8{gap:2rem}}@media(min-width:768px){.md\:col-span-2{grid-column:span 2 / span 2}.md\:w-auto{width:auto}.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-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:grid-cols-\[1\.4fr_110px_40px\]{grid-template-columns:1.4fr 110px 40px}.md\:grid-cols-\[180px_1fr\]{grid-template-columns:180px 1fr}.md\:grid-cols-\[1fr_1fr_1\.4fr_110px_40px\]{grid-template-columns:1fr 1fr 1.4fr 110px 40px}.md\:flex-row{flex-direction:row}.md\:items-end{align-items:flex-end}.md\:items-center{align-items:center}.md\:justify-between{justify-content:space-between}.md\:border-l{border-left-width:1px}.md\:border-t-0{border-top-width:0px}.md\:p-12{padding:3rem}.md\:pl-6{padding-left:1.5rem}.md\:pt-0{padding-top:0}}@media(min-width:1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.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-\[320px_1fr\]{grid-template-columns:320px 1fr}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:self-auto{align-self:auto}}@media(min-width:1280px){.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:flex-row{flex-direction:row}.xl\:items-end{align-items:flex-end}.xl\:justify-between{justify-content:space-between}}@media(min-width:1536px){.\32xl\:grid-cols-\[360px_1fr\]{grid-template-columns:360px 1fr}} diff --git a/internal/webui/static/index.html b/internal/webui/static/index.html index e5eea30..8b9bef2 100644 --- a/internal/webui/static/index.html +++ b/internal/webui/static/index.html @@ -6,8 +6,8 @@ Ydisks闲鱼助手 - 自动发货与管家系统 - - + +
diff --git a/internal/xianyu/mtop/client.go b/internal/xianyu/mtop/client.go index 38c2756..dcba0f3 100644 --- a/internal/xianyu/mtop/client.go +++ b/internal/xianyu/mtop/client.go @@ -5,6 +5,7 @@ package mtop import ( "context" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -57,6 +58,7 @@ type ClientImpl struct { TokenURL string ConsignURL string OrderDetailURL string + LoginUserURL string } // NewClient 构造默认 HTTP 实现的非零 ClientImpl(调用方多为持有 Client 接口字段)。 @@ -117,10 +119,9 @@ func hasMTopSuccess(ret []string) bool { func isTokenExpiredRet(ret []string) bool { for _, r := range ret { - lower := strings.ToLower(r) - if strings.Contains(lower, "token") || - strings.Contains(r, "FAIL_SYS_TOKEN_EXOIRED") || + if strings.Contains(r, "FAIL_SYS_TOKEN_EXOIRED") || strings.Contains(r, "FAIL_SYS_TOKEN_EXPIRED") || + strings.Contains(r, "FAIL_SYS_TOKEN_EMPTY") || strings.Contains(r, "FAIL_SYS_SESSION_EXPIRED") { return true } @@ -128,6 +129,54 @@ func isTokenExpiredRet(ret []string) bool { return false } +// RiskVerificationError 表示闲鱼服务端要求用户验证(滑块/人脸/风控页)。 +// 这类错误不能按普通 token 过期快速重试,否则会持续打接口并放大风控。 +type RiskVerificationError struct { + Ret []string + VerificationURL string +} + +func (e *RiskVerificationError) Error() string { + if e == nil { + return "" + } + if e.VerificationURL != "" { + return fmt.Sprintf("闲鱼要求安全验证: ret=%v url=%s", e.Ret, e.VerificationURL) + } + return fmt.Sprintf("闲鱼要求安全验证: ret=%v", e.Ret) +} + +// IsRiskVerificationErr 判断错误是否是闲鱼风控验证要求。 +func IsRiskVerificationErr(err error) bool { + var riskErr *RiskVerificationError + if errors.As(err, &riskErr) { + return true + } + if err == nil { + return false + } + msg := strings.ToLower(err.Error()) + return strings.Contains(msg, "fail_sys_user_validate") || + strings.Contains(msg, "rgv587") || + strings.Contains(msg, "punish") || + strings.Contains(msg, "captcha") || + strings.Contains(msg, "x5secdata") +} + +func isRiskVerificationRet(ret []string) bool { + for _, r := range ret { + lower := strings.ToLower(r) + if strings.Contains(lower, "fail_sys_user_validate") || + strings.Contains(lower, "rgv587") || + strings.Contains(lower, "punish") || + strings.Contains(lower, "captcha") || + strings.Contains(lower, "x5secdata") { + return true + } + } + return false +} + // IsSessionExpiredErr 判断错误是否表示 cookie/session 已彻底失效(需密码登录刷新)。 func IsSessionExpiredErr(err error) bool { if err == nil { diff --git a/internal/xianyu/mtop/client_test.go b/internal/xianyu/mtop/client_test.go index 02033b8..3c32fea 100644 --- a/internal/xianyu/mtop/client_test.go +++ b/internal/xianyu/mtop/client_test.go @@ -165,7 +165,7 @@ func TestIsTokenExpiredRet(t *testing.T) { {[]string{"FAIL_SYS_TOKEN_EXOIRED::令牌过期"}, true}, {[]string{"FAIL_SYS_TOKEN_EXPIRED::令牌过期"}, true}, {[]string{"FAIL_SYS_SESSION_EXPIRED::会话过期"}, true}, - {[]string{"FAIL_SYS_USER_VALIDATE::非法请求TOKEN"}, true}, // lower contains "token" + {[]string{"FAIL_SYS_USER_VALIDATE::非法请求TOKEN"}, false}, {[]string{"SUCCESS::调用成功"}, false}, {[]string{"FAIL_BIZ_ORDER_STATUS_ERROR::订单状态错误"}, false}, {nil, false}, diff --git a/internal/xianyu/mtop/login_status.go b/internal/xianyu/mtop/login_status.go new file mode 100644 index 0000000..7d480d0 --- /dev/null +++ b/internal/xianyu/mtop/login_status.go @@ -0,0 +1,136 @@ +package mtop + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "strconv" + "strings" + "time" + + "xianyu-go/internal/xianyu/protocol" +) + +const LoginUserAPI = "https://h5api.m.goofish.com/h5/mtop.taobao.idlemessage.pc.loginuser.get/1.0/" + +const ( + LoginStatusSuccess = "success" + LoginStatusTokenRefreshed = "token_refreshed" + LoginStatusSessionExpired = "session_expired" + LoginStatusTokenEmpty = "token_empty" + LoginStatusRiskRequired = "risk_required" + LoginStatusFailed = "failed" +) + +// LoginStatusResult 是 loginuser.get 的登录态检查结果。 +type LoginStatusResult struct { + Status string + Ret []string + UpdatedCookies string + VerificationURL string + Message string +} + +// CheckLoginStatusContext 调用 loginuser.get 做低成本登录态检查。 +// 它不会做浏览器动作;只负责分类响应和合并 Set-Cookie。 +func (c *ClientImpl) CheckLoginStatusContext(ctx context.Context, cookiesStr string) (*LoginStatusResult, error) { + hc := c.HTTPClient + if hc == nil { + hc = &http.Client{Timeout: 20 * time.Second} + } + t := strconv.FormatInt(time.Now().UnixMilli(), 10) + dataVal := `{}` + query := buildLoginStatusQuery(t, protocol.GenerateSign(t, protocol.SignToken(cookiesStr), dataVal)) + + loginURL := c.LoginUserURL + if loginURL == "" { + loginURL = LoginUserAPI + } + req, err := http.NewRequestWithContext(ctx, http.MethodPost, loginURL+"?"+query, strings.NewReader("data=%7B%7D")) + if err != nil { + return nil, err + } + setCommonHeaders(req, cookiesStr) + + resp, err := hc.Do(req) + if err != nil { + return nil, fmt.Errorf("loginuser.get 请求失败: %w", err) + } + defer resp.Body.Close() + raw, err := readMTopBody(resp) + if err != nil { + return nil, err + } + updated := mergeSetCookie(cookiesStr, protocol.TransCookies(cookiesStr), resp) + + var payload struct { + Ret []string `json:"ret"` + Data struct { + URL string `json:"url"` + } `json:"data"` + } + if err := json.Unmarshal(raw, &payload); err != nil { + return nil, fmt.Errorf("解析 loginuser.get 响应失败: %w (body=%s)", err, truncate(string(raw), 300)) + } + status, msg := classifyLoginStatus(payload.Ret, updated != cookiesStr) + return &LoginStatusResult{ + Status: status, + Ret: payload.Ret, + UpdatedCookies: updated, + VerificationURL: payload.Data.URL, + Message: msg, + }, nil +} + +func buildLoginStatusQuery(t, sign string) string { + parts := [][2]string{ + {"jsv", "2.7.2"}, + {"appKey", protocol.SignAppKey}, + {"t", t}, + {"sign", sign}, + {"v", "1.0"}, + {"type", "originaljson"}, + {"accountSite", "xianyu"}, + {"dataType", "json"}, + {"timeout", "20000"}, + {"api", "mtop.taobao.idlemessage.pc.loginuser.get"}, + {"sessionOption", "AutoLoginOnly"}, + {"spm_cnt", "a21ybx.im.0.0"}, + {"spm_pre", "a21ybx.item.want.1.12523da6waCtUp"}, + {"log_id", "12523da6waCtUp"}, + } + var b strings.Builder + for i, p := range parts { + if i > 0 { + b.WriteByte('&') + } + b.WriteString(p[0]) + b.WriteByte('=') + b.WriteString(p[1]) + } + return b.String() +} + +func classifyLoginStatus(ret []string, cookieUpdated bool) (string, string) { + if hasMTopSuccess(ret) { + return LoginStatusSuccess, "登录状态正常" + } + if isRiskVerificationRet(ret) { + return LoginStatusRiskRequired, "闲鱼要求安全验证" + } + retStr := strings.Join(ret, " ") + switch { + case strings.Contains(retStr, "TOKEN_EMPTY") || strings.Contains(retStr, "令牌为空"): + return LoginStatusTokenEmpty, "令牌为空,需要重新登录" + case strings.Contains(retStr, "SESSION_EXPIRED") || strings.Contains(retStr, "Session过期"): + return LoginStatusSessionExpired, "Session过期,需要重新登录" + case strings.Contains(retStr, "TOKEN_EXOIRED") || strings.Contains(retStr, "TOKEN_EXPIRED"): + if cookieUpdated { + return LoginStatusTokenRefreshed, "令牌已刷新" + } + return LoginStatusFailed, "令牌过期但未获取到新Cookie" + default: + return LoginStatusFailed, retStr + } +} diff --git a/internal/xianyu/mtop/login_status_test.go b/internal/xianyu/mtop/login_status_test.go new file mode 100644 index 0000000..9af743e --- /dev/null +++ b/internal/xianyu/mtop/login_status_test.go @@ -0,0 +1,72 @@ +package mtop + +import ( + "context" + "fmt" + "net/http" + "net/http/httptest" + "strings" + "testing" +) + +func TestRiskVerificationClassification(t *testing.T) { + ret := []string{"FAIL_SYS_USER_VALIDATE::用户校验失败"} + if !isRiskVerificationRet(ret) { + t.Fatal("FAIL_SYS_USER_VALIDATE 应识别为风控") + } + if isTokenExpiredRet(ret) { + t.Fatal("FAIL_SYS_USER_VALIDATE 不应再被当作普通 token 过期") + } + err := &RiskVerificationError{Ret: ret, VerificationURL: "https://passport.goofish.com/punish?x5secdata=1"} + if !IsRiskVerificationErr(err) { + t.Fatal("RiskVerificationError 应被识别") + } +} + +func TestRefreshTokenReturnsRiskVerificationError(t *testing.T) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + http.SetCookie(w, &http.Cookie{Name: "_m_h5_tk", Value: "newtk_1"}) + fmt.Fprint(w, `{"ret":["FAIL_SYS_USER_VALIDATE::用户校验失败"],"data":{"url":"https://passport.goofish.com/punish?x5secdata=1"}}`) + })) + defer srv.Close() + + c := &ClientImpl{HTTPClient: srv.Client(), TokenURL: srv.URL} + res, err := c.RefreshTokenWithDeviceIDContext(context.Background(), "unb=123; _m_h5_tk=old_1", "device-1") + if err == nil || !IsRiskVerificationErr(err) { + t.Fatalf("应返回风控错误: res=%#v err=%v", res, err) + } + if res == nil || !strings.Contains(res.UpdatedCookies, "_m_h5_tk=newtk_1") { + t.Fatalf("风控时仍应保留 Set-Cookie: %#v", res) + } + var riskErr *RiskVerificationError + if !strings.Contains(err.Error(), "x5secdata") { + t.Fatalf("风控 URL 未进入错误信息: %v", riskErr) + } +} + +func TestCheckLoginStatusTokenRefreshed(t *testing.T) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + http.SetCookie(w, &http.Cookie{Name: "_m_h5_tk", Value: "newtk_1"}) + fmt.Fprint(w, `{"ret":["FAIL_SYS_TOKEN_EXOIRED::令牌过期"],"data":{}}`) + })) + defer srv.Close() + + c := &ClientImpl{HTTPClient: srv.Client(), LoginUserURL: srv.URL} + res, err := c.CheckLoginStatusContext(context.Background(), "unb=123; _m_h5_tk=old_1") + if err != nil { + t.Fatalf("CheckLoginStatusContext: %v", err) + } + if res.Status != LoginStatusTokenRefreshed { + t.Fatalf("status=%s want %s", res.Status, LoginStatusTokenRefreshed) + } + if !strings.Contains(res.UpdatedCookies, "_m_h5_tk=newtk_1") { + t.Fatalf("UpdatedCookies=%q", res.UpdatedCookies) + } +} + +func TestClassifyLoginStatusRisk(t *testing.T) { + status, msg := classifyLoginStatus([]string{"RGV587_ERROR::哎哟喂,被挤爆啦"}, false) + if status != LoginStatusRiskRequired || msg == "" { + t.Fatalf("status=%s msg=%q", status, msg) + } +} diff --git a/internal/xianyu/mtop/token.go b/internal/xianyu/mtop/token.go index 23d4073..ffbbe33 100644 --- a/internal/xianyu/mtop/token.go +++ b/internal/xianyu/mtop/token.go @@ -32,13 +32,16 @@ func (c *ClientImpl) RefreshTokenContext(ctx context.Context, cookiesStr string) func (c *ClientImpl) RefreshTokenWithDeviceIDContext(ctx context.Context, cookiesStr, deviceID string) (*RefreshResult, error) { currentCookies := cookiesStr for attempt := 0; attempt < 2; attempt++ { - accessToken, ret, updatedCookies, status, err := c.refreshTokenOnce(ctx, currentCookies, deviceID) + accessToken, ret, updatedCookies, verificationURL, status, err := c.refreshTokenOnce(ctx, currentCookies, deviceID) if err != nil { return &RefreshResult{UpdatedCookies: currentCookies}, err } if accessToken != "" { return &RefreshResult{AccessToken: accessToken, UpdatedCookies: updatedCookies}, nil } + if isRiskVerificationRet(ret) { + return &RefreshResult{UpdatedCookies: updatedCookies}, &RiskVerificationError{Ret: ret, VerificationURL: verificationURL} + } if !isTokenExpiredRet(ret) { return &RefreshResult{UpdatedCookies: updatedCookies}, fmt.Errorf("token API 返回非成功: ret=%v (status=%d)", ret, status) } @@ -54,7 +57,7 @@ func (c *ClientImpl) RefreshTokenWithDeviceIDContext(ctx context.Context, cookie return &RefreshResult{UpdatedCookies: currentCookies}, fmt.Errorf("token API 登录凭证已失效") } -func (c *ClientImpl) refreshTokenOnce(ctx context.Context, cookiesStr, deviceID string) (string, []string, string, int, error) { +func (c *ClientImpl) refreshTokenOnce(ctx context.Context, cookiesStr, deviceID string) (string, []string, string, string, int, error) { hc := c.HTTPClient if hc == nil { hc = &http.Client{Timeout: 30 * time.Second} @@ -63,7 +66,7 @@ func (c *ClientImpl) refreshTokenOnce(ctx context.Context, cookiesStr, deviceID cookies := protocol.TransCookies(cookiesStr) myid := cookies["unb"] if myid == "" { - return "", nil, cookiesStr, 0, fmt.Errorf("cookie 缺少 unb 字段,无法生成 deviceId") + return "", nil, cookiesStr, "", 0, fmt.Errorf("cookie 缺少 unb 字段,无法生成 deviceId") } if strings.TrimSpace(deviceID) == "" { deviceID = protocol.GenerateDeviceID(myid) @@ -84,18 +87,18 @@ func (c *ClientImpl) refreshTokenOnce(ctx context.Context, cookiesStr, deviceID } req, err := http.NewRequestWithContext(ctx, http.MethodPost, tokenURL+"?"+query, strings.NewReader(body)) if err != nil { - return "", nil, cookiesStr, 0, err + return "", nil, cookiesStr, "", 0, err } setCommonHeaders(req, cookiesStr) resp, err := hc.Do(req) if err != nil { - return "", nil, cookiesStr, 0, fmt.Errorf("token API 请求失败: %w", err) + return "", nil, cookiesStr, "", 0, fmt.Errorf("token API 请求失败: %w", err) } defer resp.Body.Close() raw, err := readMTopBody(resp) if err != nil { - return "", nil, cookiesStr, resp.StatusCode, err + return "", nil, cookiesStr, "", resp.StatusCode, err } // 即使业务返回 token 过期,也要保留响应下发的新签名 Cookie。 updated := mergeSetCookie(cookiesStr, cookies, resp) @@ -104,10 +107,11 @@ func (c *ClientImpl) refreshTokenOnce(ctx context.Context, cookiesStr, deviceID Ret []string `json:"ret"` Data struct { AccessToken string `json:"accessToken"` + URL string `json:"url"` } `json:"data"` } if err := json.Unmarshal(raw, &res); err != nil { - return "", nil, updated, resp.StatusCode, fmt.Errorf("解析 token 响应失败: %w (body=%s)", err, truncate(string(raw), 300)) + return "", nil, updated, "", resp.StatusCode, fmt.Errorf("解析 token 响应失败: %w (body=%s)", err, truncate(string(raw), 300)) } ok := false @@ -118,12 +122,12 @@ func (c *ClientImpl) refreshTokenOnce(ctx context.Context, cookiesStr, deviceID } } if !ok { - return "", res.Ret, updated, resp.StatusCode, nil + return "", res.Ret, updated, res.Data.URL, resp.StatusCode, nil } if res.Data.AccessToken == "" { - return "", res.Ret, updated, resp.StatusCode, fmt.Errorf("token API 成功但 accessToken 为空 (body=%s)", truncate(string(raw), 300)) + return "", res.Ret, updated, "", resp.StatusCode, fmt.Errorf("token API 成功但 accessToken 为空 (body=%s)", truncate(string(raw), 300)) } - return res.Data.AccessToken, res.Ret, updated, resp.StatusCode, nil + return res.Data.AccessToken, res.Ret, updated, "", resp.StatusCode, nil } // buildTokenQuery 构造 token API 的 query string。 diff --git a/internal/xianyu/qrlogin/client.go b/internal/xianyu/qrlogin/client.go index 0c8de4f..b10b2ab 100644 --- a/internal/xianyu/qrlogin/client.go +++ b/internal/xianyu/qrlogin/client.go @@ -32,6 +32,7 @@ const ( apiMiniLogin = host + "/mini_login.htm" apiGenerateQR = host + "/newlogin/qrcode/generate.do" apiScanStatus = host + "/newlogin/qrcode/query.do" + apiFaceCheck = host + "/iv/photoVerify/check.do" apiH5TK = "https://h5api.m.goofish.com/h5/mtop.gaia.nodejs.gaia.idle.data.gw.v2.index.get/1.0/" appKey = "34839810" ) @@ -63,6 +64,8 @@ type Session struct { params map[string]string verificationURL string verificationScreenshot string // 最新截图 data URL,前端轮询时显示 + faceQRURL string // 人脸验证二维码 data URL,优先展示给前端 + faceQRContent string // 人脸验证二维码原始内容,便于排查协议变化 } func (s *Session) isExpired() bool { @@ -222,6 +225,10 @@ func (m *Manager) GetSessionStatus(sessionID string) map[string]any { if sess.Status == "verification_required" && sess.verificationURL != "" { result["verification_url"] = sess.verificationURL result["message"] = "账号被风控,需要手机验证" + if sess.faceQRURL != "" { + result["face_qr_url"] = sess.faceQRURL + result["message"] = "需要人脸验证,请使用手机闲鱼扫描二维码" + } if sess.verificationScreenshot != "" { result["verification_screenshot"] = sess.verificationScreenshot } @@ -298,44 +305,22 @@ func (m *Manager) monitorQRStatus(ctx context.Context, sessionID string) { for _, c := range resp.Cookies() { sess.cookies[c.Name] = c.Value } - m.logger.Warn("扫码登录需要风控验证,立即启动浏览器等待验证", "session_id", sessionID, "verification_url", logsafe.URL(sess.verificationURL), "tmp_cookie_count", len(sess.cookies)) + // 人脸验证会额外占用用户手机端操作时间。这里重置窗口,避免普通 + // 扫码 5 分钟窗口在用户扫人脸二维码时把会话误标为 expired。 + sess.createdTime = time.Now() + sess.expireTime = 5 * time.Minute + m.logger.Warn("扫码登录需要风控验证,启动 API 人脸验证链路", "session_id", sessionID, "verification_url", logsafe.URL(sess.verificationURL), "tmp_cookie_count", len(sess.cookies)) - // 关键:必须在检测到风控时立即启动浏览器,带临时 cookie 打开验证页面。 - // 用户在手机完成验证后,服务端回调打到这个 Chromium 页面(redirect 到 ivCheckLogin.htm), - // Chromium 才能拿到授权 session,再访问 /im 得到 unb。 - // 不能等用户点按钮——那时验证已绑定到用户浏览器 session,与此 Chromium 无关。 - if m.browser != nil { - browserFn := m.browser - cookieStr := cookieMarshal(sess.cookies) - verURL := sess.verificationURL - // #nosec G118 -- 浏览器验证必须跨越轮询请求,浏览器实现本身有超时限制。 - go func() { - verifyCtx, cancel := context.WithTimeout(context.Background(), sess.expireTime) - defer cancel() - onScreenshot := func(dataURL string) { - m.mu.Lock() - if s, ok := m.sessions[sessionID]; ok { - s.verificationScreenshot = dataURL - } - m.mu.Unlock() - } - realCookies, unb, err := browserFn(verifyCtx, cookieStr, verURL, onScreenshot) - m.mu.Lock() - defer m.mu.Unlock() - s, ok := m.sessions[sessionID] - if !ok { - return - } - if err != nil { - m.logger.Error("浏览器等待验证失败", "err", err) - return - } - s.cookies = parseCookieStr(realCookies) - s.unb = unb - s.Status = "success" - m.logger.Info("浏览器验证成功,已自动完成登录", "session_id", sessionID, "account_hash", logsafe.ID(unb)) - }() - } + verURL := sess.verificationURL + // #nosec G118 -- 风控验证必须跨越轮询请求,且由超时上下文保证退出。 + go func() { + verifyCtx, cancel := context.WithTimeout(context.Background(), sess.expireTime) + defer cancel() + if err := m.runFaceVerification(verifyCtx, sessionID, verURL); err != nil { + m.logger.Error("API 人脸验证链路失败", "session_id", sessionID, "err", err) + m.fallbackBrowserVerification(verifyCtx, sessionID, verURL) + } + }() } time.Sleep(800 * time.Millisecond) continue diff --git a/internal/xianyu/qrlogin/client_test.go b/internal/xianyu/qrlogin/client_test.go index e508051..a30e76f 100644 --- a/internal/xianyu/qrlogin/client_test.go +++ b/internal/xianyu/qrlogin/client_test.go @@ -5,7 +5,9 @@ import ( "errors" "io" "net/http" + "net/http/cookiejar" "net/http/httptest" + "net/url" "strings" "testing" "time" @@ -100,6 +102,62 @@ func TestRandomUUIDRequiresEntropy(t *testing.T) { } } +func TestFaceVerificationExtractors(t *testing.T) { + normal := `` + htoken, err := extractFaceHToken(`https://passport.goofish.com/iv/mini/normal_validate.htm?htoken=abc-123`) + if err != nil || htoken != "abc-123" { + t.Fatalf("extractFaceHToken=%q err=%v", htoken, err) + } + verifyURL, err := extractVerifyModesURL(normal) + if err != nil { + t.Fatalf("extractVerifyModesURL: %v", err) + } + if !strings.HasSuffix(verifyURL, "_umidfg=1") { + t.Fatalf("verifyURL 未补齐 _umidfg: %q", verifyURL) + } + qrContent, err := extractFaceQRCodeContent(``) + if err != nil { + t.Fatalf("extractFaceQRCodeContent: %v", err) + } + if qrContent != "https://passport.goofish.com/face?x=1&y=2" { + t.Fatalf("qrContent=%q", qrContent) + } +} + +func TestCheckFaceVerificationDone(t *testing.T) { + hc := &handlerChain{} + hc.handle("/iv/photoVerify/check.do", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Query().Get("htoken") != "face-token" { + t.Fatalf("htoken=%q", r.URL.Query().Get("htoken")) + } + _, _ = w.Write([]byte(`{"content":{"code":3,"url":"https://passport.goofish.com/ivCheckLogin.htm?ok=1"}}`)) + })) + m, _, _ := newStubbedManager(t, hc) + jar, err := cookiejar.New(nil) + if err != nil { + t.Fatal(err) + } + client := *m.httpc + client.Jar = jar + gotURL, done, err := m.checkFaceVerification(context.Background(), &client, "face-token") + if err != nil || !done || !strings.Contains(gotURL, "ivCheckLogin") { + t.Fatalf("checkFaceVerification url=%q done=%v err=%v", gotURL, done, err) + } +} + +func TestCollectJarCookies(t *testing.T) { + jar, err := cookiejar.New(nil) + if err != nil { + t.Fatal(err) + } + u, _ := url.Parse("https://passport.goofish.com/") + jar.SetCookies(u, []*http.Cookie{{Name: "unb", Value: "123"}, {Name: "cookie2", Value: "abc"}}) + got := collectJarCookies(jar, u) + if got["unb"] != "123" || got["cookie2"] != "abc" { + t.Fatalf("collectJarCookies=%v", got) + } +} + func testVerificationSession() *Session { return &Session{ SessionID: "s1", diff --git a/internal/xianyu/qrlogin/face_verification.go b/internal/xianyu/qrlogin/face_verification.go new file mode 100644 index 0000000..37091a5 --- /dev/null +++ b/internal/xianyu/qrlogin/face_verification.go @@ -0,0 +1,350 @@ +package qrlogin + +import ( + "context" + "encoding/base64" + "encoding/json" + "fmt" + "html" + "net/http" + "net/http/cookiejar" + "net/url" + "regexp" + "strconv" + "strings" + "time" + + qrcode "github.com/skip2/go-qrcode" + + "xianyu-go/internal/logsafe" +) + +// runFaceVerification 参照闲鱼浏览器端风控跳转链,纯 HTTP 复现人脸验证流程。 +// +// 关键点:必须用同一个 Cookie Jar 贯穿 normal_validate -> verify_modes -> +// identity_verify -> check.do -> ivCheckLogin。服务端会在跳转链路中写入身份 +// 锚点 Cookie;如果拆成多个无状态请求,最终通常拿不到 unb。 +func (m *Manager) runFaceVerification(ctx context.Context, sessionID, iframeURL string) error { + m.mu.Lock() + sess := m.sessions[sessionID] + if sess == nil { + m.mu.Unlock() + return fmt.Errorf("会话不存在") + } + initialCookies := cloneCookieMap(sess.cookies) + m.mu.Unlock() + if len(initialCookies) == 0 { + return fmt.Errorf("无扫码临时 cookie") + } + + client, jar, err := m.faceHTTPClient(initialCookies, iframeURL) + if err != nil { + return err + } + + normalHTML, err := m.faceGetHTML(ctx, client, iframeURL, "") + if err != nil { + return fmt.Errorf("请求 normal_validate: %w", err) + } + htoken, err := extractFaceHToken(normalHTML) + if err != nil { + return err + } + verifyModesURL, err := extractVerifyModesURL(normalHTML) + if err != nil { + return err + } + + identityHTML, err := m.faceGetHTML(ctx, client, verifyModesURL, "") + if err != nil { + return fmt.Errorf("请求 verify_modes: %w", err) + } + faceContent, err := extractFaceQRCodeContent(identityHTML) + if err != nil { + return err + } + faceQRURL, err := renderQRDataURL(faceContent) + if err != nil { + return fmt.Errorf("渲染人脸二维码: %w", err) + } + + m.mu.Lock() + if s := m.sessions[sessionID]; s != nil { + s.faceQRContent = faceContent + s.faceQRURL = faceQRURL + s.Status = "verification_required" + } + m.mu.Unlock() + m.logger.Info("人脸验证二维码已生成,等待用户手机扫码", "session_id", sessionID) + + ivCheckURL, err := m.waitFaceVerification(ctx, client, sessionID, htoken) + if err != nil { + return err + } + if _, err := m.faceGetHTML(ctx, client, ivCheckURL, faceIdentityReferer(htoken)); err != nil { + return fmt.Errorf("请求 ivCheckLogin: %w", err) + } + + finalCookies := collectJarCookies(jar, + mustParseURL(host), + mustParseURL("https://www.goofish.com/"), + mustParseURL(iframeURL), + mustParseURL(ivCheckURL), + ) + if finalCookies["unb"] == "" { + return fmt.Errorf("人脸验证完成但未获取到 unb") + } + + m.mu.Lock() + if s := m.sessions[sessionID]; s != nil { + s.cookies = finalCookies + s.unb = finalCookies["unb"] + s.Status = "success" + } + m.mu.Unlock() + m.logger.Info("人脸验证登录成功", "session_id", sessionID, "account_hash", logsafe.ID(finalCookies["unb"])) + return nil +} + +// fallbackBrowserVerification 保留旧浏览器验证作为协议变化时的兜底。 +// 主路径不再截图展示,只有 API 链路失败且浏览器可用时才尝试。 +func (m *Manager) fallbackBrowserVerification(ctx context.Context, sessionID, verificationURL string) { + if m.browser == nil { + return + } + m.mu.Lock() + sess := m.sessions[sessionID] + if sess == nil { + m.mu.Unlock() + return + } + cookieStr := cookieMarshal(sess.cookies) + m.mu.Unlock() + + onScreenshot := func(dataURL string) { + m.mu.Lock() + if s, ok := m.sessions[sessionID]; ok { + s.verificationScreenshot = dataURL + } + m.mu.Unlock() + } + realCookies, unb, err := m.browser(ctx, cookieStr, verificationURL, onScreenshot) + m.mu.Lock() + defer m.mu.Unlock() + s, ok := m.sessions[sessionID] + if !ok { + return + } + if err != nil { + m.logger.Error("浏览器验证兜底失败", "session_id", sessionID, "err", err) + return + } + s.cookies = parseCookieStr(realCookies) + s.unb = unb + if s.unb == "" { + s.unb = s.cookies["unb"] + } + if s.unb != "" { + s.Status = "success" + m.logger.Info("浏览器验证兜底成功", "session_id", sessionID, "account_hash", logsafe.ID(s.unb)) + } +} + +func (m *Manager) faceHTTPClient(cookies map[string]string, iframeURL string) (*http.Client, http.CookieJar, error) { + jar, err := cookiejar.New(nil) + if err != nil { + return nil, nil, err + } + setJarCookies(jar, mustParseURL(host), cookies) + if u, err := url.Parse(iframeURL); err == nil { + setJarCookies(jar, u, cookies) + } + hc := *m.httpc + hc.Jar = jar + return &hc, jar, nil +} + +func (m *Manager) faceGetHTML(ctx context.Context, client *http.Client, targetURL, referer string) (string, error) { + req, err := http.NewRequestWithContext(ctx, http.MethodGet, targetURL, nil) + if err != nil { + return "", err + } + m.setHeaders(req) + if referer != "" { + req.Header.Set("Referer", referer) + } + resp, err := client.Do(req) + if err != nil { + return "", err + } + defer resp.Body.Close() + body, err := readQRBody(resp.Body) + if err != nil { + return "", err + } + return string(body), nil +} + +func (m *Manager) waitFaceVerification(ctx context.Context, client *http.Client, sessionID, htoken string) (string, error) { + ticker := time.NewTicker(2 * time.Second) + defer ticker.Stop() + for { + m.mu.Lock() + sess := m.sessions[sessionID] + expired := sess == nil || sess.isExpired() + m.mu.Unlock() + if expired { + return "", fmt.Errorf("人脸验证超时或会话已过期") + } + ivCheckURL, done, err := m.checkFaceVerification(ctx, client, htoken) + if err != nil { + m.logger.Warn("人脸验证轮询异常", "session_id", sessionID, "err", err) + } else if done { + return ivCheckURL, nil + } + select { + case <-ctx.Done(): + return "", ctx.Err() + case <-ticker.C: + } + } +} + +func (m *Manager) checkFaceVerification(ctx context.Context, client *http.Client, htoken string) (ivCheckURL string, done bool, err error) { + req, err := http.NewRequestWithContext(ctx, http.MethodGet, apiFaceCheck, nil) + if err != nil { + return "", false, err + } + q := req.URL.Query() + q.Set("htoken", htoken) + req.URL.RawQuery = q.Encode() + m.setHeaders(req) + req.Header.Set("Accept", "application/json, text/javascript, */*; q=0.01") + req.Header.Set("X-Requested-With", "XMLHttpRequest") + req.Header.Set("Referer", faceIdentityReferer(htoken)) + resp, err := client.Do(req) + if err != nil { + return "", false, err + } + defer resp.Body.Close() + body, err := readQRBody(resp.Body) + if err != nil { + return "", false, err + } + var result struct { + Content struct { + Code any `json:"code"` + URL string `json:"url"` + } `json:"content"` + } + if err := json.Unmarshal(body, &result); err != nil { + return "", false, fmt.Errorf("解析人脸验证状态失败: %w", err) + } + if fmt.Sprint(result.Content.Code) == "3" && result.Content.URL != "" { + return result.Content.URL, true, nil + } + return "", false, nil +} + +func faceIdentityReferer(htoken string) string { + return host + "/iv/mini/identity_verify.htm?htoken=" + url.QueryEscape(htoken) +} + +func cloneCookieMap(in map[string]string) map[string]string { + out := make(map[string]string, len(in)) + for k, v := range in { + out[k] = v + } + return out +} + +func setJarCookies(jar http.CookieJar, u *url.URL, cookies map[string]string) { + if jar == nil || u == nil { + return + } + cs := make([]*http.Cookie, 0, len(cookies)) + for k, v := range cookies { + cs = append(cs, &http.Cookie{Name: k, Value: v, Path: "/"}) + } + jar.SetCookies(u, cs) +} + +func collectJarCookies(jar http.CookieJar, urls ...*url.URL) map[string]string { + out := make(map[string]string) + if jar == nil { + return out + } + for _, u := range urls { + if u == nil { + continue + } + for _, c := range jar.Cookies(u) { + out[c.Name] = c.Value + } + } + return out +} + +func mustParseURL(raw string) *url.URL { + u, err := url.Parse(raw) + if err != nil { + return nil + } + return u +} + +func renderQRDataURL(content string) (string, error) { + png, err := qrcode.New(content, qrcode.Low) + if err != nil { + return "", err + } + png.DisableBorder = false + pngBytes, err := png.PNG(256) + if err != nil { + return "", err + } + return "data:image/png;base64," + base64.StdEncoding.EncodeToString(pngBytes), nil +} + +func extractFaceHToken(pageHTML string) (string, error) { + re := regexp.MustCompile(`htoken=([A-Za-z0-9_\-]+)`) + match := re.FindStringSubmatch(pageHTML) + if match == nil { + return "", fmt.Errorf("人脸验证:未能提取 htoken") + } + return match[1], nil +} + +func extractVerifyModesURL(pageHTML string) (string, error) { + re := regexp.MustCompile(`window\.location\.href\s*=\s*"((?:https?:)?//[^"]*?/iv/mini/verify_modes\.htm\?[^"]*)"`) + match := re.FindStringSubmatch(pageHTML) + if match == nil { + return "", fmt.Errorf("人脸验证:未能提取 verify_modes 链接") + } + raw := html.UnescapeString(match[1]) + raw = strings.ReplaceAll(raw, `\/`, `/`) + if strings.HasPrefix(raw, "//") { + raw = "https:" + raw + } + if strings.HasSuffix(raw, "_umidfg=") { + raw += "1" + } + return raw, nil +} + +func extractFaceQRCodeContent(pageHTML string) (string, error) { + re := regexp.MustCompile(`new\s+Qrcode\(\{\s*text:\s*"((?:\\.|[^"\\])*)"`) + match := re.FindStringSubmatch(pageHTML) + if match == nil { + return "", fmt.Errorf("人脸验证:未能提取人脸验证二维码 URL") + } + content, err := strconv.Unquote(`"` + match[1] + `"`) + if err != nil { + content = match[1] + } + content = html.UnescapeString(strings.ReplaceAll(content, `\/`, `/`)) + if strings.TrimSpace(content) == "" { + return "", fmt.Errorf("人脸验证二维码内容为空") + } + return content, nil +} diff --git a/internal/xianyu/renew/service.go b/internal/xianyu/renew/service.go new file mode 100644 index 0000000..20c7bd2 --- /dev/null +++ b/internal/xianyu/renew/service.go @@ -0,0 +1,337 @@ +// Package renew 实现闲鱼登录 Cookie 续期链路。 +// +// 这层只负责低成本 HTTP 续期:hasLogin.do -> silentHasLogin.do -> +// setLoginSettings.do。浏览器续期和密码登录属于更重的恢复手段,应该由上层在 +// 本包返回失败后再决定是否执行。 +package renew + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + "sort" + "strconv" + "strings" + "time" + + "xianyu-go/internal/xianyu" + "xianyu-go/internal/xianyu/protocol" +) + +const ( + HasLoginURL = "https://passport.goofish.com/newlogin/hasLogin.do" + SilentHasLoginURL = "https://passport.goofish.com/newlogin/silentHasLogin.do" + SetLoginSettingsURL = "https://passport.goofish.com/ac/account/setLoginSettings.do" + defaultRequestTimout = 20 * time.Second + maxRenewBodyBytes = 2 << 20 +) + +// Service 是 Cookie 接口续期服务。零值可用;测试可覆盖 URL 和 HTTPClient。 +type Service struct { + HTTPClient *http.Client + HasLoginURL string + SilentHasLoginURL string + SetLoginSettingsURL string +} + +// Result 描述一次接口续期的完整结果。 +type Result struct { + Success bool + RenewMethod string + NewCookies string + UpdatedCookieNames []string + StepDetails []StepResult + Message string +} + +// StepResult 是单个续期接口的执行结果,便于上层记录日志和定位失败点。 +type StepResult struct { + Name string + HTTPStatus int + BusinessOK bool + SetCookieCount int + Message string +} + +// RenewAPIFirst 按对方项目的“接口续期优先”思路执行三段续期。 +// 只有 setLoginSettings.do 返回 Set-Cookie,才认为长登录续期真正成功; +// 前两步下发的 Cookie 即使最终失败也会保留在 NewCookies 中,避免丢失服务端刷新字段。 +func (s Service) RenewAPIFirst(ctx context.Context, cookiesStr string) (*Result, error) { + cookiesStr = strings.TrimSpace(cookiesStr) + if cookiesStr == "" { + return &Result{RenewMethod: "none", Message: "Cookie为空,无法续期"}, nil + } + return s.renewOnce(ctx, cookiesStr) +} + +func (s Service) renewOnce(ctx context.Context, original string) (*Result, error) { + current := original + steps := make([]StepResult, 0, 3) + allSetCookies := make([]string, 0, 8) + + hasLogin, err := s.callHasLogin(ctx, current) + if err != nil { + return nil, err + } + steps = append(steps, hasLogin.Step) + if len(hasLogin.SetCookies) > 0 { + allSetCookies = append(allSetCookies, hasLogin.SetCookies...) + current = MergeSetCookies(current, hasLogin.SetCookies) + } + + silent, err := s.callSilentHasLogin(ctx, current) + if err != nil { + return nil, err + } + steps = append(steps, silent.Step) + if len(silent.SetCookies) > 0 { + allSetCookies = append(allSetCookies, silent.SetCookies...) + current = MergeSetCookies(current, silent.SetCookies) + } + + settings, err := s.callSetLoginSettings(ctx, current) + if err != nil { + return nil, err + } + steps = append(steps, settings.Step) + if len(settings.SetCookies) > 0 { + allSetCookies = append(allSetCookies, settings.SetCookies...) + } + + newCookies := MergeSetCookies(original, allSetCookies) + updated := ChangedCookieNames(original, newCookies) + success := len(settings.SetCookies) > 0 + method := "none" + msg := "setLoginSettings 未返回 Set-Cookie,需要浏览器续期或密码登录" + if success { + method = "api" + msg = "接口续期成功" + } + return &Result{ + Success: success, + RenewMethod: method, + NewCookies: newCookies, + UpdatedCookieNames: updated, + StepDetails: steps, + Message: msg, + }, nil +} + +type callResult struct { + Step StepResult + SetCookies []string + Body []byte +} + +func (s Service) callHasLogin(ctx context.Context, cookiesStr string) (callResult, error) { + cookies := protocol.TransCookies(cookiesStr) + unb := cookies["unb"] + if unb == "" { + return callResult{Step: StepResult{Name: "hasLogin", Message: "Cookie缺少unb,跳过"}}, nil + } + form := url.Values{} + form.Set("hid", unb) + form.Set("ltl", "true") + form.Set("appName", "xianyu") + form.Set("appEntrance", "web") + form.Set("_csrf_token", cookies["_tb_token_"]) + form.Set("umidToken", firstNonEmpty(cookies["_uab_collina"], cookies["cna"])) + form.Set("hsiz", cookies["cookie2"]) + form.Set("bizParams", "taobaoBizLoginFrom=web&renderRefer=https%3A%2F%2Fwww.goofish.com%2F") + form.Set("mainPage", "false") + form.Set("isMobile", "false") + form.Set("lang", "zh_CN") + form.Set("fromSite", "77") + form.Set("isIframe", "true") + form.Set("documentReferer", "https://www.goofish.com/") + form.Set("defaultView", "hasLogin") + form.Set("umidTag", "SERVER") + form.Set("pageTraceId", "21504"+strconv.FormatInt(time.Now().UnixMilli(), 10)) + + req, err := http.NewRequestWithContext(ctx, http.MethodPost, s.urlOrDefault(s.HasLoginURL, HasLoginURL), strings.NewReader(form.Encode())) + if err != nil { + return callResult{}, err + } + setPassportHeaders(req, cookiesStr) + req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + if xsrf := cookies["XSRF-TOKEN"]; xsrf != "" { + req.Header.Set("x-xsrf-token", xsrf) + } + q := req.URL.Query() + q.Set("appName", "xianyu") + q.Set("fromSite", "77") + req.URL.RawQuery = q.Encode() + return s.doRenewRequest(req, "hasLogin") +} + +func (s Service) callSilentHasLogin(ctx context.Context, cookiesStr string) (callResult, error) { + req, err := http.NewRequestWithContext(ctx, http.MethodPost, s.urlOrDefault(s.SilentHasLoginURL, SilentHasLoginURL), nil) + if err != nil { + return callResult{}, err + } + q := req.URL.Query() + q.Set("documentReferer", "https://www.goofish.com/") + q.Set("appName", "xianyu") + q.Set("appEntrance", "xianyu_sdkSilent") + q.Set("fromSite", "0") + q.Set("ltl", "true") + req.URL.RawQuery = q.Encode() + setPassportHeaders(req, cookiesStr) + return s.doRenewRequest(req, "silentHasLogin") +} + +func (s Service) callSetLoginSettings(ctx context.Context, cookiesStr string) (callResult, error) { + form := url.Values{} + form.Set("appName", "xianyu") + form.Set("fromSite", "77") + form.Set("keepLogin", "true") + req, err := http.NewRequestWithContext(ctx, http.MethodPost, s.urlOrDefault(s.SetLoginSettingsURL, SetLoginSettingsURL), strings.NewReader(form.Encode())) + if err != nil { + return callResult{}, err + } + setPassportHeaders(req, cookiesStr) + req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + return s.doRenewRequest(req, "setLoginSettings") +} + +func (s Service) doRenewRequest(req *http.Request, name string) (callResult, error) { + hc := s.HTTPClient + if hc == nil { + hc = &http.Client{Timeout: defaultRequestTimout} + } + resp, err := hc.Do(req) + if err != nil { + return callResult{}, fmt.Errorf("%s 请求失败: %w", name, err) + } + defer resp.Body.Close() + body, err := readRenewBody(resp.Body) + if err != nil { + return callResult{}, fmt.Errorf("%s 响应读取失败: %w", name, err) + } + setCookies := resp.Header.Values("Set-Cookie") + step := StepResult{ + Name: name, + HTTPStatus: resp.StatusCode, + SetCookieCount: len(setCookies), + } + if resp.StatusCode < 200 || resp.StatusCode >= 400 { + step.Message = fmt.Sprintf("HTTP状态异常: %d", resp.StatusCode) + return callResult{Step: step, SetCookies: setCookies, Body: body}, nil + } + step.BusinessOK = renewBusinessOK(body) + if step.BusinessOK { + step.Message = "业务成功" + } else { + step.Message = "业务结果未确认成功" + } + return callResult{Step: step, SetCookies: setCookies, Body: body}, nil +} + +func renewBusinessOK(body []byte) bool { + if len(body) == 0 { + return false + } + var payload map[string]any + if err := json.Unmarshal(body, &payload); err != nil { + return false + } + content, _ := payload["content"].(map[string]any) + if content == nil { + return false + } + ok, _ := content["success"].(bool) + return ok +} + +func setPassportHeaders(req *http.Request, cookiesStr string) { + req.Header.Set("Accept", "application/json, text/plain, */*") + req.Header.Set("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8") + req.Header.Set("Cache-Control", "no-cache") + req.Header.Set("Pragma", "no-cache") + req.Header.Set("Origin", "https://passport.goofish.com") + req.Header.Set("Referer", "https://passport.goofish.com/") + req.Header.Set("User-Agent", xianyu.BrowserUA) + req.Header.Set("sec-ch-ua", xianyu.SecChUA) + req.Header.Set("sec-ch-ua-mobile", "?0") + req.Header.Set("sec-ch-ua-platform", `"Windows"`) + req.Header.Set("Cookie", strings.ReplaceAll(strings.ReplaceAll(cookiesStr, "\n", ""), "\r", "")) +} + +func (s Service) urlOrDefault(v, fallback string) string { + if strings.TrimSpace(v) != "" { + return v + } + return fallback +} + +func readRenewBody(r io.Reader) ([]byte, error) { + body, err := io.ReadAll(io.LimitReader(r, maxRenewBodyBytes+1)) + if err != nil { + return nil, err + } + if len(body) > maxRenewBodyBytes { + return nil, fmt.Errorf("续期响应体超过 %d MiB", maxRenewBodyBytes>>20) + } + return body, nil +} + +func firstNonEmpty(values ...string) string { + for _, v := range values { + if strings.TrimSpace(v) != "" { + return v + } + } + return "" +} + +// MergeSetCookies 将 Set-Cookie 头合并到 Cookie 头字符串。只保留 name=value, +// 忽略 Path/Domain/Expires 等属性,因为后续出站请求只需要 Cookie header。 +func MergeSetCookies(original string, setCookies []string) string { + cookies := protocol.TransCookies(original) + for _, sc := range setCookies { + pair := sc + if i := strings.Index(pair, ";"); i >= 0 { + pair = pair[:i] + } + name, val, ok := strings.Cut(pair, "=") + if !ok { + continue + } + name = strings.TrimSpace(name) + if name == "" { + continue + } + cookies[name] = strings.TrimSpace(val) + } + return marshalCookies(cookies) +} + +// ChangedCookieNames 返回 newCookies 相对 original 变化过的字段名,按字典序排序。 +func ChangedCookieNames(original, newCookies string) []string { + oldMap := protocol.TransCookies(original) + newMap := protocol.TransCookies(newCookies) + changed := make([]string, 0) + for k, v := range newMap { + if oldMap[k] != v { + changed = append(changed, k) + } + } + sort.Strings(changed) + return changed +} + +func marshalCookies(cookies map[string]string) string { + keys := make([]string, 0, len(cookies)) + for k := range cookies { + keys = append(keys, k) + } + sort.Strings(keys) + parts := make([]string, 0, len(keys)) + for _, k := range keys { + parts = append(parts, k+"="+cookies[k]) + } + return strings.Join(parts, "; ") +} diff --git a/internal/xianyu/renew/service_test.go b/internal/xianyu/renew/service_test.go new file mode 100644 index 0000000..840c67f --- /dev/null +++ b/internal/xianyu/renew/service_test.go @@ -0,0 +1,122 @@ +package renew + +import ( + "context" + "fmt" + "net/http" + "net/http/httptest" + "strings" + "testing" +) + +func TestMergeSetCookies(t *testing.T) { + got := MergeSetCookies("unb=1; old=a", []string{ + "old=b; Path=/; HttpOnly", + "new=c; Domain=.goofish.com; Path=/", + "bad-cookie", + }) + if !strings.Contains(got, "old=b") || !strings.Contains(got, "new=c") || !strings.Contains(got, "unb=1") { + t.Fatalf("MergeSetCookies=%q", got) + } + changed := ChangedCookieNames("unb=1; old=a", got) + if strings.Join(changed, ",") != "new,old" { + t.Fatalf("ChangedCookieNames=%v", changed) + } +} + +func TestRenewAPIFirstSuccess(t *testing.T) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/hasLogin.do": + http.SetCookie(w, &http.Cookie{Name: "sgcookie", Value: "s1"}) + _, _ = w.Write([]byte(`{"content":{"success":true}}`)) + case "/silentHasLogin.do": + http.SetCookie(w, &http.Cookie{Name: "_m_h5_tk", Value: "tk_1"}) + _, _ = w.Write([]byte(`{"content":{"success":true}}`)) + case "/setLoginSettings.do": + // 只有这个接口返回 Set-Cookie 才代表长登录续期真正成功。 + http.SetCookie(w, &http.Cookie{Name: "havana_lgc2_77", Value: "lgc"}) + _, _ = w.Write([]byte(`{"content":{"success":true}}`)) + default: + t.Fatalf("unexpected path %s", r.URL.Path) + } + })) + defer srv.Close() + + svc := Service{ + HTTPClient: srv.Client(), + HasLoginURL: srv.URL + "/hasLogin.do", + SilentHasLoginURL: srv.URL + "/silentHasLogin.do", + SetLoginSettingsURL: srv.URL + "/setLoginSettings.do", + } + res, err := svc.RenewAPIFirst(context.Background(), "unb=1; cookie2=c2; _tb_token_=csrf") + if err != nil { + t.Fatalf("RenewAPIFirst: %v", err) + } + if !res.Success || res.RenewMethod != "api" { + t.Fatalf("success/method 异常: %#v", res) + } + for _, want := range []string{"sgcookie=s1", "_m_h5_tk=tk_1", "havana_lgc2_77=lgc"} { + if !strings.Contains(res.NewCookies, want) { + t.Fatalf("NewCookies 缺少 %s: %q", want, res.NewCookies) + } + } +} + +func TestRenewAPIFirstKeepsPartialCookiesWhenLongLoginFails(t *testing.T) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/hasLogin.do": + http.SetCookie(w, &http.Cookie{Name: "sgcookie", Value: "s1"}) + _, _ = w.Write([]byte(`{"content":{"success":true}}`)) + case "/silentHasLogin.do": + http.SetCookie(w, &http.Cookie{Name: "_m_h5_tk", Value: "tk_1"}) + _, _ = w.Write([]byte(`{"content":{"success":true}}`)) + case "/setLoginSettings.do": + _, _ = w.Write([]byte(`{"content":{"success":false}}`)) + default: + http.Error(w, fmt.Sprintf("unexpected path %s", r.URL.Path), http.StatusNotFound) + } + })) + defer srv.Close() + + svc := Service{ + HTTPClient: srv.Client(), + HasLoginURL: srv.URL + "/hasLogin.do", + SilentHasLoginURL: srv.URL + "/silentHasLogin.do", + SetLoginSettingsURL: srv.URL + "/setLoginSettings.do", + } + res, err := svc.RenewAPIFirst(context.Background(), "unb=1; cookie2=c2") + if err != nil { + t.Fatalf("RenewAPIFirst: %v", err) + } + if res.Success { + t.Fatalf("setLoginSettings 无 Set-Cookie 不应成功: %#v", res) + } + if !strings.Contains(res.NewCookies, "sgcookie=s1") || !strings.Contains(res.NewCookies, "_m_h5_tk=tk_1") { + t.Fatalf("部分 Cookie 更新未保留: %q", res.NewCookies) + } +} + +func TestRenewAPIFirstSkipsHasLoginWithoutUNB(t *testing.T) { + calls := 0 + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + calls++ + _, _ = w.Write([]byte(`{"content":{"success":true}}`)) + })) + defer srv.Close() + + svc := Service{ + HTTPClient: srv.Client(), + HasLoginURL: srv.URL + "/hasLogin.do", + SilentHasLoginURL: srv.URL + "/silentHasLogin.do", + SetLoginSettingsURL: srv.URL + "/setLoginSettings.do", + } + _, err := svc.RenewAPIFirst(context.Background(), "cookie2=c2") + if err != nil { + t.Fatalf("RenewAPIFirst: %v", err) + } + if calls != 2 { + t.Fatalf("缺少 unb 时 hasLogin 应跳过,只调用后两步,calls=%d", calls) + } +}