From 2f2ebf08e396eeebd4b6a71185b9c310861c0bd3 Mon Sep 17 00:00:00 2001 From: yoruuuchan Date: Mon, 26 Oct 2026 12:52:47 +0900 Subject: [PATCH 1/3] feat(routing): add same-provider credit-expiry-first scheduling --- README.md | 11 +- README_EN.md | 11 +- .../unreleased/fefo-credit-expiry-routing.md | 13 + frontend/src/api/system.ts | 2 +- frontend/src/i18n/messages.ts | 6 +- frontend/src/pages/SystemPage.tsx | 1 + internal/accounts/ids.go | 6 + internal/accounts/quota.go | 9 +- internal/api/system_settings_test.go | 23 ++ internal/app/gateway.go | 1 + internal/control/system.go | 4 +- internal/executor/fefo.go | 202 +++++++++++ internal/executor/fefo_test.go | 324 ++++++++++++++++++ internal/executor/ids.go | 1 + internal/executor/pool.go | 19 +- internal/gateway/fefo_quota_test.go | 31 ++ internal/gateway/handler.go | 3 + internal/gateway/openai.go | 3 + internal/providers/interfaces.go | 10 +- internal/providers/workbuddy/client.go | 30 +- internal/providers/workbuddy/client_test.go | 126 ++++++- internal/runtime/manager.go | 16 + internal/runtime/manager_fefo.go | 51 +++ internal/runtime/manager_fefo_test.go | 300 ++++++++++++++++ internal/runtime/manager_maintenance.go | 15 +- internal/runtime/manager_quota.go | 6 + internal/runtime/manager_quota_gate.go | 58 ++++ .../webui/static/assets/AreaChart-BqFAEkTX.js | 5 + .../static/assets/CartesianChart-Dc6HOANc.js | 25 ++ .../webui/static/assets/CostChart-BlNjRD6T.js | 5 + .../static/assets/LiveSparkline-BRAmSM_0.js | 5 + .../static/assets/TrafficChart-DXiktQ6F.js | 5 + .../webui/static/assets/XAxis-DqeVRlZV.js | 37 ++ .../webui/static/assets/index-CucRSUHh.js | 114 ++++++ 34 files changed, 1445 insertions(+), 33 deletions(-) create mode 100644 changelog/unreleased/fefo-credit-expiry-routing.md create mode 100644 internal/executor/fefo.go create mode 100644 internal/executor/fefo_test.go create mode 100644 internal/gateway/fefo_quota_test.go create mode 100644 internal/runtime/manager_fefo.go create mode 100644 internal/runtime/manager_fefo_test.go create mode 100644 internal/runtime/manager_quota_gate.go create mode 100644 internal/webui/static/assets/AreaChart-BqFAEkTX.js create mode 100644 internal/webui/static/assets/CartesianChart-Dc6HOANc.js create mode 100644 internal/webui/static/assets/CostChart-BlNjRD6T.js create mode 100644 internal/webui/static/assets/LiveSparkline-BRAmSM_0.js create mode 100644 internal/webui/static/assets/TrafficChart-DXiktQ6F.js create mode 100644 internal/webui/static/assets/XAxis-DqeVRlZV.js create mode 100644 internal/webui/static/assets/index-CucRSUHh.js diff --git a/README.md b/README.md index 6b3b81c4..e85e3369 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ ## 功能 - **兼容接口**:Chat Completions、Responses、Anthropic Messages 和模型列表,支持流式回复与函数工具调用。 -- **多账号调度**:自动选号、会话粘性、并发限制、冷却与故障切换。 +- **多账号调度**:轮询、加权轮询、顺序填满,以及可选的同供应商最早到期优先(FEFO);保留自动选号、会话粘性、并发限制、冷却与故障切换。 - **统一控制台**:管理账号、模型、客户端密钥、代理设置,查看额度和请求日志。 - **Docker 运维**:持久化账号数据;可选安装宿主机更新器,在控制台下载更新、确认升级和回滚。 @@ -71,6 +71,15 @@ Go 网关统一鉴权、调度和记录请求。Qoder 每个账号使用独立 N 在「账号」卡片直接操作 WorkBuddy、QwenWork 国内版/国际版与 Qoder 国内版、国际版的签到、自动签到开关(默认关闭),并从「更多 → 签到记录」查看历史,不另设签到中心。在「系统 → 自动签到」配置各供应商默认时间,「编辑账号」可选择跟随默认或自定义;修改默认时间会立即影响未覆盖的账号。已有 WorkBuddy 账号保留原时间,可在编辑账号时切回跟随默认。活动关闭时只记录跳过;真实账号签到验收仍待完成。QwenWork 的签到接口在客户端里存在,但生产网关尚未开放(404):国内版按钱包日额度核对当日免费积分,国际版只能核对总额度并记录跳过原因。 +## 最早到期优先(FEFO) + +在「系统 → 账号调度策略」选择「最早到期优先(FEFO)」,或向 `PATCH /api/system/settings` 提交 `{"routing_strategy":"fefo"}`。默认仍是轮询,原有轮询、加权轮询和顺序填满行为不变。 + +- **只在同一供应商内排序**:先按供应商分组,再比较本组账号最近的积分包到期日;Qoder、WorkBuddy 等互不影响,跨供应商仍按原有轮询选择。 +- **只认实际可消费的积分包到期**:跳过余额为零、已过期或到期未知的包;同一 UTC+8 自然日到期的账号公平轮询。未知到期不猜测,作为该供应商的兜底候选,只有已知到期账号都不可用时才参与。 +- **额度与故障切换照旧**:额度耗尽、限流冷却、并发占满或被显式排除的账号先退出候选,恢复后自动回到排序。响应或流结束后异步刷新该账号额度并重新排序;缓存中的包自然过期也会触发额度探测。不会把订阅重置、令牌有效期或签到奖励当成积分包到期。 +- **数据缺口**:目前只有 WorkBuddy 个人账号的 `get-user-resource` 返回逐包 `CycleEndTime`。Qoder 的 `quota/usage` 只有订阅月度边界(`expiresAt`),Trae、Devin、Command Code、Codex 也只有重置窗口或总额度,因此这些供应商的账号在 FEFO 下按未知日期处理。WorkBuddy 企业/共享身份,以及结果达到 100 条的未确认列表,也不会获得 FEFO 优先级。升级后尚未刷新额度的旧缓存同样按未知日期处理,启动探测或手动刷新后才会带上包元数据。 + ## 使用限制 - 只连接你自己的账号,不提供账号、额度或官方 API 服务。 diff --git a/README_EN.md b/README_EN.md index 6575b242..217aabc6 100644 --- a/README_EN.md +++ b/README_EN.md @@ -20,7 +20,7 @@ Deploy with Docker, manage accounts in the web console, and connect clients thro ## Features - **Compatible APIs**: Chat Completions, Responses, Anthropic Messages, and model listing, with streaming and function tools. -- **Multi-account routing**: automatic selection, session affinity, concurrency limits, cooldowns, and failover. +- **Multi-account routing**: round-robin, weighted round-robin, fill-first, and opt-in same-provider earliest-expiry-first (FEFO), with automatic selection, session affinity, concurrency limits, cooldowns, and failover. - **Web console**: manage accounts, models, client keys, and proxies; view quotas and request logs. - **Docker operations**: persistent account data; an optional host updater lets you download, confirm, and roll back updates from the console. @@ -71,6 +71,15 @@ Accounts, models, access, and logs all live in one web console: readiness and qu Account cards provide WorkBuddy, QwenWork CN/Global, Qoder CN, and Qoder Global check-in actions and automatic check-in switches (off by default), with history under More → Check-in records; no separate check-in page is needed. Set each provider's default time under System → Automatic check-in, then choose inheritance or an override in Edit account. Default changes apply to inheriting accounts immediately. Existing WorkBuddy accounts retain their previous times until switched to inheritance. Inactive campaigns are skipped. Live-account check-in acceptance is still pending. QwenWork ships a check-in API in its desktop client, but production gateways do not route it (404): CN confirms the daily free credits from the wallet balance, while Global can only report the total quota and the skip reason. +## Earliest-expiry-first (FEFO) + +Select **Earliest expiry first (FEFO)** under **System → Account routing strategy**, or send `{"routing_strategy":"fefo"}` to `PATCH /api/system/settings`. Round-robin remains the default; the existing round-robin, weighted round-robin, and fill-first behavior is unchanged. + +- **Rank only inside one provider.** Accounts are grouped by provider family before their nearest credit-package expiry is compared. Qoder, WorkBuddy, and other providers never compete with each other, and cross-provider selection keeps its existing rotation. +- **Use only spendable package dates.** Depleted, expired, and undated packages are skipped. Accounts expiring on the same UTC+8 calendar day rotate fairly. Missing dates are never guessed: they form that provider's fallback cohort and participate only after every dated account is unavailable. +- **Keep quota and failover semantics.** Exhausted, cooling, concurrency-saturated, or explicitly excluded accounts leave the candidate set and return to the ranking once they recover. Finishing a response or stream refreshes that account's quota asynchronously; a cached package expiring naturally also triggers a probe. Subscription resets, token lifetimes, and check-in rewards are never treated as package expiry. +- **Data gaps.** Only WorkBuddy personal accounts currently return per-package `CycleEndTime` from `get-user-resource`. Qoder's `quota/usage` exposes only the subscription cycle boundary (`expiresAt`), while Trae, Devin, Command Code, and Codex expose reset windows or totals only, so their accounts remain in the unknown-date cohort under FEFO. WorkBuddy enterprise/shared identities and unconfirmed result sets capped at 100 also receive no FEFO priority. Cached quota snapshots written before this version remain undated until the boot probe or a manual refresh repopulates the package metadata. + ## Limitations - Bring your own accounts. CLI2API does not supply accounts, quotas, or an official API service. diff --git a/changelog/unreleased/fefo-credit-expiry-routing.md b/changelog/unreleased/fefo-credit-expiry-routing.md new file mode 100644 index 00000000..7e4b918e --- /dev/null +++ b/changelog/unreleased/fefo-credit-expiry-routing.md @@ -0,0 +1,13 @@ +### English + +- Add opt-in earliest-expiry-first (FEFO) account routing. It ranks accounts only inside the same provider family by their nearest spendable credit-package expiry, rotates accounts expiring on the same UTC+8 day, and falls back to round-robin when a provider has no package dates. Existing round-robin, weighted round-robin, fill-first, affinity, pinning, region/provider gates, cooldowns, and failover are unchanged. +- Refresh a FEFO account's quota after each completed response or stream (coalesced per account) and re-probe accounts whose trusted packages all expired, so newly granted or spent credits change the next selection without waiting for a manual refresh. +- Expose WorkBuddy package expiry as FEFO-eligible only for personal identities with a complete, paginated result. Enterprise/shared identities, full result pages, undated packages, and other providers' reset windows or token lifetimes never invent a priority. +- Add the FEFO option to System → Account routing strategy and document that Qoder, Trae, Devin, Command Code, and Codex do not currently provide per-package credit expiry, so their accounts stay in the unknown-date cohort. + +### 中文 + +- 新增可选的同供应商最早到期优先(FEFO)调度:只在同一供应商内按最近可消费积分包到期日排序,同一 UTC+8 自然日到期的账号公平轮询;供应商没有积分包日期时回退轮询。原有轮询、加权轮询、顺序填满、会话粘性、固定账号、地域/供应商限制、冷却与故障切换保持不变。 +- 每次响应或流结束后异步刷新该账号额度(按账号合并请求),并重新探测积分包已全部过期的账号,让新增或已消耗的积分立即影响下一次选择,无需手动刷新。 +- 仅 WorkBuddy 个人身份且分页结果完整的积分包参与 FEFO 优先级;企业/共享身份、满 100 条的未确认列表、无日期包,以及其他供应商的重置窗口或令牌有效期都不会被伪造成到期优先级。 +- 在「系统 → 账号调度策略」增加 FEFO 选项,并说明 Qoder、Trae、Devin、Command Code、Codex 当前不提供逐包积分到期信息,其账号保持未知日期分组。 diff --git a/frontend/src/api/system.ts b/frontend/src/api/system.ts index 3c7fea9e..c9a5ab01 100644 --- a/frontend/src/api/system.ts +++ b/frontend/src/api/system.ts @@ -63,7 +63,7 @@ export type SystemSettings = { cross_provider_model_pool: boolean checkin_disabled_accounts: boolean proxy_url: string - routing_strategy: 'round-robin' | 'weighted-round-robin' | 'fill-first' + routing_strategy: 'round-robin' | 'weighted-round-robin' | 'fill-first' | 'fefo' workbuddy_checkin_time: string checkin_times: Record timezone: string diff --git a/frontend/src/i18n/messages.ts b/frontend/src/i18n/messages.ts index 64036aed..81f636ca 100644 --- a/frontend/src/i18n/messages.ts +++ b/frontend/src/i18n/messages.ts @@ -122,11 +122,12 @@ export const messages: Record = { workbuddyCheckinSettingsHint: 'Default first daily check-in time for new WorkBuddy accounts. Existing accounts keep their own time until you edit them.', workbuddyCheckinSettingsFieldHint: 'Uses server local time. New WorkBuddy accounts inherit this unless you set a different time on the account.', routingStrategyTitle: 'Account routing strategy', - routingStrategyHint: 'Choose how ready accounts share traffic. Fill-first keeps traffic on the highest-priority account until it is unavailable.', + routingStrategyHint: 'Choose how ready accounts share traffic. Fill-first keeps traffic on the highest-priority account until it is unavailable. Earliest-expiry-first only ranks accounts inside the same provider by their nearest credit-package expiry; providers without package expiry keep the existing rotation.', routingStrategy: 'Strategy', routingRoundRobin: 'Round robin', routingWeightedRoundRobin: 'Weighted round robin', routingFillFirst: 'Fill first', + routingFEFO: 'Earliest expiry first (FEFO)', routingWeight: 'Routing weight', sessionAffinityTTL: 'Session TTL', sessionAffinityHits: 'Sticky hits', @@ -1053,11 +1054,12 @@ export const messages: Record = { workbuddyCheckinSettingsHint: '新建 WorkBuddy 账号时使用的默认首次签到时间。已有账号会保留各自的时间,直到你单独修改。', workbuddyCheckinSettingsFieldHint: '使用服务器本地时间。新建 WorkBuddy 账号会继承这里的时间,账号编辑页仍可单独覆盖。', routingStrategyTitle: '账号调度策略', - routingStrategyHint: '选择就绪账号如何分担流量。填满优先会持续使用最高优先级账号,直到它不可用。', + routingStrategyHint: '选择就绪账号如何分担流量。填满优先会持续使用最高优先级账号,直到它不可用。最早到期优先只在同一供应商内部按最近的积分包到期日排序;没有积分包到期信息的供应商保持原有轮询。', routingStrategy: '策略', routingRoundRobin: '轮询', routingWeightedRoundRobin: '加权轮询', routingFillFirst: '填满优先', + routingFEFO: '最早到期优先(FEFO)', routingWeight: '调度权重', sessionAffinityTTL: '会话 TTL', sessionAffinityHits: '粘性命中', diff --git a/frontend/src/pages/SystemPage.tsx b/frontend/src/pages/SystemPage.tsx index 326eab9e..a93ef66d 100644 --- a/frontend/src/pages/SystemPage.tsx +++ b/frontend/src/pages/SystemPage.tsx @@ -255,6 +255,7 @@ export function SystemPage() { + diff --git a/internal/accounts/ids.go b/internal/accounts/ids.go index 3a827282..05de83f0 100644 --- a/internal/accounts/ids.go +++ b/internal/accounts/ids.go @@ -9,6 +9,10 @@ const ( RoutingStrategyRoundRobin = "round-robin" RoutingStrategyWeightedRoundRobin = "weighted-round-robin" RoutingStrategyFillFirst = "fill-first" + // RoutingStrategyFEFO is the opt-in earliest-expiry-first strategy. It + // ranks accounts inside one provider family by the nearest credit-package + // expiry and leaves cross-provider rotation untouched. + RoutingStrategyFEFO = "fefo" ) func NormalizeRoutingStrategy(strategy string) string { @@ -17,6 +21,8 @@ func NormalizeRoutingStrategy(strategy string) string { return RoutingStrategyFillFirst case RoutingStrategyWeightedRoundRobin: return RoutingStrategyWeightedRoundRobin + case RoutingStrategyFEFO: + return RoutingStrategyFEFO default: return RoutingStrategyRoundRobin } diff --git a/internal/accounts/quota.go b/internal/accounts/quota.go index 2d88d110..5f5adf6d 100644 --- a/internal/accounts/quota.go +++ b/internal/accounts/quota.go @@ -15,6 +15,11 @@ type QuotaWindow struct { Exceeded bool `json:"exceeded,omitempty"` } +// QuotaPackageScopeAccountFEFO marks credit packages that the provider has +// confirmed are spendable by this account and carry a real package expiry. An +// empty or unknown scope never participates in FEFO ranking. +const QuotaPackageScopeAccountFEFO = "account-fefo" + // QuotaPackage is one upstream credit/resource pack that carries its own // expiry. EndsAt is a Unix second; EndTime is the provider-native wall-clock // string for display. @@ -23,12 +28,14 @@ type QuotaPackage struct { Used float64 `json:"used"` Size float64 `json:"size"` Unit string `json:"unit,omitempty"` + Scope string `json:"scope,omitempty"` EndsAt int64 `json:"ends_at,omitempty"` EndTime string `json:"end_time,omitempty"` } // QuotaSnapshot is the quota state for one account. -// A zero value means "unknown"; only Exceeded influences routing. +// A zero value means "unknown". Exceeded gates quota routing; explicitly +// scoped package expiry may additionally guide opt-in FEFO scheduling. type QuotaSnapshot struct { Used float64 `json:"used"` Total float64 `json:"total"` diff --git a/internal/api/system_settings_test.go b/internal/api/system_settings_test.go index c43b35eb..7b364d52 100644 --- a/internal/api/system_settings_test.go +++ b/internal/api/system_settings_test.go @@ -86,6 +86,29 @@ func TestSystemSettingsRoutePersistsAndAppliesRoutingStrategy(t *testing.T) { } } +func TestSystemSettingsRoutePersistsFEFORoutingStrategy(t *testing.T) { + srv := New(config.Config{ + Host: "127.0.0.1", Port: 3010, ProxyAPIKey: "secret", + QoderHome: t.TempDir(), DataDir: t.TempDir(), + }) + defer srv.Close() + + request := httptest.NewRequest(http.MethodPatch, "/api/system/settings", bytes.NewBufferString(`{"routing_strategy":"fefo"}`)) + request.Header.Set("Authorization", "Bearer secret") + response := httptest.NewRecorder() + srv.Handler().ServeHTTP(response, request) + if response.Code != http.StatusOK || !bytes.Contains(response.Body.Bytes(), []byte(`"routing_strategy":"fefo"`)) { + t.Fatalf("updated settings: %d %s", response.Code, response.Body.String()) + } + if got := srv.Pool.RoutingStrategy(); got != accounts.RoutingStrategyFEFO { + t.Fatalf("runtime strategy = %q", got) + } + value, ok, err := srv.Manager.Store().GetSecret(context.Background(), routingStrategySecret) + if err != nil || !ok || value != accounts.RoutingStrategyFEFO { + t.Fatalf("persisted strategy=%q ok=%v err=%v", value, ok, err) + } +} + func TestEnsureWorkBuddyCheckinTimeDefaultsToNine(t *testing.T) { store, err := sqlstore.OpenStore(filepath.Join(t.TempDir(), "qoder.db")) if err != nil { diff --git a/internal/app/gateway.go b/internal/app/gateway.go index 0515e635..5010cb03 100644 --- a/internal/app/gateway.go +++ b/internal/app/gateway.go @@ -48,6 +48,7 @@ func (a *App) newGateway() *apigateway.Handler { } if a.Manager != nil { h.Catalogs = a.Manager + h.AfterAccountUse = a.Manager.RefreshFEFOQuotaAfterUse } if a.Recorder != nil { h.Logs = a.Recorder diff --git a/internal/control/system.go b/internal/control/system.go index 3e16bff8..af4064b9 100644 --- a/internal/control/system.go +++ b/internal/control/system.go @@ -80,8 +80,8 @@ func (h *System) Patch(ctx context.Context, input SystemSettingsPatch) error { var strategy string if input.RoutingStrategy != nil { rawStrategy := strings.ToLower(strings.TrimSpace(*input.RoutingStrategy)) - if rawStrategy != accounts.RoutingStrategyRoundRobin && rawStrategy != accounts.RoutingStrategyWeightedRoundRobin && rawStrategy != accounts.RoutingStrategyFillFirst { - return operationError("invalid_routing_strategy", "routing_strategy must be round-robin, weighted-round-robin, or fill-first") + if rawStrategy != accounts.RoutingStrategyRoundRobin && rawStrategy != accounts.RoutingStrategyWeightedRoundRobin && rawStrategy != accounts.RoutingStrategyFillFirst && rawStrategy != accounts.RoutingStrategyFEFO { + return operationError("invalid_routing_strategy", "routing_strategy must be round-robin, weighted-round-robin, fill-first, or fefo") } strategy = accounts.NormalizeRoutingStrategy(rawStrategy) } diff --git a/internal/executor/fefo.go b/internal/executor/fefo.go new file mode 100644 index 00000000..84203a5d --- /dev/null +++ b/internal/executor/fefo.go @@ -0,0 +1,202 @@ +package executor + +import ( + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +// fefoBillingUTCOffsetSeconds is the credit-package billing calendar. WorkBuddy +// reports CycleEndTime as a UTC+8 wall clock, so two expiries on the same +// billing day share one priority batch even when their timestamps differ. +const fefoBillingUTCOffsetSeconds = 8 * 60 * 60 + +// effectiveCreditModel resolves an account alias to the model whose pricing +// actually applies. A free alias must stay free, and an empty/auto model must +// not pretend to spend credits. +func effectiveCreditModel(item Item, publicModel string) string { + model := routeModel(publicModel) + if target := item.ModelAliases[model]; target != "" { + model = routeModel(target) + } + return model +} + +// routeQuotaExceeded is the single quota gate for routing. The historical +// strategies keep the cached Exceeded flag; FEFO additionally treats a +// trustworthy package set with no live positive balance as exhausted, because +// an expired package can leave Exceeded false until the next quota refresh. +func routeQuotaExceeded(item Item, q RouteQuery) bool { + model := q.PublicModel + if !q.fefoNow.IsZero() { + model = effectiveCreditModel(item, model) + } + if itemServesFreeModel(item, model) { + return false + } + if item.Quota != nil && item.Quota.Exceeded { + return true + } + if !q.fefoNow.IsZero() { + _, depleted := fefoExpiry(item, q.PublicModel, q.fefoNow) + return depleted + } + return false +} + +// fefoQuotaState inspects one account's packages without reference to a model. +// tracked is true only when the provider explicitly scoped every reported +// package to this account and the package is credit-denominated. Such a set can +// prove "no live positive balance"; mixed, unscoped, or non-credit data cannot. +func fefoQuotaState(item Item, now time.Time) (earliest int64, depleted, tracked bool) { + quota := item.Quota + if quota == nil || len(quota.Packages) == 0 || quota.HasAddOn || quota.HasResourcePackage { + return 0, false, false + } + unknownDate := false + live := false + for _, pkg := range quota.Packages { + if pkg.Scope != accounts.QuotaPackageScopeAccountFEFO || (pkg.Unit != "" && pkg.Unit != "credits") { + return 0, false, false + } + // NaN fails this comparison too, so a malformed balance never counts as + // spendable. A package with no reported expiry stays in the unknown + // tier instead of borrowing the subscription or token lifetime. + if !(pkg.Remain > 0) || (pkg.EndsAt > 0 && pkg.EndsAt <= now.Unix()) { + continue + } + live = true + if pkg.EndsAt <= 0 { + unknownDate = true + continue + } + if earliest == 0 || pkg.EndsAt < earliest { + earliest = pkg.EndsAt + } + } + if !live { + return 0, true, true + } + if unknownDate { + return 0, false, true + } + return earliest, false, true +} + +// fefoExpiry returns the nearest live package expiry for a paid model. A free +// model never consumes credits, so it never creates FEFO priority or depletion. +func fefoExpiry(item Item, publicModel string, now time.Time) (expiry int64, depleted bool) { + model := effectiveCreditModel(item, publicModel) + if model == "" || itemServesFreeModel(item, model) { + return 0, false + } + earliest, depleted, tracked := fefoQuotaState(item, now) + if !tracked { + return 0, false + } + return earliest, depleted +} + +// fefoCreditDay maps an expiry instant onto the UTC+8 billing day. Expired +// packages are filtered by the caller before this comparison so a package that +// lapsed earlier today cannot remain the "nearest" batch. +func fefoCreditDay(expiry int64) int64 { + return (expiry + fefoBillingUTCOffsetSeconds) / (24 * 60 * 60) +} + +// fefoCandidates narrows the already healthy/model/region/concurrency-filtered +// pool to each provider's earliest billing day. Providers are grouped by family +// so a Qoder or Kimi account never has to compete with a WorkBuddy expiry, and +// the existing ID-cursor round-robin still distributes that day's requests. +// A provider with no usable dates keeps all of its accounts; inside a provider +// that has dated accounts, unknown-date accounts are fallback candidates that +// rejoin as soon as no dated account is available. +func fefoCandidates(available []Item, publicModel string, now time.Time) []Item { + if len(available) < 2 { + return available + } + minDay := make(map[string]int64, 4) + known := make(map[string]bool, 4) + for _, item := range available { + expiry, _ := fefoExpiry(item, publicModel, now) + if expiry <= 0 { + continue + } + family := accounts.NormalizeProviderFamily(item.Provider) + day := fefoCreditDay(expiry) + if !known[family] || day < minDay[family] { + minDay[family] = day + known[family] = true + } + } + if len(known) == 0 { + return available + } + out := make([]Item, 0, len(available)) + for _, item := range available { + family := accounts.NormalizeProviderFamily(item.Provider) + if !known[family] { + out = append(out, item) + continue + } + expiry, _ := fefoExpiry(item, publicModel, now) + if expiry <= 0 || fefoCreditDay(expiry) != minDay[family] { + continue + } + out = append(out, item) + } + if len(out) == 0 { + return available + } + return out +} + +// HasFEFOQuota reports whether a completed request could have consumed a +// trustworthy package balance. Runtime uses this gate to refresh only opt-in, +// supported routes; the historical strategies add no upstream traffic. +func (p *Pool) HasFEFOQuota(accountID, publicModel string) bool { + if p == nil || accountID == "" { + return false + } + p.mu.Lock() + defer p.mu.Unlock() + if p.routingStrategy != RoutingStrategyFEFO { + return false + } + for _, item := range p.items { + if item.ID != accountID { + continue + } + model := effectiveCreditModel(item, publicModel) + if model == "" || itemServesFreeModel(item, model) { + return false + } + _, _, tracked := fefoQuotaState(item, time.Now()) + return tracked + } + return false +} + +// FEFOQuotaDepleted reports whether an account routed by FEFO has a +// trustworthy package set with no live positive balance. A naturally expired +// cache looks exactly like this while its top-level Exceeded flag stays false. +// The runtime stale-quota sweep uses it to discover newly granted upstream +// packages; unknown scopes or dates never qualify. +func (p *Pool) FEFOQuotaDepleted(accountID string) bool { + if p == nil || accountID == "" { + return false + } + p.mu.Lock() + defer p.mu.Unlock() + if p.routingStrategy != RoutingStrategyFEFO { + return false + } + for _, item := range p.items { + if item.ID != accountID { + continue + } + _, depleted, tracked := fefoQuotaState(item, time.Now()) + return tracked && depleted + } + return false +} diff --git a/internal/executor/fefo_test.go b/internal/executor/fefo_test.go new file mode 100644 index 00000000..1f10cd93 --- /dev/null +++ b/internal/executor/fefo_test.go @@ -0,0 +1,324 @@ +package executor + +import ( + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +func fefoTime(days, hour int) int64 { + now := time.Now().In(time.FixedZone("billing", 8*60*60)) + return time.Date(now.Year(), now.Month(), now.Day()+days, hour, 0, 0, 0, now.Location()).Unix() +} + +func fefoPack(remain float64, expiry int64) accounts.QuotaPackage { + return accounts.QuotaPackage{ + Remain: remain, + Size: remain, + Unit: "credits", + Scope: accounts.QuotaPackageScopeAccountFEFO, + EndsAt: expiry, + } +} + +func fefoItem(id string, packages ...accounts.QuotaPackage) Item { + return Item{ + ID: id, + Provider: "workbuddy", + Region: "cn", + Models: []string{"paid", "free", "unknown"}, + FreeModels: []string{ + "free", + }, + Quota: &accounts.QuotaSnapshot{Total: 100, Remaining: 100, Unit: "credits", Packages: packages}, + } +} + +func fefoPool(items ...Item) *Pool { + p := NewPool(nil, nil) + p.SetRoutingStrategy(RoutingStrategyFEFO) + for _, item := range items { + p.Upsert(item) + } + return p +} + +func assertFEFOPick(t *testing.T, p *Pool, q RouteQuery, want string) { + t.Helper() + item, ok := p.PickRoute(q) + if !ok || item.ID != want { + t.Fatalf("pick = %q, %v; want %q", item.ID, ok, want) + } +} + +func TestFEFOSelectsEarliestLivePackageAndFollowsRefresh(t *testing.T) { + later := fefoItem("a", fefoPack(20, fefoTime(3, 12))) + earlier := fefoItem("z", + fefoPack(0, fefoTime(1, 12)), + fefoPack(100, time.Now().Add(-time.Hour).Unix()), + fefoPack(10, fefoTime(2, 12)), + ) + // A stale aggregate field must never outrank the live package list. + later.Quota.ExpiresAt = fefoTime(1, 12) + p := fefoPool(later, earlier) + for i := 0; i < 4; i++ { + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid"}, "z") + } + // A quota refresh changes the winner without replacing the pool. + p.MergeQuota("z", &QuotaSnapshot{Packages: []accounts.QuotaPackage{ + fefoPack(0, fefoTime(2, 12)), + fefoPack(20, fefoTime(4, 12)), + }}) + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid"}, "a") +} + +func TestFEFOSameBillingDayRotatesAndIgnoresWeights(t *testing.T) { + a := fefoItem("a", fefoPack(5, fefoTime(2, 1))) + b := fefoItem("b", fefoPack(20, fefoTime(2, 23))) + a.Weight, b.Weight = 99, 1 + p := fefoPool(a, b, fefoItem("later", fefoPack(100, fefoTime(3, 1)))) + for i := 0; i < 10; i++ { + want := "a" + if i%2 == 1 { + want = "b" + } + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid"}, want) + } +} + +func TestFEFOUnknownExpiryFallsBackWithoutInventingDates(t *testing.T) { + a := fefoItem("a", fefoPack(10, 0)) + b := fefoItem("b") + b.Quota.ExpiresAt = fefoTime(1, 12) + p := fefoPool(a, b) + for i := 0; i < 6; i++ { + want := "a" + if i%2 == 1 { + want = "b" + } + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid"}, want) + } + + // Inside one provider, a dated cohort outranks unknown dates, but unknown + // accounts rejoin once no dated account is available. + known := fefoItem("known", fefoPack(10, fefoTime(1, 12))) + unknown := fefoItem("unknown", fefoPack(10, 0)) + later := fefoItem("later", fefoPack(10, fefoTime(2, 12))) + p = fefoPool(known, unknown, later) + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid"}, "known") + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid", Excluded: map[string]struct{}{"known": {}}}, "later") + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid", Excluded: map[string]struct{}{"known": {}, "later": {}}}, "unknown") +} + +func TestFEFOCrossProviderIsolation(t *testing.T) { + q1 := fefoItem("q1") + q2 := fefoItem("q2") + q1.Provider, q2.Provider = "qoder", "qoder" + q1.Models, q2.Models = []string{"paid"}, []string{"paid"} + w1 := fefoItem("w1", fefoPack(10, fefoTime(1, 12))) + w2 := fefoItem("w2", fefoPack(10, fefoTime(2, 12))) + p := fefoPool(q1, q2, w1, w2) + // Qoder has no package dates, so it keeps rotating both accounts. WorkBuddy + // contributes only its nearest-expiry account; w2 must not inherit w1's day. + want := []string{"q1", "q2", "w1", "q1", "q2", "w1"} + for i, id := range want { + item, ok := p.PickRoute(RouteQuery{PublicModel: "paid"}) + if !ok || item.ID != id { + t.Fatalf("pick %d = %q, %v; want %q", i, item.ID, ok, id) + } + } + // A provider-scoped route is unaffected by another provider's dates. + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid", ProviderFilter: "qoder"}, "q1") + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid", ProviderFilter: "workbuddy"}, "w1") + + // Even when every provider has dates, the earliest WorkBuddy package must + // not suppress the earliest Qoder account: each family picks its own batch. + q1 = fefoItem("q1", fefoPack(10, fefoTime(10, 12))) + q2 = fefoItem("q2", fefoPack(10, fefoTime(20, 12))) + q1.Provider, q2.Provider = "qoder", "qoder" + q1.Models, q2.Models = []string{"paid"}, []string{"paid"} + w1 = fefoItem("w1", fefoPack(10, fefoTime(1, 12))) + w2 = fefoItem("w2", fefoPack(10, fefoTime(2, 12))) + p = fefoPool(q1, q2, w1, w2) + want = []string{"q1", "w1", "q1", "w1"} + for i, id := range want { + item, ok := p.PickRoute(RouteQuery{PublicModel: "paid"}) + if !ok || item.ID != id { + t.Fatalf("dated pick %d = %q, %v; want %q", i, item.ID, ok, id) + } + } +} + +func TestFEFODepletedExpiredAndFreeModels(t *testing.T) { + dead := fefoItem("a", fefoPack(0, fefoTime(1, 12)), fefoPack(50, time.Now().Add(-time.Minute).Unix())) + live := fefoItem("z", fefoPack(10, fefoTime(2, 12))) + p := fefoPool(dead, live) + q := RouteQuery{PublicModel: "paid"} + assertFEFOPick(t, p, q, "z") + if got := p.LenRoute(q); got != 1 { + t.Fatalf("LenRoute = %d, want 1", got) + } + if _, ok := p.QuotaBlockedForModel(q); !ok { + t.Fatal("expired trusted packages must report quota exhaustion, not model mismatch") + } + // A known-free model spends no credits and may still use the exhausted account. + assertFEFOPick(t, p, RouteQuery{PublicModel: "free"}, "a") + dead.Quota.Exceeded = true + p = fefoPool(dead, live) + assertFEFOPick(t, p, RouteQuery{PublicModel: "free"}, "a") + if _, ok := p.PickRoute(RouteQuery{PublicModel: "paid"}); ok { + item, _ := p.PickRoute(RouteQuery{PublicModel: "paid"}) + if item.ID == "a" { + t.Fatal("exceeded paid route selected the dead account") + } + } +} + +func TestFEFOUnknownScopeMixedBucketsAndAliasesStayUnknown(t *testing.T) { + for _, test := range []struct { + name string + edit func(*Item) + }{ + {"unknown scope", func(i *Item) { i.Quota.Packages[0].Scope = "" }}, + {"other scope", func(i *Item) { i.Quota.Packages[0].Scope = "work-only" }}, + {"non-credit unit", func(i *Item) { i.Quota.Packages[0].Unit = "tokens" }}, + {"mixed unknown date", func(i *Item) { i.Quota.Packages = append(i.Quota.Packages, fefoPack(10, 0)) }}, + {"additional add-on bucket", func(i *Item) { i.Quota.HasAddOn = true }}, + {"organization resource package", func(i *Item) { i.Quota.HasResourcePackage = true }}, + } { + t.Run(test.name, func(t *testing.T) { + a := fefoItem("a", fefoPack(10, fefoTime(1, 12))) + test.edit(&a) + p := fefoPool(a, fefoItem("z", fefoPack(20, fefoTime(2, 12)))) + // Unknown metadata never outranks a dated package; the account is a + // fallback candidate once the dated account is unavailable. + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid"}, "z") + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid", Excluded: map[string]struct{}{"z": {}}}, "a") + }) + } + + a := fefoItem("a", fefoPack(10, fefoTime(3, 12))) + z := fefoItem("z", fefoPack(10, fefoTime(1, 12))) + a.ModelAliases = map[string]string{"free-alias": "free", "paid-alias": "paid"} + z.ModelAliases = map[string]string{"free-alias": "free", "paid-alias": "paid"} + p := fefoPool(a, z) + assertFEFOPick(t, p, RouteQuery{PublicModel: "free-alias"}, "a") + assertFEFOPick(t, p, RouteQuery{PublicModel: "free-alias"}, "z") + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid-alias"}, "z") +} + +func TestFEFORespectsPinCooldownSaturationAndExclusion(t *testing.T) { + early := fefoItem("a", fefoPack(10, fefoTime(1, 12))) + late := fefoItem("z", fefoPack(10, fefoTime(2, 12))) + p := fefoPool(early, late) + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid", PreferAccount: "z"}, "z") + + early.DownUntil = time.Now().Add(time.Hour) + p = fefoPool(early, late) + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid"}, "z") + + // Once the cooldown expires, the earlier account returns to the front of + // its provider's ranking. + early.DownUntil = time.Now().Add(-time.Second) + p = fefoPool(early, late) + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid"}, "a") + + early.DownUntil = time.Time{} + early.MaxInFlight = 1 + p = fefoPool(early, late) + if !p.Acquire("a") { + t.Fatal("acquire") + } + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid"}, "z") + p.Release("a") + + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid", Excluded: map[string]struct{}{"a": {}}}, "z") + + early.Region = "global" + p = fefoPool(early, late) + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid", RegionFilter: "cn"}, "z") +} + +func TestFEFOLeavesHistoricalStrategiesUnchanged(t *testing.T) { + for _, strategy := range []string{RoutingStrategyRoundRobin, RoutingStrategyWeightedRoundRobin, RoutingStrategyFillFirst} { + t.Run(strategy, func(t *testing.T) { + a := fefoItem("a", fefoPack(0, fefoTime(-1, 12))) + z := fefoItem("z", fefoPack(20, fefoTime(2, 12))) + a.Weight, z.Weight = 90, 10 + p := fefoPool(a, z) + p.SetRoutingStrategy(strategy) + counts := map[string]int{} + for i := 0; i < 10; i++ { + item, ok := p.PickRoute(RouteQuery{PublicModel: "paid"}) + if !ok { + t.Fatal("historical strategy gate changed") + } + counts[item.ID]++ + } + want := 5 + if strategy == RoutingStrategyWeightedRoundRobin { + want = 9 + } + if strategy == RoutingStrategyFillFirst { + want = 10 + } + if counts["a"] != want { + t.Fatalf("counts=%v; want %d picks for a", counts, want) + } + }) + } +} + +func TestFEFOIgnoresSubscriptionAndTokenExpiry(t *testing.T) { + // The top-level quota timestamp is a subscription/reset boundary on + // providers such as Qoder, never a credit-package expiry. + q1 := fefoItem("q1") + q2 := fefoItem("q2") + q1.Provider, q2.Provider = "qoder", "qoder" + q1.Quota.ExpiresAt = fefoTime(1, 12) + q2.Quota.ExpiresAt = fefoTime(2, 12) + p := fefoPool(q1, q2) + for i := 0; i < 4; i++ { + want := "q1" + if i%2 == 1 { + want = "q2" + } + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid"}, want) + } + + // A dated package still outranks an account whose only timestamp is the + // aggregate field. + aggregateOnly := fefoItem("aggregate") + aggregateOnly.Quota.ExpiresAt = fefoTime(1, 12) + p = fefoPool(aggregateOnly, fefoItem("dated", fefoPack(10, fefoTime(2, 12)))) + assertFEFOPick(t, p, RouteQuery{PublicModel: "paid"}, "dated") +} + +func TestFEFOQuotaTrackingAndDepletion(t *testing.T) { + unknownDate := fefoItem("unknown-date", fefoPack(10, 0)) + if !fefoPool(unknownDate).HasFEFOQuota("unknown-date", "paid") { + t.Fatal("scoped packages with unknown dates still need post-use refresh") + } + unknownScope := fefoItem("unknown-scope", fefoPack(10, fefoTime(1, 12))) + unknownScope.Quota.Packages[0].Scope = "" + if fefoPool(unknownScope).HasFEFOQuota("unknown-scope", "paid") { + t.Fatal("unknown scope must not create extra quota traffic") + } + free := fefoItem("free", fefoPack(10, fefoTime(1, 12))) + if fefoPool(free).HasFEFOQuota("free", "free") { + t.Fatal("free models must not create FEFO quota traffic") + } + check := fefoPool(free) + check.SetRoutingStrategy(RoutingStrategyFillFirst) + if check.HasFEFOQuota("free", "paid") { + t.Fatal("other strategies must not create FEFO quota traffic") + } + expired := fefoItem("expired", fefoPack(100, fefoTime(-1, 12))) + if !fefoPool(expired).FEFOQuotaDepleted("expired") { + t.Fatal("expired trusted packages should be revalidated under FEFO") + } + if fefoPool(unknownDate).FEFOQuotaDepleted("unknown-date") { + t.Fatal("unknown dates must not be treated as depleted") + } +} diff --git a/internal/executor/ids.go b/internal/executor/ids.go index 68ea3ede..8219613f 100644 --- a/internal/executor/ids.go +++ b/internal/executor/ids.go @@ -24,6 +24,7 @@ const ( RoutingStrategyRoundRobin = accounts.RoutingStrategyRoundRobin RoutingStrategyWeightedRoundRobin = accounts.RoutingStrategyWeightedRoundRobin RoutingStrategyFillFirst = accounts.RoutingStrategyFillFirst + RoutingStrategyFEFO = accounts.RoutingStrategyFEFO ) func NormalizeRoutingStrategy(strategy string) string { diff --git a/internal/executor/pool.go b/internal/executor/pool.go index 5d0c7734..56d13b60 100644 --- a/internal/executor/pool.go +++ b/internal/executor/pool.go @@ -106,6 +106,9 @@ type RouteQuery struct { // protocol (for example native Responses input the chat form cannot // carry). Nil admits every item. Eligible func(Item) bool + // fefoNow is set only by a FEFO pool. Other strategies keep the historical + // quota gate, even when a cached package has since expired. + fefoNow time.Time } func itemRegion(item Item) string { @@ -324,7 +327,7 @@ func itemServesFreeModel(item Item, publicModel string) bool { } func routeBaseMatches(item Item, q RouteQuery) bool { - if item.Quota != nil && item.Quota.Exceeded && !itemServesFreeModel(item, q.PublicModel) { + if routeQuotaExceeded(item, q) { return false } return routeReadyAndScoped(item, q) @@ -360,7 +363,7 @@ func routeReadyAndScoped(item Item, q RouteQuery) bool { // that its quota is exceeded. Free-model accounts are never quota-blocked: // they spend no credits, so an exhausted account can still serve them. func routeBlockedByQuota(item Item, q RouteQuery) bool { - if item.Quota == nil || !item.Quota.Exceeded || itemServesFreeModel(item, q.PublicModel) { + if !routeQuotaExceeded(item, q) { return false } return routeReadyAndScoped(item, q) && itemCouldServeModel(item, q.PublicModel) @@ -489,6 +492,9 @@ func (p *Pool) LenRoute(q RouteQuery) int { } p.mu.Lock() defer p.mu.Unlock() + if p.routingStrategy == RoutingStrategyFEFO { + q.fefoNow = time.Now() + } count := 0 for _, item := range p.items { if routeMatches(item, q) { @@ -508,6 +514,9 @@ func (p *Pool) QuotaBlockedForModel(q RouteQuery) (Item, bool) { } p.mu.Lock() defer p.mu.Unlock() + if p.routingStrategy == RoutingStrategyFEFO { + q.fefoNow = time.Now() + } for _, item := range p.items { if routeBlockedByQuota(item, q) { return item, true @@ -553,6 +562,9 @@ func (p *Pool) PickRoute(q RouteQuery) (Item, bool) { p.mu.Lock() defer p.mu.Unlock() now := time.Now() + if p.routingStrategy == RoutingStrategyFEFO { + q.fefoNow = now + } eligible := make([]int, 0, len(p.items)) for i, item := range p.items { if routeMatches(item, q) { @@ -653,6 +665,9 @@ func (p *Pool) PickRoute(q RouteQuery) (Item, bool) { } else { p.lastRegion[key] = itemRegion(available[0]) } + if p.routingStrategy == RoutingStrategyFEFO { + available = fefoCandidates(available, q.PublicModel, now) + } if p.routingStrategy == RoutingStrategyFillFirst { picked := pickFillFirst(available) p.lastPicked[key] = picked.ID diff --git a/internal/gateway/fefo_quota_test.go b/internal/gateway/fefo_quota_test.go new file mode 100644 index 00000000..cf8f726a --- /dev/null +++ b/internal/gateway/fefo_quota_test.go @@ -0,0 +1,31 @@ +package gateway + +import ( + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/translate" +) + +func TestQuotaInvalidationRunsAfterTerminalResponseNotStreamHeaders(t *testing.T) { + var calls []string + h := &Handler{AfterAccountUse: func(id, model string) { calls = append(calls, id+":"+model) }} + finish := func(status, id, publicModel string) { + h.finishRequestLog("", time.Now(), translate.ChatRequest{Model: "paid"}, publicModel, id, "workbuddy", "", status, 0, nil, nil, 1, "") + } + finish(accounts.RequestStatusStarted, "synthetic", "paid") + finish(accounts.RequestStatusStreaming, "synthetic", "paid") + finish(accounts.RequestStatusOK, "", "paid") + if len(calls) != 0 { + t.Fatalf("invalidated before account use finished: %v", calls) + } + for _, status := range []string{accounts.RequestStatusOK, accounts.RequestStatusIncomplete, accounts.RequestStatusError, accounts.RequestStatusCanceled} { + finish(status, "synthetic", "paid") + } + finish(accounts.RequestStatusOK, "synthetic", "workbuddy-cn/paid") + h.finishRequestLog("", time.Now(), translate.ChatRequest{Model: "alias"}, "workbuddy/alias", "synthetic", "workbuddy", "", accounts.RequestStatusOK, 0, nil, nil, 1, "") + if len(calls) != 6 || calls[0] != "synthetic:paid" || calls[4] != "synthetic:paid" || calls[5] != "synthetic:alias" { + t.Fatalf("terminal response invalidations = %v", calls) + } +} diff --git a/internal/gateway/handler.go b/internal/gateway/handler.go index e3691b7f..ef90a514 100644 --- a/internal/gateway/handler.go +++ b/internal/gateway/handler.go @@ -26,6 +26,9 @@ type Handler struct { RequestedAccount func(*http.Request) string FilterModels func(*http.Request, []map[string]any) []map[string]any DecorateModels func(*http.Request, []map[string]any) []map[string]any + // AfterAccountUse is an optional non-blocking quota invalidation hook. It + // runs after the response/stream finishes, never on receipt of SSE headers. + AfterAccountUse func(accountID, publicModel string) } func (h *Handler) requestIdentity(r *http.Request) auth.Identity { diff --git a/internal/gateway/openai.go b/internal/gateway/openai.go index 463e397b..d8e430b8 100644 --- a/internal/gateway/openai.go +++ b/internal/gateway/openai.go @@ -169,6 +169,9 @@ func (h *Handler) HandleChatCompletions(w http.ResponseWriter, r *http.Request) } func (h *Handler) finishRequestLog(requestID string, started time.Time, req translate.ChatRequest, publicModel, accountID, provider, routing, status string, ttfb int, stats *StreamRelayStats, err error, attemptCount int, resolvedReasoning string) { + if accountID != "" && h.AfterAccountUse != nil && status != accounts.RequestStatusStarted && status != accounts.RequestStatusStreaming { + h.AfterAccountUse(accountID, firstNonEmpty(req.Model, publicModel)) + } if h.Recorder == nil || requestID == "" { return } diff --git a/internal/providers/interfaces.go b/internal/providers/interfaces.go index 9263361e..269f81a3 100644 --- a/internal/providers/interfaces.go +++ b/internal/providers/interfaces.go @@ -191,10 +191,12 @@ type QuotaWindow struct { // QuotaPackage is one upstream credit/resource pack with its own expiry. // EndsAt is a Unix second; EndTime is the provider-native wall-clock string. type QuotaPackage struct { - Remain float64 - Used float64 - Size float64 - Unit string + Remain float64 + Used float64 + Size float64 + Unit string + // Scope follows accounts.QuotaPackageScopeAccountFEFO; empty is unknown. + Scope string EndsAt int64 EndTime string } diff --git a/internal/providers/workbuddy/client.go b/internal/providers/workbuddy/client.go index 1cafea66..77cc95ab 100644 --- a/internal/providers/workbuddy/client.go +++ b/internal/providers/workbuddy/client.go @@ -1025,7 +1025,7 @@ func (c *Client) Keepalive(ctx context.Context, accountID string) error { // UserResource aggregates package remain/used/total from get-user-resource. // packages carries the per-pack expiry detail parsed from CycleEndTime. func (c *Client) UserResource(ctx context.Context, accountID string, credential Credential) (remain, used, total int64, packages []providers.QuotaPackage, err error) { - now := time.Now() + now := time.Now().In(cycleEndTimeZone) payload, err := json.Marshal(map[string]any{ "PageNumber": 1, "PageSize": 100, @@ -1064,7 +1064,16 @@ func (c *Client) UserResource(ctx context.Context, accountID string, credential return 0, 0, 0, nil, fmt.Errorf("user-resource code=%d msg=%s", env.Code, env.Msg) } remain, used, total = aggregateUserResource(env.Data.Response.Data.Accounts, env.Data.Response.Data.TotalDosage) - return remain, used, total, quotaPackages(env.Data.Response.Data.Accounts), nil + packages = quotaPackages(env.Data.Response.Data.Accounts) + // These packs are account-wide only for a personal identity. Enterprise + // resources may belong to a shared pool or an unselected payer, and a full + // page may hide additional packs; either case leaves FEFO scope unknown. + if credential.EnterpriseID != "" || len(env.Data.Response.Data.Accounts) >= 100 { + for i := range packages { + packages[i].Scope = "" + } + } + return remain, used, total, packages, nil } type resourcePackage struct { @@ -1083,6 +1092,10 @@ var cycleEndTimeZone = time.FixedZone("UTC+8", 8*60*60) // quotaPackages converts raw packs into per-pack expiry detail for the // console. A pack with no parseable CycleEndTime keeps EndsAt zero. +// +// The request above filters ProductCode=p_tcaca and live statuses, so every +// returned pack is a personal credit pack. The scope declaration is cleared by +// UserResource for enterprise identities and incomplete pages. func quotaPackages(packages []resourcePackage) []providers.QuotaPackage { out := make([]providers.QuotaPackage, 0, len(packages)) for _, pkg := range packages { @@ -1092,6 +1105,7 @@ func quotaPackages(packages []resourcePackage) []providers.QuotaPackage { Used: float64(used), Size: float64(size), Unit: "credits", + Scope: accounts.QuotaPackageScopeAccountFEFO, } if trimmed := strings.TrimSpace(pkg.CycleEndTime); trimmed != "" { if parsed, err := time.ParseInLocation("2006-01-02 15:04:05", trimmed, cycleEndTimeZone); err == nil { @@ -1104,11 +1118,17 @@ func quotaPackages(packages []resourcePackage) []providers.QuotaPackage { return out } -// soonestExpiry returns the earliest non-zero pack expiry and the remaining -// amount that expires at that time. +// soonestExpiry returns the earliest future expiry of a positive balance and +// the remaining amount that expires at that time. Depleted and already-expired +// packages must not keep advertising a stale date after the cached snapshot has +// outlived the package. func soonestExpiry(packages []providers.QuotaPackage) (expiresAt int64, expiringRemain float64) { + return soonestExpiryAt(packages, time.Now().Unix()) +} + +func soonestExpiryAt(packages []providers.QuotaPackage, nowUnix int64) (expiresAt int64, expiringRemain float64) { for _, pkg := range packages { - if pkg.EndsAt <= 0 { + if pkg.EndsAt <= 0 || pkg.EndsAt <= nowUnix || !(pkg.Remain > 0) { continue } if expiresAt == 0 || pkg.EndsAt < expiresAt { diff --git a/internal/providers/workbuddy/client_test.go b/internal/providers/workbuddy/client_test.go index d3e5b0ac..78364b47 100644 --- a/internal/providers/workbuddy/client_test.go +++ b/internal/providers/workbuddy/client_test.go @@ -1568,8 +1568,8 @@ func TestUserResourcePackageExpiry(t *testing.T) { "Response": map[string]any{ "Data": map[string]any{ "Accounts": []map[string]any{ - {"CycleCapacitySize": 2000, "CycleCapacityRemain": 1200, "CycleCapacityUsed": 800, "CycleEndTime": "2026-12-31 23:59:59"}, - {"CycleCapacitySize": 500, "CycleCapacityRemain": 300, "CycleCapacityUsed": 200, "CycleEndTime": "2026-10-01 00:00:00"}, + {"CycleCapacitySize": 2000, "CycleCapacityRemain": 1200, "CycleCapacityUsed": 800, "CycleEndTime": "2027-12-31 23:59:59"}, + {"CycleCapacitySize": 500, "CycleCapacityRemain": 300, "CycleCapacityUsed": 200, "CycleEndTime": "2027-10-01 00:00:00"}, {"CycleCapacitySize": 100, "CycleCapacityRemain": 100, "CycleCapacityUsed": 0}, }, }, @@ -1588,32 +1588,134 @@ func TestUserResourcePackageExpiry(t *testing.T) { if len(info.Packages) != 3 { t.Fatalf("packages=%+v", info.Packages) } - // UTC+8 2026-10-01 00:00:00 = UTC 2026-09-30 16:00:00 - want := time.Date(2026, 9, 30, 16, 0, 0, 0, time.UTC).Unix() + // UTC+8 2027-10-01 00:00:00 = UTC 2027-09-30 16:00:00 + want := time.Date(2027, 9, 30, 16, 0, 0, 0, time.UTC).Unix() if info.ExpiresAt != want { t.Fatalf("expires_at=%d want %d", info.ExpiresAt, want) } if info.ExpiringRemain != 300 { t.Fatalf("expiring_remain=%v want 300", info.ExpiringRemain) } - if info.Packages[1].EndsAt != want || info.Packages[1].EndTime != "2026-10-01 00:00:00" { + if info.Packages[1].EndsAt != want || info.Packages[1].EndTime != "2027-10-01 00:00:00" { t.Fatalf("pkg=%+v", info.Packages[1]) } + if info.Packages[0].Scope != accounts.QuotaPackageScopeAccountFEFO { + t.Fatalf("personal package scope = %q", info.Packages[0].Scope) + } if info.Packages[2].EndsAt != 0 { t.Fatalf("unexpired pkg ends_at=%d want 0", info.Packages[2].EndsAt) } } -func TestSoonestExpiry(t *testing.T) { - expiresAt, remain := soonestExpiry([]providers.QuotaPackage{ - {Remain: 100, EndsAt: 200}, - {Remain: 50, EndsAt: 200}, +func TestUserResourceQueryUsesBillingTimezone(t *testing.T) { + // The API expects UTC+8 wall-clock bounds. A host in another zone must not + // shift the query window and hide a package expiring today. + previous := time.Local + time.Local = time.FixedZone("fixture-UTC-7", -7*60*60) + t.Cleanup(func() { time.Local = previous }) + before := time.Now() + client, _ := newTestClient(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var payload struct { + Begin string `json:"PackageEndTimeRangeBegin"` + End string `json:"PackageEndTimeRangeEnd"` + } + if err := json.NewDecoder(r.Body).Decode(&payload); err != nil { + t.Error(err) + w.WriteHeader(http.StatusBadRequest) + return + } + begin, err := time.ParseInLocation("2006-01-02 15:04:05", payload.Begin, cycleEndTimeZone) + if err != nil { + t.Error(err) + } + end, err := time.ParseInLocation("2006-01-02 15:04:05", payload.End, cycleEndTimeZone) + if err != nil { + t.Error(err) + } + if begin.Before(before.Add(-time.Minute)) || begin.After(time.Now().Add(time.Minute)) { + t.Errorf("query begin=%s outside current instant range; host timezone leaked", begin) + } + if end.Sub(begin) != 365*101*24*time.Hour { + t.Errorf("query range=%s", end.Sub(begin)) + } + _, _ = w.Write([]byte(`{"code":0,"data":{"Response":{"Data":{"Accounts":[]}}}}`)) + })) + if _, _, _, _, err := client.UserResource(context.Background(), "fixture-account", Credential{UID: "fixture-user", AccessToken: "fixture-token"}); err != nil { + t.Fatal(err) + } +} + +func TestSoonestExpirySkipsDepletedExpiredAndUndated(t *testing.T) { + now := time.Now().Unix() + expiresAt, remain := soonestExpiryAt([]providers.QuotaPackage{ + {Remain: 100, EndsAt: now + 200}, + {Remain: 50, EndsAt: now + 200}, {Remain: 300, EndsAt: 0}, - {Remain: 400, EndsAt: 100}, - }) - if expiresAt != 100 || remain != 400 { + {Remain: 0, EndsAt: now + 100}, + {Remain: 400, EndsAt: now - 100}, + {Remain: 400, EndsAt: now + 100}, + }, now) + if expiresAt != now+100 || remain != 400 { t.Fatalf("expiresAt=%d remain=%v", expiresAt, remain) } + if got, left := soonestExpiryAt([]providers.QuotaPackage{{Remain: 10, EndsAt: now - 1}}, now); got != 0 || left != 0 { + t.Fatalf("expired-only summary = %d/%v", got, left) + } +} + +func TestUserResourcePackageScopeClearedForEnterpriseAndIncompletePage(t *testing.T) { + pack := func() map[string]any { + return map[string]any{ + "CycleCapacitySize": 100, "CycleCapacityRemain": 100, + "CycleCapacityUsed": 0, "CycleEndTime": "2027-12-31 23:59:59", + } + } + for _, test := range []struct { + name string + credential Credential + accounts []map[string]any + }{ + { + name: "enterprise identity", + credential: Credential{AccessToken: "at", RefreshToken: "rt", ExpiresAt: 4102444800, Domain: DomainCN, UID: "u1", EnterpriseID: "ent-1"}, + accounts: []map[string]any{pack()}, + }, + { + name: "full page", + credential: Credential{AccessToken: "at", RefreshToken: "rt", ExpiresAt: 4102444800, Domain: DomainCN, UID: "u1"}, + accounts: func() []map[string]any { + out := make([]map[string]any, 100) + for i := range out { + out[i] = pack() + } + return out + }(), + }, + } { + t.Run(test.name, func(t *testing.T) { + client, store := newTestClient(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + _ = json.NewEncoder(w).Encode(map[string]any{ + "code": 0, + "data": map[string]any{"Response": map[string]any{"Data": map[string]any{"Accounts": test.accounts}}}, + }) + })) + payload, _ := json.Marshal(test.credential) + _ = store.SaveCredentialPayload(context.Background(), "acc1", CredentialFormat, payload) + info, err := client.Quota(context.Background(), "acc1") + if err != nil { + t.Fatal(err) + } + if len(info.Packages) != len(test.accounts) { + t.Fatalf("packages=%d want %d", len(info.Packages), len(test.accounts)) + } + for _, pkg := range info.Packages { + if pkg.Scope != "" { + t.Fatalf("incomplete/shared package kept FEFO scope: %+v", pkg) + } + } + }) + } } func TestDailyCheckinSuccess(t *testing.T) { diff --git a/internal/runtime/manager.go b/internal/runtime/manager.go index afbabb23..548fa629 100644 --- a/internal/runtime/manager.go +++ b/internal/runtime/manager.go @@ -131,6 +131,21 @@ type Manager struct { quotaProbeMu sync.Mutex quotaProbeLevels map[string]int + // FEFO completion refreshes coalesce per account. A completion during an + // in-flight fetch marks it dirty for one further fetch, not another + // goroutine. Guarded by mu; Close cancels and waits before the backing + // store is closed. + quotaAfterUse map[string]bool + quotaAfterUseDone sync.WaitGroup + + // All provider quota fetches for one account share a gate so an older, + // slow request cannot persist after a newer one (boot/manual/check-in, + // maintenance sweep, and FEFO after-use all pass through + // fetchProviderQuota). Guarded by quotaFetchMu; gates are reference-counted + // and removed when idle. + quotaFetchMu sync.Mutex + quotaFetchGates map[string]*quotaFetchGate + // healthFailures counts consecutive liveness probe failures per worker // account. The maintenance loop's workerLiveness watchdog increments it on // each failed /health probe and clears it on success; reaching @@ -485,6 +500,7 @@ func (m *Manager) Close() error { m.cancel() m.mu.Unlock() m.recoverDone.Wait() + m.quotaAfterUseDone.Wait() m.mu.Lock() processes := make([]ManagedProcess, 0, len(m.processes)) for _, process := range m.processes { diff --git a/internal/runtime/manager_fefo.go b/internal/runtime/manager_fefo.go new file mode 100644 index 00000000..76739692 --- /dev/null +++ b/internal/runtime/manager_fefo.go @@ -0,0 +1,51 @@ +package runtime + +import ( + "context" + "time" +) + +// RefreshFEFOQuotaAfterUse invalidates a trusted credit balance after the whole +// response (including an SSE body) finishes. It never waits on upstream quota in +// the request path. Concurrent completions share one fetch; a completion during +// that fetch requests one trailing fetch so its consumption is not lost. +func (m *Manager) RefreshFEFOQuotaAfterUse(accountID, publicModel string) { + if m == nil || m.pool == nil || m.runCtx == nil || !m.pool.HasFEFOQuota(accountID, publicModel) { + return + } + m.mu.Lock() + if m.runCtx.Err() != nil { + m.mu.Unlock() + return + } + if m.quotaAfterUse == nil { + m.quotaAfterUse = map[string]bool{} + } + if _, running := m.quotaAfterUse[accountID]; running { + m.quotaAfterUse[accountID] = true + m.mu.Unlock() + return + } + m.quotaAfterUse[accountID] = false + m.quotaAfterUseDone.Add(1) + m.mu.Unlock() + + go func() { + defer m.quotaAfterUseDone.Done() + for { + if item, ok := m.pool.ByID(accountID); ok && m.pool.HasFEFOQuota(accountID, publicModel) { + ctx, cancel := context.WithTimeout(m.runCtx, 10*time.Second) + m.refreshQuotaOnly(ctx, item) + cancel() + } + m.mu.Lock() + if !m.quotaAfterUse[accountID] || m.runCtx.Err() != nil { + delete(m.quotaAfterUse, accountID) + m.mu.Unlock() + return + } + m.quotaAfterUse[accountID] = false + m.mu.Unlock() + } + }() +} diff --git a/internal/runtime/manager_fefo_test.go b/internal/runtime/manager_fefo_test.go new file mode 100644 index 00000000..70089412 --- /dev/null +++ b/internal/runtime/manager_fefo_test.go @@ -0,0 +1,300 @@ +package runtime + +import ( + "context" + "path/filepath" + "sync/atomic" + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/executor" + "github.com/caigee-cmd/cli2api/internal/providers" + sqlstore "github.com/caigee-cmd/cli2api/internal/store" +) + +type fefoRefreshProber struct { + calls atomic.Int32 + started chan int32 + release chan struct{} +} + +func (p *fefoRefreshProber) Probe(context.Context, string) (providers.AccountHealth, error) { + return providers.AccountHealth{Ready: true}, nil +} + +func (p *fefoRefreshProber) Quota(ctx context.Context, _ string) (*providers.QuotaInfo, error) { + n := p.calls.Add(1) + p.started <- n + select { + case <-p.release: + case <-ctx.Done(): + return nil, ctx.Err() + } + return &providers.QuotaInfo{ + ProviderID: "workbuddy", Total: 100, Used: 100, Exceeded: true, + FetchedAt: time.Now().UTC().Format(time.RFC3339Nano), + Packages: []providers.QuotaPackage{{Size: 100, Used: 100, Unit: "credits", Scope: accounts.QuotaPackageScopeAccountFEFO, EndsAt: time.Now().Add(time.Hour).Unix()}}, + }, nil +} + +func newFEFORefreshFixture(t *testing.T) (*Manager, string, *fefoRefreshProber) { + t.Helper() + store, err := sqlstore.OpenStore(filepath.Join(t.TempDir(), "after-use.db")) + if err != nil { + t.Fatal(err) + } + m := NewManager(ManagerConfig{}, store, nil) + t.Cleanup(func() { _ = m.Close(); _ = store.Close() }) + account, err := store.Create(context.Background(), accounts.CreateAccount{Name: "synthetic-after-use", Provider: "workbuddy", Region: "cn"}) + if err != nil { + t.Fatal(err) + } + m.pool.SetRoutingStrategy(accounts.RoutingStrategyFEFO) + m.pool.Upsert(Item{ + ID: account.ID, Provider: "workbuddy", Region: "cn", Models: []string{"paid", "free"}, FreeModels: []string{"free"}, + Quota: &accounts.QuotaSnapshot{Remaining: 10, Total: 100, Packages: []accounts.QuotaPackage{{ + Remain: 10, Size: 100, Unit: "credits", Scope: accounts.QuotaPackageScopeAccountFEFO, EndsAt: time.Now().Add(time.Hour).Unix(), + }}}, + }) + p := &fefoRefreshProber{started: make(chan int32, 10), release: make(chan struct{}, 10)} + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "workbuddy", Prober: p}) + m.SetProviders(registry) + return m, account.ID, p +} + +func awaitFEFORefresh(t *testing.T, p *fefoRefreshProber, want int32) { + t.Helper() + select { + case got := <-p.started: + if got != want { + t.Fatalf("refresh number = %d, want %d", got, want) + } + case <-time.After(2 * time.Second): + t.Fatal("quota refresh did not start") + } +} + +func TestFEFOCompletionRefreshCoalescesAndReorders(t *testing.T) { + m, id, p := newFEFORefreshFixture(t) + m.pool.Upsert(Item{ + ID: "later", Provider: "workbuddy", Region: "cn", Models: []string{"paid"}, + Quota: &accounts.QuotaSnapshot{Remaining: 10, Packages: []accounts.QuotaPackage{{ + Remain: 10, Unit: "credits", Scope: accounts.QuotaPackageScopeAccountFEFO, EndsAt: time.Now().Add(48 * time.Hour).Unix(), + }}}, + }) + m.RefreshFEFOQuotaAfterUse(id, "paid") + awaitFEFORefresh(t, p, 1) + for i := 0; i < 100; i++ { + m.RefreshFEFOQuotaAfterUse(id, "paid") + } + p.release <- struct{}{} + awaitFEFORefresh(t, p, 2) + p.release <- struct{}{} + m.quotaAfterUseDone.Wait() + if got := p.calls.Load(); got != 2 { + t.Fatalf("concurrent invalidations made %d requests, want 2", got) + } + item, ok := m.pool.PickRoute(executor.RouteQuery{PublicModel: "paid"}) + if !ok || item.ID != "later" { + t.Fatalf("spent package remains preferred: %q, %v", item.ID, ok) + } + stored, err := m.store.Get(context.Background(), id) + if err != nil || stored.Quota == nil || !stored.Quota.Exceeded { + t.Fatalf("new quota not persisted: %v, %+v", err, stored.Quota) + } +} + +func TestFEFOCompletionRefreshSkipsHistoricalStrategiesAndFreeRoutes(t *testing.T) { + m, id, p := newFEFORefreshFixture(t) + for _, strategy := range []string{accounts.RoutingStrategyRoundRobin, accounts.RoutingStrategyWeightedRoundRobin, accounts.RoutingStrategyFillFirst} { + m.pool.SetRoutingStrategy(strategy) + m.RefreshFEFOQuotaAfterUse(id, "paid") + } + m.pool.SetRoutingStrategy(accounts.RoutingStrategyFEFO) + m.RefreshFEFOQuotaAfterUse(id, "free") + m.RefreshFEFOQuotaAfterUse("missing", "paid") + m.quotaAfterUseDone.Wait() + if p.calls.Load() != 0 { + t.Fatal("unsupported route created extra quota traffic") + } +} + +func TestFEFOCompletionRefreshStopsOnClose(t *testing.T) { + m, id, p := newFEFORefreshFixture(t) + m.RefreshFEFOQuotaAfterUse(id, "paid") + awaitFEFORefresh(t, p, 1) + done := make(chan struct{}) + go func() { + _ = m.Close() + close(done) + }() + select { + case <-done: + case <-time.After(2 * time.Second): + t.Fatal("Close did not cancel the pending quota fetch") + } + m.RefreshFEFOQuotaAfterUse(id, "paid") + if p.calls.Load() != 1 { + t.Fatal("closed manager started another quota fetch") + } +} + +type orderedQuotaProber struct { + started chan int + release chan struct{} + calls atomic.Int32 +} + +func (p *orderedQuotaProber) Probe(context.Context, string) (providers.AccountHealth, error) { + return providers.AccountHealth{Ready: true}, nil +} + +func (p *orderedQuotaProber) Quota(ctx context.Context, _ string) (*providers.QuotaInfo, error) { + n := p.calls.Add(1) + p.started <- int(n) + if n == 1 { + select { + case <-p.release: + case <-ctx.Done(): + return nil, ctx.Err() + } + } + remain := 10.0 + exceeded := false + if n > 1 { + remain = 0 + exceeded = true + } + return &providers.QuotaInfo{ + ProviderID: "workbuddy", Total: 100, Remaining: remain, Used: 100 - remain, Exceeded: exceeded, + FetchedAt: time.Now().UTC().Format(time.RFC3339Nano), + Packages: []providers.QuotaPackage{{Remain: remain, Size: 100, Unit: "credits", Scope: accounts.QuotaPackageScopeAccountFEFO, EndsAt: time.Now().Add(time.Hour).Unix()}}, + }, nil +} + +// A slow ordinary refresh must not persist an old positive snapshot after the +// post-use refresh has already discovered the spent balance. +func TestQuotaFetchGateSerializesOrdinaryAndAfterUseRefreshes(t *testing.T) { + m, id, _ := newFEFORefreshFixture(t) + p := &orderedQuotaProber{started: make(chan int, 10), release: make(chan struct{})} + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "workbuddy", Prober: p}) + m.SetProviders(registry) + go func() { + item, _ := m.pool.ByID(id) + m.refreshQuotaOnly(context.Background(), item) + }() + if got := <-p.started; got != 1 { + t.Fatalf("first start = %d", got) + } + m.RefreshFEFOQuotaAfterUse(id, "paid") + close(p.release) + select { + case got := <-p.started: + if got != 2 { + t.Fatalf("second start = %d", got) + } + case <-time.After(2 * time.Second): + t.Fatal("after-use refresh did not wait for the in-flight ordinary refresh") + } + m.quotaAfterUseDone.Wait() + item, _ := m.pool.ByID(id) + if item.Quota == nil || !item.Quota.Exceeded { + t.Fatalf("stale positive snapshot overwrote the newer depleted one: %+v", item.Quota) + } +} + +// An account whose trusted packages expired naturally has Exceeded=false but is +// invisible to FEFO. The stale sweep must still probe it so a new upstream +// package can restore routing, with the normal backoff. +func TestFEFOExpiredTrustedPackagesEnterStaleRevalidation(t *testing.T) { + m, id, _ := newFEFORefreshFixture(t) + expired := &accounts.QuotaSnapshot{ + Used: 100, Total: 100, Remaining: 100, Exceeded: false, + FetchedAt: time.Now().Add(-2 * time.Hour).UTC().Format(time.RFC3339), + Packages: []accounts.QuotaPackage{{Remain: 100, Size: 100, Unit: "credits", Scope: accounts.QuotaPackageScopeAccountFEFO, EndsAt: time.Now().Add(-time.Minute).Unix()}}, + } + m.pool.MergeQuota(id, expired) + item, _ := m.pool.ByID(id) + if !m.quotaNeedsRevalidationFor(item, time.Now()) { + t.Fatal("exceeded=false expired trusted packages must be revalidated") + } + m.pool.SetRoutingStrategy(accounts.RoutingStrategyRoundRobin) + if m.quotaNeedsRevalidationFor(item, time.Now()) { + t.Fatal("stale revalidation must not add traffic outside FEFO") + } + m.pool.SetRoutingStrategy(accounts.RoutingStrategyFEFO) + m.pool.MergeQuota(id, &accounts.QuotaSnapshot{Exceeded: false, Packages: []accounts.QuotaPackage{{Remain: 100, Scope: "unknown", EndsAt: time.Now().Add(-time.Minute).Unix()}}}) + item, _ = m.pool.ByID(id) + if m.quotaNeedsRevalidationFor(item, time.Now()) { + t.Fatal("unknown scope must never be treated as depleted") + } + m.pool.MergeQuota(id, &accounts.QuotaSnapshot{Exceeded: false, Packages: []accounts.QuotaPackage{{Remain: 100, Scope: accounts.QuotaPackageScopeAccountFEFO, EndsAt: 0}}}) + item, _ = m.pool.ByID(id) + if m.quotaNeedsRevalidationFor(item, time.Now()) { + t.Fatal("unknown expiry must never be treated as depleted") + } +} + +type fefoQuotaFixture struct{ info *providers.QuotaInfo } + +func (f fefoQuotaFixture) Probe(context.Context, string) (providers.AccountHealth, error) { + return providers.AccountHealth{Ready: true}, nil +} + +func (f fefoQuotaFixture) Quota(context.Context, string) (*providers.QuotaInfo, error) { + return f.info, nil +} + +func TestFetchProviderQuotaPreservesPackageScopeOnlyForWorkBuddy(t *testing.T) { + ctx := context.Background() + store, err := sqlstore.OpenStore(filepath.Join(t.TempDir(), "quota-fixture.db")) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = store.Close() }) + account, err := store.Create(ctx, accounts.CreateAccount{Name: "scope-fixture", Provider: "workbuddy", Region: "cn"}) + if err != nil { + t.Fatal(err) + } + manager := &Manager{pool: NewPool(nil, nil), store: store} + manager.pool.Upsert(Item{ID: account.ID, Provider: "workbuddy", Runtime: "in_process"}) + for _, providerID := range []string{"workbuddy", "trae", ""} { + t.Run(providerID, func(t *testing.T) { + info := &providers.QuotaInfo{ + ProviderID: providerID, Remaining: 10, Total: 10, FetchedAt: "2026-10-24T00:00:00Z", + ExpiresAt: 1792857600, ExpiringRemain: 10, + Packages: []providers.QuotaPackage{ + {Remain: 10, Size: 10, Scope: accounts.QuotaPackageScopeAccountFEFO, EndsAt: 1792857600, EndTime: "2026-10-25 00:00:00"}, + {Remain: 5, Size: 5, Unit: "credits", Scope: "work-only"}, + {Remain: 5, Size: 5}, + }, + } + manager.fetchProviderQuota(ctx, account.ID, fefoQuotaFixture{info: info}) + item, _ := manager.pool.ByID(account.ID) + stored, err := store.Get(ctx, account.ID) + if err != nil { + t.Fatal(err) + } + for _, quota := range []*accounts.QuotaSnapshot{item.Quota, stored.Quota} { + if quota == nil { + t.Fatal("missing quota snapshot") + } + if providerID != "workbuddy" { + if len(quota.Packages) != 0 || quota.ExpiresAt != 0 || quota.ExpiringRemain != 0 { + t.Fatalf("non-WorkBuddy package metadata leaked through gate: %+v", quota) + } + continue + } + if len(quota.Packages) != 3 || quota.Packages[0].Scope != accounts.QuotaPackageScopeAccountFEFO || + quota.Packages[1].Scope != "work-only" || quota.Packages[2].Scope != "" || + quota.Packages[0].Unit != "credits" || quota.Packages[0].EndTime != "2026-10-25 00:00:00" || + quota.ExpiresAt != info.ExpiresAt || quota.ExpiringRemain != 10 { + t.Fatalf("package facts were not preserved: %+v", quota) + } + } + }) + } +} diff --git a/internal/runtime/manager_maintenance.go b/internal/runtime/manager_maintenance.go index a94ac155..be52a45d 100644 --- a/internal/runtime/manager_maintenance.go +++ b/internal/runtime/manager_maintenance.go @@ -476,6 +476,17 @@ func quotaNeedsRevalidation(item Item, now time.Time) bool { !item.DownUntil.IsZero() && now.Before(item.DownUntil) } +// quotaNeedsRevalidationFor adds the FEFO-only case: a trustworthy package set +// whose live balance is empty is invisible to routing while its top-level +// Exceeded flag stays false. Without this probe, a newly granted package would +// never re-enter the pool. Unknown scopes or dates never trigger the probe. +func (manager *Manager) quotaNeedsRevalidationFor(item Item, now time.Time) bool { + if quotaNeedsRevalidation(item, now) { + return true + } + return manager != nil && manager.pool != nil && manager.pool.FEFOQuotaDepleted(item.ID) +} + // refreshStaleQuota re-fetches quota for accounts whose cached snapshot still // reports Exceeded. A snapshot can go stale when upstream credits are // replenished out-of-band (billing reset, add-on purchase) or when a flaky @@ -503,7 +514,7 @@ func (manager *Manager) refreshStaleQuota(ctx context.Context) { if item.RuntimeState == "dead" { continue } - if !quotaNeedsRevalidation(item, now) { + if !manager.quotaNeedsRevalidationFor(item, now) { // Recovered (or never exhausted): the next exhaustion is a new // episode and starts from the 5-minute probes again. manager.resetQuotaProbeLevel(item.ID) @@ -527,7 +538,7 @@ func (manager *Manager) refreshStaleQuota(ctx context.Context) { // Probe failed (upstream/network). Keep the level so the next // sweep retries at the same cadence instead of escalating a // transient outage into an hours-long wait. - case updated.Quota.Exceeded: + case updated.Quota.Exceeded || manager.pool.FEFOQuotaDepleted(item.ID): manager.bumpQuotaProbeLevel(item.ID) default: manager.resetQuotaProbeLevel(item.ID) diff --git a/internal/runtime/manager_quota.go b/internal/runtime/manager_quota.go index 5e06a20f..bac81f61 100644 --- a/internal/runtime/manager_quota.go +++ b/internal/runtime/manager_quota.go @@ -27,6 +27,11 @@ func (m *Manager) fetchProviderQuota(ctx context.Context, accountID string, prob if prober == nil { return } + release, ok := m.acquireQuotaFetch(ctx, accountID) + if !ok { + return + } + defer release() info, err := prober.Quota(ctx, accountID) if err != nil || info == nil || !quotaInfoHasWindows(info) { // An empty snapshot is "not fetched yet", not a zero balance. Saving it @@ -110,6 +115,7 @@ func quotaPackagesFromInfo(packages []providers.QuotaPackage) []accounts.QuotaPa Used: pkg.Used, Size: pkg.Size, Unit: unit, + Scope: pkg.Scope, EndsAt: pkg.EndsAt, EndTime: pkg.EndTime, }) diff --git a/internal/runtime/manager_quota_gate.go b/internal/runtime/manager_quota_gate.go new file mode 100644 index 00000000..e3a95c00 --- /dev/null +++ b/internal/runtime/manager_quota_gate.go @@ -0,0 +1,58 @@ +package runtime + +import ( + "context" + "sync" +) + +// quotaFetchGate serializes quota samples for one account. Every entry point +// (boot probe, manual/console refresh, maintenance sweep, check-in, and the +// FEFO after-use refresher) funnels through fetchProviderQuota, so an older +// sample that started first cannot be persisted after a newer one. +type quotaFetchGate struct { + ch chan struct{} + // refs counts the holder plus all waiters. The map entry is dropped when + // the last participant leaves, keeping the table bounded by active probes. + refs int +} + +// acquireQuotaFetch blocks until this account's gate is free or ctx ends. +// The returned release must be called exactly once after the fetch completes. +func (m *Manager) acquireQuotaFetch(ctx context.Context, accountID string) (func(), bool) { + m.quotaFetchMu.Lock() + if m.quotaFetchGates == nil { + m.quotaFetchGates = make(map[string]*quotaFetchGate) + } + gate := m.quotaFetchGates[accountID] + if gate == nil { + gate = "aFetchGate{ch: make(chan struct{}, 1)} + m.quotaFetchGates[accountID] = gate + } + gate.refs++ + m.quotaFetchMu.Unlock() + + select { + case gate.ch <- struct{}{}: + var once sync.Once + return func() { + once.Do(func() { + <-gate.ch + m.releaseQuotaFetchRef(accountID, gate) + }) + }, true + case <-ctx.Done(): + m.releaseQuotaFetchRef(accountID, gate) + return func() {}, false + } +} + +func (m *Manager) releaseQuotaFetchRef(accountID string, gate *quotaFetchGate) { + m.quotaFetchMu.Lock() + gate.refs-- + if gate.refs == 0 { + if current, ok := m.quotaFetchGates[accountID]; ok && current == gate { + delete(m.quotaFetchGates, accountID) + } + } + m.quotaFetchMu.Unlock() +} diff --git a/internal/webui/static/assets/AreaChart-BqFAEkTX.js b/internal/webui/static/assets/AreaChart-BqFAEkTX.js new file mode 100644 index 00000000..64de2138 --- /dev/null +++ b/internal/webui/static/assets/AreaChart-BqFAEkTX.js @@ -0,0 +1,5 @@ +<<<<<<<< HEAD:internal/webui/static/assets/AreaChart-Cm1PLzri.js +import{f as e,h as t}from"./index--8Ifgwr4.js";import{L as n,t as r}from"./CartesianChart-BtPJbdpG.js";var i=t(e()),a=[`axis`],o=(0,i.forwardRef)((e,t)=>i.createElement(r,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:a,tooltipPayloadSearcher:n,categoricalChartProps:e,ref:t}));export{o as t}; +======== +import{f as e,h as t}from"./index-CucRSUHh.js";import{L as n,t as r}from"./CartesianChart-Dc6HOANc.js";var i=t(e()),a=[`axis`],o=(0,i.forwardRef)((e,t)=>i.createElement(r,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:a,tooltipPayloadSearcher:n,categoricalChartProps:e,ref:t}));export{o as t}; +>>>>>>>> 85fe552 (feat(routing): add same-provider credit-expiry-first scheduling):internal/webui/static/assets/AreaChart-BqFAEkTX.js diff --git a/internal/webui/static/assets/CartesianChart-Dc6HOANc.js b/internal/webui/static/assets/CartesianChart-Dc6HOANc.js new file mode 100644 index 00000000..98794e26 --- /dev/null +++ b/internal/webui/static/assets/CartesianChart-Dc6HOANc.js @@ -0,0 +1,25 @@ +<<<<<<<< HEAD:internal/webui/static/assets/CartesianChart-BtPJbdpG.js +import{c as e,d as t,f as n,h as r,m as i,p as a,u as o}from"./index--8Ifgwr4.js";var s=r(n()),c=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function l(e){return typeof e==`string`&&c.includes(e)}var u=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function d(e){return typeof e==`string`&&u.has(e)}function f(e){return typeof e==`string`&&e.startsWith(`data-`)}function p(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(d(n)||f(n))&&(t[n]=e[n]);return t}function m(e){if(e==null)return null;if((0,s.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return p(t)}return typeof e==`object`&&!Array.isArray(e)?p(e):null}function h(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(d(n)||f(n)||l(n))&&(t[n]=e[n]);return t}function g(e){return e==null?null:(0,s.isValidElement)(e)?h(e.props):typeof e==`object`&&!Array.isArray(e)?h(e):null}var _=r(t()),v=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.width,i=e.height,a=e.viewBox,c=e.className,l=e.style,u=e.title,d=e.desc,f=b(e,v),p=a||{width:r,height:i,x:0,y:0},m=o(`recharts-surface`,c);return s.createElement(`svg`,y({},h(f),{className:m,width:r,height:i,style:l,viewBox:`${p.x} ${p.y} ${p.width} ${p.height}`,ref:t}),s.createElement(`title`,null,u),s.createElement(`desc`,null,d),n)}),C=[`children`,`className`];function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.className,i=T(e,C),a=o(`recharts-layer`,r);return s.createElement(`g`,w({className:a},h(i),{ref:t}),n)});function O(e){return e===`__proto__`}var k=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function A(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:k.test(e);default:return!1}}function j(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function M(e){return typeof e==`symbol`||e instanceof Symbol}function N(e){return e==null?``:ee(e)}function ee(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(ee).join(`,`);if(M(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function te(e){if(Array.isArray(e))return e.map(j);if(typeof e==`symbol`)return[e];e=N(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r1&&arguments[1]!==void 0?arguments[1]:ie),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function oe(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+ae(i)+n},``)}var se=e=>e===0?0:e>0?1:-1,ce=e=>typeof e==`number`&&e!=+e,le=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,P=e=>(typeof e==`number`||e instanceof Number)&&!ce(e),ue=e=>P(e)||typeof e==`string`,de=0,fe=e=>{var t=++de;return`${e||``}${t}`},pe=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!P(e)&&typeof e!=`string`)return n;var i;if(le(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return ce(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},me=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):ne(e,t))===n)}var _e=e=>e==null,ve=e=>_e(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function ye(e){return e!=null}function be(){}function xe(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}}function Se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ce(e){for(var t=1;t{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=xe(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?Ce({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?Ce({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?Ce({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?Ce({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?Ce({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?Ce({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?Ce({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?Ce({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(P(n.x)||le(n.x))&&(P(n.y)||le(n.y))?Ce({x:c+pe(n.x,g),y:l+pe(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):Ce({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},Oe=[`top`,`left`,`right`,`bottom`];function ke(e){return e==null?!1:typeof e==`object`||Oe.includes(e)}var Ae=(0,s.createContext)(null);function F(e){return function(){return e}}var je=Math.PI,Me=2*je,Ne=1e-6,Pe=Me-Ne;function Fe(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return Fe;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tNe){if(!(Math.abs(u*s-c*l)>Ne)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((je-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Ne&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Ne||Math.abs(this._y1-l)>Ne)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%Me+Me),d>Pe?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>Ne&&this._append`A${n},${n},0,${+(d>=je)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};Le.prototype;function Re(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Le(t)}Array.prototype.slice;function ze(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Be(e){this._context=e}Be.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)}}};function Ve(e){return new Be(e)}function He(e){return e[0]}function Ue(e){return e[1]}function We(e,t){var n=F(!0),r=null,i=Ve,a=null,o=Re(s);e=typeof e==`function`?e:e===void 0?He:F(e),t=typeof t==`function`?t:t===void 0?Ue:F(t);function s(s){var c,l=(s=ze(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return We().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:F(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:F(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:F(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:F(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:F(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:F(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:F(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Ke=class{constructor(e,t){this._context=e,this._x=t}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(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._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function qe(e){return new Ke(e,!0)}function Je(e){return new Ke(e,!1)}function Ye(){}function Xe(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 Ze(e){this._context=e}Ze.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:Xe(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(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:Xe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Qe(e){return new Ze(e)}function $e(e){this._context=e}$e.prototype={areaStart:Ye,areaEnd:Ye,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)}},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:Xe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function et(e){return new $e(e)}function tt(e){this._context=e}tt.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:Xe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function nt(e){return new tt(e)}function rt(e){this._context=e}rt.prototype={areaStart:Ye,areaEnd:Ye,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 it(e){return new rt(e)}function at(e){return e<0?-1:1}function ot(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(at(a)+at(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function st(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function ct(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function lt(e){this._context=e}lt.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:ct(this,this._t0,st(this,this._t0))}(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,ct(this,st(this,n=ot(this,e,t)),n);break;default:ct(this,this._t0,n=ot(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function ut(e){this._context=new dt(e)}(ut.prototype=Object.create(lt.prototype)).point=function(e,t){lt.prototype.point.call(this,t,e)};function dt(e){this._context=e}dt.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,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function ft(e){return new lt(e)}function pt(e){return new ut(e)}function mt(e){this._context=e}mt.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=ht(e),i=ht(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[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)}}this._x=e,this._y=t}};function vt(e){return new _t(e,.5)}function yt(e){return new _t(e,0)}function bt(e){return new _t(e,1)}function xt(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function Ct(e,t){return e[t]}function wt(e){let t=[];return t.key=e,t}function Tt(){var e=F([]),t=St,n=xt,r=Ct;function i(i){var a=Array.from(e.apply(this,arguments),wt),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r`radius`in e&&`startAngle`in e&&`endAngle`in e,At=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,s.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{l(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},jt=(e,t,n)=>r=>(e(t,n,r),null),Mt=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];l(i)&&typeof a==`function`&&(r||={},r[i]=jt(a,t,n))}),r};function Nt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Pt(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function zt(e){return Number.isSafeInteger(e)&&e>=0}function Bt(e){return e!=null&&typeof e!=`function`&&zt(e.length)}function Vt(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function Ht(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var Ut=`[object RegExp]`,Wt=`[object String]`,Gt=`[object Number]`,Kt=`[object Boolean]`,qt=`[object Arguments]`,Jt=`[object Symbol]`,Yt=`[object Date]`,Xt=`[object Map]`,Zt=`[object Set]`,Qt=`[object Array]`,$t=`[object Function]`,en=`[object ArrayBuffer]`,tn=`[object Object]`,nn=`[object Error]`,rn=`[object DataView]`,an=`[object Uint8Array]`,on=`[object Uint8ClampedArray]`,sn=`[object Uint16Array]`,cn=`[object Uint32Array]`,ln=`[object BigUint64Array]`,un=`[object Int8Array]`,dn=`[object Int16Array]`,fn=`[object Int32Array]`,pn=`[object BigInt64Array]`,mn=`[object Float32Array]`,hn=`[object Float64Array]`,gn=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function _n(e){return gn.Buffer!==void 0&&gn.Buffer.isBuffer(e)}function vn(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function yn(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}var bn=/^(?:0|[1-9]\d*)$/;function xn(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e{var r=n(),i=e();function a(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var o=typeof Object.is==`function`?Object.is:a,s=i.useSyncExternalStore,c=r.useRef,l=r.useEffect,u=r.useMemo,d=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=c(null);if(a.current===null){var f={hasValue:!1,value:null};a.current=f}else f=a.current;a=u(function(){function e(e){if(!a){if(a=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,o(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var a=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=s(e,a[0],a[1]);return l(function(){f.hasValue=!0,f.value=p},[p]),d(p),p}})),Cn=a(((e,t)=>{t.exports=Sn()}))(),wn=(0,s.createContext)(null),Tn=e=>e,I=()=>{var e=(0,s.useContext)(wn);return e?e.store.dispatch:Tn},En=()=>{},Dn=()=>En,On=(e,t)=>e===t;function L(e){var t=(0,s.useContext)(wn),n=(0,s.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:En,[t,e]);return(0,Cn.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Dn,t?t.store.getState:En,t?t.store.getState:En,n,On)}function kn(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function An(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var jn=e=>Array.isArray(e)?e:[e];function Mn(e){let t=Array.isArray(e[0])?e[0]:e;return An(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Nn(e,t){let n=[],{length:r}=e;for(let i=0;i`u`?Pn:WeakRef,In=0,Ln=1;function Rn(){return{s:In,v:void 0,o:null,p:null}}function zn(e){return e instanceof Fn?e.deref():e}function Bn(e,t={}){let n=Rn(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e{n=Rn(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function Vn(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),kn(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=Bn,argsMemoizeOptions:u=[]}={...n,...a},d=jn(c),f=jn(u),p=Mn(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=Nn(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var R=Vn(Bn);function Hn(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{if(e!==t){let r=Wn(e),i=Wn(t);if(r===i&&r===0){if(et)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},Kn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qn=/^\w*$/;function Jn(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||M(e)?!0:typeof e==`string`&&(qn.test(e)||!Kn.test(e))||t!=null&&Object.hasOwn(t,e)}function Yn(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=Bt(e)?Array.from(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(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||Jn(e)?e:{key:e,path:te(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;re.original)}function Xn(e,...t){let n=t.length;return n>1&&Un(e,t[0],t[1])?t=[]:n>2&&Un(t[0],t[1],t[2])&&(t=[t[0]]),Yn(e,Hn(t),[`asc`])}var Zn=e=>e.legend.settings,Qn=e=>e.legend.size;R([e=>e.legend.payload,Zn],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?Xn(r,n):r});function z(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 $n=typeof Symbol==`function`&&Symbol.observable||`@@observable`,er=()=>Math.random().toString(36).substring(7).split(``).join(`.`),tr={INIT:`@@redux/INIT${er()}`,REPLACE:`@@redux/REPLACE${er()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${er()}`};function nr(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function rr(e,t,n){if(typeof e!=`function`)throw Error(z(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(z(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(z(1));return n(rr)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(z(3));return i}function d(e){if(typeof e!=`function`)throw Error(z(4));if(c)throw Error(z(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(z(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!nr(e))throw Error(z(7));if(e.type===void 0)throw Error(z(8));if(typeof e.type!=`string`)throw Error(z(17));if(c)throw Error(z(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(z(10));r=e,f({type:tr.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(z(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[$n](){return this}}}return f({type:tr.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[$n]:m}}function ir(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:tr.INIT})===void 0)throw Error(z(12));if(n(void 0,{type:tr.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(z(13))})}function ar(e){let t=Object.keys(e),n={};for(let r=0;re:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function sr(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(z(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=or(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function cr(e){return nr(e)&&`type`in e&&typeof e.type==`string`}var lr=Symbol.for(`immer-nothing`),ur=Symbol.for(`immer-draftable`),dr=Symbol.for(`immer-state`);function fr(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var pr=Object,mr=pr.getPrototypeOf,hr=`constructor`,gr=`prototype`,_r=`configurable`,vr=`enumerable`,yr=`writable`,br=`value`,xr=e=>!!e&&!!e[dr];function Sr(e){return e?Tr(e)||Mr(e)||!!e[ur]||!!e[hr]?.[ur]||Nr(e)||Pr(e):!1}var Cr=pr[gr][hr].toString(),wr=new WeakMap;function Tr(e){if(!e||!Fr(e))return!1;let t=mr(e);if(t===null||t===pr[gr])return!0;let n=pr.hasOwnProperty.call(t,hr)&&t[hr];if(n===Object)return!0;if(!Ir(n))return!1;let r=wr.get(n);return r===void 0&&(r=Function.toString.call(n),wr.set(n,r)),r===Cr}function Er(e,t,n=!0){Dr(e)===0?(n?Reflect.ownKeys(e):pr.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Dr(e){let t=e[dr];return t?t.type_:Mr(e)?1:Nr(e)?2:Pr(e)?3:0}var Or=(e,t,n=Dr(e))=>n===2?e.has(t):pr[gr].hasOwnProperty.call(e,t),kr=(e,t,n=Dr(e))=>n===2?e.get(t):e[t],Ar=(e,t,n,r=Dr(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function jr(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var Mr=Array.isArray,Nr=e=>e instanceof Map,Pr=e=>e instanceof Set,Fr=e=>typeof e==`object`,Ir=e=>typeof e==`function`,Lr=e=>typeof e==`boolean`;function Rr(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var zr=e=>e.copy_||e.base_,Br=e=>e.modified_?e.copy_:e.base_;function Vr(e,t){if(Nr(e))return new Map(e);if(Pr(e))return new Set(e);if(Mr(e))return Array[gr].slice.call(e);let n=Tr(e);if(t===!0||t===`class_only`&&!n){let t=pr.getOwnPropertyDescriptors(e);delete t[dr];let n=Reflect.ownKeys(t);for(let r=0;r1&&pr.defineProperties(e,{set:Wr,add:Wr,clear:Wr,delete:Wr}),pr.freeze(e),t&&Er(e,(e,t)=>{Hr(t,!0)},!1),e)}function Ur(){fr(2)}var Wr={[br]:Ur};function Gr(e){return e===null||!Fr(e)||pr.isFrozen(e)}var Kr=`MapSet`,qr=`Patches`,Jr=`ArrayMethods`,Yr={};function Xr(e){let t=Yr[e];return t||fr(0,e),t}var Zr=e=>!!Yr[e],Qr,$r=()=>Qr,ei=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Zr(Kr)?Xr(Kr):void 0,arrayMethodsPlugin_:Zr(Jr)?Xr(Jr):void 0});function ti(e,t){t&&(e.patchPlugin_=Xr(qr),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ni(e){ri(e),e.drafts_.forEach(ai),e.drafts_=null}function ri(e){e===Qr&&(Qr=e.parent_)}var ii=e=>Qr=ei(Qr,e);function ai(e){let t=e[dr];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function oi(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[dr].modified_&&(ni(t),fr(4)),Sr(e)&&(e=si(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[dr].base_,e,t)}else e=si(t,n);return ci(t,e,!0),ni(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===lr?void 0:e}function si(e,t){if(Gr(t))return t;let n=t[dr];if(!n)return gi(t,e.handledSet_,e);if(!ui(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);mi(n,e)}return n.copy_}function ci(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Hr(t,n)}function li(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var ui=(e,t)=>e.scope_===t,di=[];function fi(e,t,n,r){let i=zr(e),a=e.type_;if(r!==void 0&&kr(i,r,a)===t){Ar(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;Er(i,(e,n)=>{if(xr(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??di;for(let e of o)Ar(i,e,n,a)}function pi(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!ui(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Br(i);fi(e,i.draft_??i,a,n),mi(i,r)})}function mi(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}li(e)}}function hi(e,t,n){let{scope_:r}=e;if(xr(n)){let i=n[dr];ui(i,r)&&i.callbacks_.push(function(){Ti(e),fi(e,n,Br(i),t)})}else Sr(n)&&e.callbacks_.push(function(){let i=zr(e);e.type_===3?i.has(n)&&gi(n,r.handledSet_,r):kr(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&gi(kr(e.copy_,t,e.type_),r.handledSet_,r)})}function gi(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||xr(e)||t.has(e)||!Sr(e)||Gr(e)?e:(t.add(e),Er(e,(r,i)=>{if(xr(i)){let t=i[dr];ui(t,n)&&(Ar(e,r,Br(t),e.type_),li(t))}else Sr(i)&&gi(i,t,n)}),e)}function _i(e,t){let n=Mr(e),r={type_:+!!n,scope_:t?t.scope_:$r(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=vi;n&&(i=[r],a=yi);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var vi={get(e,t){if(t===dr)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=zr(e);if(!Or(i,t,e.type_))return Si(e,i,t);let a=i[t];if(e.finalized_||!Sr(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&Rr(t))return a;if(a===bi(e.base_,t)||xi(e,t,a)){Ti(e);let n=e.type_===1?+t:t,r=Di(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in zr(e)},ownKeys(e){return Reflect.ownKeys(zr(e))},set(e,t,n){let r=Ci(zr(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=bi(zr(e),t),i=r?.[dr];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(jr(n,r)&&(n!==void 0||Or(e.base_,t,e.type_)))return!0;Ti(e),wi(e)}return e.copy_[t]===n&&(n!==void 0||Or(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),hi(e,t,n),!0)},deleteProperty(e,t){return Ti(e),bi(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),wi(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=zr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[yr]:!0,[_r]:e.type_!==1||t!==`length`,[vr]:r[vr],[br]:n[t]}},defineProperty(){fr(11)},getPrototypeOf(e){return mr(e.base_)},setPrototypeOf(){fr(12)}},yi={};for(let e in vi){let t=vi[e];yi[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}yi.deleteProperty=function(e,t){return yi.set.call(this,e,t,void 0)},yi.set=function(e,t,n){return vi.set.call(this,e[0],t,n,e[0])};function bi(e,t){let n=e[dr];return(n?zr(n):e)[t]}function xi(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!Sr(n)||n[dr]?!1:e.baseRefs_.has(n)}function Si(e,t,n){let r=Ci(t,n);return r?br in r?r[br]:r.get?.call(e.draft_):void 0}function Ci(e,t){if(!(t in e))return;let n=mr(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=mr(n)}}function wi(e){e.modified_||(e.modified_=!0,e.parent_&&wi(e.parent_))}function Ti(e){e.copy_||=(e.assigned_=new Map,Vr(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Ei=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Ir(e)&&!Ir(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}Ir(t)||fr(6),n!==void 0&&!Ir(n)&&fr(7);let r;if(Sr(e)){let i=ii(this),a=Di(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?ni(i):ri(i)}return ti(i,n),oi(r,i)}if(!e||!Fr(e)){if(r=t(e),r===void 0&&(r=e),r===lr&&(r=void 0),this.autoFreeze_&&Hr(r,!0),n){let t=[],i=[];Xr(qr).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}fr(1,e)},this.produceWithPatches=(e,t)=>{if(Ir(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Lr(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Lr(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Lr(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Sr(e)||fr(8),xr(e)&&(e=Oi(e));let t=ii(this),n=Di(t,e,void 0);return n[dr].isManual_=!0,ri(t),n}finishDraft(e,t){let n=e&&e[dr];(!n||!n.isManual_)&&fr(9);let{scope_:r}=n;return ti(r,t),oi(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--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Xr(qr).applyPatches_;return xr(e)?r(e,t):this.produce(e,e=>r(e,t))}};function Di(e,t,n,r){let[i,a]=Nr(t)?Xr(Kr).proxyMap_(t,n):Pr(t)?Xr(Kr).proxySet_(t,n):_i(t,n);return(n?.scope_??$r()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?pi(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function Oi(e){return xr(e)||fr(10,e),ki(e)}function ki(e){if(!Sr(e)||Gr(e))return e;let t=e[dr],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Vr(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Vr(e,!0);return Er(n,(e,t)=>{Ar(n,e,ki(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var Ai=new Ei().produce,B=e=>e;function ji(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var Mi=ji(),Ni=ji,Pi=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?or:or.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function Fi(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(Ua(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>cr(t)&&t.type===e,n}var Ii=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function Li(e){return Sr(e)?Ai(e,()=>{}):e}function Ri(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function zi(e){return typeof e==`boolean`}var Bi=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new Ii;return t&&(zi(t)?a.push(Mi):a.push(Ni(t.extraArgument))),a},Vi=`RTK_autoBatch`,V=()=>e=>({payload:e,meta:{[Vi]:!0}}),Hi=e=>t=>{setTimeout(t,e)},Ui=(e,t)=>n=>{let r=!1,i=()=>{r||(r=!0,cancelAnimationFrame(a),clearTimeout(o),n())},a=e(i),o=setTimeout(i,t)},Wi=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?Ui(window.requestAnimationFrame,100):Hi(10):e.type===`callback`?e.queueNotification:Hi(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[Vi],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},Gi=e=>function(t){let{autoBatch:n=!0}=t??{},r=new Ii(e);return n&&r.push(Wi(typeof n==`object`?n:void 0)),r};function Ki(e){let t=Bi(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(nr(n))c=ar(n);else throw Error(Ua(1));let l;l=typeof r==`function`?r(t):t();let u=or;i&&(u=Pi({trace:!1,...typeof i==`object`&&i}));let d=Gi(sr(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return rr(c,o,p)}function qi(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(Ua(28));if(r in t)throw Error(Ua(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function Ji(e){return typeof e==`function`}function Yi(e,t){let[n,r,i]=qi(t),a;if(Ji(e))a=()=>Li(e());else{let t=Li(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(xr(e)){let r=n(e,t);return r===void 0?e:r}if(Sr(e))return Ai(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}}return e},e)}return o.getInitialState=a,o}var Xi=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,Zi=(e=21)=>{let t=``,n=e;for(;n--;)t+=Xi[Math.random()*64|0];return t},Qi=Symbol.for(`rtk-slice-createasyncthunk`);function $i(e,t){return`${e}/${t}`}function ea({creators:e}={}){let t=e?.asyncThunk?.[Qi];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(Ua(11));let i=(typeof e.reducers==`function`?e.reducers(ra()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(Ua(12));if(n in o.sliceCaseReducersByType)throw Error(Ua(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:$i(n,r),createNotation:typeof e.reducers==`function`};aa(a)?sa(o,a,s,t):ia(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?qi(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return Yi(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=Ri(d,r,m)),i}function i(t=l){return Ri(Ri(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=ta(a,t,()=>Ri(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function ta(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var na=ea();function ra(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function ia({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!oa(r))throw Error(Ua(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?Fi(e,o):Fi(e))}function aa(e){return e._reducerDefinitionType===`asyncThunk`}function oa(e){return e._reducerDefinitionType===`reducerWithPrepare`}function sa({type:e,reducerName:t},n,r,i){if(!i)throw Error(Ua(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||ca,pending:s||ca,rejected:c||ca,settled:l||ca})}function ca(){}var la=`task`,ua=`listener`,da=`completed`,fa=`cancelled`,pa=`task-${fa}`,ma=`task-${da}`,ha=`${ua}-${fa}`,ga=`${ua}-${da}`,_a=class{constructor(e){this.code=e,this.message=`${la} ${fa} (reason: ${e})`}code;name=`TaskAbortError`;message},va=(e,t)=>{if(typeof e!=`function`)throw TypeError(Ua(32))},ya=()=>{},ba=(e,t=ya)=>(e.catch(t),e),xa=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),Sa=e=>{if(e.aborted)throw new _a(e.reason)};function Ca(e,t){let n=ya;return new Promise((r,i)=>{let a=()=>i(new _a(e.reason));if(e.aborted){a();return}n=xa(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=ya})}var wa=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof _a?`cancelled`:`rejected`,error:e}}finally{t?.()}},Ta=e=>t=>ba(Ca(e,t).then(t=>(Sa(e),t))),Ea=e=>{let t=Ta(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:Da}=Object,Oa={},ka=`listenerMiddleware`,Aa=(e,t)=>{let n=t=>xa(e,()=>t.abort(e.reason));return(r,i)=>{va(r,`taskExecutor`);let a=new AbortController;n(a);let o=wa(async()=>{Sa(e),Sa(a.signal);let t=await r({pause:Ta(a.signal),delay:Ea(a.signal),signal:a.signal});return Sa(a.signal),t},()=>a.abort(ma));return i?.autoJoin&&t.push(o.catch(ya)),{result:Ta(e)(o),cancel(){a.abort(pa)}}}},ja=(e,t)=>{let n=async(n,r)=>{Sa(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await Ca(t,Promise.race(a));return Sa(t),e}finally{i()}};return((e,t)=>ba(n(e,t)))},Ma=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=Fi(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(Ua(21));return va(a,`options.listener`),{predicate:i,type:t,effect:a}},Na=Da(e=>{let{type:t,predicate:n,effect:r}=Ma(e);return{id:Zi(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(Ua(22))}}},{withTypes:()=>Na}),Pa=(e,t)=>{let{type:n,effect:r,predicate:i}=Ma(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},Fa=e=>{e.pending.forEach(e=>{e.abort(ha)})},Ia=(e,t)=>()=>{for(let e of t.keys())Fa(e);e.clear()},La=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},Ra=Da(Fi(`${ka}/add`),{withTypes:()=>Ra}),za=Fi(`${ka}/removeAll`),Ba=Da(Fi(`${ka}/remove`),{withTypes:()=>Ba}),Va=(...e)=>{console.error(`${ka}/error`,...e)},Ha=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=Va}=e;va(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&Fa(e)}),c=(e=>{let n=Pa(t,e)??Na(e);return s(n)});Da(c,{withTypes:()=>c});let l=e=>{let n=Pa(t,e);return n&&(n.unsubscribe(),e.cancelActive&&Fa(n)),!!n};Da(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=ja(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,Da({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:Ea(u.signal),pause:Ta(u.signal),extra:a,signal:u.signal,fork:Aa(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(ha),n.delete(e))})},cancel:()=>{u.abort(ha),e.pending.delete(u)},throwIfCancelled:()=>{Sa(u.signal)}})))}catch(e){e instanceof _a||La(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(ga),i(e),e.pending.delete(u)}},d=Ia(t,n);return{middleware:e=>n=>r=>{if(!cr(r))return n(r);if(Ra.match(r))return c(r.payload);if(za.match(r)){d();return}if(Ba.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===Oa)throw Error(Ua(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,La(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=Oa}return s},startListening:c,stopListening:l,clearListeners:d}};function Ua(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 Wa=na({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),Ga=Wa.actions,Ka=Ga.setMargin,qa=Ga.setLayout,Ja=Ga.setChartSize,Ya=Ga.setScale,Xa=Wa.reducer;function Za(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function H(e){return Number.isFinite(e)}function Qa(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function $a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eo(e){for(var t=1;t{if(t&&n){var r=n.width,i=n.height,a=t.align,o=t.verticalAlign,s=t.layout,c=t.position,l=t.offset,u=l===void 0?0:l;if(c!=null){if(ke(c)){if(c===`top`&&P(e.top))return eo(eo({},e),{},{top:e.top+(i||0)+u});if(c===`bottom`&&P(e.bottom))return eo(eo({},e),{},{bottom:e.bottom+(i||0)+u});if(c===`left`&&P(e.left))return eo(eo({},e),{},{left:e.left+(r||0)+u});if(c===`right`&&P(e.right))return eo(eo({},e),{},{right:e.right+(r||0)+u})}return e}if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&P(e[a]))return eo(eo({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&P(e[o]))return eo(eo({},e),{},{[o]:e[o]+(i||0)})}return e},ao=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,oo=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},so=(e,t,n)=>{if(!e)return null;var r=e.duplicateDomain,i=e.type,a=e.range,o=e.scale,s=e.realScaleType,c=e.isCategorical,l=e.categoricalDomain,u=e.tickCount,d=e.ticks,f=e.niceTicks,p=e.axisType;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?se(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return H(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(ye):c&&l?l.map((e,t)=>{var n=o.map(e);return H(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(ye):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return H(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(ye):o.domain().map((e,t)=>{var n=o.map(e);return H(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(ye)},co={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:Et,none:xt,silhouette:Dt,wiggle:Ot,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},lo=(e,t,n)=>{var r=co[n]??xt,i=Tt().keys(t).value((e,t)=>Number(U(e,t,0))).order(St).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=U(e[i],t[r],0);Array.isArray(a)&&a.length===2&&P(a[0])&&P(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function uo(e){return e==null?void 0:String(e)}function fo(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!_e(i[t.dataKey])){var s=ge(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=U(i,_e(o)?t.dataKey:o),l=t.scale.map(c);return P(l)?l:null}var po=e=>{var t=e.flat(2).filter(P);return[Math.min(...t),Math.max(...t)]},mo=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],ho=(e,t,n)=>{if(e!=null&&Object.keys(e).length!==0)return mo(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var o=a.stackedData.reduce((e,r)=>{var i=po(Za(r,t,n));return!H(i[0])||!H(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(o[0],r[0]),Math.max(o[1],r[1])]},[1/0,-1/0]))},go=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,_o=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,vo=(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 i=Xn(t,e=>e.coordinate),a=[],o=0,s=1,c=i.length;su&&(d=Math.min(f,d));return d===1/0?0:d}return n?void 0:0};function yo(e){var t=e.tooltipEntrySettings,n=e.dataKey,r=e.payload,i=e.value,a=e.name;return eo(eo({},t),{},{dataKey:n,payload:r,value:i,name:a})}function bo(e,t){if(e!=null)return String(e);if(typeof t==`string`)return t}var xo=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},So=(e,t)=>t===`centric`?e.angle:e.radius,Co=e=>e.layout.width,wo=e=>e.layout.height,To=e=>e.layout.scale,Eo=e=>e.layout.margin,Do=R(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Oo=R(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),ko=`data-recharts-item-index`;function Ao(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jo(e){for(var t=1;te.brush.height;function Io(e){return Oo(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Lo(e){return Oo(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Ro(e){return Do(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}function zo(e){return Do(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}var Bo=R([Co,wo,Eo,Fo,Io,Lo,Ro,zo,Zn,Qn],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=jo(jo({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=io(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return jo(jo({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),Vo=R(Bo,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),Ho=R(Co,wo,(e,t)=>({x:0,y:0,width:e,height:t})),Uo=(0,s.createContext)(null),Wo=()=>(0,s.useContext)(Uo)!=null,Go=e=>e.brush,Ko=R([Go,Bo,Eo],(e,t,n)=>({height:e.height,x:P(e.x)?e.x:t.left,y:P(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:P(e.width)?e.width:t.width}));function qo(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function Jo(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=qo(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function Yo(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return Jo(e,t,{leading:r,maxWait:t,trailing:i})}var Xo=function(e,t){var n=[...arguments].slice(2);if(typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e)){if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}}},Zo={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},Qo=(e,t,n)=>{var r=n.width,i=r===void 0?Zo.width:r,a=n.height,o=a===void 0?Zo.height:a,s=n.aspect,c=n.maxHeight,l=le(i)?e:Number(i),u=le(o)?t:Number(o);return s&&s>0&&(l?u=l/s:u&&(l=u*s),c&&u!=null&&u>c&&(u=c)),{calculatedWidth:l,calculatedHeight:u}},$o={width:0,height:0,overflow:`visible`},es={width:0,overflowX:`visible`},ts={height:0,overflowY:`visible`},ns={},rs=e=>{var t=e.width,n=e.height,r=le(t),i=le(n);return r&&i?$o:r?es:i?ts:ns};function is(e){var t=e.width,n=e.height,r=e.aspect,i=t,a=n;return i===void 0&&a===void 0?(i=Zo.width,a=Zo.height):i===void 0?i=r&&r>0?void 0:Zo.width:a===void 0&&(a=r&&r>0?void 0:Zo.height),{width:i,height:a}}var as=[`aspect`,`initialDimension`,`width`,`height`,`minWidth`,`minHeight`,`maxHeight`,`children`,`debounce`,`id`,`className`,`onResize`,`style`];function os(){return os=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.width,i=e.height,a=e.viewBox,c=e.className,l=e.style,u=e.title,d=e.desc,f=b(e,v),p=a||{width:r,height:i,x:0,y:0},m=o(`recharts-surface`,c);return s.createElement(`svg`,y({},h(f),{className:m,width:r,height:i,style:l,viewBox:`${p.x} ${p.y} ${p.width} ${p.height}`,ref:t}),s.createElement(`title`,null,u),s.createElement(`desc`,null,d),n)}),C=[`children`,`className`];function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.className,i=T(e,C),a=o(`recharts-layer`,r);return s.createElement(`g`,w({className:a},h(i),{ref:t}),n)});function O(e){return e===`__proto__`}var k=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function A(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:k.test(e);default:return!1}}function j(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function M(e){return typeof e==`symbol`||e instanceof Symbol}function N(e){return e==null?``:ee(e)}function ee(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(ee).join(`,`);if(M(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function te(e){if(Array.isArray(e))return e.map(j);if(typeof e==`symbol`)return[e];e=N(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r1&&arguments[1]!==void 0?arguments[1]:ie),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function oe(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+ae(i)+n},``)}var se=e=>e===0?0:e>0?1:-1,ce=e=>typeof e==`number`&&e!=+e,le=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,P=e=>(typeof e==`number`||e instanceof Number)&&!ce(e),ue=e=>P(e)||typeof e==`string`,de=0,fe=e=>{var t=++de;return`${e||``}${t}`},pe=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!P(e)&&typeof e!=`string`)return n;var i;if(le(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return ce(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},me=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):ne(e,t))===n)}var _e=e=>e==null,ve=e=>_e(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function ye(e){return e!=null}function be(){}function xe(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}}function Se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ce(e){for(var t=1;t{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=xe(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?Ce({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?Ce({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?Ce({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?Ce({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?Ce({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?Ce({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?Ce({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?Ce({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(P(n.x)||le(n.x))&&(P(n.y)||le(n.y))?Ce({x:c+pe(n.x,g),y:l+pe(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):Ce({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},Oe=[`top`,`left`,`right`,`bottom`];function ke(e){return e==null?!1:typeof e==`object`||Oe.includes(e)}var Ae=(0,s.createContext)(null);function F(e){return function(){return e}}var je=Math.PI,Me=2*je,Ne=1e-6,Pe=Me-Ne;function Fe(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return Fe;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tNe){if(!(Math.abs(u*s-c*l)>Ne)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((je-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Ne&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Ne||Math.abs(this._y1-l)>Ne)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%Me+Me),d>Pe?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>Ne&&this._append`A${n},${n},0,${+(d>=je)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};Le.prototype;function Re(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Le(t)}Array.prototype.slice;function ze(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Be(e){this._context=e}Be.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)}}};function Ve(e){return new Be(e)}function He(e){return e[0]}function Ue(e){return e[1]}function We(e,t){var n=F(!0),r=null,i=Ve,a=null,o=Re(s);e=typeof e==`function`?e:e===void 0?He:F(e),t=typeof t==`function`?t:t===void 0?Ue:F(t);function s(s){var c,l=(s=ze(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return We().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:F(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:F(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:F(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:F(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:F(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:F(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:F(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Ke=class{constructor(e,t){this._context=e,this._x=t}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(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._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function qe(e){return new Ke(e,!0)}function Je(e){return new Ke(e,!1)}function Ye(){}function Xe(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 Ze(e){this._context=e}Ze.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:Xe(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(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:Xe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Qe(e){return new Ze(e)}function $e(e){this._context=e}$e.prototype={areaStart:Ye,areaEnd:Ye,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)}},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:Xe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function et(e){return new $e(e)}function tt(e){this._context=e}tt.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:Xe(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function nt(e){return new tt(e)}function rt(e){this._context=e}rt.prototype={areaStart:Ye,areaEnd:Ye,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 it(e){return new rt(e)}function at(e){return e<0?-1:1}function ot(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(at(a)+at(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function st(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function ct(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function lt(e){this._context=e}lt.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:ct(this,this._t0,st(this,this._t0))}(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,ct(this,st(this,n=ot(this,e,t)),n);break;default:ct(this,this._t0,n=ot(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function ut(e){this._context=new dt(e)}(ut.prototype=Object.create(lt.prototype)).point=function(e,t){lt.prototype.point.call(this,t,e)};function dt(e){this._context=e}dt.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,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function ft(e){return new lt(e)}function pt(e){return new ut(e)}function mt(e){this._context=e}mt.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=ht(e),i=ht(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[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)}}this._x=e,this._y=t}};function vt(e){return new _t(e,.5)}function yt(e){return new _t(e,0)}function bt(e){return new _t(e,1)}function xt(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function Ct(e,t){return e[t]}function wt(e){let t=[];return t.key=e,t}function Tt(){var e=F([]),t=St,n=xt,r=Ct;function i(i){var a=Array.from(e.apply(this,arguments),wt),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r`radius`in e&&`startAngle`in e&&`endAngle`in e,At=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,s.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{l(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},jt=(e,t,n)=>r=>(e(t,n,r),null),Mt=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];l(i)&&typeof a==`function`&&(r||={},r[i]=jt(a,t,n))}),r};function Nt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Pt(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function zt(e){return Number.isSafeInteger(e)&&e>=0}function Bt(e){return e!=null&&typeof e!=`function`&&zt(e.length)}function Vt(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function Ht(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var Ut=`[object RegExp]`,Wt=`[object String]`,Gt=`[object Number]`,Kt=`[object Boolean]`,qt=`[object Arguments]`,Jt=`[object Symbol]`,Yt=`[object Date]`,Xt=`[object Map]`,Zt=`[object Set]`,Qt=`[object Array]`,$t=`[object Function]`,en=`[object ArrayBuffer]`,tn=`[object Object]`,nn=`[object Error]`,rn=`[object DataView]`,an=`[object Uint8Array]`,on=`[object Uint8ClampedArray]`,sn=`[object Uint16Array]`,cn=`[object Uint32Array]`,ln=`[object BigUint64Array]`,un=`[object Int8Array]`,dn=`[object Int16Array]`,fn=`[object Int32Array]`,pn=`[object BigInt64Array]`,mn=`[object Float32Array]`,hn=`[object Float64Array]`,gn=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function _n(e){return gn.Buffer!==void 0&&gn.Buffer.isBuffer(e)}function vn(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function yn(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}var bn=/^(?:0|[1-9]\d*)$/;function xn(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e{var r=n(),i=e();function a(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var o=typeof Object.is==`function`?Object.is:a,s=i.useSyncExternalStore,c=r.useRef,l=r.useEffect,u=r.useMemo,d=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=c(null);if(a.current===null){var f={hasValue:!1,value:null};a.current=f}else f=a.current;a=u(function(){function e(e){if(!a){if(a=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,o(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var a=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=s(e,a[0],a[1]);return l(function(){f.hasValue=!0,f.value=p},[p]),d(p),p}})),Cn=a(((e,t)=>{t.exports=Sn()}))(),wn=(0,s.createContext)(null),Tn=e=>e,I=()=>{var e=(0,s.useContext)(wn);return e?e.store.dispatch:Tn},En=()=>{},Dn=()=>En,On=(e,t)=>e===t;function L(e){var t=(0,s.useContext)(wn),n=(0,s.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:En,[t,e]);return(0,Cn.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Dn,t?t.store.getState:En,t?t.store.getState:En,n,On)}function kn(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function An(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var jn=e=>Array.isArray(e)?e:[e];function Mn(e){let t=Array.isArray(e[0])?e[0]:e;return An(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Nn(e,t){let n=[],{length:r}=e;for(let i=0;i`u`?Pn:WeakRef,In=0,Ln=1;function Rn(){return{s:In,v:void 0,o:null,p:null}}function zn(e){return e instanceof Fn?e.deref():e}function Bn(e,t={}){let n=Rn(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e{n=Rn(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function Vn(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),kn(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=Bn,argsMemoizeOptions:u=[]}={...n,...a},d=jn(c),f=jn(u),p=Mn(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=Nn(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var R=Vn(Bn);function Hn(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{if(e!==t){let r=Wn(e),i=Wn(t);if(r===i&&r===0){if(et)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},Kn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qn=/^\w*$/;function Jn(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||M(e)?!0:typeof e==`string`&&(qn.test(e)||!Kn.test(e))||t!=null&&Object.hasOwn(t,e)}function Yn(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=Bt(e)?Array.from(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(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||Jn(e)?e:{key:e,path:te(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;re.original)}function Xn(e,...t){let n=t.length;return n>1&&Un(e,t[0],t[1])?t=[]:n>2&&Un(t[0],t[1],t[2])&&(t=[t[0]]),Yn(e,Hn(t),[`asc`])}var Zn=e=>e.legend.settings,Qn=e=>e.legend.size;R([e=>e.legend.payload,Zn],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?Xn(r,n):r});function z(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 $n=typeof Symbol==`function`&&Symbol.observable||`@@observable`,er=()=>Math.random().toString(36).substring(7).split(``).join(`.`),tr={INIT:`@@redux/INIT${er()}`,REPLACE:`@@redux/REPLACE${er()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${er()}`};function nr(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function rr(e,t,n){if(typeof e!=`function`)throw Error(z(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(z(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(z(1));return n(rr)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(z(3));return i}function d(e){if(typeof e!=`function`)throw Error(z(4));if(c)throw Error(z(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(z(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!nr(e))throw Error(z(7));if(e.type===void 0)throw Error(z(8));if(typeof e.type!=`string`)throw Error(z(17));if(c)throw Error(z(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(z(10));r=e,f({type:tr.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(z(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[$n](){return this}}}return f({type:tr.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[$n]:m}}function ir(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:tr.INIT})===void 0)throw Error(z(12));if(n(void 0,{type:tr.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(z(13))})}function ar(e){let t=Object.keys(e),n={};for(let r=0;re:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function sr(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(z(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=or(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function cr(e){return nr(e)&&`type`in e&&typeof e.type==`string`}var lr=Symbol.for(`immer-nothing`),ur=Symbol.for(`immer-draftable`),dr=Symbol.for(`immer-state`);function fr(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var pr=Object,mr=pr.getPrototypeOf,hr=`constructor`,gr=`prototype`,_r=`configurable`,vr=`enumerable`,yr=`writable`,br=`value`,xr=e=>!!e&&!!e[dr];function Sr(e){return e?Tr(e)||Mr(e)||!!e[ur]||!!e[hr]?.[ur]||Nr(e)||Pr(e):!1}var Cr=pr[gr][hr].toString(),wr=new WeakMap;function Tr(e){if(!e||!Fr(e))return!1;let t=mr(e);if(t===null||t===pr[gr])return!0;let n=pr.hasOwnProperty.call(t,hr)&&t[hr];if(n===Object)return!0;if(!Ir(n))return!1;let r=wr.get(n);return r===void 0&&(r=Function.toString.call(n),wr.set(n,r)),r===Cr}function Er(e,t,n=!0){Dr(e)===0?(n?Reflect.ownKeys(e):pr.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Dr(e){let t=e[dr];return t?t.type_:Mr(e)?1:Nr(e)?2:Pr(e)?3:0}var Or=(e,t,n=Dr(e))=>n===2?e.has(t):pr[gr].hasOwnProperty.call(e,t),kr=(e,t,n=Dr(e))=>n===2?e.get(t):e[t],Ar=(e,t,n,r=Dr(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function jr(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var Mr=Array.isArray,Nr=e=>e instanceof Map,Pr=e=>e instanceof Set,Fr=e=>typeof e==`object`,Ir=e=>typeof e==`function`,Lr=e=>typeof e==`boolean`;function Rr(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var zr=e=>e.copy_||e.base_,Br=e=>e.modified_?e.copy_:e.base_;function Vr(e,t){if(Nr(e))return new Map(e);if(Pr(e))return new Set(e);if(Mr(e))return Array[gr].slice.call(e);let n=Tr(e);if(t===!0||t===`class_only`&&!n){let t=pr.getOwnPropertyDescriptors(e);delete t[dr];let n=Reflect.ownKeys(t);for(let r=0;r1&&pr.defineProperties(e,{set:Wr,add:Wr,clear:Wr,delete:Wr}),pr.freeze(e),t&&Er(e,(e,t)=>{Hr(t,!0)},!1),e)}function Ur(){fr(2)}var Wr={[br]:Ur};function Gr(e){return e===null||!Fr(e)||pr.isFrozen(e)}var Kr=`MapSet`,qr=`Patches`,Jr=`ArrayMethods`,Yr={};function Xr(e){let t=Yr[e];return t||fr(0,e),t}var Zr=e=>!!Yr[e],Qr,$r=()=>Qr,ei=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Zr(Kr)?Xr(Kr):void 0,arrayMethodsPlugin_:Zr(Jr)?Xr(Jr):void 0});function ti(e,t){t&&(e.patchPlugin_=Xr(qr),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ni(e){ri(e),e.drafts_.forEach(ai),e.drafts_=null}function ri(e){e===Qr&&(Qr=e.parent_)}var ii=e=>Qr=ei(Qr,e);function ai(e){let t=e[dr];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function oi(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[dr].modified_&&(ni(t),fr(4)),Sr(e)&&(e=si(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[dr].base_,e,t)}else e=si(t,n);return ci(t,e,!0),ni(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===lr?void 0:e}function si(e,t){if(Gr(t))return t;let n=t[dr];if(!n)return gi(t,e.handledSet_,e);if(!ui(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);mi(n,e)}return n.copy_}function ci(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Hr(t,n)}function li(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var ui=(e,t)=>e.scope_===t,di=[];function fi(e,t,n,r){let i=zr(e),a=e.type_;if(r!==void 0&&kr(i,r,a)===t){Ar(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;Er(i,(e,n)=>{if(xr(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??di;for(let e of o)Ar(i,e,n,a)}function pi(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!ui(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Br(i);fi(e,i.draft_??i,a,n),mi(i,r)})}function mi(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}li(e)}}function hi(e,t,n){let{scope_:r}=e;if(xr(n)){let i=n[dr];ui(i,r)&&i.callbacks_.push(function(){Ti(e),fi(e,n,Br(i),t)})}else Sr(n)&&e.callbacks_.push(function(){let i=zr(e);e.type_===3?i.has(n)&&gi(n,r.handledSet_,r):kr(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&gi(kr(e.copy_,t,e.type_),r.handledSet_,r)})}function gi(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||xr(e)||t.has(e)||!Sr(e)||Gr(e)?e:(t.add(e),Er(e,(r,i)=>{if(xr(i)){let t=i[dr];ui(t,n)&&(Ar(e,r,Br(t),e.type_),li(t))}else Sr(i)&&gi(i,t,n)}),e)}function _i(e,t){let n=Mr(e),r={type_:+!!n,scope_:t?t.scope_:$r(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=vi;n&&(i=[r],a=yi);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var vi={get(e,t){if(t===dr)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=zr(e);if(!Or(i,t,e.type_))return Si(e,i,t);let a=i[t];if(e.finalized_||!Sr(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&Rr(t))return a;if(a===bi(e.base_,t)||xi(e,t,a)){Ti(e);let n=e.type_===1?+t:t,r=Di(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in zr(e)},ownKeys(e){return Reflect.ownKeys(zr(e))},set(e,t,n){let r=Ci(zr(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=bi(zr(e),t),i=r?.[dr];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(jr(n,r)&&(n!==void 0||Or(e.base_,t,e.type_)))return!0;Ti(e),wi(e)}return e.copy_[t]===n&&(n!==void 0||Or(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),hi(e,t,n),!0)},deleteProperty(e,t){return Ti(e),bi(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),wi(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=zr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[yr]:!0,[_r]:e.type_!==1||t!==`length`,[vr]:r[vr],[br]:n[t]}},defineProperty(){fr(11)},getPrototypeOf(e){return mr(e.base_)},setPrototypeOf(){fr(12)}},yi={};for(let e in vi){let t=vi[e];yi[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}yi.deleteProperty=function(e,t){return yi.set.call(this,e,t,void 0)},yi.set=function(e,t,n){return vi.set.call(this,e[0],t,n,e[0])};function bi(e,t){let n=e[dr];return(n?zr(n):e)[t]}function xi(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!Sr(n)||n[dr]?!1:e.baseRefs_.has(n)}function Si(e,t,n){let r=Ci(t,n);return r?br in r?r[br]:r.get?.call(e.draft_):void 0}function Ci(e,t){if(!(t in e))return;let n=mr(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=mr(n)}}function wi(e){e.modified_||(e.modified_=!0,e.parent_&&wi(e.parent_))}function Ti(e){e.copy_||=(e.assigned_=new Map,Vr(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Ei=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Ir(e)&&!Ir(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}Ir(t)||fr(6),n!==void 0&&!Ir(n)&&fr(7);let r;if(Sr(e)){let i=ii(this),a=Di(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?ni(i):ri(i)}return ti(i,n),oi(r,i)}if(!e||!Fr(e)){if(r=t(e),r===void 0&&(r=e),r===lr&&(r=void 0),this.autoFreeze_&&Hr(r,!0),n){let t=[],i=[];Xr(qr).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}fr(1,e)},this.produceWithPatches=(e,t)=>{if(Ir(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Lr(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Lr(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Lr(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Sr(e)||fr(8),xr(e)&&(e=Oi(e));let t=ii(this),n=Di(t,e,void 0);return n[dr].isManual_=!0,ri(t),n}finishDraft(e,t){let n=e&&e[dr];(!n||!n.isManual_)&&fr(9);let{scope_:r}=n;return ti(r,t),oi(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--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Xr(qr).applyPatches_;return xr(e)?r(e,t):this.produce(e,e=>r(e,t))}};function Di(e,t,n,r){let[i,a]=Nr(t)?Xr(Kr).proxyMap_(t,n):Pr(t)?Xr(Kr).proxySet_(t,n):_i(t,n);return(n?.scope_??$r()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?pi(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function Oi(e){return xr(e)||fr(10,e),ki(e)}function ki(e){if(!Sr(e)||Gr(e))return e;let t=e[dr],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Vr(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Vr(e,!0);return Er(n,(e,t)=>{Ar(n,e,ki(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var Ai=new Ei().produce,B=e=>e;function ji(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var Mi=ji(),Ni=ji,Pi=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?or:or.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function Fi(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(Ua(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>cr(t)&&t.type===e,n}var Ii=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function Li(e){return Sr(e)?Ai(e,()=>{}):e}function Ri(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function zi(e){return typeof e==`boolean`}var Bi=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new Ii;return t&&(zi(t)?a.push(Mi):a.push(Ni(t.extraArgument))),a},Vi=`RTK_autoBatch`,V=()=>e=>({payload:e,meta:{[Vi]:!0}}),Hi=e=>t=>{setTimeout(t,e)},Ui=(e,t)=>n=>{let r=!1,i=()=>{r||(r=!0,cancelAnimationFrame(a),clearTimeout(o),n())},a=e(i),o=setTimeout(i,t)},Wi=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?Ui(window.requestAnimationFrame,100):Hi(10):e.type===`callback`?e.queueNotification:Hi(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[Vi],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},Gi=e=>function(t){let{autoBatch:n=!0}=t??{},r=new Ii(e);return n&&r.push(Wi(typeof n==`object`?n:void 0)),r};function Ki(e){let t=Bi(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(nr(n))c=ar(n);else throw Error(Ua(1));let l;l=typeof r==`function`?r(t):t();let u=or;i&&(u=Pi({trace:!1,...typeof i==`object`&&i}));let d=Gi(sr(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return rr(c,o,p)}function qi(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(Ua(28));if(r in t)throw Error(Ua(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function Ji(e){return typeof e==`function`}function Yi(e,t){let[n,r,i]=qi(t),a;if(Ji(e))a=()=>Li(e());else{let t=Li(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(xr(e)){let r=n(e,t);return r===void 0?e:r}if(Sr(e))return Ai(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}}return e},e)}return o.getInitialState=a,o}var Xi=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,Zi=(e=21)=>{let t=``,n=e;for(;n--;)t+=Xi[Math.random()*64|0];return t},Qi=Symbol.for(`rtk-slice-createasyncthunk`);function $i(e,t){return`${e}/${t}`}function ea({creators:e}={}){let t=e?.asyncThunk?.[Qi];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(Ua(11));let i=(typeof e.reducers==`function`?e.reducers(ra()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(Ua(12));if(n in o.sliceCaseReducersByType)throw Error(Ua(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:$i(n,r),createNotation:typeof e.reducers==`function`};aa(a)?sa(o,a,s,t):ia(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?qi(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return Yi(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=Ri(d,r,m)),i}function i(t=l){return Ri(Ri(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=ta(a,t,()=>Ri(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function ta(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var na=ea();function ra(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function ia({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!oa(r))throw Error(Ua(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?Fi(e,o):Fi(e))}function aa(e){return e._reducerDefinitionType===`asyncThunk`}function oa(e){return e._reducerDefinitionType===`reducerWithPrepare`}function sa({type:e,reducerName:t},n,r,i){if(!i)throw Error(Ua(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||ca,pending:s||ca,rejected:c||ca,settled:l||ca})}function ca(){}var la=`task`,ua=`listener`,da=`completed`,fa=`cancelled`,pa=`task-${fa}`,ma=`task-${da}`,ha=`${ua}-${fa}`,ga=`${ua}-${da}`,_a=class{constructor(e){this.code=e,this.message=`${la} ${fa} (reason: ${e})`}code;name=`TaskAbortError`;message},va=(e,t)=>{if(typeof e!=`function`)throw TypeError(Ua(32))},ya=()=>{},ba=(e,t=ya)=>(e.catch(t),e),xa=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),Sa=e=>{if(e.aborted)throw new _a(e.reason)};function Ca(e,t){let n=ya;return new Promise((r,i)=>{let a=()=>i(new _a(e.reason));if(e.aborted){a();return}n=xa(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=ya})}var wa=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof _a?`cancelled`:`rejected`,error:e}}finally{t?.()}},Ta=e=>t=>ba(Ca(e,t).then(t=>(Sa(e),t))),Ea=e=>{let t=Ta(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:Da}=Object,Oa={},ka=`listenerMiddleware`,Aa=(e,t)=>{let n=t=>xa(e,()=>t.abort(e.reason));return(r,i)=>{va(r,`taskExecutor`);let a=new AbortController;n(a);let o=wa(async()=>{Sa(e),Sa(a.signal);let t=await r({pause:Ta(a.signal),delay:Ea(a.signal),signal:a.signal});return Sa(a.signal),t},()=>a.abort(ma));return i?.autoJoin&&t.push(o.catch(ya)),{result:Ta(e)(o),cancel(){a.abort(pa)}}}},ja=(e,t)=>{let n=async(n,r)=>{Sa(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await Ca(t,Promise.race(a));return Sa(t),e}finally{i()}};return((e,t)=>ba(n(e,t)))},Ma=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=Fi(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(Ua(21));return va(a,`options.listener`),{predicate:i,type:t,effect:a}},Na=Da(e=>{let{type:t,predicate:n,effect:r}=Ma(e);return{id:Zi(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(Ua(22))}}},{withTypes:()=>Na}),Pa=(e,t)=>{let{type:n,effect:r,predicate:i}=Ma(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},Fa=e=>{e.pending.forEach(e=>{e.abort(ha)})},Ia=(e,t)=>()=>{for(let e of t.keys())Fa(e);e.clear()},La=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},Ra=Da(Fi(`${ka}/add`),{withTypes:()=>Ra}),za=Fi(`${ka}/removeAll`),Ba=Da(Fi(`${ka}/remove`),{withTypes:()=>Ba}),Va=(...e)=>{console.error(`${ka}/error`,...e)},Ha=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=Va}=e;va(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&Fa(e)}),c=(e=>{let n=Pa(t,e)??Na(e);return s(n)});Da(c,{withTypes:()=>c});let l=e=>{let n=Pa(t,e);return n&&(n.unsubscribe(),e.cancelActive&&Fa(n)),!!n};Da(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=ja(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,Da({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:Ea(u.signal),pause:Ta(u.signal),extra:a,signal:u.signal,fork:Aa(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(ha),n.delete(e))})},cancel:()=>{u.abort(ha),e.pending.delete(u)},throwIfCancelled:()=>{Sa(u.signal)}})))}catch(e){e instanceof _a||La(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(ga),i(e),e.pending.delete(u)}},d=Ia(t,n);return{middleware:e=>n=>r=>{if(!cr(r))return n(r);if(Ra.match(r))return c(r.payload);if(za.match(r)){d();return}if(Ba.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===Oa)throw Error(Ua(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,La(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=Oa}return s},startListening:c,stopListening:l,clearListeners:d}};function Ua(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 Wa=na({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),Ga=Wa.actions,Ka=Ga.setMargin,qa=Ga.setLayout,Ja=Ga.setChartSize,Ya=Ga.setScale,Xa=Wa.reducer;function Za(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function H(e){return Number.isFinite(e)}function Qa(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function $a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eo(e){for(var t=1;t{if(t&&n){var r=n.width,i=n.height,a=t.align,o=t.verticalAlign,s=t.layout,c=t.position,l=t.offset,u=l===void 0?0:l;if(c!=null){if(ke(c)){if(c===`top`&&P(e.top))return eo(eo({},e),{},{top:e.top+(i||0)+u});if(c===`bottom`&&P(e.bottom))return eo(eo({},e),{},{bottom:e.bottom+(i||0)+u});if(c===`left`&&P(e.left))return eo(eo({},e),{},{left:e.left+(r||0)+u});if(c===`right`&&P(e.right))return eo(eo({},e),{},{right:e.right+(r||0)+u})}return e}if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&P(e[a]))return eo(eo({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&P(e[o]))return eo(eo({},e),{},{[o]:e[o]+(i||0)})}return e},ao=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,oo=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},so=(e,t,n)=>{if(!e)return null;var r=e.duplicateDomain,i=e.type,a=e.range,o=e.scale,s=e.realScaleType,c=e.isCategorical,l=e.categoricalDomain,u=e.tickCount,d=e.ticks,f=e.niceTicks,p=e.axisType;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?se(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return H(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(ye):c&&l?l.map((e,t)=>{var n=o.map(e);return H(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(ye):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return H(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(ye):o.domain().map((e,t)=>{var n=o.map(e);return H(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(ye)},co={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:Et,none:xt,silhouette:Dt,wiggle:Ot,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},lo=(e,t,n)=>{var r=co[n]??xt,i=Tt().keys(t).value((e,t)=>Number(U(e,t,0))).order(St).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=U(e[i],t[r],0);Array.isArray(a)&&a.length===2&&P(a[0])&&P(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function uo(e){return e==null?void 0:String(e)}function fo(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!_e(i[t.dataKey])){var s=ge(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=U(i,_e(o)?t.dataKey:o),l=t.scale.map(c);return P(l)?l:null}var po=e=>{var t=e.flat(2).filter(P);return[Math.min(...t),Math.max(...t)]},mo=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],ho=(e,t,n)=>{if(e!=null&&Object.keys(e).length!==0)return mo(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var o=a.stackedData.reduce((e,r)=>{var i=po(Za(r,t,n));return!H(i[0])||!H(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(o[0],r[0]),Math.max(o[1],r[1])]},[1/0,-1/0]))},go=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,_o=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,vo=(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 i=Xn(t,e=>e.coordinate),a=[],o=0,s=1,c=i.length;su&&(d=Math.min(f,d));return d===1/0?0:d}return n?void 0:0};function yo(e){var t=e.tooltipEntrySettings,n=e.dataKey,r=e.payload,i=e.value,a=e.name;return eo(eo({},t),{},{dataKey:n,payload:r,value:i,name:a})}function bo(e,t){if(e!=null)return String(e);if(typeof t==`string`)return t}var xo=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},So=(e,t)=>t===`centric`?e.angle:e.radius,Co=e=>e.layout.width,wo=e=>e.layout.height,To=e=>e.layout.scale,Eo=e=>e.layout.margin,Do=R(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Oo=R(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),ko=`data-recharts-item-index`;function Ao(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jo(e){for(var t=1;te.brush.height;function Io(e){return Oo(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Lo(e){return Oo(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Ro(e){return Do(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}function zo(e){return Do(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}var Bo=R([Co,wo,Eo,Fo,Io,Lo,Ro,zo,Zn,Qn],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=jo(jo({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=io(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return jo(jo({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),Vo=R(Bo,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),Ho=R(Co,wo,(e,t)=>({x:0,y:0,width:e,height:t})),Uo=(0,s.createContext)(null),Wo=()=>(0,s.useContext)(Uo)!=null,Go=e=>e.brush,Ko=R([Go,Bo,Eo],(e,t,n)=>({height:e.height,x:P(e.x)?e.x:t.left,y:P(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:P(e.width)?e.width:t.width}));function qo(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function Jo(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=qo(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function Yo(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return Jo(e,t,{leading:r,maxWait:t,trailing:i})}var Xo=function(e,t){var n=[...arguments].slice(2);if(typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e)){if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}}},Zo={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},Qo=(e,t,n)=>{var r=n.width,i=r===void 0?Zo.width:r,a=n.height,o=a===void 0?Zo.height:a,s=n.aspect,c=n.maxHeight,l=le(i)?e:Number(i),u=le(o)?t:Number(o);return s&&s>0&&(l?u=l/s:u&&(l=u*s),c&&u!=null&&u>c&&(u=c)),{calculatedWidth:l,calculatedHeight:u}},$o={width:0,height:0,overflow:`visible`},es={width:0,overflowX:`visible`},ts={height:0,overflowY:`visible`},ns={},rs=e=>{var t=e.width,n=e.height,r=le(t),i=le(n);return r&&i?$o:r?es:i?ts:ns};function is(e){var t=e.width,n=e.height,r=e.aspect,i=t,a=n;return i===void 0&&a===void 0?(i=Zo.width,a=Zo.height):i===void 0?i=r&&r>0?void 0:Zo.width:a===void 0&&(a=r&&r>0?void 0:Zo.height),{width:i,height:a}}var as=[`aspect`,`initialDimension`,`width`,`height`,`minWidth`,`minHeight`,`maxHeight`,`children`,`debounce`,`id`,`className`,`onResize`,`style`];function os(){return os=Object.assign?Object.assign.bind():function(e){for(var t=1;t>>>>>>> 85fe552 (feat(routing): add same-provider credit-expiry-first scheduling):internal/webui/static/assets/CartesianChart-Dc6HOANc.js +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ms(e,t){if(e){if(typeof e==`string`)return hs(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)?hs(e,t):void 0}}function hs(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n({width:n,height:r}),[n,r]);return xs(i)?s.createElement(bs.Provider,{value:i},t):null}var Cs=()=>(0,s.useContext)(bs),ws=(0,s.forwardRef)((e,t)=>{var n=e.aspect,r=e.initialDimension,i=r===void 0?Zo.initialDimension:r,a=e.width,c=e.height,l=e.minWidth,u=l===void 0?Zo.minWidth:l,d=e.minHeight,f=e.maxHeight,p=e.children,m=e.debounce,h=m===void 0?Zo.debounce:m,g=e.id,_=e.className,v=e.onResize,y=e.style,b=y===void 0?{}:y,x=vs(e,as),S=(0,s.useRef)(null),C=(0,s.useRef)();C.current=v,(0,s.useImperativeHandle)(t,()=>S.current);var w=fs((0,s.useState)({containerWidth:i.width,containerHeight:i.height}),2),T=w[0],E=w[1],D=(0,s.useCallback)((e,t)=>{E(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,s.useEffect)(()=>{if(S.current==null||typeof ResizeObserver>`u`)return be;var e=e=>{var t,n=e[0];if(n!=null){var r=n.contentRect,i=r.width,a=r.height;D(i,a),(t=C.current)==null||t.call(C,i,a)}};h>0&&(e=Yo(e,h,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=S.current.getBoundingClientRect(),r=n.width,i=n.height;return D(r,i),t.observe(S.current),()=>{t.disconnect()}},[D,h]);var O=T.containerWidth,k=T.containerHeight;Xo(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var A=Qo(O,k,{width:a,height:c,aspect:n,maxHeight:f}),j=A.calculatedWidth,M=A.calculatedHeight;return Xo(O<0||k<0||j!=null&&j>0||M!=null&&M>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.`,j,M,a,c,u,d,n),s.createElement(`div`,os({id:g?`${g}`:void 0,className:o(`recharts-responsive-container`,_),style:cs(cs({},b),{},{width:a,height:c,minWidth:u,minHeight:d,maxHeight:f}),ref:S},x),s.createElement(`div`,{style:rs({width:a,height:c})},s.createElement(Ss,{width:j,height:M},p)))}),Ts=(0,s.forwardRef)((e,t)=>{var n=Cs();if(Qa(n.width)&&Qa(n.height))return e.children;var r=is({width:e.width,height:e.height,aspect:e.aspect}),i=r.width,a=r.height,o=Qo(void 0,void 0,{width:i,height:a,aspect:e.aspect,maxHeight:e.maxHeight}),c=o.calculatedWidth,l=o.calculatedHeight;return P(c)&&P(l)?s.createElement(Ss,{width:c,height:l},e.children):s.createElement(ws,os({},e,{width:i,height:a,ref:t}))}),Es=()=>{var e=Wo(),t=L(Vo),n=L(Ko),r=L(Go)?.padding;return!e||!n||!r?t:{width:n.width-r.left-r.right,height:n.height-r.top-r.bottom,x:r.left,y:r.top}},Ds={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},Os=()=>L(Bo)??Ds,ks=()=>L(Co),As=()=>L(wo),W=e=>e.layout.layoutType,js=()=>L(W),Ms=()=>{var e=js();if(e===`horizontal`||e===`vertical`)return e},Ns=e=>{var t=e.layout.layoutType;if(t===`centric`||t===`radial`)return t},Ps=()=>js()!==void 0,Fs=e=>{var t=I(),n=Wo(),r=e.width,i=e.height,a=Cs(),o=r,c=i;return a&&(o=a.width>0?a.width:r,c=a.height>0?a.height:i),(0,s.useEffect)(()=>{!n&&Qa(o)&&Qa(c)&&t(Ja({width:o,height:c}))},[t,n,o,c]),null},Is=na({name:`legend`,initialState:{settings:{layout:`horizontal`,align:`center`,verticalAlign:`bottom`,itemSorter:`value`,position:void 0,offset:0},size:{width:0,height:0},payload:[]},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,e.settings.position=t.payload.position,e.settings.offset=t.payload.offset},addLegendPayload:{reducer(e,t){e.payload.push(B(t.payload))},prepare:V()},replaceLegendPayload:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=Oi(e).payload.indexOf(B(r));a>-1&&(e.payload[a]=B(i))},prepare:V()},removeLegendPayload:{reducer(e,t){var n=Oi(e).payload.indexOf(B(t.payload));n>-1&&e.payload.splice(n,1)},prepare:V()}}}),Ls=Is.actions;Ls.setLegendSize,Ls.setLegendSettings;var Rs=Ls.addLegendPayload,zs=Ls.replaceLegendPayload,Bs=Ls.removeLegendPayload,Vs=Is.reducer,Hs=a((e=>{var t=n();t.useSyncExternalStore,t.useRef,t.useEffect,t.useMemo,t.useDebugValue}));a(((e,t)=>{t.exports=Hs()}))();function Us(e){e()}function Ws(){let e=null,t=null;return{clear(){e=null,t=null},notify(){Us(()=>{let t=e;for(;t;)t.callback(),t=t.next})},get(){let t=[],n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0,i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var Gs={notify(){},get:()=>[]};function Ks(e,t){let n,r=Gs,i=0,a=!1;function o(e){u();let t=r.subscribe(e),n=!1;return()=>{n||(n=!0,t(),d())}}function s(){r.notify()}function c(){m.onStateChange&&m.onStateChange()}function l(){return a}function u(){i++,n||(n=t?t.addNestedSub(c):e.subscribe(c),r=Ws())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Gs)}function f(){a||(a=!0,u())}function p(){a&&(a=!1,d())}let m={addNestedSub:o,notifyNestedSubs:s,handleChangeWrapper:c,isSubscribed:l,trySubscribe:f,tryUnsubscribe:p,getListeners:()=>r};return m}var qs=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Js=typeof navigator<`u`&&navigator.product===`ReactNative`,Ys=qs||Js?s.useLayoutEffect:s.useEffect;function Xs(e,t){return e===t?e!==0||t!==0||1/e==1/t:e!==e&&t!==t}function Zs(e,t){if(Xs(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r{let e=Ks(i);return{store:i,subscription:e,getServerState:r?()=>r:void 0}},[i,r]),o=s.useMemo(()=>i.getState(),[i]);Ys(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]);let c=n||tc;return s.createElement(c.Provider,{value:a},t)}var rc=nc,ic=new Set([`axisLine`,`tickLine`,`activeBar`,`activeDot`,`activeLabel`,`activeShape`,`allowEscapeViewBox`,`background`,`cursor`,`dot`,`label`,`line`,`margin`,`padding`,`position`,`shape`,`style`,`tick`,`wrapperStyle`,`radius`,`throttledEvents`]);function ac(e,t){return e==null&&t==null?!0:typeof e==`number`&&typeof t==`number`?e===t||e!==e&&t!==t:e===t}function oc(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(ic.has(n)){if(e[n]==null&&t[n]==null)continue;if(!Zs(e[n],t[n]))return!1}else if(!ac(e[n],t[n]))return!1;return!0}var sc={devToolsEnabled:!0,isSsr:!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)};function cc(e,t){return pc(e)||fc(e,t)||uc(e,t)||lc()}function lc(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uc(e,t){if(e){if(typeof e==`string`)return dc(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)?dc(e,t):void 0}}function dc(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nsc.isSsr||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),2),t=e[0],n=e[1];return(0,s.useEffect)(()=>{if(window.matchMedia){var e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>{n(e.matches)};return e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}}},[]),t}var hc=()=>L(e=>e.rootProps.accessibilityLayer)??!0;function gc(){return gc=Object.assign?Object.assign.bind():function(e){for(var t=1;tH(e.x)&&H(e.y),wc=e=>e.base!=null&&Cc(e.base)&&Cc(e),Tc=e=>e.x,Ec=e=>e.y,Dc=(e,t)=>{if(typeof e==`function`)return e;var n=`curve${ve(e)}`;if((n===`curveMonotone`||n===`curveBump`)&&t){var r=Sc[`${n}${t===`vertical`?`Y`:`X`}`];if(r)return r}return Sc[n]||Ve},Oc={connectNulls:!1,type:`linear`},kc=e=>{var t=e.type,n=t===void 0?Oc.type:t,r=e.points,i=r===void 0?[]:r,a=e.baseLine,o=e.layout,s=e.connectNulls,c=s===void 0?Oc.connectNulls:s,l=Dc(n,o),u=c?i.filter(Cc):i;if(Array.isArray(a)){var d,f=i.map((e,t)=>vc(vc({},e),{},{base:a[t]}));return d=o===`vertical`?Ge().y(Ec).x1(Tc).x0(e=>e.base.x):Ge().x(Tc).y1(Ec).y0(e=>e.base.y),d.defined(wc).curve(l)(c?f.filter(wc):f)}return(o===`vertical`&&P(a)?Ge().y(Ec).x1(Tc).x0(a):P(a)?Ge().x(Tc).y1(Ec).y0(a):We().x(Tc).y(Ec)).defined(Cc).curve(l)(u)},Ac=e=>{var t=e.className,n=e.points,r=e.path,i=e.pathRef,a=js();if((!n||!n.length)&&!r)return null;var c={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},l=n&&n.length?kc(c):r;return s.createElement(`path`,gc({},p(e),At(e),{className:o(`recharts-curve`,t),d:l===null?void 0:l,ref:i}))},jc=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],Mc=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),Nc=(e,t)=>n=>Mc(jc(e,t),n),Pc=(e,t)=>n=>Mc([...jc(e,t).map((e,t)=>e*t).slice(1),0],n),Fc=e=>{var t,n=e.split(`(`);if(n.length!==2||n[0]!==`cubic-bezier`)return null;var r=(t=n[1])==null||(t=t.split(`)`)[0])==null?void 0:t.split(`,`);if(r==null||r.length!==4)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]},Ic=function(){var e=[...arguments];if(e.length===1)switch(e[0]){case`linear`:return[0,0,1,1];case`ease`:return[.25,.1,.25,1];case`ease-in`:return[.42,0,1,1];case`ease-out`:return[.42,0,.58,1];case`ease-in-out`:return[0,0,.58,1];default:var t=Fc(e[0]);if(t)return t}return e.length===4?e:[0,0,1,1]},Lc=(e,t,n,r)=>{var i=Nc(e,n),a=Nc(t,r),o=Pc(e,n),s=e=>e>1?1:e<0?0:e,c=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var c=i(n)-t,l=o(n);if(Math.abs(c-t)<1e-4||l<1e-4)return a(n);n=s(n-c/l)}return a(n)};return c.isStepper=!1,c},Rc=function(){return Lc(...Ic(...arguments))},zc=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.stiff,n=t===void 0?100:t,r=e.damping,i=r===void 0?8:r,a=e.dt,o=a===void 0?16.67:a,s=1,c=[0],l=0,u=0,d=1e4,f=0;f{if(e<=0)return 0;if(e>=1)return s;var t=e*h,n=Math.floor(t),r=t-n;return(c[n]??0)+((c[n+1]??0)-(c[n]??0))*r}},Bc=e=>{if(typeof e==`string`)switch(e){case`ease`:case`ease-in-out`:case`ease-out`:case`ease-in`:case`linear`:return Rc(e);case`spring`:return zc();default:if(e.split(`(`)[0]===`cubic-bezier`)return Rc(e)}return typeof e==`function`?e:null},Vc=(0,s.createContext)((e,t,n)=>{var r,i=a=>{var o=t.tick(a);if(t.getState()===`active`){if(n(t.getInterpolated()),t.getProgress()===1){t.complete(),r=void 0;return}r=e.setTimeout(i,o);return}r=e.setTimeout(i,o)};return r=e.setTimeout(i,0),()=>r?.()});Vc.Provider;function Hc(e){var t=(0,s.useContext)(Vc);return(0,s.useMemo)(()=>e??t,[e,t])}function Uc(e,t,n){return(t=Wc(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wc(e){var t=Gc(e,`string`);return typeof t==`symbol`?t:t+``}function Gc(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Kc=`init`,qc=`pending`,Jc=`active`,Yc=`completed`;function Xc(e){return Math.max(0,e)}var Zc=class{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var t;Uc(this,`state`,Kc),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=Xc(e.animationDuration),this.animationBegin=Xc(e.animationBegin),this.progress=0,this.from=e.from,this.to=e.to,this.easing=e.easing,(t=e.onAnimationStart)==null||t.call(e)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(e){if(this.getState()===Kc)return this.state=qc,this.beginStartedTime=e,this.animationBegin;if(this.getState()===qc){if(this.beginStartedTime==null)throw Error();var t=e-this.beginStartedTime;return t>=this.animationBegin?(this.state=Jc,this.animationStartedTime=e,this.nextAnimationUpdate(0)):Xc(this.animationBegin-t)}if(this.getState()===Jc){if(this.animationStartedTime==null)throw Error();var n=e-this.animationStartedTime;return this.setProgress(n/this.animationDuration),this.nextAnimationUpdate(n)}return 0}setProgress(e){this.progress=Math.min(1,Math.max(0,e))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state===`active`){var e;(e=this.onAnimationEnd)==null||e.call(this)}this.state=Yc}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}},Qc=class extends Zc{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(he(this.getFrom(),this.getTo(),this.getProgress()))}},$c=class{setTimeout(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):r=requestAnimationFrame(i)};return r=requestAnimationFrame(i),()=>{r!=null&&cancelAnimationFrame(r)}}};function el(e,t){return al(e)||il(e,t)||nl(e,t)||tl()}function tl(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nl(e,t){if(e){if(typeof e==`string`)return rl(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)?rl(e,t):void 0}}function rl(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{},onAnimationStart:()=>{}},sl=0,cl=1;function ll(e){var t=Rt(e,ol),n=t.animationId,r=t.isActive,i=t.canBegin,a=t.duration,o=t.easing,c=t.begin,l=t.onAnimationEnd,u=t.onAnimationStart,d=t.children,f=mc(),p=r===`auto`?!sc.isSsr&&!f:r,m=Hc(t.animationController),h=el((0,s.useState)(p?sl:cl),2),g=h[0],_=h[1];return(0,s.useEffect)(()=>{p||_(cl)},[p]),(0,s.useEffect)(()=>{var e=Bc(o);return!p||!i||e==null?be:m(new $c,new Qc({animationId:n,easing:e,animationDuration:a,animationBegin:c,onAnimationStart:u,onAnimationEnd:l,from:sl,to:cl}),_)},[m,n,p,i,a,o,c,u,l]),d(Number(g))}function ul(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`animation-`,n=(0,s.useRef)(fe(t)),r=(0,s.useRef)(e);return r.current!==e&&(n.current=fe(t),r.current=e),n.current}function dl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fl(e){for(var t=1;te*180/Math.PI,vl=(e,t,n,r)=>({x:e+Math.cos(-gl*r)*n,y:t+Math.sin(-gl*r)*n}),yl=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2},bl=(e,t)=>{var n=e.x,r=e.y,i=t.x,a=t.y;return Math.sqrt((n-i)**2+(r-a)**2)},xl=(e,t)=>{var n=e.x,r=e.y,i=t.cx,a=t.cy,o=bl({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var s=(n-i)/o,c=Math.acos(s);return r>a&&(c=2*Math.PI-c),{radius:o,angle:_l(c),angleInRadian:c}},Sl=e=>{var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},Cl=(e,t)=>{var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),a=Math.floor(r/360);return e+Math.min(i,a)*360},wl=(e,t)=>{var n=e.relativeX,r=e.relativeY,i=xl({x:n,y:r},t),a=i.radius,o=i.angle,s=t.innerRadius,c=t.outerRadius;if(ac||a===0)return null;var l=Sl(t),u=l.startAngle,d=l.endAngle,f=o,p;if(u<=d){for(;f>d;)f-=360;for(;f=u&&f<=d}else{for(;f>u;)f-=360;for(;f=d&&f<=u}return p?fl(fl({},t),{},{radius:a,angle:Cl(f,t)}):null};function Tl(e){return M(e)?NaN:Number(e)}function El(e){return e?(e=Tl(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function Dl(e,t,n){n&&typeof n!=`number`&&Un(e,t,n)&&(t=n=void 0),e=El(e),t===void 0?(t=e,e=0):t=El(t),n=n===void 0?ee.chartData,kl=R([Ol],e=>{var t=e.chartData==null?0:e.chartData.length-1;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Al=(e,t,n,r)=>r?kl(e):Ol(e),jl=(e,t,n)=>n?kl(e):Ol(e),Ml=R([Al],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t==null?[]:t.slice(n,r+1)});R([kl],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t==null?[]:t.slice(n,r+1)});var Nl=R([Ol],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t==null?[]:t.slice(n,r+1)});function Pl(e,t){return zl(e)||Rl(e,t)||Il(e,t)||Fl()}function Fl(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Il(e,t){if(e){if(typeof e==`string`)return Ll(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)?Ll(e,t):void 0}}function Ll(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),A(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),A(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||en)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;tr?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,A=r.constructor,j=r.s==i.s?1:-1,M=r.d,N=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=N.length,T=M.length,g=new A(j),_=g.d=[],u=0;N[u]==(M[u]||0);)++u;if(N[u]>(M[u]||0)&&--l,x=o==null?o=A.precision:s?o+(S(r)-S(i))+1:o,x<0)return new A(0);if(x=x/p+2|0,u=0,O==1)for(d=0,N=N[0],x++;(u1&&(N=e(N,d),M=e(M,d),O=N.length,T=M.length),w=O,v=M.slice(0,O),y=v.length;y=f/2&&++E;do d=0,c=t(N,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(N,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;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(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),rh||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a0;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function A(e,t){if(e.length>t)return e.length=t,!0}function j(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=j,i.config=i.set=M,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i)}if((i=e[r=`LN10`])!==void 0){if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i)}return this}r=j(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}))());function Wl(e){return e===0?1:Math.floor(new G.default(e).abs().log(10).toNumber())+1}function Gl(e,t,n){for(var r=new G.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}function Kl(e,t){return Zl(e)||Xl(e,t)||Jl(e,t)||ql()}function ql(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jl(e,t){if(e){if(typeof e==`string`)return Yl(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)?Yl(e,t):void 0}}function Yl(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=Kl(e,2),n=t[0],r=t[1],i=n,a=r;return n>r&&(i=r,a=n),[i,a]},$l=(e,t,n)=>{if(e.lte(0))return new G.default(0);var r=Wl(e.toNumber()),i=new G.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new G.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?new G.default(s.toNumber()):new G.default(Math.ceil(s.toNumber()))},eu=(e,t,n)=>{if(e.lte(0))return new G.default(0);var r=[1,2,2.5,5],i=e.toNumber(),a=Math.floor(new G.default(i).abs().log(10).toNumber()),o=new G.default(10).pow(a),s=e.div(o).toNumber(),c=r.findIndex(e=>e>=s-1e-10);if(c===-1&&(o=o.mul(10),c=0),c+=n,c>=r.length){var l=Math.floor(c/r.length);c%=r.length,o=o.mul(new G.default(10).pow(l))}var u=r[c]??1,d=new G.default(u).mul(o);return t?d:new G.default(Math.ceil(d.toNumber()))},tu=(e,t,n)=>{var r=new G.default(1),i=new G.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new G.default(10).pow(Wl(e)-1),i=new G.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new G.default(Math.floor(e)))}else e===0?i=new G.default(Math.floor((t-1)/2)):n||(i=new G.default(Math.floor(e)));for(var o=Math.floor((t-1)/2),s=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:$l;if(!Number.isFinite((t-e)/(n-1)))return{step:new G.default(0),tickMin:new G.default(0),tickMax:new G.default(0)};var o=a(new G.default(t).sub(e).div(n-1),r,i),s;e<=0&&t>=0?s=new G.default(0):(s=new G.default(e).add(t).div(2),s=s.sub(new G.default(s).mod(o)));var c=Math.ceil(s.sub(e).div(o).toNumber()),l=Math.ceil(new G.default(t).sub(s).div(o).toNumber()),u=c+l+1;return u>n?nu(e,t,n,r,i+1,a):(u0?l+(n-u):l,c=t>0?c:c+(n-u)),{step:o,tickMin:s.sub(new G.default(c).mul(o)),tickMax:s.add(new G.default(l).mul(o))})},ru=function(e){var t=Kl(e,2),n=t[0],r=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,s=Math.max(i,2),c=Kl(Ql([n,r]),2),l=c[0],u=c[1];if(l===-1/0||u===1/0){var d=u===1/0?[l,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),u];return n>r?d.reverse():d}if(l===u)return tu(l,i,a);var f=nu(l,u,s,a,0,o===`snap125`?eu:$l),p=f.step,m=f.tickMin,h=f.tickMax,g=Gl(m,h.add(new G.default(.1).mul(p)),p);return n>r?g.reverse():g},iu=function(e,t){var n=Kl(e,2),r=n[0],i=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,s=Kl(Ql([r,i]),2),c=s[0],l=s[1];if(c===-1/0||l===1/0)return[r,i];if(c===l)return[c];var u=o===`snap125`?eu:$l,d=Math.max(t,2),f=u(new G.default(l).sub(c).div(d-1),a,0),p=[...Gl(new G.default(c),new G.default(l),f),l];if(a===!1){p=p.map(e=>Math.round(e));var m=p.length-1;m>0&&p[m]===p[m-1]&&(p=p.slice(0,m))}return r>i?p.reverse():p},au=e=>e.rootProps.barCategoryGap,ou=e=>e.rootProps.stackOffset,su=e=>e.rootProps.reverseStackOrder,cu=e=>e.options.chartName,lu=e=>e.rootProps.syncId,uu=e=>e.rootProps.syncMethod,du=e=>e.options.eventEmitter,fu=e=>e.rootProps.baseValue,pu={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},mu={allowDecimals:!1,allowDuplicatedCategory:!0,allowDataOverflow:!1,angle:0,angleAxisId:0,axisLine:!0,axisLineType:`polygon`,cx:0,cy:0,hide:!1,includeHidden:!1,label:!1,niceTicks:`auto`,orientation:`outer`,reversed:!1,scale:`auto`,tick:!0,tickLine:!0,tickSize:8,type:`auto`,zIndex:pu.axis},hu={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,niceTicks:`auto`,label:!1,orientation:`right`,radiusAxisId:0,reversed:!1,scale:`auto`,stroke:`#ccc`,tick:!0,tickCount:5,tickLine:!0,type:`auto`,zIndex:pu.axis},gu=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function _u(e,t,n){if(n!==`auto`)return n;if(e!=null)return ao(e,t)?`category`:`number`}function vu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yu(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},Ns],(e,t)=>{if(e!=null)return e;var n=_u(t,`angleAxis`,Cu.type)??`category`;return yu(yu({},Cu),{},{type:n})}),Eu=R([(e,t)=>e.polarAxis.radiusAxis[t],Ns],(e,t)=>{if(e!=null)return e;var n=_u(t,`radiusAxis`,wu.type)??`category`;return yu(yu({},wu),{},{type:n})}),Du=e=>e.polarOptions,Ou=R([Co,wo,Bo],yl),ku=R([Du,Ou],(e,t)=>{if(e!=null)return pe(e.innerRadius,t,0)}),Au=R([Du,Ou],(e,t)=>{if(e!=null)return pe(e.outerRadius,t,t*.8)}),ju=R([Du],e=>e==null?[0,0]:[e.startAngle,e.endAngle]);R([Tu,ju],gu);var Mu=R([Ou,ku,Au],(e,t,n)=>{if(e!=null&&t!=null&&n!=null)return[t,n]});R([Eu,Mu],gu);var Nu=R([W,Du,ku,Au,Co,wo],(e,t,n,r,i,a)=>{if(!(e!==`centric`&&e!==`radial`||t==null||n==null||r==null)){var o=t.cx,s=t.cy,c=t.startAngle,l=t.endAngle;return{cx:pe(o,i,i/2),cy:pe(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:l,clockWise:!1}}}),K=(e,t)=>t,Pu=(e,t,n)=>n;function Fu(e){return e?.id}function Iu(e,t,n){var r=t.chartData,i=r===void 0?[]:r,a=n.allowDuplicatedCategory,o=n.dataKey,s=new Map;return e.forEach(e=>{var t=e.data??i;if(t!=null&&t.length!==0){var n=Fu(e);t.forEach((t,r)=>{var i=o==null||a?r:String(U(t,o,null)),c=U(t,e.dataKey,0),l=s.has(i)?s.get(i):{};Object.assign(l,{[n]:c}),s.set(i,l)})}}),Array.from(s.values())}function Lu(e){return`stackId`in e&&e.stackId!=null&&e.dataKey!=null}var Ru=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function zu(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function Bu(e,t){if(e.length===t.length){for(var n=0;n{var t=W(e);return t===`horizontal`?`xAxis`:t===`vertical`?`yAxis`:t===`centric`?`angleAxis`:`radiusAxis`},Vu=e=>e.tooltip.settings.axisId;function Hu(e){if(e!=null){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(e){var t=i[0],n=i[1];return t<=n?e>=t&&e<=n:e>=n&&e<=t},bandwidth:n?()=>n.call(e):void 0,ticks:t?n=>t.call(e,n):void 0,map:(t,n)=>{var r=e(t);if(r!=null){if(e.bandwidth&&n!=null&&n.position){var i=e.bandwidth();switch(n.position){case`middle`:r+=i/2;break;case`end`:r+=i}}return r}}}}}var Uu=(e,t)=>{if(t!=null)switch(e){case`linear`:if(!Bl(t)){for(var n,r,i=0;ir)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t;default:return t}};function Wu(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Gu(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Ku(e){let t,n,r;e.length===2?(t=e===Wu||e===Gu?e:qu,n=e,r=e):(t=Wu,n=(t,n)=>Wu(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(in&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function qu(){return 0}function Ju(e){return e===null?NaN:+e}function*Yu(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var Xu=Ku(Wu),Zu=Xu.right;Xu.left,Ku(Ju).center;var Qu=class extends Map{constructor(e,t=nd){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get($u(this,e))}has(e){return super.has($u(this,e))}set(e,t){return super.set(ed(this,e),t)}delete(e){return super.delete(td(this,e))}};function $u({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function ed({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function td({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function nd(e){return typeof e==`object`&&e?e.valueOf():e}function rd(e=Wu){if(e===Wu)return id;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function id(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var ad=Math.sqrt(50),od=Math.sqrt(10),sd=Math.sqrt(2);function cd(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=ad?10:a>=od?5:a>=sd?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/lt&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*lt&&--c),c0))return[];if(e===t)return[e];let r=t=i))return[];let s=a-i+1,c=Array(s);if(r){if(o<0)for(let e=0;e=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function pd(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function md(e,t,n=0,r=1/0,i){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(i=i===void 0?id:rd(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));md(e,t,u,d,i)}let a=e[t],o=n,s=r;for(hd(e,n,t),i(e[r],a)>0&&hd(e,n,r);o0;)--s}i(e[n],a)===0?hd(e,n,s):(++s,hd(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function hd(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function gd(e,t,n){if(e=Float64Array.from(Yu(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return pd(e);if(t>=1)return fd(e);var r,i=(r-1)*t,a=Math.floor(i),o=fd(md(e,a).subarray(0,a+1));return o+(pd(e.subarray(a+1))-o)*(i-a)}}function _d(e,t,n=Ju){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,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function vd(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Jd(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Jd(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=Fd.exec(e))?new Zd(t[1],t[2],t[3],1):(t=Id.exec(e))?new Zd(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ld.exec(e))?Jd(t[1],t[2],t[3],t[4]):(t=Rd.exec(e))?Jd(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=zd.exec(e))?af(t[1],t[2]/100,t[3]/100,1):(t=Bd.exec(e))?af(t[1],t[2]/100,t[3]/100,t[4]):Vd.hasOwnProperty(e)?qd(Vd[e]):e===`transparent`?new Zd(NaN,NaN,NaN,0):null}function qd(e){return new Zd(e>>16&255,e>>8&255,e&255,1)}function Jd(e,t,n,r){return r<=0&&(e=t=n=NaN),new Zd(e,t,n,r)}function Yd(e){return e instanceof Od||(e=Kd(e)),e?(e=e.rgb(),new Zd(e.r,e.g,e.b,e.opacity)):new Zd}function Xd(e,t,n,r){return arguments.length===1?Yd(e):new Zd(e,t,n,r??1)}function Zd(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ed(Zd,Xd,Dd(Od,{brighter(e){return e=e==null?Ad:Ad**+e,new Zd(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?kd:kd**+e,new Zd(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Zd(nf(this.r),nf(this.g),nf(this.b),tf(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:Qd,formatHex:Qd,formatHex8:$d,formatRgb:ef,toString:ef}));function Qd(){return`#${rf(this.r)}${rf(this.g)}${rf(this.b)}`}function $d(){return`#${rf(this.r)}${rf(this.g)}${rf(this.b)}${rf((isNaN(this.opacity)?1:this.opacity)*255)}`}function ef(){let e=tf(this.opacity);return`${e===1?`rgb(`:`rgba(`}${nf(this.r)}, ${nf(this.g)}, ${nf(this.b)}${e===1?`)`:`, ${e})`}`}function tf(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nf(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function rf(e){return e=nf(e),(e<16?`0`:``)+e.toString(16)}function af(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new cf(e,t,n,r)}function of(e){if(e instanceof cf)return new cf(e.h,e.s,e.l,e.opacity);if(e instanceof Od||(e=Kd(e)),!e)return new cf;if(e instanceof cf)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new cf(o,s,c,e.opacity)}function sf(e,t,n,r){return arguments.length===1?of(e):new cf(e,t,n,r??1)}function cf(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ed(cf,sf,Dd(Od,{brighter(e){return e=e==null?Ad:Ad**+e,new cf(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?kd:kd**+e,new cf(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,i=2*n-r;return new Zd(df(e>=240?e-240:e+120,i,r),df(e,i,r),df(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new cf(lf(this.h),uf(this.s),uf(this.l),tf(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(){let e=tf(this.opacity);return`${e===1?`hsl(`:`hsla(`}${lf(this.h)}, ${uf(this.s)*100}%, ${uf(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function lf(e){return e=(e||0)%360,e<0?e+360:e}function uf(e){return Math.max(0,Math.min(1,e||0))}function df(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var ff=e=>()=>e;function pf(e,t){return function(n){return e+n*t}}function mf(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function hf(e){return(e=+e)==1?gf:function(t,n){return n-t?mf(t,n,e):ff(isNaN(t)?n:t)}}function gf(e,t){var n=t-e;return n?pf(e,n):ff(isNaN(e)?t:e)}var _f=(function e(t){var n=hf(t);function r(e,t){var r=n((e=Xd(e)).r,(t=Xd(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=gf(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function vf(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Sf(r,i)})),n=Tf.lastIndex;return nt&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function Rf(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?zf:Rf,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),Sf))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,Nf),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=Af,u()},d.clamp=function(e){return arguments.length?(o=e?!0:Ff,u()):o!==Ff},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function Hf(){return Vf()(Ff,Ff)}function Uf(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Wf(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 Gf(e){return e=Wf(Math.abs(e)),e?e[1]:NaN}function Kf(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function qf(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var Jf=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Yf(e){if(!(t=Jf.exec(e)))throw Error(`invalid format: `+e);var t;return new Xf({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]})}Yf.prototype=Xf.prototype;function Xf(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+``}Xf.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 Zf(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0)}return r>0?e.slice(0,r)+e.slice(i+1):e}var Qf;function $f(e,t){var n=Wf(e,t);if(!n)return Qf=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Qf=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Wf(e,Math.max(0,t+a-1))[0]}function ep(e,t){var n=Wf(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var tp={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Uf,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)=>ep(e*100,t),r:ep,s:$f,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function np(e){return e}var rp=Array.prototype.map,ip=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function ap(e){var t=e.grouping===void 0||e.thousands===void 0?np:Kf(rp.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?np:qf(rp.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=Yf(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):tp[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=tp[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=Zf(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Qf!==void 0?ip[8+Qf/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Gf(t)/3)))*3,r=10**-n,i=l((e=Yf(e),e.type=`f`,e),{suffix:ip[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var op,sp,cp;lp({thousands:`,`,grouping:[3],currency:[`$`,``]});function lp(e){return op=ap(e),sp=op.format,cp=op.formatPrefix,op}function up(e){return Math.max(0,-Gf(Math.abs(e)))}function dp(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Gf(t)/3)))*3-Gf(Math.abs(e)))}function fp(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Gf(t)-Gf(e))+1}function pp(e,t,n,r){var i=dd(e,t,n),a;switch(r=Yf(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=dp(i,o))&&(r.precision=a),cp(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=fp(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=up(i))&&(r.precision=a-(r.type===`%`)*2)}return sp(r)}function mp(e){var t=e.domain;return e.ticks=function(e){var n=t();return ld(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return pp(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s0;){if(l=ud(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function hp(){var e=Hf();return e.copy=function(){return Bf(e,hp())},yd.apply(e,arguments),mp(e)}function gp(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,Nf),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return gp(e).unknown(t)},e=arguments.length?Array.from(e,Nf):[0,1],mp(n)}function _p(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return ae**+t}function wp(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 Tp(e){return(t,n)=>-e(-t,n)}function Ep(e){let t=e(vp,yp),n=t.domain,r=10,i,a;function o(){return i=wp(r),a=Cp(r),n()[0]<0?(i=Tp(i),a=Tp(a),e(bp,xp)):e(vp,yp),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s0){for(;l<=u;++l)for(d=1;ds)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(fs)break;m.push(f)}m.length*2{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=Yf(n)).precision==null&&(n.trim=!0),n=sp(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*rn(_p(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function Dp(){let e=Ep(Vf()).domain([1,10]);return e.copy=()=>Bf(e,Dp()).base(e.base()),yd.apply(e,arguments),e}function Op(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function kp(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Ap(e){var t=1,n=e(Op(t),kp(t));return n.constant=function(n){return arguments.length?e(Op(t=+n),kp(t)):t},mp(n)}function jp(){var e=Ap(Vf());return e.copy=function(){return Bf(e,jp()).constant(e.constant())},yd.apply(e,arguments)}function Mp(e){return function(t){return t<0?-((-t)**+e):t**+e}}function Np(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Pp(e){return e<0?-e*e:e*e}function Fp(e){var t=e(Ff,Ff),n=1;function r(){return n===1?e(Ff,Ff):n===.5?e(Np,Pp):e(Mp(n),Mp(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},mp(t)}function Ip(){var e=Fp(Vf());return e.copy=function(){return Bf(e,Ip()).exponent(e.exponent())},yd.apply(e,arguments),e}function Lp(){return Ip.apply(null,arguments).exponent(.5)}function Rp(e){return Math.sign(e)*e*e}function zp(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function Bp(){var e=Hf(),t=[0,1],n=!1,r;function i(t){var i=zp(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(Rp(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain()},i.range=function(n){return arguments.length?(e.range((t=Array.from(n,Nf)).map(Rp)),i):t.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(t){return arguments.length?(e.clamp(t),i):e.clamp()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return Bp(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},yd.apply(i,arguments),mp(i)}function Vp(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r0?n[i-1]:e[0],i=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Hp().domain([e,t]).range(i).unknown(a)},yd.apply(mp(o),arguments)}function Up(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[Zu(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return Up().domain(e).range(t).unknown(n)},yd.apply(i,arguments)}var Wp=new Date,Gp=new Date;function J(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(sJ(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e){if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}}),n&&(i.count=(t,r)=>(Wp.setTime(+t),Gp.setTime(+r),e(Wp),e(Gp),Math.floor(n(Wp,Gp))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var Kp=J(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Kp.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?J(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Kp),Kp.range;var qp=1e3,Jp=qp*60,Yp=Jp*60,Xp=Yp*24,Zp=Xp*7,Qp=Xp*30,$p=Xp*365,em=J(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*qp)},(e,t)=>(t-e)/qp,e=>e.getUTCSeconds());em.range;var tm=J(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*qp)},(e,t)=>{e.setTime(+e+t*Jp)},(e,t)=>(t-e)/Jp,e=>e.getMinutes());tm.range;var nm=J(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Jp)},(e,t)=>(t-e)/Jp,e=>e.getUTCMinutes());nm.range;var rm=J(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*qp-e.getMinutes()*Jp)},(e,t)=>{e.setTime(+e+t*Yp)},(e,t)=>(t-e)/Yp,e=>e.getHours());rm.range;var im=J(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Yp)},(e,t)=>(t-e)/Yp,e=>e.getUTCHours());im.range;var am=J(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Jp)/Xp,e=>e.getDate()-1);am.range;var om=J(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Xp,e=>e.getUTCDate()-1);om.range;var sm=J(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Xp,e=>Math.floor(e/Xp));sm.range;function cm(e){return J(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Jp)/Zp)}var lm=cm(0),um=cm(1),dm=cm(2),fm=cm(3),pm=cm(4),mm=cm(5),hm=cm(6);lm.range,um.range,dm.range,fm.range,pm.range,mm.range,hm.range;function gm(e){return J(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/Zp)}var _m=gm(0),vm=gm(1),ym=gm(2),bm=gm(3),xm=gm(4),Sm=gm(5),Cm=gm(6);_m.range,vm.range,ym.range,bm.range,xm.range,Sm.range,Cm.range;var wm=J(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());wm.range;var Tm=J(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());Tm.range;var Em=J(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());Em.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:J(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)}),Em.range;var Dm=J(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());Dm.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:J(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)}),Dm.range;function Om(e,t,n,r,i,a){let o=[[em,1,qp],[em,5,5*qp],[em,15,15*qp],[em,30,30*qp],[a,1,Jp],[a,5,5*Jp],[a,15,15*Jp],[a,30,30*Jp],[i,1,Yp],[i,3,3*Yp],[i,6,6*Yp],[i,12,12*Yp],[r,1,Xp],[r,2,2*Xp],[n,1,Zp],[t,1,Qp],[t,3,3*Qp],[e,1,$p]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(dd(t/$p,n/$p,r));if(a===0)return Kp.every(Math.max(dd(t,n,r),1));let[s,c]=o[i/o[a-1][2]53)return null;`w`in r||(r.w=1),`Z`in r?(a=Pm(Fm(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?vm.ceil(a):vm(a),a=om.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=Nm(Fm(r.y,0,1)),o=a.getDay(),a=o>4||o===0?um.ceil(a):um(a),a=am.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else(`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?Pm(Fm(r.y,0,1)).getUTCDay():Nm(Fm(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,Pm(r)):Nm(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in Lm?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function A(e,n,r){return w(e,t,n,r)}function j(e,t,r){return w(e,n,t,r)}function M(e,t,n){return w(e,r,t,n)}function N(e){return o[e.getDay()]}function ee(e){return a[e.getDay()]}function te(e){return c[e.getMonth()]}function ne(e){return s[e.getMonth()]}function re(e){return i[+(e.getHours()>=12)]}function ie(e){return 1+~~(e.getMonth()/3)}function ae(e){return o[e.getUTCDay()]}function oe(e){return a[e.getUTCDay()]}function se(e){return c[e.getUTCMonth()]}function ce(e){return s[e.getUTCMonth()]}function le(e){return i[+(e.getUTCHours()>=12)]}function P(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var Lm={"-":``,_:` `,0:`0`},Y=/^\s*\d+/,Rm=/^%/,zm=/[\\^$*+?|[\]().{}]/g;function X(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function Um(e,t,n){var r=Y.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Wm(e,t,n){var r=Y.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Gm(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Km(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function qm(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Jm(e,t,n){var r=Y.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Ym(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Xm(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 Zm(e,t,n){var r=Y.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Qm(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function $m(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function eh(e,t,n){var r=Y.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function th(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function nh(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function rh(e,t,n){var r=Y.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function ih(e,t,n){var r=Y.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function ah(e,t,n){var r=Y.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function oh(e,t,n){var r=Rm.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function sh(e,t,n){var r=Y.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function ch(e,t,n){var r=Y.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function lh(e,t){return X(e.getDate(),t,2)}function uh(e,t){return X(e.getHours(),t,2)}function dh(e,t){return X(e.getHours()%12||12,t,2)}function fh(e,t){return X(1+am.count(Em(e),e),t,3)}function ph(e,t){return X(e.getMilliseconds(),t,3)}function mh(e,t){return ph(e,t)+`000`}function hh(e,t){return X(e.getMonth()+1,t,2)}function gh(e,t){return X(e.getMinutes(),t,2)}function _h(e,t){return X(e.getSeconds(),t,2)}function vh(e){var t=e.getDay();return t===0?7:t}function yh(e,t){return X(lm.count(Em(e)-1,e),t,2)}function bh(e){var t=e.getDay();return t>=4||t===0?pm(e):pm.ceil(e)}function xh(e,t){return e=bh(e),X(pm.count(Em(e),e)+(Em(e).getDay()===4),t,2)}function Sh(e){return e.getDay()}function Ch(e,t){return X(um.count(Em(e)-1,e),t,2)}function wh(e,t){return X(e.getFullYear()%100,t,2)}function Th(e,t){return e=bh(e),X(e.getFullYear()%100,t,2)}function Eh(e,t){return X(e.getFullYear()%1e4,t,4)}function Dh(e,t){var n=e.getDay();return e=n>=4||n===0?pm(e):pm.ceil(e),X(e.getFullYear()%1e4,t,4)}function Oh(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+X(t/60|0,`0`,2)+X(t%60,`0`,2)}function kh(e,t){return X(e.getUTCDate(),t,2)}function Ah(e,t){return X(e.getUTCHours(),t,2)}function jh(e,t){return X(e.getUTCHours()%12||12,t,2)}function Mh(e,t){return X(1+om.count(Dm(e),e),t,3)}function Nh(e,t){return X(e.getUTCMilliseconds(),t,3)}function Ph(e,t){return Nh(e,t)+`000`}function Fh(e,t){return X(e.getUTCMonth()+1,t,2)}function Ih(e,t){return X(e.getUTCMinutes(),t,2)}function Lh(e,t){return X(e.getUTCSeconds(),t,2)}function Rh(e){var t=e.getUTCDay();return t===0?7:t}function zh(e,t){return X(_m.count(Dm(e)-1,e),t,2)}function Bh(e){var t=e.getUTCDay();return t>=4||t===0?xm(e):xm.ceil(e)}function Vh(e,t){return e=Bh(e),X(xm.count(Dm(e),e)+(Dm(e).getUTCDay()===4),t,2)}function Hh(e){return e.getUTCDay()}function Uh(e,t){return X(vm.count(Dm(e)-1,e),t,2)}function Wh(e,t){return X(e.getUTCFullYear()%100,t,2)}function Gh(e,t){return e=Bh(e),X(e.getUTCFullYear()%100,t,2)}function Kh(e,t){return X(e.getUTCFullYear()%1e4,t,4)}function qh(e,t){var n=e.getUTCDay();return e=n>=4||n===0?xm(e):xm.ceil(e),X(e.getUTCFullYear()%1e4,t,4)}function Jh(){return`+0000`}function Yh(){return`%`}function Xh(e){return+e}function Zh(e){return Math.floor(e/1e3)}var Qh,$h,eg;tg({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 tg(e){return Qh=Im(e),$h=Qh.format,Qh.parse,eg=Qh.utcFormat,Qh.utcParse,Qh}function ng(e){return new Date(e)}function rg(e){return e instanceof Date?+e:+new Date(+e)}function ig(e,t,n,r,i,a,o,s,c,l){var u=Hf(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>gd(e,r/t))},n.copy=function(){return mg(t).domain(e)},bd.apply(n,arguments)}function hg(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=Ff,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*eCd,scaleDiverging:()=>gg,scaleDivergingLog:()=>_g,scaleDivergingPow:()=>yg,scaleDivergingSqrt:()=>bg,scaleDivergingSymlog:()=>vg,scaleIdentity:()=>gp,scaleImplicit:()=>xd,scaleLinear:()=>hp,scaleLog:()=>Dp,scaleOrdinal:()=>Sd,scalePoint:()=>Td,scalePow:()=>Ip,scaleQuantile:()=>Vp,scaleQuantize:()=>Hp,scaleRadial:()=>Bp,scaleSequential:()=>lg,scaleSequentialLog:()=>ug,scaleSequentialPow:()=>fg,scaleSequentialQuantile:()=>mg,scaleSequentialSqrt:()=>pg,scaleSequentialSymlog:()=>dg,scaleSqrt:()=>Lp,scaleSymlog:()=>jp,scaleThreshold:()=>Up,scaleTime:()=>ag,scaleUtc:()=>og,tickFormat:()=>pp});function Sg(e){var t=xg;if(e in t&&typeof t[e]==`function`)return t[e]();var n=`scale${ve(e)}`;if(n in t&&typeof t[n]==`function`)return t[n]()}function Cg(e,t,n){if(typeof e==`function`)return e.copy().domain(t).range(n);if(e!=null){var r=Sg(e);if(r!=null)return r.domain(t).range(n),r}}function wg(e,t,n,r){if(n!=null&&r!=null)return typeof e.scale==`function`?Cg(e.scale,n,r):Cg(t,n,r)}function Tg(e){return`scale${ve(e)}`}function Eg(e){return Tg(e)in xg}var Dg=(e,t,n)=>{if(e!=null){var r=e.scale,i=e.type;if(r===`auto`)return i===`category`&&n&&(n.indexOf(`LineChart`)>=0||n.indexOf(`AreaChart`)>=0||n.indexOf(`ComposedChart`)>=0&&!t)?`point`:i===`category`?`band`:`linear`;if(typeof r==`string`)return Eg(r)?r:`point`}};function Og(e,t){for(var n=0,r=e.length,i=e[0]t)?n=a+1:r=a}return n}function kg(e,t){if(e){var n=t??e.domain(),r=n.map(t=>e(t)??0),i=e.range();if(!(n.length===0||i.length<2))return e=>{var t=Og(r,e);if(t<=0)return n[0];if(t>=n.length)return n[n.length-1];var i=r[t-1]??0,a=r[t]??0;return Math.abs(e-i)<=Math.abs(e-a)?n[t-1]:n[t]}}}function Ag(e){if(e!=null)return`invert`in e&&typeof e.invert==`function`?e.invert.bind(e):kg(e,void 0)}function jg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Mg(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);ne.cartesianAxis.xAxis[t],Gg=(e,t)=>Wg(e,t)??Ug,Z={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Hg,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:60},Kg=(e,t)=>e.cartesianAxis.yAxis[t],qg=(e,t)=>Kg(e,t)??Z,Jg={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:``},Yg=(e,t)=>e.cartesianAxis.zAxis[t]??Jg,Xg=(e,t,n)=>{switch(t){case`xAxis`:return Gg(e,n);case`yAxis`:return qg(e,n);case`zAxis`:return Yg(e,n);case`angleAxis`:return Tu(e,n);case`radiusAxis`:return Eu(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},Zg=(e,t,n)=>{switch(t){case`xAxis`:return Gg(e,n);case`yAxis`:return qg(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},Qg=(e,t,n)=>{switch(t){case`xAxis`:return Gg(e,n);case`yAxis`:return qg(e,n);case`angleAxis`:return Tu(e,n);case`radiusAxis`:return Eu(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},$g=e=>e.graphicalItems.cartesianItems.some(e=>e.type===`bar`)||e.graphicalItems.polarItems.some(e=>e.type===`radialBar`);function e_(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 t_=e=>e.graphicalItems.cartesianItems,n_=R([K,Pu],e_),r_=(e,t,n)=>e.filter(n).filter(e=>t?.includeHidden===!0||!e.hide),i_=R([t_,Xg,n_],r_,{memoizeOptions:{resultEqualityCheck:zu}}),a_=R([i_],e=>e.filter(e=>e.type===`area`||e.type===`bar`).filter(Lu)),o_=e=>e.filter(e=>!(`stackId`in e)||e.stackId===void 0),s_=R([i_],o_),c_=e=>e.map(e=>e.data).filter(Boolean).flat(1),l_=R([i_],e=>e.some(e=>!e.data)),u_=R([i_],c_,{memoizeOptions:{resultEqualityCheck:zu}}),d_=(e,t)=>{var n=t.chartData,r=n===void 0?[]:n,i=t.dataStartIndex,a=t.dataEndIndex;return e.length>0?e:r.slice(i,a+1)},f_=R([u_,Al],d_),p_=(e,t,n)=>t?.dataKey==null?n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:U(e,t)}))):e.map(e=>({value:e})):e.map(e=>({value:U(e,t.dataKey)})),m_=(e,t,n,r,i,a)=>{var o=r.chartData,s=o===void 0?[]:o,c=r.dataStartIndex,l=r.dataEndIndex,u=p_(e,t,n);return i&&t?.dataKey!=null&&a.length>0?[...s.slice(c,l+1).map(e=>({value:U(e,t.dataKey)})).filter(e=>e.value!=null),...u]:u},h_=R([f_,Xg,i_,Al,l_,u_],m_);function g_(e){if(ue(e)||e instanceof Date){var t=Number(e);if(H(t))return t}}function __(e){if(Array.isArray(e)){var t=[g_(e[0]),g_(e[1])];return Bl(t)?t:void 0}var n=g_(e);if(n!=null)return[n,n]}function v_(e){return e.map(g_).filter(ye)}function y_(e,t){var n=g_(e),r=g_(t);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var b_=R([h_],e=>e?.map(e=>e.value).sort(y_));function x_(e,t){switch(e){case`xAxis`:return t.direction===`x`;case`yAxis`:return t.direction===`y`;default:return!1}}function S_(e,t,n){if(!n||!n.length)return[];var r;if(typeof t==`number`&&!ce(t))r=t;else if(Array.isArray(t)){var i=v_(t);i.length>0&&(r=Math.max(...i))}return r==null?[]:v_(n.flatMap(t=>{var n=U(e,t.dataKey),i,a;if(Array.isArray(n)){var o=Ig(n,2);i=o[0],a=o[1]}else i=a=n;if(!(!H(i)||!H(a)))return[r-i,r+a]}))}var Q=e=>Qg(e,q(e),Vu(e)),C_=R([Q],e=>e?.dataKey),w_=R([a_,Al,Q],Iu),T_=(e,t,n,r)=>{var i=t.reduce((e,t)=>{if(t.stackId==null)return e;var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},{});return Object.fromEntries(Object.entries(i).map(t=>{var i=Ig(t,2),a=i[0],o=i[1],s=r?[...o].reverse():o;return[a,{stackedData:lo(e,s.map(Fu),n),graphicalItems:s}]}))},E_=R([w_,a_,ou,su],T_),D_=(e,t,n,r)=>{var i=t.dataStartIndex,a=t.dataEndIndex;if(r==null&&n!==`zAxis`)return ho(e,i,a)},O_=R([Xg],e=>e.allowDataOverflow),k_=e=>{if(e==null||!(`domain`in e))return Hg;if(e.domain!=null)return e.domain;if(`ticks`in e&&e.ticks!=null){if(e.type===`number`){var t=v_(e.ticks);return[Math.min(...t),Math.max(...t)]}if(e.type===`category`)return e.ticks.map(String)}return e?.domain??Hg},A_=R([Xg],k_),j_=R([A_,O_],Hl),M_=R([E_,Ol,K,j_],D_,{memoizeOptions:{resultEqualityCheck:Ru}}),N_=e=>e.errorBars,P_=(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>x_(n,e)),F_=function(){var e=[...arguments].filter(Boolean);if(e.length!==0){var t=e.flat();return[Math.min(...t),Math.max(...t)]}},I_=function(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],o,s;if(n.length>0&&n.forEach(e=>{var n=e.data==null?a:[...e.data],c=r[e.id]?.filter(e=>x_(i,e));n.forEach(n=>{var r=U(n,t.dataKey??e.dataKey),i=S_(n,r,c);if(i.length>=2){var a=Math.min(...i),l=Math.max(...i);(o==null||as)&&(s=l)}var u=__(r);u!=null&&(o=o==null?u[0]:Math.min(o,u[0]),s=s==null?u[1]:Math.max(s,u[1]))})}),t?.dataKey!=null&&n.length===0&&e.forEach(e=>{var n=__(U(e,t.dataKey));n!=null&&(o=o==null?n[0]:Math.min(o,n[0]),s=s==null?n[1]:Math.max(s,n[1]))}),H(o)&&H(s))return[o,s]},L_=R([f_,Xg,s_,N_,K,Ml],I_,{memoizeOptions:{resultEqualityCheck:Ru}});function R_(e){var t=e.value;if(ue(t)||t instanceof Date)return t}var z_=(e,t,n)=>{var r=e.map(R_).filter(e=>e!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&me(r))?Dl(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},B_=e=>e.referenceElements.dots,V_=(e,t,n)=>e.filter(e=>e.ifOverflow===`extendDomain`).filter(e=>t===`xAxis`?e.xAxisId===n:e.yAxisId===n),H_=R([B_,K,Pu],V_),U_=e=>e.referenceElements.areas,W_=R([U_,K,Pu],V_),G_=e=>e.referenceElements.lines,K_=R([G_,K,Pu],V_),q_=(e,t)=>{if(e!=null){var n=v_(e.map(e=>t===`xAxis`?e.x:e.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},J_=R(H_,K,q_),Y_=(e,t)=>{if(e!=null){var n=v_(e.flatMap(e=>[t===`xAxis`?e.x1:e.y1,t===`xAxis`?e.x2:e.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},X_=R([W_,K],Y_);function Z_(e){if(e.x!=null)return v_([e.x]);var t=e.segment?.map(e=>e.x);return t==null||t.length===0?[]:v_(t)}function Q_(e){if(e.y!=null)return v_([e.y]);var t=e.segment?.map(e=>e.y);return t==null||t.length===0?[]:v_(t)}var $_=(e,t)=>{if(e!=null){var n=e.flatMap(e=>t===`xAxis`?Z_(e):Q_(e));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},ev=R(J_,R([K_,K],$_),X_,(e,t,n)=>F_(e,n,t)),tv=(e,t,n,r,i,a,o,s,c)=>{if(n!=null)return n;var l=o===`vertical`&&s===`xAxis`||o===`horizontal`&&s===`yAxis`?F_(r,a,i):F_(a,i),u=Ul(t,l,e.allowDataOverflow);return u==null&&e.allowDataOverflow&&l==null&&c!=null?c:u},nv=R([Xg,A_,j_,M_,L_,ev,W,K,R([Xg],e=>{if(!(e==null||e.type!==`number`||!(`ticks`in e)||e.ticks==null)){var t=v_(e.ticks);if(t.length!==0)return[Math.min(...t),Math.max(...t)]}},{memoizeOptions:{resultEqualityCheck:Ru}})],tv,{memoizeOptions:{resultEqualityCheck:Ru}}),rv=[0,1],iv=(e,t,n,r,i,a,o)=>{if(e!=null&&n!=null&&n.length!==0||o!==void 0){var s=e.dataKey,c=e.type,l=ao(t,a);return l&&s==null?Dl(0,n?.length??0):c===`category`?z_(r,e,l):i===`expand`&&!l?rv:o}},av=R([Xg,W,f_,h_,ou,K,nv],iv),ov=R([Xg,$g,cu],Dg),sv=(e,t,n)=>{var r=t.niceTicks;if(r!==`none`){var i=k_(t),a=Array.isArray(i)&&(i[0]===`auto`||i[1]===`auto`);if((r===`snap125`||r===`adaptive`)&&t!=null&&t.tickCount&&Bl(e)){if(a)return ru(e,t.tickCount,t.allowDecimals,r);if(t.type===`number`)return iu(e,t.tickCount,t.allowDecimals,r)}if(r===`auto`&&n===`linear`&&t!=null&&t.tickCount){if(a&&Bl(e))return ru(e,t.tickCount,t.allowDecimals,`adaptive`);if(t.type===`number`&&Bl(e))return iu(e,t.tickCount,t.allowDecimals,`adaptive`)}}},cv=R([av,Qg,ov],sv),lv=(e,t,n,r)=>{if(r!==`angleAxis`&&e?.type===`number`&&Bl(t)&&Array.isArray(n)&&n.length>0){var i=t[0],a=n[0]??0,o=t[1],s=n[n.length-1]??0;return[Math.min(i,a),Math.max(o,s)]}return t},uv=R([Xg,av,cv,K],lv),dv=R(R(h_,Xg,(e,t)=>{if(!(!t||t.type!==`number`)){var n=1/0,r=Array.from(v_(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var s=0;si,(e,t,n,r,i)=>{if(!H(e))return 0;var a=t===`vertical`?r.height:r.width;if(i===`gap`)return e*a/2;if(i===`no-gap`){var o=pe(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),fv=(e,t,n)=>{var r=Gg(e,t);return r==null||typeof r.padding!=`string`?0:dv(e,`xAxis`,t,n,r.padding)},pv=(e,t,n)=>{var r=qg(e,t);return r==null||typeof r.padding!=`string`?0:dv(e,`yAxis`,t,n,r.padding)},mv=R(Gg,fv,(e,t)=>{if(e==null)return{left:0,right:0};var n=e.padding;return typeof n==`string`?{left:t,right:t}:{left:(n.left??0)+t,right:(n.right??0)+t}}),hv=R(qg,pv,(e,t)=>{if(e==null)return{top:0,bottom:0};var n=e.padding;return typeof n==`string`?{top:t,bottom:t}:{top:(n.top??0)+t,bottom:(n.bottom??0)+t}}),gv=R([Bo,mv,Ko,Go,(e,t,n)=>n],(e,t,n,r,i)=>{var a=r.padding;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),_v=R([Bo,W,hv,Ko,Go,(e,t,n)=>n],(e,t,n,r,i,a)=>{var o=i.padding;return a?[r.height-o.bottom,o.top]:t===`horizontal`?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),vv=(e,t,n,r)=>{switch(t){case`xAxis`:return gv(e,n,r);case`yAxis`:return _v(e,n,r);case`zAxis`:return Yg(e,n)?.range;case`angleAxis`:return ju(e);case`radiusAxis`:return Mu(e,n);default:return}},yv=R([Xg,vv],gu),bv=R([Xg,ov,R([ov,uv],Uu),yv],wg),xv=(e,t,n,r)=>{if(n!=null&&n.dataKey!=null){var i=n.type,a=n.scale;if(ao(e,r)&&(i===`number`||a!==`auto`))return t.map(e=>e.value)}},Sv=R([W,h_,Qg,K],xv),Cv=R([bv],Hu);R([bv],Ag),R([bv,b_],kg),R([i_,N_,K],P_);function wv(e,t){return e.idt.id)}var Tv=(e,t)=>t,Ev=(e,t,n)=>n,Dv=R(Do,Tv,Ev,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(wv)),Ov=R(Oo,Tv,Ev,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(wv)),kv=(e,t)=>{var n=typeof t.height==`number`?t.height:30;return{width:e.width,height:n}},Av=(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height}),jv=R(Bo,Gg,kv),Mv=(e,t,n)=>{switch(t){case`top`:return e.top;case`bottom`:return n-e.bottom;default:return 0}},Nv=(e,t,n)=>{switch(t){case`left`:return e.left;case`right`:return n-e.right;default:return 0}},Pv=R(wo,Bo,Dv,Tv,Ev,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=kv(t,n);o??=Mv(t,r,e);var c=r===`top`&&!i||r===`bottom`&&i;a[n.id]=o-Number(c)*s.height,o+=(c?-1:1)*s.height}),a}),Fv=R(Co,Bo,Ov,Tv,Ev,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=Av(t,n);o??=Nv(t,r,e);var c=r===`left`&&!i||r===`right`&&i;a[n.id]=o-Number(c)*s.width,o+=(c?-1:1)*s.width}),a}),Iv=R([Bo,Gg,(e,t)=>{var n=Gg(e,t);if(n!=null)return Pv(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),Lv=R([Bo,qg,(e,t)=>{var n=qg(e,t);if(n!=null)return Fv(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),Rv=R(Bo,qg,(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height})),zv=(e,t,n,r)=>{if(n!=null){var i=n.allowDuplicatedCategory,a=n.type,o=n.dataKey,s=ao(e,r),c=t.map(e=>e.value),l=c.filter(e=>e!=null);if(o&&s&&a===`category`&&i&&me(l))return c}},Bv=R([W,h_,Xg,K],zv),Vv=R([W,Zg,ov,Cv,Bv,Sv,vv,cv,K],(e,t,n,r,i,a,o,s,c)=>{if(t!=null){var l=ao(e,c);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:c,categoricalDomain:a,duplicateDomain:i,isCategorical:l,niceTicks:s,range:o,realScaleType:n,scale:r}}}),Hv=R([W,Qg,ov,Cv,cv,vv,Bv,Sv,K],(e,t,n,r,i,a,o,s,c)=>{if(t!=null&&r!=null){var l=ao(e,c),u=t.type,d=t.ticks,f=t.tickCount,p=n===`scaleBand`&&typeof r.bandwidth==`function`?r.bandwidth()/2:2,m=u===`category`&&r.bandwidth?r.bandwidth()/p:0;m=c===`angleAxis`&&a!=null&&a.length>=2?se(a[0]-a[1])*2*m:m;var h=d||i;return h?h.map((e,t)=>{var n=o?o.indexOf(e):e,i=r.map(n);return H(i)?{index:t,coordinate:i+m,value:e,offset:m}:null}).filter(ye):l&&s?s.map((e,t)=>{var n=r.map(e);return H(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(ye):r.ticks?r.ticks(f).map((e,t)=>{var n=r.map(e);return H(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(ye):r.domain().map((e,t)=>{var n=r.map(e);return H(n)?{coordinate:n+m,value:o?o[e]:e,index:t,offset:m}:null}).filter(ye)}}),Uv=R([W,Qg,Cv,vv,Bv,Sv,K],(e,t,n,r,i,a,o)=>{if(t!=null&&n!=null&&r!=null&&r[0]!==r[1]){var s=ao(e,o),c=t.tickCount,l=0;return l=o===`angleAxis`&&r?.length>=2?se(r[0]-r[1])*2*l:l,s&&a?a.map((e,t)=>{var r=n.map(e);return H(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(ye):n.ticks?n.ticks(c).map((e,t)=>{var r=n.map(e);return H(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(ye):n.domain().map((e,t)=>{var r=n.map(e);return H(r)?{coordinate:r+l,value:i?i[e]:e,index:t,offset:l}:null}).filter(ye)}}),Wv=R(Xg,Cv,(e,t)=>{if(e!=null&&t!=null)return Mg(Mg({},e),{},{scale:t})});R((e,t,n)=>Yg(e,n),R([R([Xg,ov,av,yv],wg)],Hu),(e,t)=>{if(e!=null&&t!=null)return Mg(Mg({},e),{},{scale:t})});var Gv=R([W,Do,Oo],(e,t,n)=>{switch(e){case`horizontal`:return t.some(e=>e.reversed)?`right-to-left`:`left-to-right`;case`vertical`:return n.some(e=>e.reversed)?`bottom-to-top`:`top-to-bottom`;case`centric`:case`radial`:return`left-to-right`;default:return}});R([(e,t,n)=>e.renderedTicks[t]?.[n]],e=>{if(!(!e||e.length===0))return t=>{var n=1/0,r=e[0];for(var i of e){var a=Math.abs(i.coordinate-t);ae.options.defaultTooltipEventType,qv=e=>e.options.validateTooltipEventTypes;function Jv(e,t,n){if(e==null)return t;var r=e?`axis`:`item`;return n==null?t:n.includes(r)?r:t}function Yv(e,t){return Jv(t,Kv(e),qv(e))}function Xv(e){return L(t=>Yv(t,e))}var Zv=(e,t)=>{var n,r=Number(t);if(!(ce(r)||t==null))return r>=0?e==null||(n=e[r])==null?void 0:n.value:void 0},Qv=e=>e.tooltip.settings,$v={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},ey=na({name:`tooltip`,initialState:{itemInteraction:{click:$v,hover:$v},axisInteraction:{click:$v,hover:$v},keyboardInteraction:$v,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}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(B(t.payload))},prepare:V()},replaceTooltipEntrySettings:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=Oi(e).tooltipItemPayloads.indexOf(B(r));a>-1&&(e.tooltipItemPayloads[a]=B(i))},prepare:V()},removeTooltipEntrySettings:{reducer(e,t){var n=Oi(e).tooltipItemPayloads.indexOf(B(t.payload));n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:V()},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}}}),ty=ey.actions,ny=ty.addTooltipEntrySettings,ry=ty.replaceTooltipEntrySettings,iy=ty.removeTooltipEntrySettings,ay=ty.setTooltipSettingsState,oy=ty.setActiveMouseOverItemIndex;ty.mouseLeaveItem;var sy=ty.mouseLeaveChart;ty.setActiveClickItemIndex;var cy=ty.setMouseOverAxisIndex,ly=ty.setMouseClickAxisIndex,uy=ty.setSyncInteraction,dy=ty.setKeyboardInteraction,fy=ey.reducer;function py(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function my(e){for(var t=1;t{if(t==null)return $v;var i=vy(e,t,n);if(i==null)return $v;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(yy(i)){if(a)return my(my({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return my(my({},$v),{},{coordinate:i.coordinate})};function xy(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 Sy(e,t){var n=xy(e),r=t[0],i=t[1];return n!==void 0&&n>=Math.min(r,i)&&n<=Math.max(r,i)}function Cy(e,t,n){if(n==null||t==null)return!0;var r=U(e,t);return r==null||!Bl(n)||Sy(r,n)}var wy=(e,t,n,r)=>{var i=e?.index;if(i==null)return null;var a=Number(i);if(!H(a))return i;var o=0,s=1/0;t.length>0&&(s=t.length-1);var c=Math.max(o,Math.min(a,s)),l=t[c];return l==null||Cy(l,n,r)?String(c):null},Ty=(e,t,n,r,i,a,o)=>{if(a!=null){var s=o[0]?.getPosition(a);if(s!=null)return s;var c=i?.[Number(a)];if(c)switch(n){case`horizontal`:return{x:c.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:c.coordinate}}}},Ey=(e,t,n,r)=>{if(t===`axis`)return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i=n===`hover`?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId;if(e.syncInteraction.active&&i==null)return e.tooltipItemPayloads;if(i==null&&(r!=null||e.keyboardInteraction.active)){var a=e.tooltipItemPayloads[0];return a==null?[]:[a]}return e.tooltipItemPayloads.filter(e=>e.settings?.graphicalItemId===i)},Dy=e=>e.options.tooltipPayloadSearcher,Oy=e=>e.tooltip;function ky(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ay(e){for(var t=1;te(t)}function Ly(e){if(typeof e==`string`)return e}function Ry(e){if(!(typeof e!=`object`||!e))return{name:`name`in e?Py(e.name):void 0,unit:`unit`in e?Fy(e.unit):void 0,dataKey:`dataKey`in e?Iy(e.dataKey):void 0,payload:`payload`in e?e.payload:void 0,color:`color`in e?Ly(e.color):void 0,fill:`fill`in e?Ly(e.fill):void 0}}function zy(e,t){return e??t}var By=(e,t,n,r,i,a,o)=>{if(t!=null&&a!=null){var s=n.chartData,c=n.computedData,l=n.dataStartIndex,u=n.dataEndIndex;return e.reduce((e,n)=>{var d=n.dataDefinedOnItem,f=n.settings,p=zy(d,s),m=Array.isArray(p)?Za(p,l,u):p,h=f?.dataKey??r,g=f?.nameKey,_;return r&&Array.isArray(m)&&!Array.isArray(m[0])&&o===`axis`?(_=ge(m,r,i),_??=a(m,t,c,g)):_=a(m,t,c,g),Array.isArray(_)?_.forEach(t=>{var n=Ry(t),r=n?.name,i=n?.dataKey,a=n?.payload,o=Ay(Ay({},f),{},{name:r,unit:n?.unit,color:n?.color??f?.color,fill:n?.fill??f?.fill});e.push(yo({tooltipEntrySettings:o,dataKey:i,payload:a,value:U(a,i),name:r==null?void 0:String(r)}))}):e.push(yo({tooltipEntrySettings:f,dataKey:h,payload:_,value:U(_,h),name:U(_,g)??f?.name})),e},[])}},Vy=R([Q,$g,cu],Dg),Hy=R([R([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Q,R([q,Vu],e_)],r_,{memoizeOptions:{resultEqualityCheck:zu}}),Uy=R([Hy],e=>e.filter(Lu)),Wy=R([Hy],c_,{memoizeOptions:{resultEqualityCheck:zu}}),Gy=R([Hy],e=>e.some(e=>!e.data)),Ky=R([Wy,Ol],d_),qy=R([Uy,Ol,Q],Iu),Jy=R([Ky,Q,Hy,Ol,Gy,Wy],m_),Yy=R([Q],k_),Xy=R([Yy,R([Q],e=>e.allowDataOverflow)],Hl),Zy=R([R([qy,R([Hy],e=>e.filter(Lu)),ou,su],T_),Ol,q,Xy],D_),Qy=R([Ky,Q,R([Hy],o_),N_,q,Nl],I_,{memoizeOptions:{resultEqualityCheck:Ru}}),$y=R([R([B_,q,Vu],V_),q],q_),eb=R([R([U_,q,Vu],V_),q],Y_),tb=R([Q,W,Ky,Jy,ou,q,R([Q,Yy,Xy,Zy,Qy,R([$y,R([R([G_,q,Vu],V_),q],$_),eb],F_),W,q],tv)],iv),nb=R([Q,tb,R([tb,Q,Vy],sv),q],lv),rb=e=>vv(e,q(e),Vu(e),!1),ib=R([Q,rb],gu),ab=R([R([Q,Vy,nb,ib],wg)],Hu),ob=R([W,Q,Vy,ab,rb,R([W,Jy,Q,q],zv),R([W,Jy,Q,q],xv),q],(e,t,n,r,i,a,o,s)=>{if(t){var c=t.type,l=ao(e,s);if(r){var u=n===`scaleBand`&&r.bandwidth?r.bandwidth()/2:2,d=c===`category`&&r.bandwidth?r.bandwidth()/u:0;return d=s===`angleAxis`&&i!=null&&i?.length>=2?se(i[0]-i[1])*2*d:d,l&&o?o.map((e,t)=>{var n=r.map(e);return H(n)?{coordinate:n+d,value:e,index:t,offset:d}:null}).filter(ye):r.domain().map((e,t)=>{var n=r.map(e);return H(n)?{coordinate:n+d,value:a?a[e]:e,index:t,offset:d}:null}).filter(ye)}}}),sb=R([Kv,qv,Qv],(e,t,n)=>Jv(n.shared,e,t)),cb=e=>e.tooltip.settings.trigger,lb=e=>e.tooltip.settings.defaultIndex,ub=R([Oy,sb,cb,lb],by),db=R([ub,Ky,C_,tb],wy),fb=R([ob,db],Zv),pb=R([ub],e=>{if(e)return e.dataKey}),mb=R([ub],e=>{if(e)return e.graphicalItemId}),hb=R([Oy,sb,cb,lb],Ey),gb=R([ub,R([Co,wo,W,Bo,ob,lb,hb],Ty)],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),_b=R([ub],e=>e?.active??!1),vb=R([R([hb,db,Ol,C_,fb,Dy,sb],By)],e=>{if(e!=null){var t=e.map(e=>e.payload).filter(e=>e!=null);return Array.from(new Set(t))}});function yb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bb(e){for(var t=1;t{var i=t.find(e=>e&&e.index===n);if(i){if(e===`horizontal`)return{x:i.coordinate,y:r.relativeY};if(e===`vertical`)return{x:r.relativeX,y:i.coordinate}}return{x:0,y:0}},Tb=(e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if(e===`centric`){var a=i.coordinate,o=r.radius;return bb(bb(bb({},r),vl(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,c=r.angle;return bb(bb(bb({},r),vl(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function Eb(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 Db=(e,t,n,r,i)=>{var a=t?.length??0;if(a<=1||e==null)return 0;if(r===`angleAxis`&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var o=i[1]-i[0],s=(t,n,r)=>[e,e+o,e-o].some(e=>(r?e>=t:e>t)&&e<=n),c=0;c0?n[c-1]?.coordinate:n[a-1]?.coordinate,u=n[c]?.coordinate,d=c>=a-1?n[0]?.coordinate:n[c+1]?.coordinate,f=void 0;if(l!=null&&u!=null&&d!=null){if(se(u-l)!==se(d-u)){var p=[];if(se(d-u)===se(i[1]-i[0])){f=d;var m=u+i[1]-i[0];p[0]=Math.min(m,(m+l)/2),p[1]=Math.max(m,(m+l)/2)}else{f=l;var h=d+i[1]-i[0];p[0]=Math.min(u,(h+u)/2),p[1]=Math.max(u,(h+u)/2)}var g=[Math.min(u,(f+u)/2),Math.max(u,(f+u)/2)];if(s(g[0],g[1],!1)||s(p[0],p[1],!0))return n[c]?.index}else{var _=Math.min(l,d),v=Math.max(l,d);if(s((_+u)/2,(v+u)/2,!1))return n[c]?.index}}}else if(t)for(var y=0;y(b.coordinate+S.coordinate)/2||y>0&&y(b.coordinate+S.coordinate)/2&&e<=(b.coordinate+x.coordinate)/2)return b.index}}return-1},Ob=()=>L(cu),kb=(e,t)=>t,Ab=(e,t,n)=>n,jb=(e,t,n,r)=>r,Mb=R(ob,e=>Xn(e,e=>e.coordinate)),Nb=R([Oy,kb,Ab,jb],by),Pb=R([Nb,Ky,C_,tb],wy),Fb=(e,t,n)=>{if(t!=null){var r=Oy(e);return t===`axis`?n===`hover`?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n===`hover`?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},Ib=R([Oy,kb,Ab,jb],Ey),Lb=R([Co,wo,W,Bo,ob,jb,Ib],Ty),Rb=R([Nb,Lb],(e,t)=>e.coordinate??t),zb=R([ob,Pb],Zv),Bb=R([Ib,Pb,Ol,C_,zb,Dy,kb],By),Vb=R([Nb,Pb],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),Hb=(e,t,n,r,i,a,o)=>{if(!(!e||!n||!r||!i)&&Eb(e,o)){var s=Db(xo(e,t),a,i,n,r),c=wb(t,i,s,e);return{activeIndex:String(s),activeCoordinate:c}}},Ub=(e,t,n,r,i,a,o)=>{if(!(!e||!r||!i||!a||!n)){var s=wl(e,n);if(s){var c=Db(So(s,t),o,a,r,i),l=Tb(t,a,c,s);return{activeIndex:String(c),activeCoordinate:l}}}},Wb=(e,t,n,r,i,a,o,s)=>{if(!(!e||!t||!r||!i||!a))return t===`horizontal`||t===`vertical`?Hb(e,t,r,i,a,o,s):Ub(e,t,n,r,i,a,o)},Gb=R(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}}),Kb=R(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(pu));return Array.from(new Set(t)).sort((e,t)=>e-t)},{memoizeOptions:{resultEqualityCheck:Bu}});function qb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Jb(e){for(var t=1;tJb(Jb({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},$b=new Set(Object.values(pu));function ex(e){return $b.has(e)}var tx=na({name:`zIndex`,initialState:Qb,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:V()},unregisterZIndexPortal:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]&&(--e.zIndexMap[n].consumers,e.zIndexMap[n].consumers<=0&&!ex(n)&&delete e.zIndexMap[n])},prepare:V()},registerZIndexPortalElement:{reducer:(e,t)=>{var n=t.payload,r=n.zIndex,i=n.element,a=n.isPanorama;e.zIndexMap[r]?a?e.zIndexMap[r].panoramaElement=B(i):e.zIndexMap[r].element=B(i):e.zIndexMap[r]={consumers:0,element:a?void 0:B(i),panoramaElement:a?B(i):void 0}},prepare:V()},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:V()}}}),nx=tx.actions,rx=nx.registerZIndexPortal,ix=nx.unregisterZIndexPortal,ax=nx.registerZIndexPortalElement,ox=nx.unregisterZIndexPortalElement,sx=tx.reducer;function cx(e){var t=e.zIndex,n=e.children,r=Ps()&&t!==void 0&&t!==0,i=Wo(),a=(0,s.useRef)(void 0),o=(0,s.useRef)(new Set),c=I(),l=L(e=>Gb(e,t,i));if((0,s.useLayoutEffect)(()=>{if(!r){var e=o.current;e.forEach(e=>{c(ix({zIndex:e}))}),e.clear(),a.current=void 0;return}if(o.current.has(t)||(c(rx({zIndex:t})),o.current.add(t)),l){a.current=l;var n=o.current;n.forEach(e=>{e!==t&&(c(ix({zIndex:e})),n.delete(e))})}},[c,t,r,l]),(0,s.useLayoutEffect)(()=>{var e=o.current;return()=>{e.forEach(e=>{c(ix({zIndex:e}))}),e.clear()}},[c]),!r)return n;var u=l??a.current;return u?(0,_.createPortal)(n,u):null}var lx=(0,s.createContext)(null),ux=()=>(0,s.useContext)(lx),dx=r(a(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!ce(n))return e[n]}},gx=na({name:`options`,initialState:{chartName:``,tooltipPayloadSearcher:()=>void 0,eventEmitter:void 0,defaultTooltipEventType:`axis`},reducers:{createEventEmitter:e=>{e.eventEmitter??=Symbol(`rechartsEventEmitter`)}}}),_x=gx.reducer,vx=gx.actions.createEventEmitter;function yx(e){return e.tooltip.syncInteraction}var bx=na({name:`chartData`,initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=B(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,i=n.endIndex;r!=null&&(e.dataStartIndex=r),i!=null&&(e.dataEndIndex=i)}}}),xx=bx.actions,Sx=xx.setChartData,Cx=xx.setDataStartEndIndexes;xx.setComputedData;var wx=bx.reducer,Tx=[`x`,`y`];function Ex(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Dx(e){for(var t=1;te.rootProps.className);(0,s.useEffect)(()=>{if(e==null)return be;var s=(s,c,l)=>{if(t!==l&&e===s){if(c.payload.active===!1){n(uy({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r===`index`){var u;if(o&&c!=null&&(u=c.payload)!=null&&u.coordinate&&c.payload.sourceViewBox){var d=c.payload.coordinate,f=d.x,p=d.y,m=jx(d,Tx),h=c.payload.sourceViewBox,g=h.x,_=h.y,v=h.width,y=h.height,b=Dx(Dx({},m),{},{x:o.x+(v?(f-g)/v:0)*o.width,y:o.y+(y?(p-_)/y:0)*o.height});n(Dx(Dx({},c),{},{payload:Dx(Dx({},c.payload),{},{coordinate:b})}))}else n(c);return}if(i!=null){var x;typeof r==`function`?x=i[r(i,{activeTooltipIndex:c.payload.index==null?void 0:Number(c.payload.index),isTooltipActive:c.payload.active,activeIndex:c.payload.index==null?void 0:Number(c.payload.index),activeLabel:c.payload.label,activeDataKey:c.payload.dataKey,activeCoordinate:c.payload.coordinate})]:r===`value`&&(x=i.find(e=>String(e.value)===c.payload.label));var S=c.payload.coordinate;if(S==null||o==null){n(uy({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(x==null){n(uy({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:void 0}));return}var C=S.x,w=S.y,T=Math.min(C,o.x+o.width),E=Math.min(w,o.y+o.height),D={x:a===`horizontal`?x.coordinate:T,y:a===`horizontal`?E:x.coordinate};n(uy({active:c.payload.active,coordinate:D,dataKey:c.payload.dataKey,index:String(x.index),label:c.payload.label,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:c.payload.graphicalItemId}))}}};return fx.on(px,s),()=>{fx.off(px,s)}},[c,n,t,e,r,i,a,o])}function Px(){var e=L(lu),t=L(du),n=I();(0,s.useEffect)(()=>{if(e==null)return be;var r=(r,i,a)=>{t!==a&&e===r&&n(Cx(i))};return fx.on(mx,r),()=>{fx.off(mx,r)}},[n,t,e])}function Fx(){var e=I();(0,s.useEffect)(()=>{e(vx())},[e]),Nx(),Px()}function Ix(e,t,n,r,i,a){var o=L(n=>Fb(n,e,t)),c=L(mb),l=L(du),u=L(lu),d=L(uu),f=L(yx)?.sourceViewBox!=null,p=Es();(0,s.useEffect)(()=>{if(!f&&u!=null&&l!=null){var e=uy({active:a,coordinate:n,dataKey:o,index:i,label:typeof r==`number`?String(r):r,sourceViewBox:p,graphicalItemId:c});fx.emit(px,u,e,l)}},[f,n,o,c,i,r,l,u,d,a,p])}function Lx(e,t,n){return(t=Rx(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rx(e){var t=zx(e,`string`);return typeof t==`symbol`?t:t+``}function zx(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Bx=class{constructor(e){Lx(this,`cache`,new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};function Vx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hx(e){for(var t=1;t{try{var n=document.getElementById(Yx);n||(n=document.createElement(`span`),n.setAttribute(`id`,Yx),n.setAttribute(`aria-hidden`,`true`),document.body.appendChild(n)),Object.assign(n.style,Jx,t),n.textContent=`${e}`;var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},Qx=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||sc.isSsr)return{width:0,height:0};if(!Kx.enableCache)return Zx(e,t);var n=Xx(e,t),r=qx.get(n);if(r)return r;var i=Zx(e,t);return qx.set(n,i),i},$x;function eS(e,t){return aS(e)||iS(e,t)||nS(e,t)||tS()}function tS(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nS(e,t){if(e){if(typeof e==`string`)return rS(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)?rS(e,t):void 0}}function rS(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 i=[];return _e(t)||(i=n?t.toString().split(``):t.toString().split(IS)),{wordsWithComputedWidth:i.map(e=>({word:e,width:Qx(e,r).width})),spaceWidth:n?0:Qx(`\xA0`,r).width}}catch{return null}};function RS(e){return e===`start`||e===`middle`||e===`end`||e===`inherit`}function zS(e){return _e(e)||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}var BS=(e,t,n,r)=>e.reduce((e,i)=>{var a=i.word,o=i.width,s=e[e.length-1];if(s&&o!=null&&(t==null||r||s.width+o+ne.reduce((e,t)=>e.width>t.width?e:t),HS=`…`,US=(e,t,n,r,i,a,o,s)=>{var c=LS({breakAll:n,style:r,children:e.slice(0,t)+HS});if(!c)return[!1,[]];var l=BS(c.wordsWithComputedWidth,a,o,s);return[l.length>i||VS(l).width>Number(a),l]},WS=(e,t,n,r,i)=>{var a=e.maxLines,o=e.children,s=e.style,c=e.breakAll,l=P(a),u=String(o),d=BS(t,r,n,i);if(!l||i||!(d.length>a||VS(d).width>Number(r)))return d;for(var f=0,p=u.length-1,m=0,h;f<=p&&m<=u.length-1;){var g=Math.floor((f+p)/2),_=AS(US(u,g-1,c,s,a,r,n,i),2),v=_[0],y=_[1],b=AS(US(u,g,c,s,a,r,n,i),1)[0];if(!v&&!b&&(f=g+1),v&&b&&(p=g-1),!v&&b){h=y;break}m++}return h||d},GS=e=>[{words:_e(e)?[]:e.toString().split(IS),width:void 0}],KS=e=>{var t=e.width,n=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,o=e.maxLines;if((t||n)&&!sc.isSsr){var s,c,l=LS({breakAll:a,children:r,style:i});if(l){var u=l.wordsWithComputedWidth,d=l.spaceWidth;s=u,c=d}else return GS(r);return WS({breakAll:a,children:r,maxLines:o,style:i},s,c,t,!!n)}return GS(r)},qS=`#808080`,JS={angle:0,breakAll:!1,capHeight:`0.71em`,fill:qS,lineHeight:`1em`,scaleToFit:!1,textAnchor:`start`,verticalAnchor:`end`,x:0,y:0},YS=(0,s.forwardRef)((e,t)=>{var n=Rt(e,JS),r=n.x,i=n.y,a=n.lineHeight,c=n.capHeight,l=n.fill,u=n.scaleToFit,d=n.textAnchor,f=n.verticalAnchor,p=OS(n,TS),m=(0,s.useMemo)(()=>KS({breakAll:p.breakAll,children:p.children,maxLines:p.maxLines,scaleToFit:u,style:p.style,width:p.width}),[p.breakAll,p.children,p.maxLines,u,p.style,p.width]),g=p.dx,_=p.dy,v=p.angle,y=p.className,b=p.breakAll,x=OS(p,ES);if(!ue(r)||!ue(i)||m.length===0)return null;var S=Number(r)+(P(g)?g:0),C=Number(i)+(P(_)?_:0);if(!H(S)||!H(C))return null;var w;switch(f){case`start`:w=wS(`calc(${c})`);break;case`middle`:w=wS(`calc(${(m.length-1)/2} * -${a} + (${c} / 2))`);break;default:w=wS(`calc(${m.length-1} * -${a})`)}var T=[],E=m[0];if(u&&E!=null){var D=E.width,O=p.width;T.push(`scale(${P(O)&&P(D)?O/D:1})`)}return v&&T.push(`rotate(${v}, ${S}, ${C})`),T.length&&(x.transform=T.join(` `)),s.createElement(`text`,DS({},h(x),{ref:t,x:S,y:C,className:o(`recharts-text`,y),textAnchor:d,fill:l.includes(`url`)?qS:l}),m.map((e,t)=>{var n=e.words.join(b?``:` `);return s.createElement(`tspan`,{x:S,dy:t===0?w:a,key:`${n}-${t}`},n)}))});YS.displayName=`Text`;var XS=[`labelRef`],ZS=[`content`];function QS(e,t){if(e==null)return{};var n,r,i=$S(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var t=e.x,n=e.y,r=e.upperWidth,i=e.lowerWidth,a=e.width,o=e.height,c=e.children,l=(0,s.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return s.createElement(oC.Provider,{value:l},c)},cC=()=>{var e=(0,s.useContext)(oC),t=Es();return e||(t?xe(t):void 0)},lC=(0,s.createContext)(null),uC=()=>{var e=(0,s.useContext)(lC),t=L(Nu);return e||t},dC=e=>{var t=e.value,n=e.formatter,r=_e(e.children)?t:e.children;return typeof n==`function`?n(r):r},fC=e=>e!=null&&typeof e==`function`,pC=(e,t)=>se(t-e)*Math.min(Math.abs(t-e),360),mC=(e,t,n,r,i)=>{var a=e.offset,c=e.className,l=i.cx,u=i.cy,d=i.innerRadius,f=i.outerRadius,p=i.startAngle,m=i.endAngle,h=i.clockWise,g=(d+f)/2,_=pC(p,m),v=_>=0?1:-1,y,b;switch(t){case`insideStart`:y=p+v*a,b=h;break;case`insideEnd`:y=m-v*a,b=!h;break;case`end`:y=m+v*a,b=h;break;default:throw Error(`Unsupported position ${t}`)}b=_<=0?b:!b;var x=vl(l,u,g,y),S=vl(l,u,g,y+(b?1:-1)*359),C=`M${x.x},${x.y} + A${g},${g},0,1,${+!b}, + ${S.x},${S.y}`,w=_e(e.id)?fe(`recharts-radial-line-`):e.id;return s.createElement(`text`,aC({},r,{dominantBaseline:`central`,className:o(`recharts-radial-bar-label`,c)}),s.createElement(`defs`,null,s.createElement(`path`,{id:w,d:C})),s.createElement(`textPath`,{xlinkHref:`#${w}`},n))},hC=(e,t,n)=>{var r=e.cx,i=e.cy,a=e.innerRadius,o=e.outerRadius,s=(e.startAngle+e.endAngle)/2;if(n===`outside`){var c=vl(r,i,o+t,s),l=c.x;return{x:l,y:c.y,textAnchor:l>=r?`start`:`end`,verticalAnchor:`middle`}}if(n===`center`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`middle`};if(n===`centerTop`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`start`};if(n===`centerBottom`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`end`};var u=vl(r,i,(a+o)/2,s);return{x:u.x,y:u.y,textAnchor:`middle`,verticalAnchor:`middle`}},gC=e=>e!=null&&`cx`in e&&P(e.cx),_C={angle:0,offset:5,zIndex:pu.label,position:`middle`,textBreakAll:!1};function vC(e){if(!gC(e))return e;var t=e.cx,n=e.cy,r=e.outerRadius,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function yC(e){var t=Rt(e,_C),n=t.viewBox,r=t.parentViewBox,i=t.position,a=t.value,c=t.children,l=t.content,u=t.className,d=u===void 0?``:u,f=t.textBreakAll,p=t.labelRef,m=uC(),g=cC(),_=n==null?i===`center`?g:m??g:gC(n)?n:xe(n),v,y,b=vC(_);if(!_||_e(a)&&_e(c)&&!(0,s.isValidElement)(l)&&typeof l!=`function`)return null;var x=gC(_)&&(i===`insideStart`||i===`insideEnd`||i===`end`);if(gC(_))x||(y=hC(_,t.offset,t.position));else if(b){var S=De({viewBox:b,position:i,offset:t.offset,parentViewBox:gC(r)?void 0:r,clamp:!0});y=tC(tC({x:S.x,y:S.y,textAnchor:S.horizontalAnchor,verticalAnchor:S.verticalAnchor},S.width===void 0?{}:{width:S.width}),S.height===void 0?{}:{height:S.height})}var C=tC(tC(tC(tC({},y?.x===void 0?{}:{x:y.x}),y?.y===void 0?{}:{y:y.y}),t),{},{viewBox:_});if((0,s.isValidElement)(l)){C.labelRef;var w=QS(C,XS);return(0,s.cloneElement)(l,w)}if(typeof l==`function`){C.content;var T=QS(C,ZS);if(v=(0,s.createElement)(l,T),(0,s.isValidElement)(v))return v}else v=dC(t);var E=h(t);return x&&gC(_)?mC(t,i,v,E,_):y==null?null:s.createElement(cx,{zIndex:t.zIndex},s.createElement(YS,aC({ref:p,className:o(`recharts-label`,d)},E,y,{textAnchor:RS(E.textAnchor)?E.textAnchor:y.textAnchor,breakAll:f}),v))}yC.displayName=`Label`;var bC=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?s.createElement(yC,aC({key:`label-implicit`},r)):ue(e)?s.createElement(yC,aC({key:`label-implicit`,value:e},r)):(0,s.isValidElement)(e)?e.type===yC?(0,s.cloneElement)(e,tC({key:`label-implicit`},r)):s.createElement(yC,aC({key:`label-implicit`,content:e},r)):fC(e)?s.createElement(yC,aC({key:`label-implicit`,content:e},r)):e&&typeof e==`object`?s.createElement(yC,aC({},e,{key:`label-implicit`},r)):null};function xC(e){var t=e.label,n=e.labelRef;return bC(t,cC(),n)||null}var SC=[`valueAccessor`],CC=[`dataKey`,`clockWise`,`id`,`textBreakAll`,`zIndex`];function wC(){return wC=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(zS(t))return t},OC=(0,s.createContext)(void 0),kC=OC.Provider,AC=(0,s.createContext)(void 0);AC.Provider;function jC(){return(0,s.useContext)(OC)}function MC(){return(0,s.useContext)(AC)}function NC(e){var t=e.valueAccessor,n=t===void 0?DC:t,r=TC(e,SC),i=r.dataKey;r.clockWise;var a=r.id,o=r.textBreakAll,c=r.zIndex,l=TC(r,CC),u=jC(),d=MC(),f=u||d;return!f||!f.length?null:s.createElement(cx,{zIndex:c??pu.label},s.createElement(D,{className:`recharts-label-list`},f.map((e,t)=>{var c=_e(i)?n(e,t):U(e.payload,i),u=_e(a)?{}:{id:`${a}-${t}`};return s.createElement(yC,wC({key:`label-${t}`},h(e),l,u,{fill:r.fill??e.fill,parentViewBox:e.parentViewBox,value:c,textBreakAll:o,viewBox:e.viewBox,index:t,zIndex:0}))})))}NC.displayName=`LabelList`;function PC(e){var t=e.label;return t?t===!0?s.createElement(NC,{key:`labelList-implicit`}):s.isValidElement(t)||fC(t)?s.createElement(NC,{key:`labelList-implicit`,content:t}):typeof t==`object`?s.createElement(NC,wC({key:`labelList-implicit`},t,{type:String(t.type)})):null:null}function FC(){return FC=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=e.cx,n=e.cy,r=e.r,i=e.className,a=o(`recharts-dot`,i);return P(t)&&P(n)&&P(r)?s.createElement(`circle`,FC({},p(e),At(e),{className:a,cx:t,cy:n,r})):null},LC=na({name:`polarAxis`,initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=B(t.payload)},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=B(t.payload)},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),RC=LC.actions;RC.addRadiusAxis,RC.removeRadiusAxis,RC.addAngleAxis,RC.removeAngleAxis;var zC=LC.reducer;function BC(e){return e&&typeof e==`object`&&`className`in e&&typeof e.className==`string`?e.className:``}var VC=a((e=>{typeof Symbol==`function`&&Symbol.for}));a(((e,t)=>{t.exports=VC()}))();var HC=e=>e&&typeof e==`object`&&`clipDot`in e?!!e.clipDot:!0;function UC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function WC(e){for(var t=1;t{r||(i.current===null?n(ny(t)):i.current!==t&&n(ry({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,s.useLayoutEffect)(()=>()=>{i.current&&=(n(iy(i.current)),null)},[n]),null}function tw(e){var t=e.legendPayload,n=I(),r=Wo(),i=(0,s.useRef)(null);return(0,s.useLayoutEffect)(()=>{r||(i.current===null?n(Rs(t)):i.current!==t&&n(zs({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,s.useLayoutEffect)(()=>()=>{i.current&&=(n(Bs(i.current)),null)},[n]),null}function nw(e,t){return sw(e)||ow(e,t)||iw(e,t)||rw()}function rw(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iw(e,t){if(e){if(typeof e==`string`)return aw(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)?aw(e,t):void 0}}function aw(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 i of n)r.push({status:`removed`,prev:i});for(var a=0;ae[Math.floor(r*n)]),t)}function dw(e,t){return lw(t.map((t,n)=>e[n]),t)}function fw(e,t){for(var n=new Map,r=0;r{var a=n(e,t);if(a!=null){var o=r.get(a);if(o!==void 0)return i.add(a),o}}),o=[];for(var s of r){var c=nw(s,2),l=c[0],u=c[1];i.has(l)||o.push(u)}return lw(a,t,o)}function mw(e,t,n){return t==null?null:e==null?t.map(e=>({status:`added`,next:e})):n===`index`?uw(e,t):n===`append`?dw(e,t):pw(e,t,n)}function hw(e,t){var n=(0,s.useRef)(e),r=(0,s.useRef)(t.current),i=(0,s.useRef)(!0);n.current!==e&&(n.current=e,r.current=t.current,i.current=!1);var a=(0,s.useCallback)(function(e,n){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(n===0){i.current=!0;return}n===1&&(r.current=e),n>0&&i.current&&a&&(t.current=e)},[t]);return{startValue:r.current,syncStepValue:a}}function gw(e,t){return xw(e)||bw(e,t)||vw(e,t)||_w()}function _w(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vw(e,t){if(e){if(typeof e==`string`)return yw(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)?yw(e,t):void 0}}function yw(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{typeof e==`function`&&e(),i(!0)},[e]),handleAnimationEnd:(0,s.useCallback)(()=>{typeof t==`function`&&t(),i(!1)},[t])}}function Cw(e){var t=e.animationInput,n=e.animationIdPrefix,r=e.items,i=e.previousItemsRef,a=e.isAnimationActive,o=e.animationBegin,c=e.animationDuration,l=e.animationEasing,u=e.onAnimationStart,d=e.onAnimationEnd,f=e.animationInterpolateFn,p=e.animationMatchBy,m=e.shouldUpdatePreviousRef,h=e.children,g=e.layout,_=ul(t,n),v=hw(_,i),y=v.startValue??null,b=mw(y,r,p??cw);return s.createElement(ll,{animationId:_,begin:o,duration:c,isActive:a,easing:l,onAnimationEnd:d,onAnimationStart:u,key:_},e=>{var t=y==null,n=r==null?r:f(b,e,g),i=m?m(e):e>0;return v.syncStepValue(n,e,i),n==null?null:h(n,e,t)})}function ww(e,t){return kw(e)||Ow(e,t)||Ew(e,t)||Tw()}function Tw(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ew(e,t){if(e){if(typeof e==`string`)return Dw(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)?Dw(e,t):void 0}}function Dw(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nww(s.useState(()=>fe(`uid-`)),1)[0]);function jw(e,t){var n=Aw();return t||(e?`${e}-${n}`:n)}var Mw=(0,s.createContext)(void 0),Nw=e=>{var t=e.id,n=e.type,r=e.children,i=jw(`recharts-${n}`,t);return s.createElement(Mw.Provider,{value:i},r(i))},Pw=na({name:`graphicalItems`,initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(B(t.payload))},prepare:V()},replaceCartesianGraphicalItem:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=Oi(e).cartesianItems.indexOf(B(r));a>-1&&(e.cartesianItems[a]=B(i))},prepare:V()},removeCartesianGraphicalItem:{reducer(e,t){var n=Oi(e).cartesianItems.indexOf(B(t.payload));n>-1&&e.cartesianItems.splice(n,1)},prepare:V()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(B(t.payload))},prepare:V()},removePolarGraphicalItem:{reducer(e,t){var n=Oi(e).polarItems.indexOf(B(t.payload));n>-1&&e.polarItems.splice(n,1)},prepare:V()},replacePolarGraphicalItem:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=Oi(e).polarItems.indexOf(B(r));a>-1&&(e.polarItems[a]=B(i))},prepare:V()}}}),Fw=Pw.actions,Iw=Fw.addCartesianGraphicalItem,Lw=Fw.replaceCartesianGraphicalItem,Rw=Fw.removeCartesianGraphicalItem;Fw.addPolarGraphicalItem,Fw.removePolarGraphicalItem,Fw.replacePolarGraphicalItem;var zw=Pw.reducer,Bw=(0,s.memo)(e=>{var t=I(),n=(0,s.useRef)(null);return(0,s.useLayoutEffect)(()=>{n.current===null?t(Iw(e)):n.current!==e&&t(Lw({prev:n.current,next:e})),n.current=e},[t,e]),(0,s.useLayoutEffect)(()=>()=>{n.current&&=(t(Rw(n.current)),null)},[t]),null}),Vw=[`points`];function Hw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Uw(e){for(var t=1;t{var c=Uw(Uw(Uw({r:3},o),p),{},{index:r,cx:e.x??void 0,cy:e.y??void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return s.createElement(Xw,{key:`dot-${r}`,option:n,dotProps:c,className:i})}),h={};return c&&l!=null&&(h.clipPath=`url(#clipPath-${f?``:`dots-`}${l})`),s.createElement(cx,{zIndex:d},s.createElement(D,qw({className:r},h),m))}function $w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eT(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),Co,wo],(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)}}),gT=()=>L(hT),_T=()=>L(vb);function vT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yT(e){for(var t=1;t{var t=e.point,n=e.childIndex,r=e.mainColor,i=e.activeDot,a=e.dataKey,o=e.clipPath;if(i===!1||t.x==null||t.y==null)return null;var c=yT(yT(yT({},{index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??`none`,strokeWidth:2,stroke:`#fff`,payload:t.payload,value:t.value}),m(i)),At(i)),l=(0,s.isValidElement)(i)?(0,s.cloneElement)(i,c):typeof i==`function`?i(c):s.createElement(IC,c);return s.createElement(D,{className:`recharts-active-dot`,clipPath:o},l)};function wT(e){var t=e.points,n=e.mainColor,r=e.activeDot,i=e.itemDataKey,a=e.clipPath,o=e.zIndex,c=o===void 0?pu.activeDot:o,l=L(db),u=_T();if(t==null||u==null)return null;var d=t.find(e=>u.includes(e.payload));return _e(d)?null:s.createElement(cx,{zIndex:c},s.createElement(CT,{point:d,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var TT=e=>{var t=e.chartData,n=I(),r=Wo();return(0,s.useEffect)(()=>r?()=>{}:(n(Sx(t)),()=>{n(Sx(void 0))}),[t,n,r]),null},ET={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},DT=na({name:`brush`,initialState:ET,reducers:{setBrushSettings(e,t){return t.payload==null?ET:t.payload}}});DT.actions.setBrushSettings;var OT=DT.reducer,kT=(e,t)=>{var n=e.x,r=e.y,i=t.x,a=t.y;return{x:Math.min(n,i),y:Math.min(r,a),width:Math.abs(i-n),height:Math.abs(a-r)}};function AT(e){return(e%180+180)%180}var jT=function(e){var t=e.width,n=e.height,r=AT(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&r{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=Oi(e).dots.findIndex(e=>e===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=Oi(e).areas.findIndex(e=>e===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(B(t.payload))},removeLine:(e,t)=>{var n=Oi(e).lines.findIndex(e=>e===t.payload);n!==-1&&e.lines.splice(n,1)}}}),NT=MT.actions;NT.addDot,NT.removeDot;var PT=NT.addArea,FT=NT.removeArea;NT.addLine,NT.removeLine;var IT=MT.reducer;function LT(e,t){return HT(e)||VT(e,t)||zT(e,t)||RT()}function RT(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zT(e,t){if(e){if(typeof e==`string`)return BT(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)?BT(e,t):void 0}}function BT(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.children,n=LT((0,s.useState)(`${fe(`recharts`)}-clip`),1)[0],r=gT();if(r==null)return null;var i=r.x,a=r.y,o=r.width,c=r.height;return s.createElement(UT.Provider,{value:n},s.createElement(`defs`,null,s.createElement(`clipPath`,{id:n},s.createElement(`rect`,{x:i,y:a,height:c,width:o}))),t)},GT=()=>(0,s.useContext)(UT);function KT(){}function qT(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:Object.prototype.toString.call(e)===`[object Object]`}function JT(e,t,n){return YT(e,t,void 0,void 0,void 0,void 0,n)}function YT(e,t,n,r,i,a,o){let s=o(e,t,n,r,i,a);if(s!==void 0)return s;if(typeof e==typeof t)switch(typeof e){case`bigint`:case`string`:case`boolean`:case`symbol`:case`undefined`:return e===t;case`number`:return e===t||Object.is(e,t);case`function`:return e===t;case`object`:return XT(e,t,a,o)}return XT(e,t,a,o)}function XT(e,t,n,r){if(Object.is(e,t))return!0;let i=Ht(e),a=Ht(t);if(i===`[object Arguments]`&&(i=tn),a===`[object Arguments]`&&(a=tn),i!==a)return!1;switch(i){case Wt:return e.toString()===t.toString();case Gt:return vn(e.valueOf(),t.valueOf());case Kt:case Yt:case Jt:return Object.is(e.valueOf(),t.valueOf());case Ut:return e.source===t.source&&e.flags===t.flags;case $t:return e===t}n??=new Map;let o=n.get(e),s=n.get(t);if(o!=null&&s!=null)return o===t;n.set(e,t),n.set(t,e);try{switch(i){case Xt:if(e.size!==t.size)return!1;for(let[i,a]of e.entries())if(!t.has(i)||!YT(a,t.get(i),i,e,t,n,r))return!1;return!0;case Zt:{if(e.size!==t.size)return!1;let i=Array.from(e.values()),a=Array.from(t.values());for(let o=0;oYT(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case Qt:case an:case on:case sn:case cn:case ln:case un:case dn:case fn:case pn:case mn:case hn:if(_n(e)!==_n(t)||e.length!==t.length)return!1;for(let i=0;ie*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function nE(e,t){return QT(e,t+1)}function rE(e,t,n,r,i){for(var a=(r||[]).slice(),o=t.start,s=t.end,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:QT(r,l)};var a=c,d,f=()=>(d===void 0&&(d=n(t,a)),d),p=t.coordinate,m=c===0||tE(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function iE(e,t,n,r,i){var a=(r||[]).slice().length;if(a===0)return[];for(var o=t.start,s=t.end,c=1;c<=a;c++){for(var l=(a-1)%c,u=o,d=!0,f=function(){var t=r[m];if(t==null)return 0;var a=m,o,c=()=>(o===void 0&&(o=n(t,a)),o),f=t.coordinate,p=m===l||tE(e,f,c,u,s);if(!p)return d=!1,1;p&&(u=f+e*(c()/2+i))},p,m=l;m(u===void 0&&(u=n(r,t)),u);if(t===o-1){var f=e*(l.coordinate+e*d()/2-c);a[t]=l=oE(oE({},l),{},{tickCoord:f>0?l.coordinate-f*e:l.coordinate})}else a[t]=l=oE(oE({},l),{},{tickCoord:l.coordinate});l.tickCoord!=null&&tE(e,l.tickCoord,d,s,c)&&(c=l.tickCoord-e*(d()/2+i),a[t]=oE(oE({},l),{},{isShow:!0}))},u=o-1;u>=0;u--)if(l(u))continue;return a}function dE(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,c=t.start,l=t.end;if(a){var u=r[s-1];if(u!=null){var d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=oE(oE({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),u.tickCoord!=null&&tE(e,u.tickCoord,()=>d,c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=oE(oE({},u),{},{isShow:!0}))}}for(var p=a?s-1:s,m=function(t){var r=o[t];if(r==null)return 1;var a=r,s,u=()=>(s===void 0&&(s=n(r,t)),s);if(t===0){var d=e*(a.coordinate-e*u()/2-c);o[t]=a=oE(oE({},a),{},{tickCoord:d<0?a.coordinate-d*e:a.coordinate})}else o[t]=a=oE(oE({},a),{},{tickCoord:a.coordinate});a.tickCoord!=null&&tE(e,a.tickCoord,u,c,l)&&(c=a.tickCoord+e*(u()/2+i),o[t]=oE(oE({},a),{},{isShow:!0}))},h=0;h{var i=typeof l==`function`?l(e.value,r):e.value;return p===`width`?$T(Qx(i,{fontSize:t,letterSpacing:n}),m,d):Qx(i,{fontSize:t,letterSpacing:n})[p]},g=i[0],_=i[1],v=i.length>=2&&g!=null&&_!=null?se(_.coordinate-g.coordinate):1,y=eE(a,v,p);return c===`equidistantPreserveStart`?rE(v,y,h,i,o):c===`equidistantPreserveEnd`?iE(v,y,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?dE(v,y,h,i,o,c===`preserveStartEnd`):uE(v,y,h,i,o),f.filter(e=>e.isShow))}var pE=e=>{var t=e.ticks,n=e.label,r=e.labelGapWithTick,i=r===void 0?5:r,a=e.tickSize,o=a===void 0?0:a,s=e.tickMargin,c=s===void 0?0:s,l=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>l&&(l=t.width)}});var u=n?n.getBoundingClientRect().width:0,d=o+c,f=l+d+u+(n?i:0);return Math.round(f)}return 0},mE=e=>{var t=e.ticks,n=e.label,r=e.labelGapWithTick,i=r===void 0?5:r,a=e.tickSize,o=a===void 0?0:a,s=e.tickMargin,c=s===void 0?0:s,l=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.height>l&&(l=t.height)}});var u=n?n.getBoundingClientRect().height:0,d=o+c,f=l+d+u+(n?i:0);return Math.round(f)}return 0},hE=na({name:`renderedTicks`,initialState:{xAxis:{},yAxis:{}},reducers:{setRenderedTicks:(e,t)=>{var n=t.payload,r=n.axisType,i=n.axisId,a=n.ticks;e[r][i]=B(a)},removeRenderedTicks:(e,t)=>{var n=t.payload,r=n.axisType,i=n.axisId;delete e[r][i]}}}),gE=hE.actions,_E=gE.setRenderedTicks,vE=gE.removeRenderedTicks,yE=hE.reducer,bE=[`axisLine`,`width`,`height`,`className`,`hide`,`ticks`,`axisType`,`axisId`];function xE(e,t){return EE(e)||TE(e,t)||CE(e,t)||SE()}function SE(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CE(e,t){if(e){if(typeof e==`string`)return wE(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)?wE(e,t):void 0}}function wE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{if(r!=null&&n!=null){var e=t.map(e=>({value:e.value,coordinate:e.coordinate,offset:e.offset,index:e.index})),o=a.current;o!=null&&o.axisId===r&&o.axisType===n&&ZT(o.ticks,e)||(a.current={ticks:e,axisId:r,axisType:n},i(_E({ticks:e,axisId:r,axisType:n})))}},[i,t,r,n]),(0,s.useEffect)(()=>r==null||n==null?be:()=>{i(vE({axisId:r,axisType:n}))},[i,r,n]),null}var VE=(0,s.forwardRef)((e,t)=>{var n=e.ticks,r=n===void 0?[]:n,i=e.tick,a=e.tickLine,c=e.stroke,l=e.tickFormatter,u=e.unit,d=e.padding,f=e.tickTextProps,h=e.orientation,g=e.mirror,_=e.x,v=e.y,y=e.width,b=e.height,x=e.tickSize,S=e.tickMargin,C=e.fontSize,w=e.letterSpacing,T=e.getTicksConfig,E=e.events,O=e.axisType,k=e.axisId,A=fE($($({},T),{},{ticks:r}),C,w),j=p(T),M=m(i),N=RS(j.textAnchor)?j.textAnchor:LE(h,g),ee=RE(h,g),te={};typeof a==`object`&&(te=a);var re=$($({},j),{},{fill:`none`},te),ie=A.map(e=>$({entry:e},IE(e,_,v,y,b,h,x,g,S))),ae=ie.map(e=>{var t=e.entry,n=e.line;return s.createElement(D,{className:`recharts-cartesian-axis-tick`,key:`tick-${t.value}-${t.coordinate}-${t.tickCoord}`},a&&s.createElement(`line`,kE({},re,n,{className:o(`recharts-cartesian-axis-tick-line`,ne(a,`className`))})))}),oe=ie.map((e,t)=>{var n=e.entry,r=e.tick,a=$($({},$($($($({verticalAnchor:ee},j),{},{textAnchor:N,stroke:`none`,fill:c},r),{},{index:t,payload:n,visibleTicksCount:A.length,tickFormatter:l,padding:d},f),{},{angle:f?.angle??j.angle??0})),M);return s.createElement(D,kE({className:`recharts-cartesian-axis-tick-label`,key:`tick-label-${n.value}-${n.coordinate}-${n.tickCoord}`},Mt(E,n,t)),i&&s.createElement(zE,{option:i,tickProps:a,value:`${typeof l==`function`?l(n.value,t):n.value}${u||``}`}))});return s.createElement(`g`,{className:`recharts-cartesian-axis-ticks recharts-${O}-ticks`},s.createElement(BE,{ticks:A,axisId:k,axisType:O}),oe.length>0&&s.createElement(cx,{zIndex:pu.label},s.createElement(`g`,{className:`recharts-cartesian-axis-tick-labels recharts-${O}-tick-labels`,ref:t},oe)),ae.length>0&&s.createElement(`g`,{className:`recharts-cartesian-axis-tick-lines recharts-${O}-tick-lines`},ae))}),HE=(0,s.forwardRef)((e,t)=>{var n=e.axisLine,r=e.width,i=e.height,a=e.className,c=e.hide,l=e.ticks,u=e.axisType,d=e.axisId,f=DE(e,bE),m=xE((0,s.useState)(``),2),h=m[0],g=m[1],_=xE((0,s.useState)(``),2),v=_[0],y=_[1],b=(0,s.useRef)(null);(0,s.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>pE({ticks:b.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin}),getCalculatedHeight:()=>mE({ticks:b.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}));var x=(0,s.useCallback)(e=>{if(e){var t=e.getElementsByClassName(`recharts-cartesian-axis-tick-value`);b.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==h||a!==v)&&(g(i),y(a))}}},[h,v]);return c||r!=null&&r<=0||i!=null&&i<=0?null:s.createElement(cx,{zIndex:e.zIndex},s.createElement(D,{className:o(`recharts-cartesian-axis`,a)},s.createElement(FE,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:p(e)}),s.createElement(VE,{ref:x,axisType:u,events:f,fontSize:h,getTicksConfig:e,height:e.height,letterSpacing:v,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:l,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:d}),s.createElement(sC,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},s.createElement(xC,{label:e.label,labelRef:e.labelRef}),e.children)))}),UE=s.forwardRef((e,t)=>{var n=Rt(e,PE);return s.createElement(HE,kE({},n,{ref:t}))});UE.displayName=`CartesianAxis`;var WE=na({name:`errorBars`,initialState:{},reducers:{addErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.errorBar;e[r]||(e[r]=[]),e[r].push(i)},replaceErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.prev,a=n.next;e[r]&&(e[r]=e[r].map(e=>e.dataKey===i.dataKey&&e.direction===i.direction?a:e))},removeErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.errorBar;e[r]&&(e[r]=e[r].filter(e=>e.dataKey!==i.dataKey||e.direction!==i.direction))}}}),GE=WE.actions;GE.addErrorBar,GE.replaceErrorBar,GE.removeErrorBar;var KE=WE.reducer;function qE(e,t){var n=L(t=>Gg(t,e)),r=L(e=>qg(e,t)),i=n?.allowDataOverflow??Ug.allowDataOverflow,a=r?.allowDataOverflow??Z.allowDataOverflow;return{needClip:i||a,needClipX:i,needClipY:a}}function JE(e){var t=e.xAxisId,n=e.yAxisId,r=e.clipPathId,i=gT(),a=qE(t,n),o=a.needClipX,c=a.needClipY,l=a.needClip,u=L(e=>gv(e,t,!1)),d=L(e=>_v(e,n,!1));if(!l||!i)return null;var f=i.x,p=i.y,m=i.width,h=i.height,g=o&&u?Math.min(u[0],u[1]):f-m/2,_=c&&d?Math.min(d[0],d[1]):p-h/2,v=o&&u?Math.abs(u[1]-u[0]):m*2,y=c&&d?Math.abs(d[1]-d[0]):h*2;return s.createElement(`clipPath`,{id:`clipPath-${r}`},s.createElement(`rect`,{x:g,y:_,width:v,height:y}))}function YE(e){var t=m(e),n=3,r=2;if(t!=null){var i=t.r,a=t.strokeWidth,o=Number(i),s=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(s)||s<0)&&(s=r),{r:o,strokeWidth:s}}return{r:n,strokeWidth:r}}function XE(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function ZE(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var QE=(e,t,n)=>Wv(e,`xAxis`,XE(e,t),n),$E=(e,t,n)=>Uv(e,`xAxis`,XE(e,t),n),eD=(e,t,n)=>Wv(e,`yAxis`,ZE(e,t),n),tD=(e,t,n)=>Uv(e,`yAxis`,ZE(e,t),n),nD=R([W,QE,eD,$E,tD],(e,t,n,r,i)=>ao(e,`xAxis`)?vo(t,r,!1):vo(n,i,!1)),rD=R([t_,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),iD=e=>ao(W(e),`xAxis`)?`yAxis`:`xAxis`,aD=(e,t)=>iD(e)===`yAxis`?ZE(e,t):XE(e,t),oD=(e,t,n)=>E_(e,iD(e),aD(e,t),n),sD=R([W,QE,eD,$E,tD,R([rD,oD],(e,t)=>{if(e!=null&&t!=null){var n=e.stackId,r=Fu(e);if(n!=null&&r!=null){var i=(t[n]?.stackedData)?.find(e=>e.key===r);if(i!=null)return i.map(e=>[e[0],e[1]])}}}),jl,nD,rD,fu,R([rD,oD],(e,t)=>{if(e!=null&&e.stackId!=null&&t!=null){var n=t[e.stackId];if(n!=null)return n.graphicalItems.map(e=>e.dataKey).filter(ye)}})],(e,t,n,r,i,a,o,s,c,l,u)=>{var d=o.chartData,f=o.dataStartIndex,p=o.dataEndIndex;if(!(c==null||e!==`horizontal`&&e!==`vertical`||t==null||n==null||r==null||i==null||r.length===0||i.length===0||s==null)){var m=c.data,h=m&&m.length>0?m:d?.slice(f,p+1);if(h!=null)return BD({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:h,chartBaseValue:l,bandSize:s,stackDataKeys:u})}}),cD=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`layout`,`isRange`,`stroke`,`connectNulls`],lD=[`id`,`baseLine`];function uD(){return uD=Object.assign?Object.assign.bind():function(e){for(var t=1;te.y||0));return P(n)?l=Math.max(n,l):n&&Array.isArray(n)&&n.length&&(l=Math.max(...n.map(e=>e.y||0),l)),P(l)?s.createElement(`rect`,{x:ae.x||0));return P(n)?l=Math.max(n,l):n&&Array.isArray(n)&&n.length&&(l=Math.max(...n.map(e=>e.x||0),l)),P(l)?s.createElement(`rect`,{x:0,y:ae==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>e.status===`matched`?[CD(CD({},e.next),{},{x:he(e.prev.x,e.next.x,t),y:he(e.prev.y,e.next.y,t)})]:e.status===`added`?[e.next]:[]),connectNulls:!1,dot:!1,fill:`#3182bd`,fillOpacity:.6,hide:!1,isAnimationActive:`auto`,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,type:`linear`,label:!1,shape:gD,xAxisId:0,yAxisId:0,zIndex:pu.area};function OD(e,t){return e&&e!==`none`?e:t}var kD=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.fill,a=e.legendType;return[{inactive:e.hide,dataKey:t,type:a,color:OD(r,i),value:bo(n,t),payload:e}]},AD=s.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,c=e.hide,l=e.unit,u=e.formatter,d=e.tooltipType,f=e.id,p={dataDefinedOnItem:n,getPosition:be,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:bo(o,t),hide:c,type:d,color:OD(r,a),unit:l,formatter:u,graphicalItemId:f}};return s.createElement(ew,{tooltipEntrySettings:p})});function jD(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.needClip,a=r.dot,o=r.dataKey,c=p(r);return s.createElement(Qw,{points:n,dot:a,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:o,baseProps:c,needClip:i,clipPathId:t})}function MD(e){var t=e.showLabels,n=e.children,r=e.points.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return CD(CD({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return s.createElement(kC,{value:t?r:void 0},n)}function ND(e){var t=e.points,n=e.baseLine,r=e.needClip,i=e.clipPathId,a=e.props,o=e.animationElapsedTime,c=e.isAnimating,l=e.isEntrance,u=a.layout,d=a.type,f=a.stroke,p=a.connectNulls,m=a.isRange,g=a.shape,_=a.id,v=bD(a,_D),y=CD(CD({},h(v)),{},{id:_,points:t,connectNulls:p,type:d,baseLine:n,layout:u,stroke:f,isRange:m,animationElapsedTime:o,isAnimating:c,isEntrance:l});return s.createElement(s.Fragment,null,t?.length>1&&s.createElement(D,{clipPath:r?`url(#clipPath-${i})`:void 0},s.createElement($C,{option:g,DefaultShape:DD.shape,shapeProps:y})),s.createElement(jD,{points:t,props:v,clipPathId:i}))}function PD(e,t,n){return P(e)?he(P(t)?t:void 0,e,n):_e(e)||ce(e)?he(P(t)?t:void 0,0,n):e}function FD(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=e.previousPointsRef,a=e.previousBaselineRef,o=r.points,c=r.baseLine,l=r.isAnimationActive,u=r.animationBegin,d=r.animationDuration,f=r.animationEasing,p=r.animationMatchBy,m=r.animationInterpolateFn,h=(0,s.useMemo)(()=>({points:o,baseLine:c}),[o,c]),g=hw(h,a),_=Ms(),v=Sw(r.onAnimationStart,r.onAnimationEnd),y=v.isAnimating,b=v.handleAnimationStart,x=v.handleAnimationEnd,S=g.startValue;if(_==null)return null;var C=Array.isArray(c)&&Array.isArray(S)?mw(S,c,p):Array.isArray(c)?mw(null,c,p):null;return s.createElement(Cw,{animationInput:h,animationIdPrefix:`recharts-area-`,items:o,previousItemsRef:i,isAnimationActive:l,animationBegin:u,animationDuration:d,animationEasing:f,onAnimationStart:b,onAnimationEnd:x,animationInterpolateFn:m,animationMatchBy:p,layout:_},(e,i,a)=>{var l=i===1?c:Array.isArray(c)?m(C,i,_):a?c:PD(c,S,i);return g.syncStepValue(l,i),s.createElement(MD,{showLabels:!y,points:o},r.children,s.createElement(ND,{points:e,baseLine:l,needClip:t,clipPathId:n,props:r,animationElapsedTime:i,isAnimating:y||i<1,isEntrance:a}),s.createElement(PC,{label:r.label}))})}function ID(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=(0,s.useRef)(null),a=(0,s.useRef)();return s.createElement(FD,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var LD=class extends s.PureComponent{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.top,c=e.left,l=e.needClip,u=e.xAxisId,d=e.yAxisId,f=e.width,p=e.height,m=e.id,h=e.baseLine,g=e.zIndex;if(t)return null;var _=o(`recharts-area`,i),v=m,y=YE(n),b=y.r,x=y.strokeWidth,S=HC(n),C=b*2+x,w=l?`url(#clipPath-${S?``:`dots-`}${v})`:void 0;return s.createElement(cx,{zIndex:g},s.createElement(D,{className:_},l&&s.createElement(`defs`,null,s.createElement(JE,{clipPathId:v,xAxisId:u,yAxisId:d}),!S&&s.createElement(`clipPath`,{id:`clipPath-dots-${v}`},s.createElement(`rect`,{x:c-C/2,y:a-C/2,width:f+C,height:p+C}))),s.createElement(ID,{needClip:l,clipPathId:v,props:this.props})),s.createElement(wT,{points:r,mainColor:OD(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:w}),this.props.isRange&&Array.isArray(h)&&s.createElement(wT,{points:h,mainColor:OD(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:w}))}};function RD(e){var t=e.activeDot,n=e.animationBegin,r=e.animationDuration,i=e.animationEasing,a=e.connectNulls,o=e.dot,c=e.fill,l=e.fillOpacity,u=e.hide,d=e.isAnimationActive,f=e.legendType,p=e.stroke,m=e.xAxisId,h=e.yAxisId,g=bD(e,vD),_=js(),v=Ob(),y=qE(m,h).needClip,b=Wo(),x=L(t=>sD(t,e.id,b))??{},S=x.points,C=x.isRange,w=x.baseLine,T=gT();if(_!==`horizontal`&&_!==`vertical`||T==null||v!==`AreaChart`&&v!==`ComposedChart`)return null;var E=T.height,D=T.width,O=T.x,k=T.y;return!S||!S.length?null:s.createElement(LD,yD({},g,{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,baseLine:w,connectNulls:a,dot:o,fill:c,fillOpacity:l,height:E,hide:u,layout:_,isAnimationActive:d,isRange:C,legendType:f,needClip:y,points:S,stroke:p,width:D,left:O,top:k,xAxisId:m,yAxisId:h}))}var zD=(e,t,n,r,i)=>{var a=n??t;if(P(a))return a;var o=e===`horizontal`?i:r,s=o.scale.domain();if(o.type===`number`){var c=Math.max(s[0],s[1]),l=Math.min(s[0],s[1]);return a===`dataMin`?l:a===`dataMax`||c<0?c:Math.max(Math.min(s[0],s[1]),0)}return a===`dataMin`?s[0]:a===`dataMax`?s[1]:s[0]};function BD(e){var t=e.areaSettings,n=t.connectNulls,r=t.baseValue,i=t.dataKey,a=e.stackedData,o=e.layout,s=e.chartBaseValue,c=e.xAxis,l=e.yAxis,u=e.displayedData,d=e.dataStartIndex,f=e.xAxisTicks,p=e.yAxisTicks,m=e.bandSize,h=e.stackDataKeys,g=a&&a.length,_=zD(o,s,r,c,l),v=o===`horizontal`,y=!1,b=u.map((e,t)=>{var r;if(g)r=a[d+t];else{var o=U(e,i);Array.isArray(o)?(r=o,y=!0):r=[_,o]}var s=r?.[1]??null,u=U(e,i),b=g&&u==null&&h!=null&&h.length>0&&h.every(t=>U(e,t)==null),x=s==null||g&&!n&&u==null||b;return v?{x:fo({axis:c,ticks:f,bandSize:m,entry:e,index:t}),y:x?null:l.scale.map(s)??null,value:r,payload:e}:{x:x?null:c.scale.map(s)??null,y:fo({axis:l,ticks:p,bandSize:m,entry:e,index:t}),value:r,payload:e}});return{points:b,baseLine:(g||y?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:t!=null&&e.y!=null?l.scale.map(t)??null:null,payload:e.payload}:{x:t==null?null:c.scale.map(t)??null,y:e.y,payload:e.payload}}):v?l.scale.map(_):c.scale.map(_))??0,isRange:y}}function VD(e){var t=Rt(e,DD),n=Wo();return s.createElement(Nw,{id:t.id,type:`area`},e=>s.createElement(s.Fragment,null,s.createElement(tw,{legendPayload:kD(t)}),s.createElement(AD,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),s.createElement(Bw,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:uo(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),s.createElement(RD,yD({},t,{id:e}))))}var HD=s.memo(VD,oc);HD.displayName=`Area`;var UD=[`domain`,`range`],WD=[`domain`,`range`];function GD(e,t){if(e==null)return{};var n,r,i=KD(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{if(o!=null)return eO(eO({},a),{},{type:o})},[o,a]);return(0,s.useLayoutEffect)(()=>{c!=null&&(n.current===null?t(lT(c)):n.current!==c&&t(uT({prev:n.current,next:c})),n.current=c)},[c,t]),(0,s.useLayoutEffect)(()=>()=>{n.current&&=(t(dT(n.current)),null)},[t]),null}function sO(e){var t=e.yAxisId,n=e.className,r=e.width,i=e.label,a=(0,s.useRef)(null),c=(0,s.useRef)(null),l=L(Ho),u=Wo(),d=I(),f=`yAxis`,p=L(e=>Rv(e,t)),m=L(e=>Lv(e,t)),h=L(e=>Hv(e,f,t,u)),g=L(e=>Kg(e,t));if((0,s.useLayoutEffect)(()=>{if(!(r!==`auto`||!p||fC(i)||(0,s.isValidElement)(i)||g==null)){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(p.width)!==Math.round(n)&&d(fT({id:t,width:n}))}}},[h,p,d,i,t,r,g]),p==null||m==null||g==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var _=iO(e,XD);g.id,g.scale;var v=iO(g,ZD);return s.createElement(UE,QD({},_,v,{ref:a,labelRef:c,x:m.x,y:m.y,tickTextProps:r===`auto`?{width:void 0}:{width:r},width:p.width,height:p.height,className:o(`recharts-${f} ${f}`,n),viewBox:l,ticks:h,axisType:f,axisId:t}))}var cO={allowDataOverflow:Z.allowDataOverflow,allowDecimals:Z.allowDecimals,allowDuplicatedCategory:Z.allowDuplicatedCategory,angle:Z.angle,axisLine:PE.axisLine,hide:!1,includeHidden:Z.includeHidden,interval:Z.interval,label:!1,minTickGap:Z.minTickGap,mirror:Z.mirror,orientation:Z.orientation,padding:Z.padding,reversed:Z.reversed,scale:Z.scale,tick:Z.tick,tickCount:Z.tickCount,tickLine:PE.tickLine,tickSize:PE.tickSize,type:Z.type,niceTicks:Z.niceTicks,width:Z.width,yAxisId:0},lO=s.memo(e=>{var t=Rt(e,cO);return s.createElement(s.Fragment,null,s.createElement(oO,{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}),s.createElement(sO,t))},JD);lO.displayName=`YAxis`;var uO=R([(e,t)=>t,W,Nu,q,ib,ob,Mb,Bo],Wb);function dO(e){return`getBBox`in e.currentTarget&&typeof e.currentTarget.getBBox==`function`}function fO(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(dO(e)){var i=e.currentTarget.getBBox();n=i.width>0?t.width/i.width:1,r=i.height>0?t.height/i.height:1}else{var a=e.currentTarget;n=a.offsetWidth>0?t.width/a.offsetWidth:1,r=a.offsetHeight>0?t.height/a.offsetHeight:1}var o=(e,i)=>({relativeX:Math.round((e-t.left)/n),relativeY:Math.round((i-t.top)/r)});return`touches`in e?Array.from(e.touches).map(e=>o(e.clientX,e.clientY)):o(e.clientX,e.clientY)}var pO=Fi(`mouseClick`),mO=Ha();mO.startListening({actionCreator:pO,effect:(e,t)=>{var n=e.payload,r=uO(t.getState(),fO(n));r?.activeIndex!=null&&t.dispatch(ly({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var hO=Fi(`mouseMove`),gO=Ha(),_O=null,vO=null,yO=null;gO.startListening({actionCreator:hO,effect:(e,t)=>{var n=e.payload,r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a?.includes(`mousemove`);_O!==null&&(cancelAnimationFrame(_O),_O=null),vO!==null&&(typeof i!=`number`||!o)&&(clearTimeout(vO),vO=null),yO=fO(n);var s=()=>{var e=t.getState(),n=Yv(e,e.tooltip.settings.shared);if(!yO){_O=null,vO=null;return}if(n===`axis`){var r=uO(e,yO);r?.activeIndex==null?t.dispatch(sy()):t.dispatch(cy({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}_O=null,vO=null};if(!o){s();return}i===`raf`?_O=requestAnimationFrame(s):typeof i==`number`&&vO===null&&(vO=setTimeout(s,i))}});function bO(e,t){return t instanceof HTMLElement?`HTMLElement <${t.tagName} class="${t.className}">`:t===window?`global.window`:e===`children`&&typeof t==`object`&&t?`<>`:t}var xO={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},SO=na({name:`rootProps`,initialState:xO,reducers:{updateOptions:(e,t)=>{e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=t.payload.barGap??xO.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}}}),CO=SO.reducer,wO=SO.actions.updateOptions,TO=na({name:`polarOptions`,initialState:null,reducers:{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)}});TO.actions.updatePolarOptions;var EO=TO.reducer,DO=Fi(`keyDown`),OO=Fi(`focus`),kO=Fi(`blur`),AO=Ha(),jO=null,MO=null,NO=null;AO.startListening({actionCreator:DO,effect:(e,t)=>{NO=e.payload,jO!==null&&(cancelAnimationFrame(jO),jO=null);var n=t.getState().eventSettings,r=n.throttleDelay,i=n.throttledEvents,a=i===`all`||i.includes(`keydown`);MO!==null&&(typeof r!=`number`||!a)&&(clearTimeout(MO),MO=null);var o=()=>{try{var e=t.getState();if(e.rootProps.accessibilityLayer===!1)return;var n=e.tooltip.keyboardInteraction,r=NO;if(r!==`ArrowRight`&&r!==`ArrowLeft`&&r!==`Enter`)return;var i=wy(n,Ky(e),C_(e),tb(e)),a=i==null?-1:Number(i),o=!Number.isFinite(a)||a<0,s=ob(e),c=Ky(e),l=Yv(e,e.tooltip.settings.shared);if(r===`Enter`){if(o)return;var u=Lb(e,l,`hover`,String(n.index));t.dispatch(dy({active:!n.active,activeIndex:n.index,activeCoordinate:u}));return}var d=Gv(e)===`left-to-right`?1:-1,f=r===`ArrowRight`?1:-1,p;if(o){var m=C_(e),h=tb(e),g=f*d,_=e=>({active:!1,index:String(e),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(p=-1,g>0){for(var v=0;v=0;y--)if(wy(_(y),c,m,h)!=null){p=y;break}if(p<0)return}else{p=a+f*d;var b=s?.length||c.length;if(b===0||p>=b||p<0)return}var x=Lb(e,l,`hover`,String(p));t.dispatch(dy({active:!0,activeIndex:p.toString(),activeCoordinate:x}))}finally{jO=null,MO=null}};if(!a){o();return}r===`raf`?jO=requestAnimationFrame(o):typeof r==`number`&&MO===null&&(o(),NO=null,MO=setTimeout(()=>{NO?o():(MO=null,jO=null)},r))}}),AO.startListening({actionCreator:OO,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var r=n.tooltip.keyboardInteraction;if(!r.active&&r.index==null){var i=`0`,a=Lb(n,Yv(n,n.tooltip.settings.shared),`hover`,String(i));t.dispatch(dy({active:!0,activeIndex:i,activeCoordinate:a}))}}}}),AO.startListening({actionCreator:kO,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var r=n.tooltip.keyboardInteraction;r.active&&t.dispatch(dy({active:!1,activeIndex:r.index,activeCoordinate:r.coordinate}))}}});function PO(e){e.persist();var t=e.currentTarget;return new Proxy(e,{get:(e,n)=>{if(n===`currentTarget`)return t;var r=Reflect.get(e,n);return typeof r==`function`?r.bind(e):r}})}var FO=Fi(`externalEvent`),IO=Ha(),LO=new Map,RO=new Map,zO=new Map;IO.startListening({actionCreator:FO,effect:(e,t)=>{var n=e.payload,r=n.handler,i=n.reactEvent;if(r!=null){var a=i.type,o=PO(i);zO.set(a,{handler:r,reactEvent:o});var s=LO.get(a);s!==void 0&&(cancelAnimationFrame(s),LO.delete(a));var c=t.getState().eventSettings,l=c.throttleDelay,u=c.throttledEvents,d=u===`all`||u?.includes(a),f=RO.get(a);f!==void 0&&(typeof l!=`number`||!d)&&(clearTimeout(f),RO.delete(a));var p=()=>{var e=zO.get(a);try{if(!e)return;var n=e.handler,r=e.reactEvent,i=t.getState(),o={activeCoordinate:gb(i),activeDataKey:pb(i),activeIndex:db(i),activeLabel:fb(i),activeTooltipIndex:db(i),isTooltipActive:_b(i)};n&&n(o,r)}finally{LO.delete(a),RO.delete(a),zO.delete(a)}};if(!d){p();return}if(l===`raf`){var m=requestAnimationFrame(p);LO.set(a,m)}else if(typeof l==`number`){if(!RO.has(a)){p();var h=setTimeout(p,l);RO.set(a,h)}}else p()}}});var BO=R([R([Oy],e=>e.tooltipItemPayloads),(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(e=>e.settings.graphicalItemId===n);if(r!=null){var i=r.getPosition;if(i!=null)return i(t)}}}),VO=Fi(`touchMove`),HO=Ha(),UO=null,WO=null,GO=null,KO=null;HO.startListening({actionCreator:VO,effect:(e,t)=>{var n=e.payload;if(n.touches!=null&&n.touches.length!==0){KO=PO(n);var r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a.includes(`touchmove`);UO!==null&&(cancelAnimationFrame(UO),UO=null),WO!==null&&(typeof i!=`number`||!o)&&(clearTimeout(WO),WO=null),GO=Array.from(n.touches).map(e=>fO({clientX:e.clientX,clientY:e.clientY,currentTarget:n.currentTarget}));var s=()=>{if(KO!=null){var e=t.getState(),n=Yv(e,e.tooltip.settings.shared);if(n===`axis`){var r=GO?.[0];if(r==null){UO=null,WO=null;return}var i=uO(e,r);i?.activeIndex!=null&&t.dispatch(cy({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}else if(n===`item`){var a=KO.touches[0];if(document.elementFromPoint==null||a==null)return;var o=document.elementFromPoint(a.clientX,a.clientY);if(!o||!o.getAttribute)return;var s=o.getAttribute(ko),c=o.getAttribute(`data-recharts-item-id`)??void 0,l=Hy(e).find(e=>e.id===c);if(s==null||l==null||c==null)return;var u=l.dataKey,d=BO(e,s,c);t.dispatch(oy({activeDataKey:u,activeIndex:s,activeCoordinate:d,activeGraphicalItemId:c}))}UO=null,WO=null}};if(!o){s();return}i===`raf`?UO=requestAnimationFrame(s):typeof i==`number`&&WO===null&&(s(),KO=null,WO=setTimeout(()=>{KO?s():(WO=null,UO=null)},i))}}});var qO={throttleDelay:`raf`,throttledEvents:[`mousemove`,`touchmove`,`pointermove`,`scroll`,`wheel`]},JO=na({name:`eventSettings`,initialState:qO,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=B(t.payload.throttledEvents))}}}),YO=JO.actions.setEventSettings,XO=JO.reducer,ZO=ar({brush:OT,cartesianAxis:mT,chartData:wx,errorBars:KE,eventSettings:XO,graphicalItems:zw,layout:Xa,legend:Vs,options:_x,polarAxis:zC,polarOptions:EO,referenceElements:IT,renderedTicks:yE,rootProps:CO,tooltip:fy,zIndex:sx}),QO=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Chart`;return Ki({reducer:ZO,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:![`commonjs`,`es6`,`production`].includes(`es6`)}).concat([mO.middleware,gO.middleware,AO.middleware,IO.middleware,HO.middleware]),enhancers:e=>{var t=e;return typeof e==`function`&&(t=e()),t.concat(Wi({type:`raf`}))},devTools:sc.devToolsEnabled&&{serialize:{replacer:bO},name:`recharts-${t}`}})};function $O(e){var t=e.preloadedState,n=e.children,r=e.reduxStoreName,i=Wo(),a=(0,s.useRef)(null);if(i)return n;a.current??=QO(t,r);var o=wn;return s.createElement(rc,{context:o,store:a.current},n)}function ek(e){var t=e.layout,n=e.margin,r=I(),i=Wo();return(0,s.useEffect)(()=>{i||(r(qa(t)),r(Ka(n)))},[r,i,t,n]),null}var tk=(0,s.memo)(ek,oc);function nk(e){var t=I();return(0,s.useEffect)(()=>{t(wO(e))},[t,e]),null}var rk=(0,s.memo)(e=>{var t=I();return(0,s.useEffect)(()=>{t(YO(e))},[t,e]),null},oc);function ik(e){var t=e.zIndex,n=e.isPanorama,r=(0,s.useRef)(null),i=I();return(0,s.useLayoutEffect)(()=>(r.current&&i(ax({zIndex:t,element:r.current,isPanorama:n})),()=>{i(ox({zIndex:t,isPanorama:n}))}),[i,t,n]),s.createElement(`g`,{tabIndex:-1,ref:r,className:`recharts-zIndex-layer_${t}`})}function ak(e){var t=e.children,n=e.isPanorama,r=L(Kb);if(!r||r.length===0)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return s.createElement(s.Fragment,null,i.map(e=>s.createElement(ik,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>s.createElement(ik,{key:e,zIndex:e,isPanorama:n})))}var ok=[`children`];function sk(e,t){if(e==null)return{};var n,r,i=ck(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=ks(),r=As(),i=hc();if(!Qa(n)||!Qa(r))return null;var a=e.children,o=e.otherAttributes,c=e.title,l=e.desc,u,d;return o!=null&&(u=typeof o.tabIndex==`number`?o.tabIndex:i?0:void 0,d=typeof o.role==`string`?o.role:i?`application`:void 0),s.createElement(S,lk({},o,{title:c,desc:l,role:d,tabIndex:u,width:n,height:r,style:uk,ref:t}),a)}),fk=e=>{var t=e.children,n=L(Ko);if(!n)return null;var r=n.width,i=n.height,a=n.y,o=n.x;return s.createElement(S,{width:r,height:i,x:o,y:a},t)},pk=(0,s.forwardRef)((e,t)=>{var n=e.children,r=sk(e,ok);return Wo()?s.createElement(fk,null,s.createElement(ak,{isPanorama:!0},n)):s.createElement(dk,lk({ref:t},r),s.createElement(ak,{isPanorama:!1},n))});function mk(e,t){return yk(e)||vk(e,t)||gk(e,t)||hk()}function hk(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gk(e,t){if(e){if(typeof e==`string`)return _k(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)?_k(e,t):void 0}}function _k(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{if(n!=null){var t=n.getBoundingClientRect().width/n.offsetWidth;H(t)&&t!==i&&e(Ya(t))}},[n,e,i]),r}function xk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Sk(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n(Fx(),null);function Pk(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var Fk=(0,s.forwardRef)((e,t)=>{var n=(0,s.useRef)(null),r=Dk((0,s.useState)({containerWidth:Pk(e.style?.width),containerHeight:Pk(e.style?.height)}),2),i=r[0],a=r[1],o=(0,s.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),c=(0,s.useCallback)(e=>{if(typeof t==`function`&&t(e),n.current!=null&&(n.current.disconnect(),n.current=null),e!=null&&typeof ResizeObserver<`u`){var r=e.getBoundingClientRect(),i=r.width,a=r.height;o(i,a);var s=new ResizeObserver(e=>{var t=e[0];if(t!=null){var n=t.contentRect,r=n.width,i=n.height;o(r,i)}});s.observe(e),n.current=s}},[t,o]);return(0,s.useEffect)(()=>()=>{n.current?.disconnect()},[o]),s.createElement(s.Fragment,null,s.createElement(Fs,{width:i.containerWidth,height:i.containerHeight}),s.createElement(`div`,Ek({ref:c},e)))}),Ik=(0,s.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=Dk((0,s.useState)({containerWidth:Pk(n),containerHeight:Pk(r)}),2),a=i[0],o=i[1],c=(0,s.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),l=(0,s.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var n=e.getBoundingClientRect(),r=n.width,i=n.height;c(r,i)}},[t,c]);return s.createElement(s.Fragment,null,s.createElement(Fs,{width:a.containerWidth,height:a.containerHeight}),s.createElement(`div`,Ek({ref:l},e)))}),Lk=(0,s.forwardRef)((e,t)=>{var n=e.width,r=e.height;return s.createElement(s.Fragment,null,s.createElement(Fs,{width:n,height:r}),s.createElement(`div`,Ek({ref:t},e)))}),Rk=(0,s.forwardRef)((e,t)=>{var n=e.width,r=e.height;return typeof n==`string`||typeof r==`string`?s.createElement(Ik,Ek({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?s.createElement(Lk,Ek({},e,{width:n,height:r,ref:t})):s.createElement(s.Fragment,null,s.createElement(Fs,{width:n,height:r}),s.createElement(`div`,Ek({ref:t},e)))});function zk(e){return e?Fk:Rk}var Bk=(0,s.forwardRef)((e,t)=>{var n=e.children,r=e.className,i=e.height,a=e.onClick,c=e.onContextMenu,l=e.onDoubleClick,u=e.onMouseDown,d=e.onMouseEnter,f=e.onMouseLeave,p=e.onMouseMove,m=e.onMouseUp,h=e.onTouchEnd,g=e.onTouchMove,_=e.onTouchStart,v=e.style,y=e.width,b=e.responsive,x=e.dispatchTouchEvents,S=x===void 0||x,C=(0,s.useRef)(null),w=I(),T=Dk((0,s.useState)(null),2),E=T[0],D=T[1],O=Dk((0,s.useState)(null),2),k=O[0],A=O[1],j=bk(),M=Cs(),N=M?.width>0?M.width:y,ee=M?.height>0?M.height:i,te=(0,s.useCallback)(e=>{j(e),typeof t==`function`&&t(e),D(e),A(e),e!=null&&(C.current=e)},[j,t,D,A]),ne=(0,s.useCallback)(e=>{w(pO(e)),w(FO({handler:a,reactEvent:e}))},[w,a]),re=(0,s.useCallback)(e=>{w(hO(e)),w(FO({handler:d,reactEvent:e}))},[w,d]),ie=(0,s.useCallback)(e=>{w(sy()),w(FO({handler:f,reactEvent:e}))},[w,f]),ae=(0,s.useCallback)(e=>{w(hO(e)),w(FO({handler:p,reactEvent:e}))},[w,p]),oe=(0,s.useCallback)(()=>{w(OO())},[w]),se=(0,s.useCallback)(()=>{w(kO())},[w]),ce=(0,s.useCallback)(e=>{w(DO(e.key))},[w]),le=(0,s.useCallback)(e=>{w(FO({handler:c,reactEvent:e}))},[w,c]),P=(0,s.useCallback)(e=>{w(FO({handler:l,reactEvent:e}))},[w,l]),ue=(0,s.useCallback)(e=>{w(FO({handler:u,reactEvent:e}))},[w,u]),de=(0,s.useCallback)(e=>{w(FO({handler:m,reactEvent:e}))},[w,m]),fe=(0,s.useCallback)(e=>{w(FO({handler:_,reactEvent:e}))},[w,_]),pe=(0,s.useCallback)(e=>{S&&w(VO(e)),w(FO({handler:g,reactEvent:e}))},[w,S,g]),me=(0,s.useCallback)(e=>{w(FO({handler:h,reactEvent:e}))},[w,h]),he=zk(b);return s.createElement(lx.Provider,{value:E},s.createElement(Ae.Provider,{value:k},s.createElement(he,{width:N??v?.width,height:ee??v?.height,className:o(`recharts-wrapper`,r),style:Sk({position:`relative`,cursor:`default`,width:N,height:ee},v),onClick:ne,onContextMenu:le,onDoubleClick:P,onFocus:oe,onBlur:se,onKeyDown:ce,onMouseDown:ue,onMouseEnter:re,onMouseLeave:ie,onMouseMove:ae,onMouseUp:de,onTouchEnd:me,onTouchMove:pe,onTouchStart:fe,ref:te},s.createElement(Nk,null),n)))}),Vk=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function Hk(e,t){if(e==null)return{};var n,r,i=Uk(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=e.width,r=e.height,i=e.responsive,a=e.children,o=e.className,c=e.style,l=e.compact,u=e.title,d=e.desc,f=p(Hk(e,Vk));return l?s.createElement(s.Fragment,null,s.createElement(Fs,{width:n,height:r}),s.createElement(pk,{otherAttributes:f,title:u,desc:d},a)):s.createElement(Bk,{className:o,style:c,width:n,height:r,responsive:i??!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},s.createElement(pk,{otherAttributes:f,title:u,desc:d,ref:t},s.createElement(WT,null,a)))});function Gk(){return Gk=Object.assign?Object.assign.bind():function(e){for(var t=1;t=10?Math.round(t):Number(t.toFixed(1))}`:n===`tokens`?r(t):e(t)}function b({active:e,payload:t,label:n,daily:r,lang:i,models:a,totalLabel:o,metric:s}){if(!e||!t?.length)return null;let c=new Map(a.map(e=>[e.id,e.label])),l=t.filter(e=>(e.value??0)>0).sort((e,t)=>t.value-e.value),u=t.reduce((e,t)=>e+(t.value??0),0);return(0,m.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,m.jsx)(`div`,{className:`mono text-muted`,children:g(String(n),r,i)}),(0,m.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[l.map(e=>(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[a.findIndex(t=>t.id===e.dataKey)%h.length]}}),c.get(e.dataKey)||e.dataKey]}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(e.value,s)})]},e.dataKey)),(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6 border-t border-separator pt-1`,children:[(0,m.jsx)(`span`,{className:`text-muted`,children:o}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(u,s)})]})]})]})}function x({series:e,models:t,lang:n,emptyLabel:r,totalLabel:i,metric:a=`credits`}){let v=(0,p.useMemo)(()=>t.map(e=>e.id),[t]),x=(0,p.useMemo)(()=>e.map(e=>{let t=_(e,a),n={at:e.at};for(let e of v){let r=Number(t[e]??0);n[e]=a===`tokens`?r:Number(r.toFixed(4))}return n}),[e,v,a]),S=Math.max(0,...x.map(e=>v.reduce((t,n)=>t+Number(e[n]??0),0)))>0,C=(x.length>1?Date.parse(x[x.length-1].at)-Date.parse(x[0].at):0)>1728e5;return!e.length||!S?(0,m.jsx)(`div`,{className:`grid min-h-56 place-items-center px-6 py-12 text-center text-sm text-muted`,children:r}):(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsx)(`div`,{className:`h-72 w-full`,children:(0,m.jsx)(c,{width:`100%`,height:`100%`,children:(0,m.jsxs)(f,{data:x,margin:{top:8,right:8,bottom:0,left:0},children:[(0,m.jsx)(`defs`,{children:v.map((e,t)=>(0,m.jsxs)(`linearGradient`,{id:`cost-${a}-${e}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,m.jsx)(`stop`,{offset:`0%`,stopColor:h[t%h.length],stopOpacity:.32}),(0,m.jsx)(`stop`,{offset:`100%`,stopColor:h[t%h.length],stopOpacity:.04})]},e))}),(0,m.jsx)(l,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,m.jsx)(d,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>g(e,C,n)}),(0,m.jsx)(s,{width:52,tickLine:!1,axisLine:!1,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>y(e,a)}),(0,m.jsx)(u,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,m.jsx)(b,{daily:C,lang:n,models:t,totalLabel:i,metric:a})}),v.map((e,t)=>(0,m.jsx)(o,{type:`monotone`,dataKey:e,stackId:`usage`,stroke:h[t%h.length],strokeWidth:1.5,fill:`url(#cost-${a}-${e})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,strokeWidth:1.2}},e))]})})}),(0,m.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted`,children:t.map((e,t)=>(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[t%h.length]}}),e.label]},e.id))})]})}export{x as CostChart}; +======== +import{a as e,f as t,h as n,i as r,l as i,r as a}from"./index-CucRSUHh.js";import{i as o,n as s,wt as c}from"./CartesianChart-Dc6HOANc.js";import{n as l,r as u,t as d}from"./XAxis-DqeVRlZV.js";import{t as f}from"./AreaChart-BqFAEkTX.js";var p=n(t(),1),m=i(),h=[`var(--accent)`,`var(--muted)`,`var(--success)`,`var(--warning)`];function g(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function _(e,t){return t===`credits`?e.per_model_credits??{}:t===`tokens`?e.per_model_tokens??{}:e.per_model??{}}function v(t,n){return n===`cost`?a(t):n===`tokens`?r(t):e(t)}function y(t,n){return n===`cost`?`¥${t>=10?Math.round(t):Number(t.toFixed(1))}`:n===`tokens`?r(t):e(t)}function b({active:e,payload:t,label:n,daily:r,lang:i,models:a,totalLabel:o,metric:s}){if(!e||!t?.length)return null;let c=new Map(a.map(e=>[e.id,e.label])),l=t.filter(e=>(e.value??0)>0).sort((e,t)=>t.value-e.value),u=t.reduce((e,t)=>e+(t.value??0),0);return(0,m.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,m.jsx)(`div`,{className:`mono text-muted`,children:g(String(n),r,i)}),(0,m.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[l.map(e=>(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[a.findIndex(t=>t.id===e.dataKey)%h.length]}}),c.get(e.dataKey)||e.dataKey]}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(e.value,s)})]},e.dataKey)),(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-6 border-t border-separator pt-1`,children:[(0,m.jsx)(`span`,{className:`text-muted`,children:o}),(0,m.jsx)(`span`,{className:`mono font-medium`,children:v(u,s)})]})]})]})}function x({series:e,models:t,lang:n,emptyLabel:r,totalLabel:i,metric:a=`credits`}){let v=(0,p.useMemo)(()=>t.map(e=>e.id),[t]),x=(0,p.useMemo)(()=>e.map(e=>{let t=_(e,a),n={at:e.at};for(let e of v){let r=Number(t[e]??0);n[e]=a===`tokens`?r:Number(r.toFixed(4))}return n}),[e,v,a]),S=Math.max(0,...x.map(e=>v.reduce((t,n)=>t+Number(e[n]??0),0)))>0,C=(x.length>1?Date.parse(x[x.length-1].at)-Date.parse(x[0].at):0)>1728e5;return!e.length||!S?(0,m.jsx)(`div`,{className:`grid min-h-56 place-items-center px-6 py-12 text-center text-sm text-muted`,children:r}):(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsx)(`div`,{className:`h-72 w-full`,children:(0,m.jsx)(c,{width:`100%`,height:`100%`,children:(0,m.jsxs)(f,{data:x,margin:{top:8,right:8,bottom:0,left:0},children:[(0,m.jsx)(`defs`,{children:v.map((e,t)=>(0,m.jsxs)(`linearGradient`,{id:`cost-${a}-${e}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,m.jsx)(`stop`,{offset:`0%`,stopColor:h[t%h.length],stopOpacity:.32}),(0,m.jsx)(`stop`,{offset:`100%`,stopColor:h[t%h.length],stopOpacity:.04})]},e))}),(0,m.jsx)(l,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,m.jsx)(d,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>g(e,C,n)}),(0,m.jsx)(s,{width:52,tickLine:!1,axisLine:!1,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>y(e,a)}),(0,m.jsx)(u,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,m.jsx)(b,{daily:C,lang:n,models:t,totalLabel:i,metric:a})}),v.map((e,t)=>(0,m.jsx)(o,{type:`monotone`,dataKey:e,stackId:`usage`,stroke:h[t%h.length],strokeWidth:1.5,fill:`url(#cost-${a}-${e})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,strokeWidth:1.2}},e))]})})}),(0,m.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted`,children:t.map((e,t)=>(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,m.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:h[t%h.length]}}),e.label]},e.id))})]})}export{x as CostChart}; +>>>>>>>> 85fe552 (feat(routing): add same-provider credit-expiry-first scheduling):internal/webui/static/assets/CostChart-BlNjRD6T.js diff --git a/internal/webui/static/assets/LiveSparkline-BRAmSM_0.js b/internal/webui/static/assets/LiveSparkline-BRAmSM_0.js new file mode 100644 index 00000000..d681d1f8 --- /dev/null +++ b/internal/webui/static/assets/LiveSparkline-BRAmSM_0.js @@ -0,0 +1,5 @@ +<<<<<<<< HEAD:internal/webui/static/assets/LiveSparkline-g4J_1uGD.js +import{l as e}from"./index--8Ifgwr4.js";import{i as t,n,wt as r}from"./CartesianChart-BtPJbdpG.js";import{t as i}from"./AreaChart-Cm1PLzri.js";var a=e();function o({samples:e,capacity:o,label:s}){let c=e.length?e:[{at:0,value:0}],l=Math.max(1,o,...c.map(e=>e.value));return(0,a.jsx)(`div`,{className:`h-6 w-[120px] shrink-0`,role:`img`,"aria-label":s,children:(0,a.jsx)(r,{width:`100%`,height:`100%`,children:(0,a.jsxs)(i,{data:c,margin:{top:1,right:0,bottom:1,left:0},children:[(0,a.jsx)(n,{hide:!0,domain:[0,l]}),(0,a.jsx)(t,{type:`monotone`,dataKey:`value`,stroke:`var(--foreground)`,strokeOpacity:.7,strokeWidth:1.25,fill:`var(--foreground)`,fillOpacity:.08,isAnimationActive:!1,dot:!1})]})})})}export{o as LiveSparkline}; +======== +import{l as e}from"./index-CucRSUHh.js";import{i as t,n,wt as r}from"./CartesianChart-Dc6HOANc.js";import{t as i}from"./AreaChart-BqFAEkTX.js";var a=e();function o({samples:e,capacity:o,label:s}){let c=e.length?e:[{at:0,value:0}],l=Math.max(1,o,...c.map(e=>e.value));return(0,a.jsx)(`div`,{className:`h-6 w-[120px] shrink-0`,role:`img`,"aria-label":s,children:(0,a.jsx)(r,{width:`100%`,height:`100%`,children:(0,a.jsxs)(i,{data:c,margin:{top:1,right:0,bottom:1,left:0},children:[(0,a.jsx)(n,{hide:!0,domain:[0,l]}),(0,a.jsx)(t,{type:`monotone`,dataKey:`value`,stroke:`var(--foreground)`,strokeOpacity:.7,strokeWidth:1.25,fill:`var(--foreground)`,fillOpacity:.08,isAnimationActive:!1,dot:!1})]})})})}export{o as LiveSparkline}; +>>>>>>>> 85fe552 (feat(routing): add same-provider credit-expiry-first scheduling):internal/webui/static/assets/LiveSparkline-BRAmSM_0.js diff --git a/internal/webui/static/assets/TrafficChart-DXiktQ6F.js b/internal/webui/static/assets/TrafficChart-DXiktQ6F.js new file mode 100644 index 00000000..a9736d2d --- /dev/null +++ b/internal/webui/static/assets/TrafficChart-DXiktQ6F.js @@ -0,0 +1,5 @@ +<<<<<<<< HEAD:internal/webui/static/assets/TrafficChart-jYJwrZhA.js +import{f as e,h as t,i as n,l as r,n as i,o as a,s as o,t as s,u as c}from"./index--8Ifgwr4.js";import{A as l,An as u,C as d,Cn as f,D as p,E as m,Et as h,L as g,Lt as _,M as v,Mn as y,Mt as b,N as x,Nt as S,O as C,Ot as w,P as T,Pt as E,Q as D,Rt as O,S as k,T as A,Z as j,_t as M,a as N,bn as P,bt as ee,ct as te,d as F,et as ne,f as re,g as ie,gt as ae,h as oe,hn as I,i as se,j as ce,jn as L,k as le,kt as R,m as ue,n as de,nt as fe,o as pe,p as me,pt as he,s as ge,st as z,t as _e,vn as B,w as ve,wn as ye,wt as be,x as xe,yn as V,z as H,zt as U}from"./CartesianChart-BtPJbdpG.js";import{i as Se,n as Ce,r as we,t as Te}from"./XAxis-C10B4cAr.js";var Ee=class{constructor(e){var t=e.x,n=e.y;this.xAxisScale=t,this.yAxisScale=n}map(e,t){var n=t.position;return{x:this.xAxisScale.map(e.x,{position:n})??0,y:this.yAxisScale.map(e.y,{position:n})??0}}mapWithFallback(e,t){var n=t.position,r=t.fallback,i=r===`rangeMin`?this.yAxisScale.rangeMin():r===`rangeMax`?this.yAxisScale.rangeMax():0,a=r===`rangeMin`?this.xAxisScale.rangeMin():r===`rangeMax`?this.xAxisScale.rangeMax():0;return{x:this.xAxisScale.map(e.x,{position:n})??a,y:this.yAxisScale.map(e.y,{position:n})??i}}isInRange(e){var t=e.x,n=e.y,r=t==null||this.xAxisScale.isInRange(t),i=n==null||this.yAxisScale.isInRange(n);return r&&i}},W=t(e());function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function K(e){for(var t=1;t{var s=o.x1,c=o.x2,l=o.y1,u=o.y2;if(i==null||a==null)return null;var d=new Ee({x:i,y:a}),f={x:e?i.map(s,{position:`start`})??null:i.rangeMin(),y:n?a.map(l,{position:`start`})??null:a.rangeMin()},p={x:t?i.map(c,{position:`end`})??null:i.rangeMax(),y:r?a.map(u,{position:`end`})??null:a.rangeMax()};return o.ifOverflow===`discard`&&(!d.isInRange(f)||!d.isInRange(p))?null:ue(f,p)},je=(e,t)=>W.isValidElement(e)?W.cloneElement(e,t):typeof e==`function`?e(t):W.createElement(Se,q({},t,{className:`recharts-reference-area-rect`}));function Me(e){var t=O();return(0,W.useEffect)(()=>(t(re(e)),()=>{t(me(e))})),null}function Ne(e){var t=e.x1,n=e.x2,r=e.y1,i=e.y2,a=e.className,o=e.shape,s=e.xAxisId,l=e.yAxisId,d=F(),f=h(),p=U(e=>j(e,`xAxis`,s,f)),m=U(e=>j(e,`yAxis`,l,f));if(p==null||m==null)return null;var g=P(t),_=P(n),v=P(r),y=P(i);if(!g&&!_&&!v&&!y&&!o)return null;var b=Ae(g,_,v,y,p,m,e);if(!b&&!o)return null;var S=e.ifOverflow===`hidden`?`url(#${d})`:void 0;return W.createElement(H,{zIndex:e.zIndex},W.createElement(u,{className:c(`recharts-reference-area`,a)},je(o,K(K({clipPath:S},L(e)),b)),b!=null&&W.createElement(x,q({},b,{lowerWidth:b.width,upperWidth:b.width}),W.createElement(T,{label:e.label}),e.children)))}var Pe={ifOverflow:`discard`,xAxisId:0,yAxisId:0,radius:0,fill:`#ccc`,label:!1,fillOpacity:.5,stroke:`none`,strokeWidth:1,zIndex:z.area};function Fe(e){var t=I(e,Pe);return W.createElement(W.Fragment,null,W.createElement(Me,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2}),W.createElement(Ne,t))}Fe.displayName=`ReferenceArea`;var Ie=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;te+t,0);if(!i)return Be(t,e);for(var a=Math.floor(e/i),o=e%i,s=[],c=0,l=0;co){s=[...r.slice(0,c),o-l];break}}var f=s.length%2==0?[0,t]:[t];return[...He(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function We(e,t,n){return e?Ue(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):Be(t,n)}function Ge(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=Le(e,Ie),a=r??!1,o;if(t!=null){var s=i.pathRef;o=We(n,ze(s?.current??null),t)}else n!=null&&(o=String(n));return W.createElement(he,J({},i,{connectNulls:a,strokeDasharray:o}))}function Ke(e){var t=(0,W.useRef)(0),n=(0,W.useRef)(0),r=(0,W.useRef)(!1),i=(0,W.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,W.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(ye(t.current+e*i),i);return e>0&&i>0&&(n.current=Math.max(n.current,a),a>=i)?(r.current=!0,null):a},[])}var qe=[`children`];function Je(e,t){if(e==null)return{};var n,r,i=Ye(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function Ze(e){var t=e.children,n=Je(e,qe);return W.createElement(Xe.Provider,{value:n},t)}var Qe=(e,t,n,r)=>D(e,`xAxis`,t,r),$e=(e,t,n,r)=>ne(e,`xAxis`,t,r),et=(e,t,n,r)=>D(e,`yAxis`,n,r),tt=(e,t,n,r)=>ne(e,`yAxis`,n,r),nt=_([M,Qe,et,$e,tt],(e,t,n,r,i)=>E(e,`xAxis`)?w(t,r,!1):w(n,i,!1)),rt=(e,t,n,r,i)=>i;function it(e){return e.type===`line`}var at=_([fe,rt],(e,t)=>e.filter(it).find(e=>e.id===t)),ot=_([M,Qe,et,$e,tt,at,nt,te],(e,t,n,r,i,a,o,s)=>{var c=s.chartData,l=s.dataStartIndex,u=s.dataEndIndex;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var d=a.dataKey,f=a.data,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return Dt({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),st=[`id`],ct=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],lt=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?t/n:0}var Q={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationInterpolateFn:(e,t)=>{if(e==null)return[];if(t===1)return e.flatMap(e=>e.status===`removed`?[]:[e.next]);var n=gt(e),r=[];for(var i of e)if(i.status===`matched`)r.push(Z(Z({},i.next),{},{x:B(i.prev.x,i.next.x,t),y:B(i.prev.y,i.next.y,t)}));else if(i.status===`added`){if(i.next.x!=null){var a=i.next.x-n;r.push(Z(Z({},i.next),{},{x:B(a,i.next.x,t),y:i.next.y}))}else r.push(i.next)}else if(i.status===`removed`&&i.prev.x!=null){var o=i.prev.x+n;r.push(Z(Z({},i.prev),{},{x:B(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:m,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:Ge,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:z.line,type:`linear`},_t=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:b(n,t),payload:e}]},vt=W.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,p={dataDefinedOnItem:n,getPosition:f,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:b(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return W.createElement(C,{tooltipEntrySettings:p})});function yt(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=X(r,st),c=y(s);return W.createElement(xe,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function bt(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,W.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return W.createElement(ce,{value:t?i:void 0},n)}function xt(e){var t=e.clipPathId,n=e.pathRef,r=e.points,i=e.props,a=e.animationElapsedTime,o=e.isAnimating,s=e.isEntrance,c=e.visibleLength,l=i.type,u=i.layout,d=i.connectNulls,f=i.needClip,p=i.shape,m=i.strokeDasharray,h=X(i,ct),g=Z(Z({},L(h)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:f?`url(#clipPath-${t})`:void 0,points:r,type:l,layout:u,connectNulls:d,strokeDasharray:m??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:c});return W.createElement(W.Fragment,null,r?.length>1&&W.createElement(le,{option:p,DefaultShape:Q.shape,shapeProps:g}),W.createElement(yt,{points:r,clipPathId:t,props:i}))}function St(e){var t=e.clipPathId,n=e.props,r=e.pathRef,i=e.previousPointsRef,a=n.points,o=n.isAnimationActive,s=n.animationBegin,c=n.animationDuration,l=n.animationEasing,u=n.animationMatchBy,d=n.animationInterpolateFn,f=n.layout,p=ht(r.current),m=A(n.onAnimationStart,n.onAnimationEnd),h=m.isAnimating,g=m.handleAnimationStart,_=m.handleAnimationEnd,y=!h,b=Ke(a),x=(0,W.useCallback)(e=>e>0&&p>0,[p]);return W.createElement(bt,{points:a,showLabels:y},n.children,W.createElement(ve,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:g,onAnimationEnd:_,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:x,layout:f},(e,i,a)=>{var o=h||i<1,s=o?b(i,p):null;return W.createElement(xt,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),W.createElement(v,{label:n.label}))}function Ct(e){var t=e.clipPathId,n=e.props,r=(0,W.useRef)(null),i=(0,W.useRef)(null);return W.createElement(St,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var wt=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:S(e.payload,t)}),Tt=class extends W.Component{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.xAxisId,o=e.yAxisId,s=e.top,d=e.left,f=e.width,p=e.height,m=e.id,h=e.needClip,g=e.zIndex;if(t)return null;var _=c(`recharts-line`,i),v=m,y=N(n),b=y.r,x=y.strokeWidth,S=l(n),C=b*2+x,w=h?`url(#clipPath-${S?``:`dots-`}${v})`:void 0;return W.createElement(H,{zIndex:g},W.createElement(u,{className:_},h&&W.createElement(`defs`,null,W.createElement(pe,{clipPathId:v,xAxisId:a,yAxisId:o}),!S&&W.createElement(`clipPath`,{id:`clipPath-dots-${v}`},W.createElement(`rect`,{x:d-C/2,y:s-C/2,width:f+C,height:p+C}))),W.createElement(Ze,{xAxisId:a,yAxisId:o,data:r,dataPointFormatter:wt,errorBarOffset:0},W.createElement(Ct,{props:this.props,clipPathId:v}))),W.createElement(oe,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:w}))}};function Et(e){var t=I(e,Q),n=t.activeDot,r=t.animateNewValues,i=t.animationBegin,a=t.animationDuration,o=t.animationEasing,s=t.connectNulls,c=t.dot,l=t.hide,u=t.isAnimationActive,d=t.label,f=t.legendType,p=t.xAxisId,m=t.yAxisId,g=t.id,_=X(t,lt),v=ge(p,m).needClip,y=ie(),b=ee(),x=h(),S=U(e=>ot(e,p,m,x,g));if(b!==`horizontal`&&b!==`vertical`||S==null||y==null)return null;var C=y.height,w=y.width,T=y.x,E=y.y;return W.createElement(Tt,Y({},_,{id:g,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:S,layout:b,height:C,width:w,left:T,top:E,needClip:v}))}function Dt(e){var t=e.layout,n=e.xAxis,r=e.yAxis,i=e.xAxisTicks,a=e.yAxisTicks,o=e.dataKey,s=e.bandSize;return e.displayedData.map((e,c)=>{var l=S(e,o);if(t===`horizontal`)return{x:R({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(V(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=V(l)?null:n.scale.map(l),d=R({axis:r,ticks:a,bandSize:s,entry:e,index:c});return u==null||d==null?null:{x:u,y:d,value:l,payload:e}}).filter(Boolean)}function Ot(e){var t=I(e,Q),n=h();return W.createElement(d,{id:t.id,type:`line`},e=>W.createElement(W.Fragment,null,W.createElement(p,{legendPayload:_t(t)}),W.createElement(vt,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),W.createElement(k,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),W.createElement(Et,Y({},t,{id:e}))))}var kt=W.memo(Ot,ae);kt.displayName=`Line`;var At=[`axis`],jt=(0,W.forwardRef)((e,t)=>W.createElement(_e,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:At,tooltipPayloadSearcher:g,categoricalChartProps:e,ref:t})),Mt={metric:24,title:18,section:15,body:13,xs:12,caption:12},$=r();function Nt(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function Pt(e){if(e<=1)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function Ft(e){let t=Math.max(0,e.ok??e.requests-e.error),n=Math.min(Math.max(0,e.requests-t),Math.max(0,e.requests));return{...e,okCount:t,errorCount:n,inputTokens:e.prompt_tokens??0,outputTokens:e.completion_tokens??0,cacheTokens:e.cache_read_tokens??0,p50:e.latency_p50_ms??null,p95:e.latency_p95_ms??null}}function It({active:e,payload:t,daily:n,lang:r,specs:i,format:a,totalLabel:o,total:s}){if(!e||!t?.[0])return null;let c=t[0].payload;return(0,$.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,$.jsx)(`div`,{className:`mono text-muted`,children:Nt(c.at,n,r)}),(0,$.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(c[e.key])})]},String(e.key))),s&&o?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6 pt-1`,children:[(0,$.jsx)(`span`,{className:`text-muted`,children:o}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(s(c))})]}):null]})]})}function Lt({series:e,lang:t,emptyLabel:r,okLabel:c,errorLabel:l,onSelectRange:u,selectHint:d,labels:f,initialMetric:p=`requests`}){let[m,h]=(0,W.useState)(p),[g,_]=(0,W.useState)(null),[v,y]=(0,W.useState)(null),b=(0,W.useRef)(!1),x=(0,W.useRef)(null),S=(0,W.useMemo)(()=>e.map(Ft),[e]),C=S[0],w=S[S.length-1],T=(C&&w?Date.parse(w.at)-Date.parse(C.at):0)>1728e5,E=f??{requests:`Requests`,tokens:`Tokens`,latency:`p95 latency`,input:`input`,output:`output`,cacheRead:`cache read`,p50:`p50`,p95:`p95`,total:`total`},D=m===`tokens`?[{key:`inputTokens`,label:E.input,color:`var(--foreground)`,area:!0,width:1.5,opacity:.75},{key:`outputTokens`,label:E.output,color:`var(--success)`,area:!0,width:1.5},{key:`cacheTokens`,label:E.cacheRead,color:`var(--muted)`,width:1.25,opacity:.8}]:m===`latency`?[{key:`p95`,label:E.p95,color:`var(--warning)`,area:!0,width:1.75},{key:`p50`,label:E.p50,color:`var(--muted)`,width:1.25,opacity:.85}]:[{key:`okCount`,label:c,color:`var(--success)`,area:!0,width:1.75},{key:`errorCount`,label:l,color:`var(--danger)`,area:!0,width:1.25,opacity:.7}],O=e=>e==null?`—`:m===`latency`?a(e):n(e),k=m===`requests`?e=>e.requests:m===`tokens`?e=>e.inputTokens+e.outputTokens:void 0,A=S.flatMap(e=>D.map(t=>Number(e[t.key]??0))),j=m===`requests`?Math.max(0,...S.map(e=>e.requests)):Math.max(0,...A),M=Pt(j),N=S.some(e=>e.requests>0),P=S.map(e=>`${e.at}:${e.requests}:${e.error}`).join(`|`);(0,W.useLayoutEffect)(()=>{let e=x.current;if(!e||!N||b.current)return;let t=!1,n=null,r=o.context(()=>{let r=o.matchMedia(),i=()=>{let t=o.utils.toArray(`.recharts-area-area`,e),n=o.utils.toArray(`.recharts-line-curve`,e);return!t.length&&!n.length?!1:(r.add(`(prefers-reduced-motion: reduce)`,()=>{o.set(n,{clearProps:`strokeDashoffset,strokeDasharray`}),o.set(t,{clearProps:`autoAlpha`})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{o.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:.45,ease:`power2.out`,stagger:.05}),n.forEach((e,t)=>{let n=e.getTotalLength();o.fromTo(e,{strokeDasharray:n,strokeDashoffset:n},{strokeDashoffset:0,duration:.7,delay:t*.05,ease:`power2.out`})})}),!0)};if(i()){t=!0,b.current=!0;return}n=new MutationObserver(()=>{t||i()&&(t=!0,b.current=!0,n?.disconnect())}),n.observe(e,{childList:!0,subtree:!0})},e);return()=>{n?.disconnect(),r.revert()}},[N,P]);let ee=S.length>1?Date.parse(S[1].at)-Date.parse(S[0].at):36e5,te=()=>{if(g&&v&&u){let e=Date.parse(g),t=Date.parse(v);if(Number.isFinite(e)&&Number.isFinite(t)){let n=Math.min(e,t),r=Math.max(e,t)+ee;u(new Date(n).toISOString(),new Date(r).toISOString())}}_(null),y(null)},F=e=>{let t=e?.activeLabel;return t==null?null:String(t)};return!e.length||!N?(0,$.jsx)(i,{emptyLabel:r}):(0,$.jsxs)(`div`,{ref:x,className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex justify-end`,children:(0,$.jsx)(s,{value:m,onChange:e=>h(e),ariaLabel:E.requests,options:[{id:`requests`,label:E.requests},{id:`tokens`,label:E.tokens},{id:`latency`,label:E.latency}]})}),(0,$.jsx)(`div`,{className:`h-56 w-full`,children:(0,$.jsx)(be,{width:`100%`,height:`100%`,children:(0,$.jsxs)(jt,{data:S,margin:{top:8,right:8,bottom:0,left:0},style:u?{cursor:`crosshair`,userSelect:`none`}:void 0,onMouseDown:u?e=>{let t=F(e);t&&(_(t),y(t))}:void 0,onMouseMove:u?e=>{if(!g)return;let t=F(e);t&&y(t)}:void 0,onMouseUp:u?te:void 0,onMouseLeave:u?()=>{_(null),y(null)}:void 0,children:[(0,$.jsx)(`defs`,{children:D.filter(e=>e.area).map(e=>(0,$.jsxs)(`linearGradient`,{id:`traffic-fill-${String(e.key)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,$.jsx)(`stop`,{offset:`0%`,stopColor:e.color,stopOpacity:.22}),(0,$.jsx)(`stop`,{offset:`100%`,stopColor:e.color,stopOpacity:.02})]},String(e.key)))}),(0,$.jsx)(Ce,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,$.jsx)(Te,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:Mt.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>Nt(e,T,t)}),(0,$.jsx)(de,{width:m===`latency`?44:36,domain:[0,M],tickLine:!1,axisLine:!1,allowDecimals:!1,tick:{fill:`var(--muted)`,fontSize:Mt.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>m===`latency`?a(e):n(e)}),(0,$.jsx)(we,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,$.jsx)(It,{daily:T,lang:t,specs:D,format:O,totalLabel:E.total,total:k})}),D.filter(e=>e.area).map(e=>(0,$.jsx)(se,{type:`monotone`,dataKey:e.key,stroke:`none`,fill:`url(#traffic-fill-${String(e.key)})`,isAnimationActive:!1,activeDot:!1,dot:!1,connectNulls:!0},`area-${String(e.key)}`)),D.map(e=>(0,$.jsx)(kt,{type:`monotone`,dataKey:e.key,stroke:e.color,strokeWidth:e.width??1.5,strokeOpacity:e.opacity??1,dot:!1,isAnimationActive:!1,connectNulls:!0,activeDot:{r:4,fill:`var(--surface)`,stroke:e.color,strokeWidth:1.5}},`line-${String(e.key)}`)),g&&v?(0,$.jsx)(Fe,{x1:g,x2:v,fill:`var(--foreground)`,fillOpacity:.06,stroke:`none`,ifOverflow:`visible`}):null]})})}),(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-5 items-center justify-between gap-3 text-caption text-muted`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-3`,children:D.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]},String(e.key)))}),(0,$.jsxs)(`span`,{className:`flex items-center gap-3`,children:[u&&d?(0,$.jsx)(`span`,{children:d}):null,(0,$.jsxs)(`span`,{className:`mono`,children:[O(j),` peak`]})]})]})]})}export{Lt as TrafficChart}; +======== +import{f as e,h as t,i as n,l as r,n as i,o as a,s as o,t as s,u as c}from"./index-CucRSUHh.js";import{A as l,An as u,C as d,Cn as f,D as p,E as m,Et as h,L as g,Lt as _,M as v,Mn as y,Mt as b,N as x,Nt as S,O as C,Ot as w,P as T,Pt as E,Q as D,Rt as O,S as k,T as A,Z as j,_t as M,a as N,bn as P,bt as ee,ct as te,d as F,et as ne,f as re,g as ie,gt as ae,h as oe,hn as I,i as se,j as ce,jn as L,k as le,kt as R,m as ue,n as de,nt as fe,o as pe,p as me,pt as he,s as ge,st as z,t as _e,vn as B,w as ve,wn as ye,wt as be,x as xe,yn as V,z as H,zt as U}from"./CartesianChart-Dc6HOANc.js";import{i as Se,n as Ce,r as we,t as Te}from"./XAxis-DqeVRlZV.js";var Ee=class{constructor(e){var t=e.x,n=e.y;this.xAxisScale=t,this.yAxisScale=n}map(e,t){var n=t.position;return{x:this.xAxisScale.map(e.x,{position:n})??0,y:this.yAxisScale.map(e.y,{position:n})??0}}mapWithFallback(e,t){var n=t.position,r=t.fallback,i=r===`rangeMin`?this.yAxisScale.rangeMin():r===`rangeMax`?this.yAxisScale.rangeMax():0,a=r===`rangeMin`?this.xAxisScale.rangeMin():r===`rangeMax`?this.xAxisScale.rangeMax():0;return{x:this.xAxisScale.map(e.x,{position:n})??a,y:this.yAxisScale.map(e.y,{position:n})??i}}isInRange(e){var t=e.x,n=e.y,r=t==null||this.xAxisScale.isInRange(t),i=n==null||this.yAxisScale.isInRange(n);return r&&i}},W=t(e());function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function K(e){for(var t=1;t{var s=o.x1,c=o.x2,l=o.y1,u=o.y2;if(i==null||a==null)return null;var d=new Ee({x:i,y:a}),f={x:e?i.map(s,{position:`start`})??null:i.rangeMin(),y:n?a.map(l,{position:`start`})??null:a.rangeMin()},p={x:t?i.map(c,{position:`end`})??null:i.rangeMax(),y:r?a.map(u,{position:`end`})??null:a.rangeMax()};return o.ifOverflow===`discard`&&(!d.isInRange(f)||!d.isInRange(p))?null:ue(f,p)},je=(e,t)=>W.isValidElement(e)?W.cloneElement(e,t):typeof e==`function`?e(t):W.createElement(Se,q({},t,{className:`recharts-reference-area-rect`}));function Me(e){var t=O();return(0,W.useEffect)(()=>(t(re(e)),()=>{t(me(e))})),null}function Ne(e){var t=e.x1,n=e.x2,r=e.y1,i=e.y2,a=e.className,o=e.shape,s=e.xAxisId,l=e.yAxisId,d=F(),f=h(),p=U(e=>j(e,`xAxis`,s,f)),m=U(e=>j(e,`yAxis`,l,f));if(p==null||m==null)return null;var g=P(t),_=P(n),v=P(r),y=P(i);if(!g&&!_&&!v&&!y&&!o)return null;var b=Ae(g,_,v,y,p,m,e);if(!b&&!o)return null;var S=e.ifOverflow===`hidden`?`url(#${d})`:void 0;return W.createElement(H,{zIndex:e.zIndex},W.createElement(u,{className:c(`recharts-reference-area`,a)},je(o,K(K({clipPath:S},L(e)),b)),b!=null&&W.createElement(x,q({},b,{lowerWidth:b.width,upperWidth:b.width}),W.createElement(T,{label:e.label}),e.children)))}var Pe={ifOverflow:`discard`,xAxisId:0,yAxisId:0,radius:0,fill:`#ccc`,label:!1,fillOpacity:.5,stroke:`none`,strokeWidth:1,zIndex:z.area};function Fe(e){var t=I(e,Pe);return W.createElement(W.Fragment,null,W.createElement(Me,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2}),W.createElement(Ne,t))}Fe.displayName=`ReferenceArea`;var Ie=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;te+t,0);if(!i)return Be(t,e);for(var a=Math.floor(e/i),o=e%i,s=[],c=0,l=0;co){s=[...r.slice(0,c),o-l];break}}var f=s.length%2==0?[0,t]:[t];return[...He(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function We(e,t,n){return e?Ue(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):Be(t,n)}function Ge(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=Le(e,Ie),a=r??!1,o;if(t!=null){var s=i.pathRef;o=We(n,ze(s?.current??null),t)}else n!=null&&(o=String(n));return W.createElement(he,J({},i,{connectNulls:a,strokeDasharray:o}))}function Ke(e){var t=(0,W.useRef)(0),n=(0,W.useRef)(0),r=(0,W.useRef)(!1),i=(0,W.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,W.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(ye(t.current+e*i),i);return e>0&&i>0&&(n.current=Math.max(n.current,a),a>=i)?(r.current=!0,null):a},[])}var qe=[`children`];function Je(e,t){if(e==null)return{};var n,r,i=Ye(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function Ze(e){var t=e.children,n=Je(e,qe);return W.createElement(Xe.Provider,{value:n},t)}var Qe=(e,t,n,r)=>D(e,`xAxis`,t,r),$e=(e,t,n,r)=>ne(e,`xAxis`,t,r),et=(e,t,n,r)=>D(e,`yAxis`,n,r),tt=(e,t,n,r)=>ne(e,`yAxis`,n,r),nt=_([M,Qe,et,$e,tt],(e,t,n,r,i)=>E(e,`xAxis`)?w(t,r,!1):w(n,i,!1)),rt=(e,t,n,r,i)=>i;function it(e){return e.type===`line`}var at=_([fe,rt],(e,t)=>e.filter(it).find(e=>e.id===t)),ot=_([M,Qe,et,$e,tt,at,nt,te],(e,t,n,r,i,a,o,s)=>{var c=s.chartData,l=s.dataStartIndex,u=s.dataEndIndex;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var d=a.dataKey,f=a.data,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return Dt({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),st=[`id`],ct=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],lt=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?t/n:0}var Q={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationInterpolateFn:(e,t)=>{if(e==null)return[];if(t===1)return e.flatMap(e=>e.status===`removed`?[]:[e.next]);var n=gt(e),r=[];for(var i of e)if(i.status===`matched`)r.push(Z(Z({},i.next),{},{x:B(i.prev.x,i.next.x,t),y:B(i.prev.y,i.next.y,t)}));else if(i.status===`added`){if(i.next.x!=null){var a=i.next.x-n;r.push(Z(Z({},i.next),{},{x:B(a,i.next.x,t),y:i.next.y}))}else r.push(i.next)}else if(i.status===`removed`&&i.prev.x!=null){var o=i.prev.x+n;r.push(Z(Z({},i.prev),{},{x:B(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:m,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:Ge,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:z.line,type:`linear`},_t=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:b(n,t),payload:e}]},vt=W.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,p={dataDefinedOnItem:n,getPosition:f,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:b(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return W.createElement(C,{tooltipEntrySettings:p})});function yt(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=X(r,st),c=y(s);return W.createElement(xe,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function bt(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,W.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return W.createElement(ce,{value:t?i:void 0},n)}function xt(e){var t=e.clipPathId,n=e.pathRef,r=e.points,i=e.props,a=e.animationElapsedTime,o=e.isAnimating,s=e.isEntrance,c=e.visibleLength,l=i.type,u=i.layout,d=i.connectNulls,f=i.needClip,p=i.shape,m=i.strokeDasharray,h=X(i,ct),g=Z(Z({},L(h)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:f?`url(#clipPath-${t})`:void 0,points:r,type:l,layout:u,connectNulls:d,strokeDasharray:m??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:c});return W.createElement(W.Fragment,null,r?.length>1&&W.createElement(le,{option:p,DefaultShape:Q.shape,shapeProps:g}),W.createElement(yt,{points:r,clipPathId:t,props:i}))}function St(e){var t=e.clipPathId,n=e.props,r=e.pathRef,i=e.previousPointsRef,a=n.points,o=n.isAnimationActive,s=n.animationBegin,c=n.animationDuration,l=n.animationEasing,u=n.animationMatchBy,d=n.animationInterpolateFn,f=n.layout,p=ht(r.current),m=A(n.onAnimationStart,n.onAnimationEnd),h=m.isAnimating,g=m.handleAnimationStart,_=m.handleAnimationEnd,y=!h,b=Ke(a),x=(0,W.useCallback)(e=>e>0&&p>0,[p]);return W.createElement(bt,{points:a,showLabels:y},n.children,W.createElement(ve,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:g,onAnimationEnd:_,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:x,layout:f},(e,i,a)=>{var o=h||i<1,s=o?b(i,p):null;return W.createElement(xt,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),W.createElement(v,{label:n.label}))}function Ct(e){var t=e.clipPathId,n=e.props,r=(0,W.useRef)(null),i=(0,W.useRef)(null);return W.createElement(St,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var wt=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:S(e.payload,t)}),Tt=class extends W.Component{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.xAxisId,o=e.yAxisId,s=e.top,d=e.left,f=e.width,p=e.height,m=e.id,h=e.needClip,g=e.zIndex;if(t)return null;var _=c(`recharts-line`,i),v=m,y=N(n),b=y.r,x=y.strokeWidth,S=l(n),C=b*2+x,w=h?`url(#clipPath-${S?``:`dots-`}${v})`:void 0;return W.createElement(H,{zIndex:g},W.createElement(u,{className:_},h&&W.createElement(`defs`,null,W.createElement(pe,{clipPathId:v,xAxisId:a,yAxisId:o}),!S&&W.createElement(`clipPath`,{id:`clipPath-dots-${v}`},W.createElement(`rect`,{x:d-C/2,y:s-C/2,width:f+C,height:p+C}))),W.createElement(Ze,{xAxisId:a,yAxisId:o,data:r,dataPointFormatter:wt,errorBarOffset:0},W.createElement(Ct,{props:this.props,clipPathId:v}))),W.createElement(oe,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:w}))}};function Et(e){var t=I(e,Q),n=t.activeDot,r=t.animateNewValues,i=t.animationBegin,a=t.animationDuration,o=t.animationEasing,s=t.connectNulls,c=t.dot,l=t.hide,u=t.isAnimationActive,d=t.label,f=t.legendType,p=t.xAxisId,m=t.yAxisId,g=t.id,_=X(t,lt),v=ge(p,m).needClip,y=ie(),b=ee(),x=h(),S=U(e=>ot(e,p,m,x,g));if(b!==`horizontal`&&b!==`vertical`||S==null||y==null)return null;var C=y.height,w=y.width,T=y.x,E=y.y;return W.createElement(Tt,Y({},_,{id:g,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:S,layout:b,height:C,width:w,left:T,top:E,needClip:v}))}function Dt(e){var t=e.layout,n=e.xAxis,r=e.yAxis,i=e.xAxisTicks,a=e.yAxisTicks,o=e.dataKey,s=e.bandSize;return e.displayedData.map((e,c)=>{var l=S(e,o);if(t===`horizontal`)return{x:R({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(V(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=V(l)?null:n.scale.map(l),d=R({axis:r,ticks:a,bandSize:s,entry:e,index:c});return u==null||d==null?null:{x:u,y:d,value:l,payload:e}}).filter(Boolean)}function Ot(e){var t=I(e,Q),n=h();return W.createElement(d,{id:t.id,type:`line`},e=>W.createElement(W.Fragment,null,W.createElement(p,{legendPayload:_t(t)}),W.createElement(vt,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),W.createElement(k,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),W.createElement(Et,Y({},t,{id:e}))))}var kt=W.memo(Ot,ae);kt.displayName=`Line`;var At=[`axis`],jt=(0,W.forwardRef)((e,t)=>W.createElement(_e,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:At,tooltipPayloadSearcher:g,categoricalChartProps:e,ref:t})),Mt={metric:24,title:18,section:15,body:13,xs:12,caption:12},$=r();function Nt(e,t,n){let r=new Date(e);return Number.isFinite(r.getTime())?new Intl.DateTimeFormat(n===`zh`?`zh-CN`:`en-US`,t?{month:`short`,day:`numeric`}:{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r):``}function Pt(e){if(e<=1)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function Ft(e){let t=Math.max(0,e.ok??e.requests-e.error),n=Math.min(Math.max(0,e.requests-t),Math.max(0,e.requests));return{...e,okCount:t,errorCount:n,inputTokens:e.prompt_tokens??0,outputTokens:e.completion_tokens??0,cacheTokens:e.cache_read_tokens??0,p50:e.latency_p50_ms??null,p95:e.latency_p95_ms??null}}function It({active:e,payload:t,daily:n,lang:r,specs:i,format:a,totalLabel:o,total:s}){if(!e||!t?.[0])return null;let c=t[0].payload;return(0,$.jsxs)(`div`,{className:`rounded-xl bg-overlay px-3 py-2 text-caption text-overlay-foreground shadow-overlay`,children:[(0,$.jsx)(`div`,{className:`mono text-muted`,children:Nt(c.at,n,r)}),(0,$.jsxs)(`div`,{className:`mt-1.5 grid gap-1`,children:[i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(c[e.key])})]},String(e.key))),s&&o?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-6 pt-1`,children:[(0,$.jsx)(`span`,{className:`text-muted`,children:o}),(0,$.jsx)(`span`,{className:`mono font-medium`,children:a(s(c))})]}):null]})]})}function Lt({series:e,lang:t,emptyLabel:r,okLabel:c,errorLabel:l,onSelectRange:u,selectHint:d,labels:f,initialMetric:p=`requests`}){let[m,h]=(0,W.useState)(p),[g,_]=(0,W.useState)(null),[v,y]=(0,W.useState)(null),b=(0,W.useRef)(!1),x=(0,W.useRef)(null),S=(0,W.useMemo)(()=>e.map(Ft),[e]),C=S[0],w=S[S.length-1],T=(C&&w?Date.parse(w.at)-Date.parse(C.at):0)>1728e5,E=f??{requests:`Requests`,tokens:`Tokens`,latency:`p95 latency`,input:`input`,output:`output`,cacheRead:`cache read`,p50:`p50`,p95:`p95`,total:`total`},D=m===`tokens`?[{key:`inputTokens`,label:E.input,color:`var(--foreground)`,area:!0,width:1.5,opacity:.75},{key:`outputTokens`,label:E.output,color:`var(--success)`,area:!0,width:1.5},{key:`cacheTokens`,label:E.cacheRead,color:`var(--muted)`,width:1.25,opacity:.8}]:m===`latency`?[{key:`p95`,label:E.p95,color:`var(--warning)`,area:!0,width:1.75},{key:`p50`,label:E.p50,color:`var(--muted)`,width:1.25,opacity:.85}]:[{key:`okCount`,label:c,color:`var(--success)`,area:!0,width:1.75},{key:`errorCount`,label:l,color:`var(--danger)`,area:!0,width:1.25,opacity:.7}],O=e=>e==null?`—`:m===`latency`?a(e):n(e),k=m===`requests`?e=>e.requests:m===`tokens`?e=>e.inputTokens+e.outputTokens:void 0,A=S.flatMap(e=>D.map(t=>Number(e[t.key]??0))),j=m===`requests`?Math.max(0,...S.map(e=>e.requests)):Math.max(0,...A),M=Pt(j),N=S.some(e=>e.requests>0),P=S.map(e=>`${e.at}:${e.requests}:${e.error}`).join(`|`);(0,W.useLayoutEffect)(()=>{let e=x.current;if(!e||!N||b.current)return;let t=!1,n=null,r=o.context(()=>{let r=o.matchMedia(),i=()=>{let t=o.utils.toArray(`.recharts-area-area`,e),n=o.utils.toArray(`.recharts-line-curve`,e);return!t.length&&!n.length?!1:(r.add(`(prefers-reduced-motion: reduce)`,()=>{o.set(n,{clearProps:`strokeDashoffset,strokeDasharray`}),o.set(t,{clearProps:`autoAlpha`})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{o.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:.45,ease:`power2.out`,stagger:.05}),n.forEach((e,t)=>{let n=e.getTotalLength();o.fromTo(e,{strokeDasharray:n,strokeDashoffset:n},{strokeDashoffset:0,duration:.7,delay:t*.05,ease:`power2.out`})})}),!0)};if(i()){t=!0,b.current=!0;return}n=new MutationObserver(()=>{t||i()&&(t=!0,b.current=!0,n?.disconnect())}),n.observe(e,{childList:!0,subtree:!0})},e);return()=>{n?.disconnect(),r.revert()}},[N,P]);let ee=S.length>1?Date.parse(S[1].at)-Date.parse(S[0].at):36e5,te=()=>{if(g&&v&&u){let e=Date.parse(g),t=Date.parse(v);if(Number.isFinite(e)&&Number.isFinite(t)){let n=Math.min(e,t),r=Math.max(e,t)+ee;u(new Date(n).toISOString(),new Date(r).toISOString())}}_(null),y(null)},F=e=>{let t=e?.activeLabel;return t==null?null:String(t)};return!e.length||!N?(0,$.jsx)(i,{emptyLabel:r}):(0,$.jsxs)(`div`,{ref:x,className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex justify-end`,children:(0,$.jsx)(s,{value:m,onChange:e=>h(e),ariaLabel:E.requests,options:[{id:`requests`,label:E.requests},{id:`tokens`,label:E.tokens},{id:`latency`,label:E.latency}]})}),(0,$.jsx)(`div`,{className:`h-56 w-full`,children:(0,$.jsx)(be,{width:`100%`,height:`100%`,children:(0,$.jsxs)(jt,{data:S,margin:{top:8,right:8,bottom:0,left:0},style:u?{cursor:`crosshair`,userSelect:`none`}:void 0,onMouseDown:u?e=>{let t=F(e);t&&(_(t),y(t))}:void 0,onMouseMove:u?e=>{if(!g)return;let t=F(e);t&&y(t)}:void 0,onMouseUp:u?te:void 0,onMouseLeave:u?()=>{_(null),y(null)}:void 0,children:[(0,$.jsx)(`defs`,{children:D.filter(e=>e.area).map(e=>(0,$.jsxs)(`linearGradient`,{id:`traffic-fill-${String(e.key)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,$.jsx)(`stop`,{offset:`0%`,stopColor:e.color,stopOpacity:.22}),(0,$.jsx)(`stop`,{offset:`100%`,stopColor:e.color,stopOpacity:.02})]},String(e.key)))}),(0,$.jsx)(Ce,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,$.jsx)(Te,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:Mt.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>Nt(e,T,t)}),(0,$.jsx)(de,{width:m===`latency`?44:36,domain:[0,M],tickLine:!1,axisLine:!1,allowDecimals:!1,tick:{fill:`var(--muted)`,fontSize:Mt.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>m===`latency`?a(e):n(e)}),(0,$.jsx)(we,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,$.jsx)(It,{daily:T,lang:t,specs:D,format:O,totalLabel:E.total,total:k})}),D.filter(e=>e.area).map(e=>(0,$.jsx)(se,{type:`monotone`,dataKey:e.key,stroke:`none`,fill:`url(#traffic-fill-${String(e.key)})`,isAnimationActive:!1,activeDot:!1,dot:!1,connectNulls:!0},`area-${String(e.key)}`)),D.map(e=>(0,$.jsx)(kt,{type:`monotone`,dataKey:e.key,stroke:e.color,strokeWidth:e.width??1.5,strokeOpacity:e.opacity??1,dot:!1,isAnimationActive:!1,connectNulls:!0,activeDot:{r:4,fill:`var(--surface)`,stroke:e.color,strokeWidth:1.5}},`line-${String(e.key)}`)),g&&v?(0,$.jsx)(Fe,{x1:g,x2:v,fill:`var(--foreground)`,fillOpacity:.06,stroke:`none`,ifOverflow:`visible`}):null]})})}),(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-5 items-center justify-between gap-3 text-caption text-muted`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-3`,children:D.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{background:e.color}}),e.label]},String(e.key)))}),(0,$.jsxs)(`span`,{className:`flex items-center gap-3`,children:[u&&d?(0,$.jsx)(`span`,{children:d}):null,(0,$.jsxs)(`span`,{className:`mono`,children:[O(j),` peak`]})]})]})]})}export{Lt as TrafficChart}; +>>>>>>>> 85fe552 (feat(routing): add same-provider credit-expiry-first scheduling):internal/webui/static/assets/TrafficChart-DXiktQ6F.js diff --git a/internal/webui/static/assets/XAxis-DqeVRlZV.js b/internal/webui/static/assets/XAxis-DqeVRlZV.js new file mode 100644 index 00000000..390c044b --- /dev/null +++ b/internal/webui/static/assets/XAxis-DqeVRlZV.js @@ -0,0 +1,37 @@ +<<<<<<<< HEAD:internal/webui/static/assets/XAxis-C10B4cAr.js +import{d as e,f as t,h as n,u as r}from"./index--8Ifgwr4.js";import{$ as i,$t as a,At as o,B as s,Bt as c,Ct as l,Dn as u,Dt as d,En as f,Et as p,F as m,Ft as h,G as g,Gt as _,H as v,Ht as y,I as b,It as x,J as S,Jt as C,K as w,Kt as T,Mn as E,Nn as D,On as O,Ot as k,Qt as A,R as ee,Rt as j,Sn as M,St as N,Tn as P,Tt as te,U as ne,Ut as re,V as ie,Vt as ae,W as oe,Wt as se,X as F,Xt as ce,Y as I,Yt as le,Zt as ue,_ as de,_n as L,an as fe,at as pe,b as me,bn as he,bt as ge,c as _e,cn as ve,dn as ye,dt as be,en as xe,fn as Se,ft as Ce,gn as we,hn as R,ht as Te,in as Ee,it as De,jn as Oe,jt as ke,kn as Ae,l as z,ln as je,lt as Me,mn as Ne,mt as Pe,nn as Fe,on as Ie,ot as Le,pn as Re,pt as ze,q as Be,qt as Ve,r as He,rn as Ue,rt as We,sn as Ge,st as B,tn as Ke,tt as qe,u as Je,un as Ye,ut as V,v as Xe,vn as Ze,vt as Qe,wn as H,xn as U,xt as $e,y as et,yn as tt,yt as nt,z as rt,zt as W}from"./CartesianChart-BtPJbdpG.js";function it(e,t){let n=new Map;for(let r=0;rvoid 0)}function mt(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return ht(e,t,n,r,i);case`function`:return Object.keys(t).length>0?mt(e,{...t},n,r,i):y(e,t);default:return ae(e)&&i?typeof t!=`string`||t===``:y(e,t)}}function ht(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return _t(e,t,n,r);if(t instanceof Map)return gt(e,t,n,r);if(t instanceof Set)return vt(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)ct(e)&&(e=Object(e));else{let t=Se(e);if(t!==`[object Object]`&&t!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;ivoid 0)}function bt(e){return e=ft(e),t=>yt(t,e)}function xt(e,t){return ut(e,(n,r,i,a)=>{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(Se(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),K(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case Fe:case Ie:case Ve:{let t=new e.constructor(e?.valueOf());return K(t,e),t}case se:{let t={};return K(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function St(e){return xt(e)}function Ct(e){return typeof e==`object`&&!!e&&Se(e)===`[object Arguments]`}function wt(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&Ae(t)&&!(t in Object(e))?u(t):[t],n.length===0)return!1;let r=e;for(let e=0;evoid 0)}function mt(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return ht(e,t,n,r,i);case`function`:return Object.keys(t).length>0?mt(e,{...t},n,r,i):y(e,t);default:return ae(e)&&i?typeof t!=`string`||t===``:y(e,t)}}function ht(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return _t(e,t,n,r);if(t instanceof Map)return gt(e,t,n,r);if(t instanceof Set)return vt(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)ct(e)&&(e=Object(e));else{let t=Se(e);if(t!==`[object Object]`&&t!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;ivoid 0)}function bt(e){return e=ft(e),t=>yt(t,e)}function xt(e,t){return ut(e,(n,r,i,a)=>{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(Se(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),K(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case Fe:case Ie:case Ve:{let t=new e.constructor(e?.valueOf());return K(t,e),t}case se:{let t={};return K(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function St(e){return xt(e)}function Ct(e){return typeof e==`object`&&!!e&&Se(e)===`[object Arguments]`}function wt(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&Ae(t)&&!(t in Object(e))?u(t):[t],n.length===0)return!1;let r=e;for(let e=0;e>>>>>>> 85fe552 (feat(routing): add same-provider credit-expiry-first scheduling):internal/webui/static/assets/XAxis-DqeVRlZV.js +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nt(e,t){if(e){if(typeof e==`string`)return Pt(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)?Pt(e,t):void 0}}function Pt(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nLt||Math.abs(e.left-t.left)>Lt||Math.abs(e.top-t.top)>Lt||Math.abs(e.width-t.width)>Lt}function zt(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function Bt(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=jt((0,q.useState)({height:0,left:0,top:0,width:0}),2),n=t[0],r=t[1],i=(0,q.useRef)(null),a=(0,q.useRef)(n);a.current=n;var o=(0,q.useCallback)(e=>{if(i.current!=null&&(i.current.disconnect(),i.current=null),e!=null){var t=zt(e);if(Rt(t,a.current)&&r(t),typeof ResizeObserver<`u`){var n=new ResizeObserver(()=>{var t=zt(e);Rt(t,a.current)&&r(t)});n.observe(e),i.current=n}}},[...e]);return(0,q.useEffect)(()=>()=>{var e;(e=i.current)==null||e.disconnect()},[]),[n,o]}function Vt(){return Vt=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?J.separator:t,i=e.contentStyle,a=e.itemStyle,o=e.labelStyle,s=o===void 0?J.labelStyle:o,c=e.payload,l=e.formatter,u=e.itemSorter,d=e.wrapperClassName,f=e.labelClassName,p=e.label,m=e.labelFormatter,h=e.accessibilityLayer,g=h===void 0?J.accessibilityLayer:h,_=()=>{if(c&&c.length){var e={padding:0,margin:0},t=en(c,u).map((e,t)=>{if(!e||e.type===`none`)return null;var r=e.formatter||l||$t,i=e.value,o=e.name,s=i,u=o;if(r){var d=r(i,o,e,t,c);if(Array.isArray(d)){var f=qt(d,2);s=f[0],u=f[1]}else if(d!=null)s=d;else return null}var p=Ut(Ut({},J.itemStyle),{},{color:e.color||J.itemStyle.color},a);return q.createElement(`li`,{className:`recharts-tooltip-item`,key:`tooltip-item-${t}`,style:p},he(u)?q.createElement(`span`,{className:`recharts-tooltip-item-name`},u):null,he(u)?q.createElement(`span`,{className:`recharts-tooltip-item-separator`},n):null,q.createElement(`span`,{className:`recharts-tooltip-item-value`},s),q.createElement(`span`,{className:`recharts-tooltip-item-unit`},e.unit||``))});return q.createElement(`ul`,{className:`recharts-tooltip-item-list`,style:e},t)}return null},v=Ut(Ut({},J.contentStyle),i),y=Ut({margin:0},s),b=!tt(p),x=b?p:``,S=r(`recharts-default-tooltip`,d),C=r(`recharts-tooltip-label`,f);b&&m&&c!=null&&(x=m(p,c));var w=g?{role:`status`,"aria-live":`assertive`}:{};return q.createElement(`div`,Vt({className:S,style:v},w),q.createElement(`p`,{className:C,style:y},q.isValidElement(x)?x:`${x}`),_())},nn=`recharts-tooltip-wrapper`,rn={visibility:`hidden`};function an(e){var t=e.coordinate,n=e.translateX,i=e.translateY;return r(nn,{[`${nn}-right`]:U(n)&&t&&U(t.x)&&n>=t.x,[`${nn}-left`]:U(n)&&t&&U(t.x)&&n=t.y,[`${nn}-top`]:U(i)&&t&&U(t.y)&&i0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var f=c[r];return f==null?0:o[r]?Math.max(uf+l?Math.max(u,f):Math.max(d,f)}function sn(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function cn(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTop,i=e.offsetLeft,a=e.position,o=e.reverseDirection,s=e.tooltipBox,c=e.useTranslate3d,l=e.viewBox,u,d,f;return s&&s.height>0&&s.width>0&&n?(d=on({allowEscapeViewBox:t,coordinate:n,key:`x`,offset:i,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=on({allowEscapeViewBox:t,coordinate:n,key:`y`,offset:r,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=sn({translateX:d,translateY:f,useTranslate3d:c})):u=rn,{cssProperties:u,cssClasses:an({translateX:d,translateY:f,coordinate:n})}}function ln(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Y(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}})),2),r=n[0],i=n[1];q.useEffect(()=>{var t=t=>{t.key===`Escape`&&i({dismissed:!0,dismissedAtCoordinate:{x:e.coordinate?.x??0,y:e.coordinate?.y??0}})};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e.coordinate?.x,e.coordinate?.y]),r.dismissed&&((e.coordinate?.x??0)!==r.dismissedAtCoordinate.x||(e.coordinate?.y??0)!==r.dismissedAtCoordinate.y)&&i(Y(Y({},r),{},{dismissed:!1}));var a=cn({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:e.lastBoundingBox,useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),o=a.cssClasses,s=a.cssProperties,c=Y(Y({},e.hasPortalFromProps?{}:Y(Y({transition:yn({prefersReducedMotion:t,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},s),{},{pointerEvents:`none`,position:`absolute`,top:0,left:0})),{},{visibility:!r.dismissed&&e.active&&e.hasPayload?`visible`:`hidden`},e.wrapperStyle);return q.createElement(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,tabIndex:-1,className:o,style:c,ref:e.innerRef},e.children)}var xn=q.memo(bn),Sn=[`x`,`y`,`top`,`left`,`width`,`height`,`className`];function Cn(){return Cn=Object.assign?Object.assign.bind():function(e){for(var t=1;t`M${e},${i}v${r}M${a},${t}h${n}`,Mn=e=>{var t=e.x,n=t===void 0?0:t,i=e.y,a=i===void 0?0:i,o=e.top,s=o===void 0?0:o,c=e.left,l=c===void 0?0:c,u=e.width,d=u===void 0?0:u,f=e.height,p=f===void 0?0:f,m=e.className,h=kn(e,Sn),g=Tn({x:n,y:a,top:s,left:l,width:d,height:p},h);return!U(n)||!U(a)||!U(d)||!U(p)||!U(s)||!U(l)?null:q.createElement(`path`,Cn({},Oe(g),{className:r(`recharts-cross`,m),d:jn(n,a,d,p,s,l)}))};function Nn(e,t,n,r){var i=r/2;return{stroke:`none`,fill:`#ccc`,x:e===`horizontal`?t.x-i:n.left+.5,y:e===`horizontal`?n.top+.5:t.y-i,width:e===`horizontal`?r:n.width-1,height:e===`horizontal`?n.height-1:r}}var Pn=e=>e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`),Fn=(e,t,n)=>e.map(e=>`${Pn(e)} ${t}ms ${n}`).join(`,`),In=[`radius`],Ln=[`radius`],Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn;function Jn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Yn(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{var a=H(n),o=H(r),s=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,l=a>=0?1:-1,u=+(o>=0&&a>=0||o<0&&a<0),d;if(s>0&&Array.isArray(i)){for(var f=[0,0,0,0],p=0,m=4;ps?s:h}d=P(Rn||=X([`M`,`,`,``]),e,t+c*f[0]),f[0]>0&&(d+=P(zn||=X([`A `,`,`,`,0,0,`,`,`,`,`,``]),f[0],f[0],u,e+l*f[0],t)),d+=P(Bn||=X([`L `,`,`,``]),e+n-l*f[1],t),f[1]>0&&(d+=P(Vn||=X([`A `,`,`,`,0,0,`,`, + `,`,`,``]),f[1],f[1],u,e+n,t+c*f[1])),d+=P(Hn||=X([`L `,`,`,``]),e+n,t+r-c*f[2]),f[2]>0&&(d+=P(Un||=X([`A `,`,`,`,0,0,`,`, + `,`,`,``]),f[2],f[2],u,e+n-l*f[2],t+r)),d+=P(Wn||=X([`L `,`,`,``]),e+l*f[3],t+r),f[3]>0&&(d+=P(Gn||=X([`A `,`,`,`,0,0,`,`, + `,`,`,``]),f[3],f[3],u,e,t+r-c*f[3])),d+=`Z`}else if(s>0&&i===+i&&i>0){var g=Math.min(s,i);d=P(Kn||=X(`M .,. + A .,.,0,0,.,.,. + L .,. + A .,.,0,0,.,.,. + L .,. + A .,.,0,0,.,.,. + L .,. + A .,.,0,0,.,.,. Z`.split(`.`)),e,t+c*g,g,g,u,e+l*g,t,e+n-l*g,t,g,g,u,e+n,t+c*g,e+n,t+r-c*g,g,g,u,e+n-l*g,t+r,e+l*g,t+r,g,g,u,e,t+r-c*g)}else d=P(qn||=X([`M `,`,`,` h `,` v `,` h `,` Z`]),e,t,n,r,-n);return d},lr={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},ur=e=>{var t=R(e,lr),n=(0,q.useRef)(null),i=nr((0,q.useState)(-1),2),a=i[0],o=i[1];(0,q.useEffect)(()=>{if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&o(e)}catch{}},[]);var s=t.x,c=t.y,l=t.width,u=t.height,d=t.radius,f=t.className,p=t.animationEasing,m=t.animationDuration,h=t.animationBegin,g=t.isAnimationActive,_=t.isUpdateAnimationActive,v=(0,q.useRef)(l),y=(0,q.useRef)(u),b=(0,q.useRef)(s),x=(0,q.useRef)(c),S=(0,q.useMemo)(()=>({x:s,y:c,width:l,height:u,radius:d}),[s,c,l,u,d]),C=be(S,`rectangle-`);if(s!==+s||c!==+c||l!==+l||u!==+u||l===0||u===0)return null;var w=r(`recharts-rectangle`,f);if(!_){var T=Oe(t);T.radius;var E=er(T,In);return q.createElement(`path`,$n({},E,{x:H(s),y:H(c),width:H(l),height:H(u),radius:typeof d==`number`?d:void 0,className:w,d:cr(s,c,l,u,d)}))}var D=v.current,O=y.current,k=b.current,A=x.current,ee=`0px ${a===-1?1:a}px`,j=`${a}px ${a}px`,M=Fn([`strokeDasharray`],m,typeof p==`string`?p:lr.animationEasing);return q.createElement(Ce,{animationId:C,key:C,canBegin:a>0,duration:m,easing:p,isActive:_,begin:h},e=>{var r=Ze(D,l,e),i=Ze(O,u,e),a=Ze(k,s,e),o=Ze(A,c,e);n.current&&(v.current=r,y.current=i,b.current=a,x.current=o);var f=g?e>0?{transition:M,strokeDasharray:j}:{strokeDasharray:ee}:{strokeDasharray:j},p=Oe(t);p.radius;var m=er(p,Ln);return q.createElement(`path`,$n({},m,{radius:typeof d==`number`?d:void 0,className:w,d:cr(a,o,r,i,d),ref:n,style:Yn(Yn({},f),t.style)}))})};function dr(e){var t=e.cx,n=e.cy,r=e.radius,i=e.startAngle,a=e.endAngle;return{points:[V(t,n,r,i),V(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var fr,pr,mr,hr,gr,_r,vr;function yr(){return yr=Object.assign?Object.assign.bind():function(e){for(var t=1;tM(t-e)*Math.min(Math.abs(t-e),359.999),xr=e=>{var t=e.cx,n=e.cy,r=e.radius,i=e.angle,a=e.sign,o=e.isExternal,s=e.cornerRadius,c=e.cornerIsExternal,l=s*(o?1:-1)+r,u=Math.asin(s/l)/Me,d=c?i:i+a*u,f=V(t,n,l,d),p=V(t,n,r,d),m=c?i-a*u:i;return{center:f,circleTangency:p,lineTangency:V(t,n,l*Math.cos(u*Me),m),theta:u}},Sr=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.startAngle,o=e.endAngle,s=br(a,o),c=a+s,l=V(t,n,i,a),u=V(t,n,i,c),d=P(fr||=Z([`M `,`,`,` + A `,`,`,`,0, + `,`,`,`, + `,`,`,` + `]),l.x,l.y,i,i,+(Math.abs(s)>180),+(a>c),u.x,u.y);if(r>0){var f=V(t,n,r,a),p=V(t,n,r,c);d+=P(pr||=Z([`L `,`,`,` + A `,`,`,`,0, + `,`,`,`, + `,`,`,` Z`]),p.x,p.y,r,r,+(Math.abs(s)>180),+(a<=c),f.x,f.y)}else d+=P(mr||=Z([`L `,`,`,` Z`]),t,n);return d},Cr=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.cornerRadius,o=e.forceCornerRadius,s=e.cornerIsExternal,c=e.startAngle,l=e.endAngle,u=M(l-c),d=xr({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),f=d.circleTangency,p=d.lineTangency,m=d.theta,h=xr({cx:t,cy:n,radius:i,angle:l,sign:-u,cornerRadius:a,cornerIsExternal:s}),g=h.circleTangency,_=h.lineTangency,v=h.theta,y=s?Math.abs(c-l):Math.abs(c-l)-m-v;if(y<0)return o?P(hr||=Z([`M `,`,`,` + a`,`,`,`,0,0,1,`,`,0 + a`,`,`,`,0,0,1,`,`,0 + `]),p.x,p.y,a,a,a*2,a,a,-a*2):Sr({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var b=P(gr||=Z([`M `,`,`,` + A`,`,`,`,0,0,`,`,`,`,`,` + A`,`,`,`,0,`,`,`,`,`,`,`,` + A`,`,`,`,0,0,`,`,`,`,`,` + `]),p.x,p.y,a,a,+(u<0),f.x,f.y,i,i,+(y>180),+(u<0),g.x,g.y,a,a,+(u<0),_.x,_.y);if(r>0){var x=xr({cx:t,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),S=x.circleTangency,C=x.lineTangency,w=x.theta,T=xr({cx:t,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),E=T.circleTangency,D=T.lineTangency,O=T.theta,k=s?Math.abs(c-l):Math.abs(c-l)-w-O;if(k<0&&a===0)return`${b}L${t},${n}Z`;b+=P(_r||=Z([`L`,`,`,` + A`,`,`,`,0,0,`,`,`,`,`,` + A`,`,`,`,0,`,`,`,`,`,`,`,` + A`,`,`,`,0,0,`,`,`,`,`,`Z`]),D.x,D.y,a,a,+(u<0),E.x,E.y,r,r,+(k>180),+(u>0),S.x,S.y,a,a,+(u<0),C.x,C.y)}else b+=P(vr||=Z([`L`,`,`,`Z`]),t,n);return b},wr={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Tr=e=>{var t=R(e,wr),n=t.cx,i=t.cy,a=t.innerRadius,o=t.outerRadius,s=t.cornerRadius,c=t.forceCornerRadius,l=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=t.className;if(o0&&Math.abs(u-d)<360?Cr({cx:n,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(h,m/2),forceCornerRadius:c,cornerIsExternal:l,startAngle:u,endAngle:d}):Sr({cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:u,endAngle:d});return q.createElement(`path`,yr({},Oe(t),{className:p,d:g}))};function Er(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(we(t)){if(e===`centric`){var r=t.cx,i=t.cy,a=t.innerRadius,o=t.outerRadius,s=t.angle,c=V(r,i,a,s),l=V(r,i,o,s);return[{x:c.x,y:c.y},{x:l.x,y:l.y}]}return dr(t)}}function Dr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Or(e){for(var t=1;tW(qe),Nr=()=>{var e=Mr(),t=W(w),n=W(g);return k(!e||!n?void 0:Or(Or({},e),{},{scale:n}),t)};function Pr(){return Pr=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{E(Be({shared:y,trigger:x,axisId:T,active:n,defaultIndex:D}))},[E,y,x,T,n,D]);var O=l(),k=Pe(),A=S(y),M=W(e=>v(e,A,x,D))??{},N=M.activeIndex,P=M.isActive,te=W(e=>ne(e,A,x,D)),re=W(e=>ie(e,A,x,D)),ae=W(e=>s(e,A,x,D)),oe=te,se=ee(),F=n??P??!1,ce=Jr(Bt([oe,F]),2),I=ce[0],le=ce[1],ue=A===`axis`?re:void 0;b(A,x,ae,ue,N,F);var de=w??se;if(de==null||O==null||A==null)return null;var L=oe??ni;F||(L=ni),c&&L.length&&(L=At(L.filter(e=>e.value!=null&&(e.hide!==!0||t.includeHidden)),f,ei));var fe=L.length>0,pe=Wr(Wr({},t),{},{payload:L,label:ue,active:F,activeIndex:N,coordinate:ae,accessibilityLayer:k}),me=q.createElement(xn,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:u,active:F,coordinate:ae,hasPayload:fe,offset:d,position:p,reverseDirection:m,useTranslate3d:h,viewBox:O,wrapperStyle:g,lastBoundingBox:I,innerRef:le,hasPortalFromProps:!!w},ti(o,pe));return q.createElement(q.Fragment,null,(0,kt.createPortal)(me,de),F&&q.createElement(Hr,{cursor:_,tooltipEventType:A,coordinate:ae,payload:L,index:N}))}var ai=(0,q.createContext)({grid:{stroke:`#ccc`,fill:`none`}});ai.Provider;var oi=()=>(0,q.useContext)(ai),si=[`x1`,`y1`,`x2`,`y2`,`key`],ci=[`offset`],li=[`xAxisId`,`yAxisId`],ui=[`xAxisId`,`yAxisId`];function di(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t{var t=e.fill;if(!t||t===`none`)return null;var n=e.fillOpacity,r=e.x,i=e.y,a=e.width,o=e.height,s=e.ry;return q.createElement(`rect`,{x:r,y:i,ry:s,width:a,height:o,stroke:`none`,fill:t,fillOpacity:n,className:`recharts-cartesian-grid-bg`})};function vi(e){var t=e.option,n=e.lineItemProps,r;if(q.isValidElement(t))r=q.cloneElement(t,n);else if(typeof t==`function`)r=t(n);else{var i=n.x1,a=n.y1,o=n.x2,s=n.y2,c=n.key,l=hi(n,si),u=E(l)??{};u.offset;var d=hi(u,ci),f=Array.isArray(d.strokeDasharray)?d.strokeDasharray.join(`,`):d.strokeDasharray;r=q.createElement(`line`,$({},d,{strokeDasharray:f,x1:i,y1:a,x2:o,y2:s,fill:`none`,key:c}))}return r}function yi(e){var t=e.x,n=e.width,r=e.horizontal,i=r===void 0||r,a=e.horizontalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=hi(e,li),s=a.map((e,r)=>{var a=Q(Q({},o),{},{x1:t,y1:e,x2:t+n,y2:e,key:`line-${r}`,index:r});return q.createElement(vi,{key:`line-${r}`,option:i,lineItemProps:a})});return q.createElement(`g`,{className:`recharts-cartesian-grid-horizontal`},s)}function bi(e){var t=e.y,n=e.height,r=e.vertical,i=r===void 0||r,a=e.verticalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=hi(e,ui),s=a.map((e,r)=>{var a=Q(Q({},o),{},{x1:e,y1:t,x2:e,y2:t+n,key:`line-${r}`,index:r});return q.createElement(vi,{option:i,lineItemProps:a,key:`line-${r}`})});return q.createElement(`g`,{className:`recharts-cartesian-grid-vertical`},s)}function xi(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,i=e.y,a=e.width,o=e.height,s=e.horizontalPoints,c=e.horizontal;if(!(c===void 0||c)||!t||!t.length||s==null)return null;var l=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,s)=>{var c=l[s+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=s%t.length;return q.createElement(`rect`,{key:`react-${s}`,y:e,x:r,height:u,width:a,stroke:`none`,fill:t[d],fillOpacity:n,className:`recharts-cartesian-grid-bg`})});return q.createElement(`g`,{className:`recharts-cartesian-gridstripes-horizontal`},u)}function Si(e){var t=e.vertical,n=t===void 0||t,r=e.verticalFill,i=e.fillOpacity,a=e.x,o=e.y,s=e.width,c=e.height,l=e.verticalPoints;if(!n||!r||!r.length)return null;var u=l.map(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==u[0]&&u.unshift(0);var d=u.map((e,t)=>{var n=u[t+1],l=n==null?a+s-e:n-e;if(l<=0)return null;var d=t%r.length;return q.createElement(`rect`,{key:`react-${t}`,x:e,y:o,width:l,height:c,stroke:`none`,fill:r[d],fillOpacity:i,className:`recharts-cartesian-grid-bg`})});return q.createElement(`g`,{className:`recharts-cartesian-gridstripes-vertical`},d)}var Ci=(e,t)=>{var n=e.xAxis,r=e.width,i=e.height,a=e.offset;return o(Je(Q(Q(Q({},z),n),{},{ticks:ke(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},wi=(e,t)=>{var n=e.yAxis,r=e.width,i=e.height,a=e.offset;return o(Je(Q(Q(Q({},z),n),{},{ticks:ke(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},Ti={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:B.grid};function Ei(e){var t=$e(),n=nt(),r=N(),i=Q(Q({},R(e,Ti)),{},{x:U(e.x)?e.x:r.left,y:U(e.y)?e.y:r.top,width:U(e.width)?e.width:r.width,height:U(e.height)?e.height:r.height}),a=i.xAxisId,o=i.yAxisId,s=i.x,c=i.y,l=i.width,u=i.height,d=i.syncWithTicks,f=i.horizontalValues,m=i.verticalValues,g=p(),_=W(e=>F(e,`xAxis`,a,g)),v=W(e=>F(e,`yAxis`,o,g)),y=oi(),b={stroke:i.stroke??y.grid.stroke,strokeWidth:i.strokeWidth??y.grid.strokeWidth,strokeOpacity:i.strokeOpacity??y.grid.strokeOpacity,strokeDasharray:i.strokeDasharray??y.grid.strokeDasharray};if(!h(l)||!h(u)||!U(s)||!U(c))return null;var x=i.verticalCoordinatesGenerator||Ci,S=i.horizontalCoordinatesGenerator||wi,C=i.horizontalPoints,w=i.verticalPoints;if((!C||!C.length)&&typeof S==`function`){var T=f&&f.length,E=S({yAxis:v?Q(Q({},v),{},{ticks:T?f:v.ticks}):void 0,width:t??l,height:n??u,offset:r},T?!0:d);te(Array.isArray(E),`horizontalCoordinatesGenerator should return Array but instead it returned [${typeof E}]`),Array.isArray(E)&&(C=E)}if((!w||!w.length)&&typeof x==`function`){var D=m&&m.length,O=x({xAxis:_?Q(Q({},_),{},{ticks:D?m:_.ticks}):void 0,width:t??l,height:n??u,offset:r},D?!0:d);te(Array.isArray(O),`verticalCoordinatesGenerator should return Array but instead it returned [${typeof O}]`),Array.isArray(O)&&(w=O)}return q.createElement(rt,{zIndex:i.zIndex},q.createElement(`g`,{className:`recharts-cartesian-grid`},q.createElement(_i,{fill:i.fill??y.grid.fill,fillOpacity:i.fillOpacity??y.grid.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),q.createElement(xi,$({},i,{horizontalPoints:C})),q.createElement(Si,$({},i,{verticalPoints:w})),q.createElement(yi,$({},i,b,{offset:r,horizontalPoints:C,xAxis:_,yAxis:v})),q.createElement(bi,$({},i,b,{offset:r,verticalPoints:w,xAxis:_,yAxis:v}))))}Ei.displayName=`CartesianGrid`;var Di=[`type`],Oi=[`dangerouslySetInnerHTML`,`ticks`,`scale`],ki=[`id`,`scale`];function Ai(){return Ai=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(o!=null)return Mi(Mi({},a),{},{type:o})},[a,o]);return(0,q.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(de(s)):n.current!==s&&t(et({prev:n.current,next:s})),n.current=s)},[s,t]),(0,q.useLayoutEffect)(()=>()=>{n.current&&=(t(Xe(n.current)),null)},[t]),null}var zi=e=>{var t=e.xAxisId,n=e.className,a=e.height,o=e.label,s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=W(d),u=p(),f=j(),h=`xAxis`,g=W(e=>i(e,h,t,u)),_=W(e=>pe(e,t)),v=W(e=>We(e,t)),y=W(e=>De(e,t));if((0,q.useLayoutEffect)(()=>{if(!(a!==`auto`||!_||m(o)||(0,q.isValidElement)(o)||y==null)){var e=s.current;if(e){var n=e.getCalculatedHeight();Math.round(_.height)!==Math.round(n)&&f(me({id:t,height:n}))}}},[g,_,f,o,t,a,y]),_==null||v==null||y==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var b=Ii(e,Oi);y.id,y.scale;var x=Ii(y,ki);return q.createElement(_e,Ai({},b,x,{ref:s,labelRef:c,x:v.x,y:v.y,width:_.width,height:_.height,className:r(`recharts-${h} ${h}`,n),viewBox:l,ticks:g,axisType:h,axisId:t}))},Bi={allowDataOverflow:I.allowDataOverflow,allowDecimals:I.allowDecimals,allowDuplicatedCategory:I.allowDuplicatedCategory,angle:I.angle,axisLine:z.axisLine,height:I.height,hide:!1,includeHidden:I.includeHidden,interval:I.interval,label:!1,minTickGap:I.minTickGap,mirror:I.mirror,orientation:I.orientation,padding:I.padding,reversed:I.reversed,scale:I.scale,tick:I.tick,tickCount:I.tickCount,tickLine:z.tickLine,tickSize:z.tickSize,type:I.type,niceTicks:I.niceTicks,xAxisId:0},Vi=q.memo(e=>{var t=R(e,Bi);return q.createElement(q.Fragment,null,q.createElement(Ri,{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}),q.createElement(zi,t))},He);Vi.displayName=`XAxis`;export{ur as i,Ei as n,ii as r,Vi as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/index-CucRSUHh.js b/internal/webui/static/assets/index-CucRSUHh.js new file mode 100644 index 00000000..45224dc7 --- /dev/null +++ b/internal/webui/static/assets/index-CucRSUHh.js @@ -0,0 +1,114 @@ +<<<<<<<< HEAD:internal/webui/static/assets/index--8Ifgwr4.js +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LiveSparkline-g4J_1uGD.js","assets/CartesianChart-BtPJbdpG.js","assets/AreaChart-Cm1PLzri.js","assets/TrafficChart-jYJwrZhA.js","assets/XAxis-C10B4cAr.js","assets/CostChart-zKBs-QQq.js"])))=>i.map(i=>d[i]); +======== +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LiveSparkline-BRAmSM_0.js","assets/CartesianChart-Dc6HOANc.js","assets/AreaChart-BqFAEkTX.js","assets/TrafficChart-DXiktQ6F.js","assets/XAxis-DqeVRlZV.js","assets/CostChart-BlNjRD6T.js"])))=>i.map(i=>d[i]); +>>>>>>>> 85fe552 (feat(routing): add same-provider credit-expiry-first scheduling):internal/webui/static/assets/index-CucRSUHh.js +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1R||(e.current=te[R],te[R]=null,R--)}function ne(e,t){R++,te[R]=e.current,e.current=t}var re=z(null),ie=z(null),V=z(null),ae=z(null);function oe(e,t){switch(ne(V,t),ne(ie,e),ne(re,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Jd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Jd(t),e=Yd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(re),ne(re,e)}function se(){B(re),B(ie),B(V)}function ce(e){e.memoizedState!==null&&ne(ae,e);var t=re.current,n=Yd(t,e.type);t!==n&&(ne(ie,e),ne(re,n))}function le(e){ie.current===e&&(B(re),B(ie)),ae.current===e&&(B(ae),ip._currentValue=L)}var ue,de;function fe(e){if(ue===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ue=t&&t[1]||``,de=-1)`:-1i||c[r]!==l[i]){var u=` +`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{pe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?fe(n):``}function he(e,t){switch(e.tag){case 26:case 27:case 5:return fe(e.type);case 16:return fe(`Lazy`);case 13:return e.child!==t&&t!==null?fe(`Suspense Fallback`):fe(`Suspense`);case 19:return fe(`SuspenseList`);case 0:case 15:return me(e.type,!1);case 11:return me(e.type.render,!1);case 1:return me(e.type,!0);case 31:return fe(`Activity`);default:return``}}function ge(e){try{var t=``,n=null;do t+=he(e,n),n=e,e=e.return;while(e);return t}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}var _e=Object.prototype.hasOwnProperty,ve=t.unstable_scheduleCallback,ye=t.unstable_cancelCallback,be=t.unstable_shouldYield,xe=t.unstable_requestPaint,Se=t.unstable_now,Ce=t.unstable_getCurrentPriorityLevel,we=t.unstable_ImmediatePriority,Te=t.unstable_UserBlockingPriority,Ee=t.unstable_NormalPriority,De=t.unstable_LowPriority,Oe=t.unstable_IdlePriority,ke=t.log,Ae=t.unstable_setDisableYieldValue,je=null,Me=null;function Ne(e){if(typeof ke==`function`&&Ae(e),Me&&typeof Me.setStrictMode==`function`)try{Me.setStrictMode(je,e)}catch{}}var Pe=Math.clz32?Math.clz32:Le,Fe=Math.log,Ie=Math.LN2;function Le(e){return e>>>=0,e===0?32:31-(Fe(e)/Ie|0)|0}var Re=256,ze=262144,Be=4194304;function Ve(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function He(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ve(n))):i=Ve(o):i=Ve(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ve(n))):i=Ve(o)):i=Ve(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ue(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function We(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Ge(){var e=Be;return Be<<=1,!(Be&62914560)&&(Be=4194304),e}function Ke(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Je(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),sn=!1;if(on)try{var cn={};Object.defineProperty(cn,"passive",{get:function(){sn=!0}}),window.addEventListener(`test`,cn,cn),window.removeEventListener(`test`,cn,cn)}catch{sn=!1}var ln=null,un=null,dn=null;function fn(){if(dn)return dn;var e,t=un,n=t.length,r,i=`value`in ln?ln.value:ln.textContent,a=i.length;for(e=0;e=Wn),qn=` `,Jn=!1;function Yn(e,t){switch(e){case`keyup`:return Hn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Xn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Zn=!1;function Qn(e,t){switch(e){case`compositionend`:return Xn(t);case`keypress`:return t.which===32?(Jn=!0,qn):null;case`textInput`:return e=t.data,e===qn&&Jn?null:e;default:return null}}function $n(e,t){if(Zn)return e===`compositionend`||!Un&&Yn(e,t)?(e=fn(),dn=un=ln=null,Zn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=xr(n)}}function Cr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Cr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Nt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Nt(e.document)}return t}function Tr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Er=on&&`documentMode`in document&&11>=document.documentMode,Dr=null,Or=null,kr=null,Ar=!1;function jr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ar||Dr==null||Dr!==Nt(r)||(r=Dr,`selectionStart`in r&&Tr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kr&&br(kr,r)||(kr=r,r=Md(Or,`onSelect`),0>=o,i-=o,Ci=1<<32-Pe(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Mi&&Ti(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Mi&&Ti(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Mi&&Ti(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Mi&&Ti(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Ea(l)===r.type){n(e,r.sibling),c=a(r,o.props),Na(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===y?(c=ui(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=li(o.type,o.key,o.props,null,e.mode,c),Na(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=pi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Ea(o),b(e,r,o,c)}if(ee(o))return h(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Ma(o),c);if(o.$$typeof===C)return b(e,r,ea(e,o),c);Pa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=di(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ja=0;var i=b(e,t,n,r);return Aa=null,i}catch(t){if(t===ba||t===Sa)throw t;var a=ai(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ia=Fa(!0),La=Fa(!1),Ra=!1;function za(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ba(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Va(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ha(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Rl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ni(e),ti(e,null,n),t}return Qr(e,r,t,n),ni(e)}function Ua(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}function Wa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ga=!1;function Ka(){if(Ga){var e=da;if(e!==null)throw e}}function qa(e,t,n,r){Ga=!1;var i=e.updateQueue;Ra=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Vl&f)===f:(r&f)===f){f!==0&&f===ua&&(Ga=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Ra=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Yl|=o,e.lanes=o,e.memoizedState=d}}function Ja(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ya(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=F.T,s={};F.T=s,Ns(e,!1,t,n);try{var c=i(),l=F.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ms(e,t,ma(c,r),_u(e)):Ms(e,t,r,_u(e))}catch(n){Ms(e,t,{then:function(){},status:`rejected`,reason:n},_u())}finally{I.p=a,o!==null&&s.types!==null&&(o.types=s.types),F.T=o}}function Cs(){}function ws(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ts(e).queue;U(e,a,t,L,n===null?Cs:function(){return Es(e),n(r)})}function Ts(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:L,baseState:L,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:L},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Es(e){var t=Ts(e);t.next===null&&(t=e.alternate.memoizedState),Ms(e,t.next.queue,{},_u())}function Ds(){return $i(ip)}function Os(){return Mo().memoizedState}function W(){return Mo().memoizedState}function ks(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=_u();e=Va(n);var r=Ha(t,e,n);r!==null&&(yu(r,t,n),Ua(r,t,n)),t={cache:oa()},e.payload=t;return}t=t.return}}function As(e,t,n){var r=_u();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ps(e)?Fs(t,n):(n=$r(e,t,n,r),n!==null&&(yu(n,e,r),Is(n,t,r)))}function js(e,t,n){Ms(e,t,n,_u())}function Ms(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ps(e))Fs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,yr(s,o))return Qr(e,t,i,0),zl===null&&Zr(),!1}catch{}if(n=$r(e,t,i,r),n!==null)return yu(n,e,r),Is(n,t,r),!0}return!1}function Ns(e,t,n,r){if(r={lane:2,revertLane:gd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ps(e)){if(t)throw Error(i(479))}else t=$r(e,n,r,2),t!==null&&yu(t,e,2)}function Ps(e){var t=e.alternate;return e===fo||t!==null&&t===fo}function Fs(e,t){go=ho=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Is(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}var Ls={readContext:$i,use:Fo,useCallback:So,useContext:So,useEffect:So,useImperativeHandle:So,useLayoutEffect:So,useInsertionEffect:So,useMemo:So,useReducer:So,useRef:So,useState:So,useDebugValue:So,useDeferredValue:So,useTransition:So,useSyncExternalStore:So,useId:So,useHostTransitionStatus:So,useFormState:So,useActionState:So,useOptimistic:So,useMemoCache:So,useCacheRefresh:So};Ls.useEffectEvent=So;var Rs={readContext:$i,use:Fo,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:$i,useEffect:ds,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ls(4194308,4,gs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ls(4194308,4,e,t)},useInsertionEffect:function(e,t){ls(4,2,e,t)},useMemo:function(e,t){var n=jo();t=t===void 0?null:t;var r=e();if(_o){Ne(!0);try{e()}finally{Ne(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=jo();if(n!==void 0){var i=n(t);if(_o){Ne(!0);try{n(t)}finally{Ne(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=As.bind(null,fo,e),[r.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:function(e){e=qo(e);var t=e.queue,n=js.bind(null,fo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:vs,useDeferredValue:function(e,t){return xs(jo(),e,t)},useTransition:function(){var e=qo(!1);return e=U.bind(null,fo,e.queue,!0,!1),jo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=fo,a=jo();if(Mi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),zl===null)throw Error(i(349));Vl&127||Ho(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ds(Wo.bind(null,r,o,e),[e]),r.flags|=2048,ss(9,{destroy:void 0},Uo.bind(null,r,o,n,t),null),n},useId:function(){var e=jo(),t=zl.identifierPrefix;if(Mi){var n=wi,r=Ci;n=(r&~(1<<32-Pe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=vo++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[rt]=t,o[it]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Vd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Mc(t)}}return Fc(t),G(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Mc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=V.current,zi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ai,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[rt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Rd(e.nodeValue,n)),e||Ii(t,!0)}else e=qd(e).createTextNode(r),e[rt]=t,t.stateNode=e}return Fc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=zi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[rt]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),e=!1}else n=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(so(t),t):(so(t),null);if(t.flags&128)throw Error(i(558))}return Fc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=zi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[rt]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),a=!1}else a=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(so(t),t):(so(t),null)}return so(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Pc(t,t.updateQueue),Fc(t),null);case 4:return se(),e===null&&Od(t.stateNode.containerInfo),Fc(t),null;case 10:return qi(t.type),Fc(t),null;case 19:if(B(co),r=t.memoizedState,r===null)return Fc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)K(r,!1);else{if(Jl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=lo(e),o!==null){for(t.flags|=128,K(r,!1),e=o.updateQueue,t.updateQueue=e,Pc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ci(n,e),n=n.sibling;return ne(co,co.current&1|2),Mi&&Ti(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Se()>au&&(t.flags|=128,a=!0,K(r,!1),t.lanes=4194304)}}else{if(!a){if(e=lo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Pc(t,e),K(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Mi)return Fc(t),null}else 2*Se()-r.renderingStartTime>au&&n!==536870912&&(t.flags|=128,a=!0,K(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Fc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Se(),e.sibling=null,n=co.current,ne(co,a?n&1|2:n&1),Mi&&Ti(t,r.treeForkCount),e);case 22:case 23:return so(t),eo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Fc(t),t.subtreeFlags&6&&(t.flags|=8192)):Fc(t),n=t.updateQueue,n!==null&&Pc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&B(ga),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),qi(aa),Fc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Lc(e,t){switch(Oi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qi(aa),se(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return le(t),null;case 31:if(t.memoizedState!==null){if(so(t),t.alternate===null)throw Error(i(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(so(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return B(co),null;case 4:return se(),null;case 10:return qi(t.type),null;case 22:case 23:return so(t),eo(),e!==null&&B(ga),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return qi(aa),null;case 25:return null;default:return null}}function Rc(e,t){switch(Oi(t),t.tag){case 3:qi(aa),se();break;case 26:case 27:case 5:le(t);break;case 4:se();break;case 31:t.memoizedState!==null&&so(t);break;case 13:so(t);break;case 19:B(co);break;case 10:qi(t.type);break;case 22:case 23:so(t),eo(),e!==null&&B(ga);break;case 24:qi(aa)}}function zc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Yu(t,t.return,e)}}function Bc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Yu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Yu(t,t.return,e)}}function Vc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ya(t,n)}catch(t){Yu(e,e.return,t)}}}function Hc(e,t,n){n.props=Gs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Yu(e,t,n)}}function Uc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Yu(e,t,n)}}function Wc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Yu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Yu(e,t,n)}else n.current=null}}function Gc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Yu(e,e.return,t)}}function Kc(e,t,n){try{var r=e.stateNode;Hd(r,e.type,n,t),r[it]=t}catch(t){Yu(e,e.return,t)}}function qc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&af(e.type)||e.tag===4}function Jc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||qc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&af(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Xt));else if(r!==4&&(r===27&&af(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&af(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Xc(e,t,n),e=e.sibling;e!==null;)Xc(e,t,n),e=e.sibling}function Zc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Vd(t,r,n),t[rt]=e,t[it]=n}catch(t){Yu(e,e.return,t)}}var Qc=!1,$c=!1,el=!1,tl=typeof WeakSet==`function`?WeakSet:Set,nl=null;function rl(e,t){if(e=e.containerInfo,Gd=pp,e=wr(e),Tr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Kd={focusedElem:e,selectionRange:n},pp=!1,nl=t;nl!==null;)if(t=nl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,nl=e;else for(;nl!==null;){switch(t=nl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Vd(o,r,n),o[rt]=e,gt(o),r=o;break a;case`link`:var s=qf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=Sr(s,h),v=Sr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,F.T=null,n=pu,pu=null;var o=lu,s=du;if(cu=0,uu=lu=null,du=0,Rl&6)throw Error(i(331));var c=Rl;if(Rl|=4,Nl(o.current),Tl(o,o.current,s,n),Rl=c,ld(0,!1),Me&&typeof Me.onPostCommitFiberRoot==`function`)try{Me.onPostCommitFiberRoot(je,o)}catch{}return!0}finally{I.p=a,F.T=r,Gu(e,t)}}function Ju(e,t,n){t=hi(n,t),t=Zs(e.stateNode,t,2),e=Ha(e,t,2),e!==null&&(qe(e,2),cd(e))}function Yu(e,t,n){if(e.tag===3)Ju(e,e,n);else for(;t!==null;){if(t.tag===3){Ju(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(su===null||!su.has(r))){e=hi(n,e),n=Qs(2),r=Ha(t,n,2),r!==null&&($s(n,r,t,e),qe(r,2),cd(r));break}}t=t.return}}function Xu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ll;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Kl=!0,i.add(n),e=Zu.bind(null,e,t,n),t.then(e,e))}function Zu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,zl===e&&(Vl&n)===n&&(Jl===4||Jl===3&&(Vl&62914560)===Vl&&300>Se()-ru?!(Rl&2)&&Eu(e,0):Zl|=n,$l===Vl&&($l=0)),cd(e)}function Qu(e,t){t===0&&(t=Ge()),e=ei(e,t),e!==null&&(qe(e,t),cd(e))}function $u(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Qu(e,n)}function ed(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Qu(e,n)}function td(e,t){return ve(e,t)}var nd=null,rd=null,id=!1,ad=!1,od=!1,sd=0;function cd(e){e!==rd&&e.next===null&&(rd===null?nd=rd=e:rd=rd.next=e),ad=!0,id||(id=!0,hd())}function ld(e,t){if(!od&&ad){od=!0;do for(var n=!1,r=nd;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Pe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,md(r,a))}else a=Vl,a=He(r,r===zl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ue(r,a)||(n=!0,md(r,a))}r=r.next}while(n);od=!1}}function ud(){dd()}function dd(){ad=id=!1;var e=0;sd!==0&&Qd()&&(e=sd);for(var t=Se(),n=null,r=nd;r!==null;){var i=r.next,a=fd(r,t);a===0?(r.next=null,n===null?nd=i:n.next=i,i===null&&(rd=n)):(n=r,(e!==0||a&3)&&(ad=!0)),r=i}cu!==0&&cu!==5||ld(e,!1),sd!==0&&(sd=0)}function fd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Ud(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function Of(e,t,n){var r=Df;if(r&&typeof t==`string`&&t){var i=Ft(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Sf.has(i)||(Sf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Vd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function kf(e){wf.D(e),Of(`dns-prefetch`,e,null)}function Af(e,t){wf.C(e,t),Of(`preconnect`,e,t)}function jf(e,t,n){wf.L(e,t,n);var r=Df;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ft(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ft(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ft(n.imageSizes)+`"]`)):i+=`[href="`+Ft(e)+`"]`;var a=i;switch(t){case`style`:a=Lf(e);break;case`script`:a=Bf(e)}xf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),xf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Rf(a))||t===`script`&&r.querySelector(Vf(a))||(t=r.createElement(`link`),Vd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function Mf(e,t){wf.m(e,t);var n=Df;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ft(r)+`"][href="`+Ft(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Bf(e)}if(!xf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),xf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Vf(a)))return}r=n.createElement(`link`),Vd(r,`link`,e),gt(r),n.head.appendChild(r)}}}function Nf(e,t,n){wf.S(e,t,n);var r=Df;if(r&&e){var i=ht(r).hoistableStyles,a=Lf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Rf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=xf.get(a))&&Wf(e,n);var c=o=r.createElement(`link`);gt(c),Vd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Uf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Pf(e,t){wf.X(e,t);var n=Df;if(n&&e){var r=ht(n).hoistableScripts,i=Bf(e),a=r.get(i);a||(a=n.querySelector(Vf(i)),a||(e=m({src:e,async:!0},t),(t=xf.get(i))&&Gf(e,t),a=n.createElement(`script`),gt(a),Vd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Ff(e,t){wf.M(e,t);var n=Df;if(n&&e){var r=ht(n).hoistableScripts,i=Bf(e),a=r.get(i);a||(a=n.querySelector(Vf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=xf.get(i))&&Gf(e,t),a=n.createElement(`script`),gt(a),Vd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function If(e,t,n,r){var a=(a=V.current)?Cf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Lf(n.href),n=ht(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Lf(n.href);var o=ht(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Rf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),xf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},xf.set(e,n),o||q(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Bf(n),n=ht(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Lf(e){return`href="`+Ft(e)+`"`}function Rf(e){return`link[rel="stylesheet"][`+e+`]`}function zf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function q(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Vd(t,`link`,n),gt(t),e.head.appendChild(t))}function Bf(e){return`[src="`+Ft(e)+`"]`}function Vf(e){return`script[async]`+e}function Hf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ft(n.href)+`"]`);if(r)return t.instance=r,gt(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),gt(r),Vd(r,`style`,a),Uf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Lf(n.href);var o=e.querySelector(Rf(a));if(o)return t.state.loading|=4,t.instance=o,gt(o),o;r=zf(n),(a=xf.get(a))&&Wf(r,a),o=(e.ownerDocument||e).createElement(`link`),gt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Vd(o,`link`,r),t.state.loading|=4,Uf(o,n.precedence,e),t.instance=o;case`script`:return o=Bf(n.src),(a=e.querySelector(Vf(o)))?(t.instance=a,gt(a),a):(r=n,(a=xf.get(o))&&(r=m({},n),Gf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),gt(a),Vd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Uf(r,n.precedence,e));return t.instance}function Uf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Yf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Xf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Zf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Lf(r.href),a=t.querySelector(Rf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ep.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,gt(a);return}a=t.ownerDocument||t,r=zf(r),(i=xf.get(i))&&Wf(r,i),a=a.createElement(`link`),gt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Vd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ep.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Qf=0;function $f(e,t){return e.stylesheets&&e.count===0&&np(e,e.stylesheets),0Qf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function ep(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)np(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var tp=null;function np(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,tp=new Map,t.forEach(rp,e),tp=null,ep.call(e))}function rp(e,t){if(!(t.state.loading&4)){var n=tp.get(e);if(n)var r=n.get(null);else{n=new Map,tp.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=l(d(),1),y=_(),b=`modulepreload`,x=function(e){return`/`+e},S={},C=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=x(t,n),t=s(t),t in S)return;S[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:b,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},w=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,T=/^[\\/]{2}/;function E(e,t){return t+e.replace(/\\/g,`/`)}var D=`popstate`;function O(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function k(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return P(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:ee(t)}return I(t,n,null,e)}function A(e,t){if(e===!1||e==null)throw Error(t)}function j(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function M(){return Math.random().toString(36).substring(2,10)}function N(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function P(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?F(t):t,state:n,key:t&&t.key||r||M(),mask:i}}function ee({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function F(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function I(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=O(e)?e:P(h.location,e,t);n&&n(r,e),l=u()+1;let d=N(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=O(e)?e:P(h.location,e,t);n&&n(r,e),l=u();let i=N(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return L(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(D,d),c=e,()=>{i.removeEventListener(D,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function L(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),A(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:ee(t);return i=i.replace(/ $/,`%20`),!n&&T.test(i)&&(i=r+i),new URL(i,r)}function te(e,t,n=`/`){return R(e,t,n,!1)}function R(e,t,n,r,i){let a=_e((typeof t==`string`?F(t):t).pathname||`/`,n);if(a==null)return null;let o=i??z(e),s=null,c=ge(a);for(let e=0;s==null&&e{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;A(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=Te([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(A(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),B(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:ue(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=he(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of ne(e.path))a(e,t,!0,n)}),t}function ne(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=ne(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function re(e){e.sort((e,t)=>e.score===t.score?de(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ie=/^:[\w-]+$/,V=3,ae=2,oe=1,se=10,ce=-2,le=e=>e===`*`;function ue(e,t){let n=e.split(`/`),r=n.length;return n.some(le)&&(r+=ce),t&&(r+=ae),n.filter(e=>!le(e)).reduce((e,t)=>e+(ie.test(t)?V:t===``?oe:se),r)}function de(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function fe(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function he(e,t=!1,n=!0){j(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function ge(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return j(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function _e(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function ve(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?F(e):e,a;return n?(n=we(n),a=n.startsWith(`/`)?ye(n.substring(1),`/`):ye(n,t)):a=t,{pathname:a,search:Oe(r),hash:ke(i)}}function ye(e,t){let n=Ee(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function be(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function xe(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Se(e){let t=xe(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Ce(e,t,n,r=!1){let i;typeof e==`string`?i=F(e):(i={...e},A(!i.pathname||!i.pathname.includes(`?`),be(`?`,`pathname`,`search`,i)),A(!i.pathname||!i.pathname.includes(`#`),be(`#`,`pathname`,`hash`,i)),A(!i.search||!i.search.includes(`#`),be(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=ve(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var we=e=>e.replace(/[\\/]{2,}/g,`/`),Te=e=>we(e.join(`/`)),Ee=e=>e.replace(/\/+$/,``),De=e=>Ee(e).replace(/^\/*/,`/`),Oe=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,ke=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ae=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function je(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Me(e){return Te(e.map(e=>e.route.path).filter(Boolean))||`/`}var Ne=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Pe(e,t){let n=e;if(typeof n!=`string`||!w.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Ne)try{let e=new URL(window.location.href),r=T.test(n)?new URL(E(n,e.protocol)):new URL(n),a=_e(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{j(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Fe=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Fe);var Ie=[`GET`,...Fe];new Set(Ie);var Le=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Re(e){try{return Le.includes(new URL(e).protocol)}catch{return!1}}var ze=v.createContext(null);ze.displayName=`DataRouter`;var Be=v.createContext(null);Be.displayName=`DataRouterState`;var Ve=v.createContext(!1);function He(){return v.useContext(Ve)}var Ue=v.createContext({isTransitioning:!1});Ue.displayName=`ViewTransition`;var We=v.createContext(new Map);We.displayName=`Fetchers`;var Ge=v.createContext(null);Ge.displayName=`Await`;var Ke=v.createContext(null);Ke.displayName=`Navigation`;var qe=v.createContext(null);qe.displayName=`Location`;var Je=v.createContext({outlet:null,matches:[],isDataRoute:!1});Je.displayName=`Route`;var Ye=v.createContext(null);Ye.displayName=`RouteError`;var Xe=`REACT_ROUTER_ERROR`,Ze=`REDIRECT`,Qe=`ROUTE_ERROR_RESPONSE`;function $e(e){if(e.startsWith(`${Xe}:${Ze}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function et(e){if(e.startsWith(`${Xe}:${Qe}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ae(t.status,t.statusText,t.data)}catch{}}function tt(e,{relative:t}={}){A(nt(),`useHref() may be used only in the context of a component.`);let{basename:n,navigator:r}=v.useContext(Ke),{hash:i,pathname:a,search:o}=ut(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Te([n,a])),r.createHref({pathname:s,search:o,hash:i})}function nt(){return v.useContext(qe)!=null}function rt(){return A(nt(),`useLocation() may be used only in the context of a component.`),v.useContext(qe).location}var it=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function at(e){v.useContext(Ke).static||v.useLayoutEffect(e)}function ot(){let{isDataRoute:e}=v.useContext(Je);return e?Dt():st()}function st(){A(nt(),`useNavigate() may be used only in the context of a component.`);let e=v.useContext(ze),{basename:t,navigator:n}=v.useContext(Ke),{matches:r}=v.useContext(Je),{pathname:i}=rt(),a=JSON.stringify(Se(r)),o=v.useRef(!1);return at(()=>{o.current=!0}),v.useCallback((r,s={})=>{if(j(o.current,it),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Ce(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Te([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var ct=v.createContext(null);function lt(e){let t=v.useContext(Je).outlet;return v.useMemo(()=>t&&v.createElement(ct.Provider,{value:e},t),[t,e])}function ut(e,{relative:t}={}){let{matches:n}=v.useContext(Je),{pathname:r}=rt(),i=JSON.stringify(Se(n));return v.useMemo(()=>Ce(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function dt(e,t){return ft(e,t)}function ft(e,t,n){A(nt(),`useRoutes() may be used only in the context of a component.`);let{navigator:r}=v.useContext(Ke),{matches:i}=v.useContext(Je),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;kt(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant (or called \`useRoutes()\`) at "${s}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. + +Please change the parent to .`)}let u=rt(),d;if(t){let e=typeof t==`string`?F(t):t;A(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):te(e,{pathname:p});j(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),j(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let h=yt(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Te([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Te([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?v.createElement(qe.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function pt(){let e=Et(),t=je(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=v.createElement(v.Fragment,null,v.createElement(`p`,null,`💿 Hey developer 👋`),v.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,v.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,v.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),v.createElement(v.Fragment,null,v.createElement(`h2`,null,`Unexpected Application Error!`),v.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?v.createElement(`pre`,{style:i},n):null,o)}var mt=v.createElement(pt,null),ht=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=et(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:v.createElement(Je.Provider,{value:this.props.routeContext},v.createElement(Ye.Provider,{value:e,children:this.props.component}));return this.context?v.createElement(_t,{error:e},t):t}};ht.contextType=Ve;var gt=new WeakMap;function _t({children:e,error:t}){let{basename:n}=v.useContext(Ke);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=$e(t.digest);if(e){let r=gt.get(t);if(r)throw r;let i=Pe(e.location,n),a=i.absoluteURL||i.to;if(Re(a))throw Error(`Invalid redirect location`);if(Ne&&!gt.get(t)){if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw gt.set(t,n),n}}return v.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function vt({routeContext:e,match:t,children:n}){let r=v.useContext(ze);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(Je.Provider,{value:e},n)}function yt(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);A(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Me(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||mt,o&&(s<0&&c===0?(kt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?v.createElement(n.route.Component,null):n.route.element?n.route.element:e,v.createElement(vt,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?v.createElement(ht,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function bt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function xt(e){let t=v.useContext(ze);return A(t,bt(e)),t}function St(e){let t=v.useContext(Be);return A(t,bt(e)),t}function Ct(e){let t=v.useContext(Je);return A(t,bt(e)),t}function wt(e){let t=Ct(e),n=t.matches[t.matches.length-1];return A(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Tt(){return wt(`useRouteId`)}function Et(){let e=v.useContext(Ye),t=St(`useRouteError`),n=wt(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Dt(){let{router:e}=xt(`useNavigate`),t=wt(`useNavigate`),n=v.useRef(!1);return at(()=>{n.current=!0}),v.useCallback(async(r,i={})=>{j(n.current,it),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Ot={};function kt(e,t,n){!t&&!Ot[e]&&(Ot[e]=!0,j(!1,n))}v.memo(At);function At({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return ft(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function jt({to:e,replace:t,state:n,relative:r}){A(nt(),` may be used only in the context of a component.`);let{static:i}=v.useContext(Ke);j(!i,` must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.`);let{matches:a}=v.useContext(Je),{pathname:o}=rt(),s=ot(),c=Ce(e,Se(a),o,r===`path`),l=JSON.stringify(c);return v.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Mt(e){return lt(e.context)}function Nt(e){A(!1,`A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .`)}function Pt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){A(!nt(),`You cannot render a inside another . You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=v.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=F(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=v.useMemo(()=>{let e=_e(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return j(h!=null,` is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the won't render anything.`),h==null?null:v.createElement(Ke.Provider,{value:c},v.createElement(qe.Provider,{children:t,value:h}))}function Ft({children:e,location:t}){return dt(It(e),t)}v.Component;function It(e,t=[]){let n=[];return v.Children.forEach(e,(e,r)=>{if(!v.isValidElement(e))return;let i=[...t,r];if(e.type===v.Fragment){n.push.apply(n,It(e.props.children,i));return}A(e.type===Nt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a component. All component children of must be a or `),A(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=It(e.props.children,i)),n.push(a)}),n}var Lt=`get`,Rt=`application/x-www-form-urlencoded`;function zt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Bt(e){return zt(e)&&e.tagName.toLowerCase()===`button`}function Vt(e){return zt(e)&&e.tagName.toLowerCase()===`form`}function Ht(e){return zt(e)&&e.tagName.toLowerCase()===`input`}function Ut(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Wt(e,t){return e.button===0&&(!t||t===`_self`)&&!Ut(e)}function Gt(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Kt(e,t){let n=Gt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var qt=null;function Jt(){if(qt===null)try{new FormData(document.createElement(`form`),0),qt=!1}catch{qt=!0}return qt}var Yt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Xt(e){return e!=null&&!Yt.has(e)?(j(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Rt}"`),null):e}function Zt(e,t){let n,r,i,a,o;if(Vt(e)){let o=e.getAttribute(`action`);r=o?_e(o,t):null,n=e.getAttribute(`method`)||Lt,i=Xt(e.getAttribute(`enctype`))||Rt,a=new FormData(e)}else if(Bt(e)||Ht(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a