diff --git a/README.md b/README.md index ece5169d..5c9786b1 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ API Key: <刚才创建的客户端密钥> Go 网关统一鉴权、调度和记录请求。已存 PAT 的 Qoder 账号在进程内直连;仍使用旧 CLI 凭证的 Qoder 账号保留每账号一个 Node 进程和 HOME。其余供应商走进程内适配器,不为每次请求启动完整 CLI。 - **三种接口**:Chat Completions、Responses、Anthropic Messages,加上模型列表。支持流式和函数工具调用。 -- **多账号**:轮询、加权轮询、顺序填满,以及可选的同供应商最早到期优先(FEFO)。自动选号、会话粘性、并发限制、冷却和故障切换都在。 +- **多账号**:轮询、加权轮询、顺序填满、剩余额度最少/最多优先,以及可选的同供应商最早到期优先(FEFO)。自动选号、会话粘性、并发限制、冷却和故障切换都在。 - **一个控制台**:账号、模型、客户端密钥、代理、额度和请求日志。 - **Docker**:账号数据持久化。可选的宿主机更新器可以在控制台里下载、确认和回滚。 @@ -85,6 +85,12 @@ Qoder 国内版、WorkBuddy、Trae 已实现,真账号验收未完成。Kimi C 只在同一供应商内,按最近一笔还能用的积分包到期日排序。没有到期日的账号不猜测,只在有日期的账号都不可用时才上场。额度耗尽、冷却、并发占满的账号照旧先退出。目前只有 WorkBuddy 个人账号有逐包到期日。 +## 剩余额度优先 + +在「系统 → 账号调度策略」里选「剩余额度最少优先」或「剩余额度最多优先」,也可以提交 `{"routing_strategy":"least-quota-first"}` / `{"routing_strategy":"most-quota-first"}` 到 `PATCH /api/system/settings`。模型池也支持同名策略。 + +按剩余额度百分比排序:优先使用 `remaining / total`;没有 `total` 时用 `100 - percentage`。不同供应商的额度单位不能直接比较,所以这里只用比例;额度未知的账号排在最后。 +

03 它不做什么

diff --git a/README_EN.md b/README_EN.md index 4416a207..e82ff619 100644 --- a/README_EN.md +++ b/README_EN.md @@ -65,7 +65,7 @@ Stable support covers **Qoder (Global / CN)**, **WorkBuddy (Global / CN)**, and The Go gateway handles authentication, routing, and request logging. PAT-backed Qoder accounts talk to the upstream in-process. Qoder accounts that still use the legacy CLI credential keep one Node process and HOME each. Other providers use in-process adapters, so no full CLI starts per request. - **Three APIs**: Chat Completions, Responses, and Anthropic Messages, plus model listing. Streaming and function tools included. -- **Many accounts**: round-robin, weighted round-robin, fill-first, and opt-in same-provider earliest-expiry-first (FEFO). Automatic selection, session affinity, concurrency limits, cooldowns, and failover stay on. +- **Many accounts**: round-robin, weighted round-robin, fill-first, least/most remaining quota first, and opt-in same-provider earliest-expiry-first (FEFO). Automatic selection, session affinity, concurrency limits, cooldowns, and failover stay on. - **One console**: accounts, models, client keys, proxies, quotas, and request logs. - **Docker**: account data persists. An optional host updater downloads, confirms, and rolls back from the console. @@ -85,6 +85,12 @@ Choose **Earliest expiry first (FEFO)** under **System → Account routing strat Accounts are ranked only inside one provider, by the nearest credit package that can still be spent. Missing dates are never guessed, and those accounts join only after every dated account is unavailable. Exhausted, cooling, and concurrency-saturated accounts still drop out first. Only WorkBuddy personal accounts currently expose a per-package expiry. +## Remaining quota first + +Choose **Least remaining quota first** or **Most remaining quota first** under **System → Account routing strategy**, or send `{"routing_strategy":"least-quota-first"}` / `{"routing_strategy":"most-quota-first"}` to `PATCH /api/system/settings`. Aggregation model pools support the same strategy names. + +Accounts are ranked by remaining quota ratio: `remaining / total` is preferred, and `100 - percentage` is used when no total exists. Raw remaining values are not comparable across providers with different units, so only ratios are used; accounts with unknown quota sort last. +

03 What it will not do

diff --git a/changelog/unreleased/aggregation-account-deployments.md b/changelog/unreleased/aggregation-account-deployments.md new file mode 100644 index 00000000..533e4a5a --- /dev/null +++ b/changelog/unreleased/aggregation-account-deployments.md @@ -0,0 +1,11 @@ +### English + +- Add `account_id` to aggregation members so one logical model can target a specific account/deployment instead of fanning out over every account of a provider. +- Persist the field in SQLite and expose it through the console API and model pool editor. +- Keep legacy members without `account_id` on the existing provider/region pool behavior. + +### 中文 + +- 聚合成员新增 `account_id`,让一个逻辑模型可以固定到一个具体账号/deployment,而不是默认在该供应商下扇出到所有账号。 +- 该字段持久化到 SQLite,并通过控制台 API 和模型池编辑器暴露。 +- 未填写 `account_id` 的旧成员保持原有 provider/region 池行为。 diff --git a/changelog/unreleased/cross-provider-model-pool.md b/changelog/unreleased/cross-provider-model-pool.md new file mode 100644 index 00000000..e115fa87 --- /dev/null +++ b/changelog/unreleased/cross-provider-model-pool.md @@ -0,0 +1,11 @@ +### English + +- Added a "Cross-provider model pool" page between Models and Access. It appears only while the existing cross-provider model pool setting is enabled, and toggling that setting updates the navigation immediately. +- You can now define logical models that aggregate multiple real provider models behind one client-facing ID, for both same-named models across providers and differently named models. Each logical model has its own routing strategy (priority order, round robin, fill first, or FEFO), failover settings, and an ordered, weighted member list. +- `/v1/models` now exposes the logical IDs instead of the aggregated per-provider entries; member capabilities are merged conservatively. Logical models are served through the existing route loop and failover/cooldown system, with cooldowns recorded against the real member model. The per-model strategy (priority order by default, round robin, fill first, FEFO) and member weights are honored during routing; priority order keeps using the first healthy member and falls through on failure. + +### 中文 + +- 在“模型”和“接入与调试”之间新增“跨 Provider 模型池”页面;仅当现有的跨 Provider 模型池开关开启时出现,切换开关后导航会立即更新。 +- 现在可以定义逻辑模型,把多个真实供应商模型聚合到同一个客户端 ID 下,既支持跨供应商的同名模型,也支持不同名称的模型。每个逻辑模型都可以单独配置路由策略(优先级顺序、轮询、优先填满或 FEFO)、故障转移规则,以及有序带权重的成员列表。 +- `/v1/models` 现在返回聚合后的逻辑 ID,而不再展示被聚合的逐供应商条目;成员能力按保守方式合并。逻辑模型复用现有选路与故障转移/冷却体系,冷却记录在真实成员模型上。每个逻辑模型的策略和成员权重现在真正参与选路;优先级顺序会持续使用第一个健康成员并在失败时顺延,未配置时默认按优先级顺序。 diff --git a/changelog/unreleased/model-availability-check.md b/changelog/unreleased/model-availability-check.md new file mode 100644 index 00000000..ed56effb --- /dev/null +++ b/changelog/unreleased/model-availability-check.md @@ -0,0 +1,11 @@ +### English + +- Added a one-click model availability check on the Models page. It sends one minimal 1-token, thinking-disabled live request per model per available account, then reports per-account reachability and latency without changing routing cooldowns or the Usage page totals; each probe still consumes one real 1-token upstream request from that account's quota. +- The Models page status column now shows the latest availability result instead of custom/default settings, and the action column is labeled Model details. +- Removed the console reasoning-strength default selector. The Models page now shows the maximum context, the reasoning levels each model actually declares, and image input capability. + +### 中文 + +- 模型页新增一键可通性检查:对“每个模型 × 每个可用账号”发送一次仅 1 token、关闭思考的真实请求,返回逐账号可通状态与延迟,且不会改变路由冷却状态或用量页统计;每次探测会真实消耗该账号的一次 1 token 上游额度。 +- 模型页状态列改为显示最近一次可通性检查结果,不再显示默认/自定义;操作表头改为“模型详情”。 +- 移除控制台推理强度默认选择器;模型页改为展示最大上下文、每个模型实际声明的思考档位和图片输入能力。 diff --git a/changelog/unreleased/quota-aware-routing.md b/changelog/unreleased/quota-aware-routing.md new file mode 100644 index 00000000..2601afc3 --- /dev/null +++ b/changelog/unreleased/quota-aware-routing.md @@ -0,0 +1,11 @@ +### English + +- Added `least-quota-first` and `most-quota-first` routing strategies for both global account scheduling and aggregation model pools. They rank accounts by remaining quota ratio and place accounts with unknown quota last. +- Fixed model-pool strategy overrides so FEFO candidate counting matches account selection, and normalized stored aggregation strategies so legacy/case-variant values do not silently fall back to round robin. +- Aggregated model-pool failover no longer pins the first member's region or recomputes the plan's attempt budget, so cross-provider members stay reachable and MaxAttempts is honored. + +### 中文 + +- 新增 `least-quota-first`(剩余额度最少优先)和 `most-quota-first`(剩余额度最多优先)路由策略,全局账号调度和模型池都可使用;按剩余额度百分比排序,额度未知的账号排在最后。 +- 修复模型池策略覆盖时 FEFO 候选计数与实际选号不一致的问题,并在读取存储的模型池策略时做归一化,避免历史大小写或旧值静默退回轮询。 +- 聚合模型池的故障转移不再锁定首个成员的 region,也不再重算尝试预算,跨供应商成员仍可被尝试,配置的 MaxAttempts 会被遵守。 diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index be670980..1cea477d 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -8,10 +8,12 @@ import { I18nProvider } from '@/hooks/useI18n' import { OverviewProvider } from '@/hooks/useOverview' import { ThemeProvider } from '@/hooks/useTheme' + const LoginPage = lazy(() => import('@/pages/LoginPage').then((module) => ({ default: module.LoginPage }))) const OverviewPage = lazy(() => import('@/pages/OverviewPage').then((module) => ({ default: module.OverviewPage }))) const ProvidersPage = lazy(() => import('@/pages/ProvidersPage').then((module) => ({ default: module.ProvidersPage }))) +const ModelPoolPage = lazy(() => import('@/pages/ModelPoolPage').then((module) => ({ default: module.ModelPoolPage }))) const AccessPage = lazy(() => import('@/pages/AccessPage').then((module) => ({ default: module.AccessPage }))) const AccountsPage = lazy(() => import('@/pages/AccountsPage').then((module) => ({ default: module.AccountsPage }))) const SystemPage = lazy(() => import('@/pages/SystemPage').then((module) => ({ default: module.SystemPage }))) @@ -34,6 +36,7 @@ export default function App() { } /> } /> } /> + } /> } /> } /> } /> diff --git a/frontend/src/api/modelPools.ts b/frontend/src/api/modelPools.ts new file mode 100644 index 00000000..e01916f1 --- /dev/null +++ b/frontend/src/api/modelPools.ts @@ -0,0 +1,57 @@ +import { api } from './client' + +export type AggregationMember = { + id?: number + provider: string + region?: string + model: string + account_id?: string + priority: number + weight: number +} + +export type AggregationRecord = { + id: string + name: string + enabled: boolean + strategy: string + allow_fallbacks: boolean + max_attempts: number + members: AggregationMember[] + created_at: string + updated_at: string +} + +export type AggregationInput = { + id?: string + name: string + enabled?: boolean + strategy: string + allow_fallbacks?: boolean + max_attempts: number + members: AggregationMember[] +} + +export function fetchAggregations() { + return api<{ object: string; data: AggregationRecord[] }>('/api/aggregations') +} + +export function createAggregation(input: AggregationInput) { + return api('/api/aggregations', { + method: 'POST', + body: JSON.stringify(input), + }) +} + +export function updateAggregation(id: string, input: Partial) { + return api(`/api/aggregations/${encodeURIComponent(id)}`, { + method: 'PATCH', + body: JSON.stringify(input), + }) +} + +export function deleteAggregation(id: string) { + return api(`/api/aggregations/${encodeURIComponent(id)}`, { method: 'DELETE' }) +} + +export const AGGREGATION_STRATEGIES = ['priority', 'round-robin', 'fill-first', 'fefo', 'least-quota-first', 'most-quota-first'] as const diff --git a/frontend/src/api/overview.ts b/frontend/src/api/overview.ts index 7966d921..ba562b15 100644 --- a/frontend/src/api/overview.ts +++ b/frontend/src/api/overview.ts @@ -175,6 +175,46 @@ export function refreshAccount(accountId: string, options?: { quota?: boolean }) }) } +export type ModelProbeAccountResult = { + account_id: string + provider?: string + region?: string + ok: boolean + status?: number + code?: string + kind?: string + message?: string + latency_ms: number +} + +export type ModelProbeResult = { + model: string + ok: boolean + account_id?: string + provider?: string + status?: number + code?: string + kind?: string + message?: string + latency_ms: number + attempt_count?: number + accounts?: ModelProbeAccountResult[] +} + +export type ModelProbeResponse = { + results: ModelProbeResult[] + summary: { total: number; passed: number; failed: number; skipped: number } + elapsed_ms: number +} + +/** Send one minimal token request per model to verify real availability. */ +export function checkModels(models?: string[]) { + return api('/api/models/check', { + method: 'POST', + body: JSON.stringify(models?.length ? { models } : {}), + }) +} + export function testChat(model: string, content: string, accountId?: string) { const headers: Record = {} if (accountId) headers['X-Qoder-Account'] = accountId diff --git a/frontend/src/api/system.ts b/frontend/src/api/system.ts index c9a5ab01..886ff538 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' | 'fefo' + routing_strategy: 'round-robin' | 'weighted-round-robin' | 'fill-first' | 'fefo' | 'least-quota-first' | 'most-quota-first' workbuddy_checkin_time: string checkin_times: Record timezone: string diff --git a/frontend/src/api/types.ts b/frontend/src/api/types.ts index 6243c723..3359c5c0 100644 --- a/frontend/src/api/types.ts +++ b/frontend/src/api/types.ts @@ -73,10 +73,12 @@ export type ModelInfo = { max_output_tokens_max?: number prompt_max_tokens_max?: number reasoning_options?: string[] + reasoning_option_values?: string[] reasoning_default?: string reasoning_effort?: string reasoning_type?: string can_disable_thinking?: boolean + supports_images?: boolean } export type CheckinRecord = { diff --git a/frontend/src/components/ModelDetailsModal.tsx b/frontend/src/components/ModelDetailsModal.tsx index f0eb8831..426de07d 100644 --- a/frontend/src/components/ModelDetailsModal.tsx +++ b/frontend/src/components/ModelDetailsModal.tsx @@ -1,7 +1,8 @@ import { Chip, Modal } from '@heroui/react' import { X } from '@phosphor-icons/react' +import type { ReactNode } from 'react' import type { ModelInfo } from '@/api/types' -import { modelCreditsText, modelIsFree } from '@/lib/format' +import { modelIsFree } from '@/lib/format' import { accountProviderLabel, tieredTraeCaps } from '@/lib/provider' type Translate = (key: string, vars?: Record) => string @@ -19,71 +20,71 @@ function formatTokens(value?: number) { return String(value) } +function DetailRow({ label, value }: { label: string; value: ReactNode }) { + return ( +
+ {label} + {value} +
+ ) +} + export function ModelDetailsModal({ model, t, onClose }: Props) { if (!model) return null const options = model.reasoning_options || [] const windowDev = model.catalog_context_length || model.default_context_length || model.context_length const windowMax = model.catalog_context_length_max - const credits = modelCreditsText(model) const free = modelIsFree(model) const provider = String(model.provider || model.owned_by || 'qoder').trim().toLowerCase() const region = String(model.region || model.regions?.[0] || '').trim().toLowerCase() const providerLabel = accountProviderLabel(provider, region || undefined, t) - // Resolve the tier shown for the current max-mode toggle so the ceilings match - // the selected window instead of lingering on the Max tier after a toggle-off. const traeTier = provider === 'trae' ? tieredTraeCaps(model) : undefined + const imageText = model.supports_images === true + ? t('imageInputDeclared') + : model.supports_images === false + ? t('imageInputUnsupported') + : t('imageInputNotDeclared') + const promptMax = traeTier?.prompt_max_tokens || model.prompt_max_tokens + const outputMax = traeTier?.max_output_tokens || model.max_output_tokens return ( { if (!next) onClose() }}> -
+
-
{model.display_name || model.id}
+
{model.display_name || model.id}
{free ? {t('modelFree')} : null}
-
{model.id}
-
- {providerLabel}{credits ? ` · ${credits}` : ''} -
+
{model.id}
- + - -
-
{t('contextWindowCol')}
-
{formatTokens(windowDev)}{windowMax && windowMax !== windowDev ? ` → ${formatTokens(windowMax)}` : ''}
- {model.supports_max_mode ?

{provider === 'qoder' ? t('qoderMaxModeHint') : t('maxModeHint')}

: null} - {!model.supports_max_mode && windowMax && windowMax !== windowDev ?

{t('workbuddyContextHint')}

: null} - {traeTier - ? (traeTier.prompt_max_tokens ?
{t('promptMaxTokens')}: {formatTokens(traeTier.prompt_max_tokens)}
: null) - : (model.prompt_max_tokens ?
{t('promptMaxTokens')}: {formatTokens(model.prompt_max_tokens)}
: null)} - {traeTier - ? (traeTier.max_output_tokens ?
{t('maxOutputTokens')}: {formatTokens(traeTier.max_output_tokens)}
: null) - : (model.max_output_tokens ?
{t('maxOutputTokens')}: {formatTokens(model.max_output_tokens)}
: null)} + +
+ + + {formatTokens(windowDev)}{windowMax && windowMax !== windowDev ? ` → ${formatTokens(windowMax)}` : ''}} /> + {promptMax ? {formatTokens(promptMax)}} /> : null} + {outputMax ? {formatTokens(outputMax)}} /> : null} +
+
-
{t('reasoningLevels')}
+
{t('reasoningLevels')}
{options.length ? ( - <> -

{t('reasoningHint')}

-
- {options.map((level) => { - const key = `reasoningLevel_${level}` - const label = t(key) - return ( - - {label === key ? level : label}{level === model.reasoning_default ? ` · ${t('defaultValue')}` : ''}{level === model.reasoning_effort && level !== model.reasoning_default ? ` · ${t('custom')}` : ''} - - ) - })} -
- +
+ {options.map((level) => ( + + {level} + + ))} +
) : ( -
+
{model.reasoning_type ? t('reasoningFixed', { type: model.reasoning_type }) : t('noReasoningLevels')}
)} diff --git a/frontend/src/components/layout/AppLayout.tsx b/frontend/src/components/layout/AppLayout.tsx index 3c7d9976..e95bebd3 100644 --- a/frontend/src/components/layout/AppLayout.tsx +++ b/frontend/src/components/layout/AppLayout.tsx @@ -10,6 +10,7 @@ const routeKey: Record = { '/': 'home', '/auth': 'auth', '/providers': 'providers', + '/model-pool': 'modelPool', '/access': 'access', '/accounts': 'accounts', '/usage': 'usage', diff --git a/frontend/src/components/layout/AppSidebar.tsx b/frontend/src/components/layout/AppSidebar.tsx index 65203811..7174115e 100644 --- a/frontend/src/components/layout/AppSidebar.tsx +++ b/frontend/src/components/layout/AppSidebar.tsx @@ -1,19 +1,21 @@ import { useState } from 'react' import { NavLink } from 'react-router-dom' import { Drawer, Button, Chip, Separator, Tooltip } from '@heroui/react' -import { ChartBar, Cube, Gauge, GearSix, Key, Lightning, Scroll, SidebarSimple, UsersThree, X } from '@phosphor-icons/react' +import { ArrowsSplit, ChartBar, Cube, Gauge, GearSix, Key, Lightning, Scroll, SidebarSimple, UsersThree, X } from '@phosphor-icons/react' import { SidebarUpdateItem } from '@/components/layout/SidebarUpdateItem' import { BrandMark } from '@/components/BrandMark' import { SkeletonBlock } from '@/components/ui/PageSkeletons' import { pressScale } from '@/hooks/useGsapReveal' import { useI18n } from '@/hooks/useI18n' import { useOverview } from '@/hooks/useOverview' +import { useCrossProviderPool } from '@/hooks/useCrossProviderPool' const nav = [ { to: '/', key: 'navOverview', icon: Gauge, section: 'workspace', end: true }, { to: '/usage', key: 'navUsage', icon: ChartBar, section: 'workspace' }, { to: '/accounts', key: 'navAccounts', icon: UsersThree, section: 'workspace' }, { to: '/providers', key: 'navProviders', icon: Cube, section: 'develop' }, + { to: '/model-pool', key: 'navModelPool', icon: ArrowsSplit, section: 'develop', requiresPool: true }, { to: '/access', key: 'navAccess', icon: Lightning, section: 'develop' }, { to: '/logs', key: 'navLogs', icon: Scroll, section: 'system' }, { to: '/keys', key: 'navKeys', icon: Key, section: 'system' }, @@ -29,12 +31,20 @@ type Props = { function NavList({ collapsed, onNavigate }: { collapsed: boolean; onNavigate?: () => void }) { const { t } = useI18n() + const { enabled: poolEnabled, loading: poolLoading } = useCrossProviderPool() const groups = [ { key: 'workspace', label: t('workspace') }, { key: 'develop', label: t('develop') }, { key: 'system', label: t('system') }, ] as const + const visibleNav = nav.filter((item) => { + if (!('requiresPool' in item) || !item.requiresPool) return true + // Keep the pool entry hidden until the flag is known, then show it only + // when the cross-provider pool is enabled. + return !poolLoading && poolEnabled + }) + return (
{message ? : null} + {probeResult ? ( + +
+
+
{t('checkAllModels')}
+
+ {t('checkModelsSummary', { + passed: probeResult.summary.passed, + failed: probeResult.summary.failed, + total: probeResult.summary.total, + elapsed: probeResult.elapsed_ms, + })} +
+
+ + {probeResult.summary.passed}/{probeResult.summary.total} + +
+ + + + + {t('modelCol')} + {t('stateCol')} + {t('account')} + {t('providerCol')} + {t('logsColLatency')} + {t('checkAccountResults')} + {t('response')} + + + {probeResult.results.map((result) => ( + + {result.model} + + + {result.ok + ? t('checkResultOK') + : result.code === 'no_models' || result.message === 'model required' + ? t('checkResultSkipped') + : t('checkResultFailed')} + + + {result.account_id || '—'} + {result.provider || '—'} + {result.latency_ms}ms + +
+ {(result.accounts || []).length ? result.accounts!.map((account) => ( +
+ {account.account_id} + + {' '}{account.ok ? t('checkResultOK') : t('checkResultFailed')} + + · {account.latency_ms}ms + {account.message ? {account.message} : null} +
+ )) : —} +
+
+ {result.message || (result.ok ? t('checkResultOK') : '')} +
+ ))} +
+
+
+
+
+ {probeResult.results.map((result) => ( +
+
+ {result.model} + + {result.ok ? t('checkResultOK') : t('checkResultFailed')} + +
+
{result.account_id || result.provider || '—'} · {result.latency_ms}ms
+ {(result.accounts || []).length ? ( +
+ {result.accounts!.map((account) => ( +
+ {account.account_id} + + {' '}{account.ok ? t('checkResultOK') : t('checkResultFailed')} + + · {account.latency_ms}ms + {account.message ? {account.message} : null} +
+ ))} +
+ ) : null} + {result.message ?
{result.message}
: null} +
+ ))} +
+
+ ) : null} +
@@ -422,9 +494,7 @@ export function ProvidersPage() { {routedModelName(model) ?
{t('routedTo', { model: routedModelName(model) })}
: null}
- - {model.context_custom ? t('custom') : t('defaultValue')} - + {modelCheckChip(model)}
@@ -439,7 +509,6 @@ export function ProvidersPage() { t={t} variant="card" onToggleTraeMax={(item, selected) => void onToggleTraeMax(item, selected)} - onReasoningChange={(item, next) => void onReasoningChange(item, next)} /> {t('qoderKeyCol')} {t('modelDefaultsCol')} {t('stateCol')} - {t('actions')} + {t('modelDetailsCol')} {paged.map((model) => { @@ -501,14 +570,9 @@ export function ProvidersPage() { t={t} variant="table" onToggleTraeMax={(item, selected) => void onToggleTraeMax(item, selected)} - onReasoningChange={(item, next) => void onReasoningChange(item, next)} /> - - - {model.context_custom ? t('custom') : t('defaultValue')} - - + {modelCheckChip(model)} modelSettingsKey(m) === modelSettingsKey(detailModel)) || detailModel : null} + model={detailModel ? models.find((m) => modelRowKey(m) === modelRowKey(detailModel)) || detailModel : null} t={t} onClose={() => setDetailModel(null)} /> diff --git a/frontend/src/pages/SystemPage.tsx b/frontend/src/pages/SystemPage.tsx index a93ef66d..83c87fc3 100644 --- a/frontend/src/pages/SystemPage.tsx +++ b/frontend/src/pages/SystemPage.tsx @@ -18,6 +18,7 @@ import { import { fetchConsoleKey, rotateConsoleKey, type ConsoleKeyView } from '@/api/keys' import { fetchSystemSettings, updateSystemSettings, type SystemSettings } from '@/api/system' import { useApiKey } from '@/hooks/useApiKey' +import { useOverview } from '@/hooks/useOverview' import { PageAlert } from '@/components/ui/PageAlert' import { ConfirmDialog } from '@/components/ui/ConfirmDialog' import { FormRow } from '@/components/ui/FormRow' @@ -41,6 +42,7 @@ export function SystemPage() { const tab: SettingsTab = tabParam && SETTINGS_TABS.includes(tabParam) ? tabParam : 'general' const selectTab = (next: SettingsTab) => setSearchParams(next === 'general' ? {} : { tab: next }, { replace: true }) const { setApiKey } = useApiKey() + const { refresh: refreshOverview } = useOverview() const [consoleKey, setConsoleKey] = useState(null) const [settings, setSettings] = useState(null) const [proxyDraft, setProxyDraft] = useState('') @@ -78,6 +80,9 @@ export function SystemPage() { setError('') try { setSettings(await updateSystemSettings({ cross_provider_model_pool: enabled })) + // The sidebar entry and the route guard read this flag from the overview + // summary; refresh it so toggling the switch takes effect immediately. + void refreshOverview(undefined, { silent: true }).catch(() => undefined) } catch (err) { setSettings((current) => current ? { ...current, cross_provider_model_pool: previous } : current) setError(err instanceof Error ? err.message : String(err)) @@ -256,6 +261,8 @@ export function SystemPage() { + + diff --git a/internal/accounts/aggregation.go b/internal/accounts/aggregation.go new file mode 100644 index 00000000..9f3ac808 --- /dev/null +++ b/internal/accounts/aggregation.go @@ -0,0 +1,231 @@ +package accounts + +import ( + "fmt" + "sort" + "strings" + "time" +) + +// AggregationStrategy is the routing strategy for one logical aggregation +// model. It reuses the existing routing strategy vocabulary plus an explicit +// "priority" mode that walks members in their configured order. +type AggregationStrategy string + +const ( + AggregationPriority AggregationStrategy = "priority" + AggregationRoundRobin AggregationStrategy = "round-robin" + AggregationFillFirst AggregationStrategy = "fill-first" + AggregationFEFOStrategy AggregationStrategy = "fefo" + AggregationLeastQuotaFirst AggregationStrategy = RoutingStrategyLeastQuotaFirst + AggregationMostQuotaFirst AggregationStrategy = RoutingStrategyMostQuotaFirst +) + +const ( + MaxAggregationMembers = 128 + MaxAggregationNameLen = 128 +) + +// AggregationMember binds one real model behind a logical model ID. +// Provider/region/model together identify a concrete upstream model. When +// AccountID is set, the member is a deployment pinned to that account; empty +// AccountID keeps the legacy provider-wide pool behavior. +type AggregationMember struct { + ID int64 `json:"id,omitempty"` + Provider string `json:"provider"` + Region string `json:"region,omitempty"` + Model string `json:"model"` + AccountID string `json:"account_id,omitempty"` + Priority int `json:"priority"` + Weight int `json:"weight"` +} + +type Aggregation struct { + ID string `json:"id"` + Name string `json:"name"` + Enabled bool `json:"enabled"` + Strategy AggregationStrategy `json:"strategy"` + AllowFallbacks bool `json:"allow_fallbacks"` + MaxAttempts int `json:"max_attempts"` + Members []AggregationMember `json:"members"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` +} + +type CreateAggregation struct { + ID string + Name string + Enabled bool + Strategy AggregationStrategy + AllowFallbacks bool + MaxAttempts int + Members []AggregationMember +} + +type UpdateAggregation struct { + Name *string + Enabled *bool + Strategy *AggregationStrategy + AllowFallbacks *bool + MaxAttempts *int + Members *[]AggregationMember +} + +// NormalizeAggregationStrategy keeps the per-model strategy inside the four +// supported values. Unknown values fall back to round-robin, the default that +// spreads traffic evenly across the members of a logical model. +func NormalizeAggregationStrategy(value string) AggregationStrategy { + switch AggregationStrategy(strings.ToLower(strings.TrimSpace(value))) { + case AggregationRoundRobin: + return AggregationRoundRobin + case AggregationFillFirst: + return AggregationFillFirst + case AggregationFEFOStrategy: + return AggregationFEFOStrategy + case AggregationPriority: + return AggregationPriority + case AggregationLeastQuotaFirst: + return AggregationLeastQuotaFirst + case AggregationMostQuotaFirst: + return AggregationMostQuotaFirst + default: + return AggregationRoundRobin + } +} + +func normalizeAggregationMembers(members []AggregationMember) ([]AggregationMember, error) { + if len(members) == 0 { + return nil, fmt.Errorf("aggregation requires at least one member") + } + if len(members) > MaxAggregationMembers { + return nil, fmt.Errorf("aggregation has too many members (max %d)", MaxAggregationMembers) + } + out := make([]AggregationMember, 0, len(members)) + seen := map[string]struct{}{} + for _, member := range members { + provider := strings.ToLower(strings.TrimSpace(member.Provider)) + region := strings.ToLower(strings.TrimSpace(member.Region)) + model := strings.TrimSpace(member.Model) + accountID := strings.TrimSpace(member.AccountID) + if provider == "" || model == "" { + return nil, fmt.Errorf("aggregation member requires provider and model") + } + if len(accountID) > 256 { + return nil, fmt.Errorf("aggregation member account id is too long") + } + weight := member.Weight + if weight <= 0 { + weight = 100 + } + if weight > 1_000_000 { + weight = 1_000_000 + } + priority := member.Priority + if priority < 0 { + priority = 0 + } + member.Provider = provider + member.Region = region + member.Model = model + member.AccountID = accountID + member.Weight = weight + member.Priority = priority + key := provider + "|" + region + "|" + CanonicalModelID(model) + "|" + accountID + if _, ok := seen[key]; ok { + continue + } + seen[key] = struct{}{} + out = append(out, member) + } + if len(out) == 0 { + return nil, fmt.Errorf("aggregation requires at least one member") + } + // Stable deterministic order; index tie-break keeps the saved order stable. + sort.SliceStable(out, func(i, j int) bool { + if out[i].Priority != out[j].Priority { + return out[i].Priority < out[j].Priority + } + return out[i].Model < out[j].Model + }) + return out, nil +} + +func normalizeAggregationMaxAttempts(value int) int { + if value <= 0 { + return 3 + } + if value > 64 { + return 64 + } + return value +} + +func PrepareCreateAggregation(input CreateAggregation) (CreateAggregation, error) { + id := strings.ToLower(strings.TrimSpace(input.ID)) + if !validAggregationID(id) { + return CreateAggregation{}, fmt.Errorf("aggregation id required (lowercase letters, digits, '-' and '/')") + } + name := strings.TrimSpace(input.Name) + if name == "" { + name = id + } + if len(name) > MaxAggregationNameLen { + return CreateAggregation{}, fmt.Errorf("aggregation name too long") + } + members, err := normalizeAggregationMembers(input.Members) + if err != nil { + return CreateAggregation{}, err + } + return CreateAggregation{ + ID: id, + Name: name, + Enabled: input.Enabled, + Strategy: NormalizeAggregationStrategy(string(input.Strategy)), + AllowFallbacks: input.AllowFallbacks, + MaxAttempts: normalizeAggregationMaxAttempts(input.MaxAttempts), + Members: members, + }, nil +} + +func ApplyAggregationUpdate(current Aggregation, input UpdateAggregation) (Aggregation, error) { + if input.Name != nil { + name := strings.TrimSpace(*input.Name) + if name == "" || len(name) > MaxAggregationNameLen { + return Aggregation{}, fmt.Errorf("invalid aggregation name") + } + current.Name = name + } + if input.Enabled != nil { + current.Enabled = *input.Enabled + } + if input.Strategy != nil { + current.Strategy = NormalizeAggregationStrategy(string(*input.Strategy)) + } + if input.AllowFallbacks != nil { + current.AllowFallbacks = *input.AllowFallbacks + } + if input.MaxAttempts != nil { + current.MaxAttempts = normalizeAggregationMaxAttempts(*input.MaxAttempts) + } + if input.Members != nil { + members, err := normalizeAggregationMembers(*input.Members) + if err != nil { + return Aggregation{}, err + } + current.Members = members + } + return current, nil +} + +func validAggregationID(id string) bool { + if id == "" || len(id) > MaxAggregationNameLen { + return false + } + for _, r := range id { + if (r >= 'a' && r <= 'z') || (r >= '0' && r <= '9') || r == '-' || r == '/' { + continue + } + return false + } + return true +} diff --git a/internal/accounts/aggregation_grant_test.go b/internal/accounts/aggregation_grant_test.go new file mode 100644 index 00000000..a8ea6429 --- /dev/null +++ b/internal/accounts/aggregation_grant_test.go @@ -0,0 +1,45 @@ +package accounts + +import "testing" + +func TestAggregationGrantParseAndNormalize(t *testing.T) { + grant, err := ParseProviderGrant("aggregation") + if err != nil || grant.Provider != AggregationProvider || grant.Region != "" { + t.Fatalf("parse aggregation: %+v err=%v", grant, err) + } + if _, err := ParseProviderGrant("aggregation:cn"); err == nil { + t.Fatal("aggregation:cn must be rejected (no regions for sentinel)") + } + normalized, err := NormalizeAPIKeyProviders([]string{"aggregation"}) + if err != nil || len(normalized) != 1 || normalized[0] != "aggregation" { + t.Fatalf("normalize: %v err=%v", normalized, err) + } +} + +func TestIsAggregationOnly(t *testing.T) { + cases := []struct { + allowed []string + want bool + }{ + {[]string{"aggregation"}, true}, + {[]string{"aggregation", "aggregation"}, true}, + {[]string{"aggregation", "qoder"}, false}, + {[]string{"qoder"}, false}, + {nil, false}, + } + for _, tc := range cases { + if got := IsAggregationOnly(tc.allowed); got != tc.want { + t.Errorf("IsAggregationOnly(%v)=%v want %v", tc.allowed, got, tc.want) + } + } +} + +func TestAggregationGrantDoesNotAllowRealProvider(t *testing.T) { + allowed := []string{"aggregation"} + if ProviderAllowed("qoder", allowed) { + t.Fatal("aggregation-only key must not authorize real provider qoder") + } + if !ProviderAllowed("qoder", nil) { + t.Fatal("empty allowlist must allow all providers") + } +} diff --git a/internal/accounts/grants.go b/internal/accounts/grants.go index 2b55a0d9..aef22cb4 100644 --- a/internal/accounts/grants.go +++ b/internal/accounts/grants.go @@ -15,6 +15,11 @@ import ( // ProviderAllowed / ProviderRegionAllowed plus NormalizeAPIKeyProviders own // the runtime/write paths. Moving this file to auth would create // accounts → auth while auth already imports accounts. +// AggregationProvider is a sentinel grant for keys that may only call logical +// aggregation models. It is not a real upstream provider and is never +// registered in the providers catalog. +const AggregationProvider = "aggregation" + type ProviderGrant struct { Provider string Region string @@ -63,6 +68,11 @@ func ParseProviderGrant(entry string) (ProviderGrant, error) { if strings.ContainsAny(family, " \t") || strings.ContainsAny(region, " \t") { return ProviderGrant{}, fmt.Errorf("provider grant %q must not contain inner whitespace", raw) } + // Sentinel grant: accepted only as a bare entry with no region. It grants + // access to logical aggregation models, never to a real upstream provider. + if family == AggregationProvider && region == "" { + return ProviderGrant{Provider: AggregationProvider}, nil + } descriptor, ok := providers.Get(family) if !ok { return ProviderGrant{}, fmt.Errorf("unknown provider %q", family) @@ -102,6 +112,23 @@ func parseProviderGrantsLenient(entries []string) []ProviderGrant { // entries. An empty allowlist allows everything. A bare family entry // ("workbuddy") covers every region of that family; a region-scoped entry // only covers accounts whose region matches. Malformed entries never match. +// IsAggregationOnly reports whether an allowlist consists solely of the +// sentinel aggregation grant. Such a key may call logical aggregation models +// but no real provider. Mixing it with real grants is intentionally ignored +// here (the key then behaves as a normal provider-scoped key). +func IsAggregationOnly(allowed []string) bool { + if len(allowed) == 0 { + return false + } + for _, entry := range allowed { + grant, err := ParseProviderGrant(strings.TrimSpace(entry)) + if err != nil || grant.Provider != AggregationProvider { + return false + } + } + return true +} + func GrantsAllowed(provider, region string, allowed []string) bool { if len(allowed) == 0 { return true diff --git a/internal/accounts/ids.go b/internal/accounts/ids.go index e7e1d263..8a2bf611 100644 --- a/internal/accounts/ids.go +++ b/internal/accounts/ids.go @@ -13,6 +13,11 @@ const ( // ranks accounts inside one provider family by the nearest credit-package // expiry and leaves cross-provider rotation untouched. RoutingStrategyFEFO = "fefo" + // Quota-aware strategies rank accounts by remaining quota ratio. They are + // conservative across providers: remaining/total is preferred, and the + // used percentage is converted to a remaining ratio when no total exists. + RoutingStrategyLeastQuotaFirst = "least-quota-first" + RoutingStrategyMostQuotaFirst = "most-quota-first" ) func NormalizeRoutingStrategy(strategy string) string { @@ -23,6 +28,10 @@ func NormalizeRoutingStrategy(strategy string) string { return RoutingStrategyWeightedRoundRobin case RoutingStrategyFEFO: return RoutingStrategyFEFO + case RoutingStrategyLeastQuotaFirst: + return RoutingStrategyLeastQuotaFirst + case RoutingStrategyMostQuotaFirst: + return RoutingStrategyMostQuotaFirst default: return RoutingStrategyRoundRobin } diff --git a/internal/accounts/store.go b/internal/accounts/store.go index ab16077c..a5b19d2e 100644 --- a/internal/accounts/store.go +++ b/internal/accounts/store.go @@ -68,4 +68,9 @@ type AccountStore interface { LookupAPIKey(ctx context.Context, secret string) (APIKey, bool, error) DeleteAPIKey(ctx context.Context, id string) error TouchAPIKey(ctx context.Context, id string) error + InsertAggregation(ctx context.Context, agg Aggregation) (Aggregation, error) + SaveAggregation(ctx context.Context, agg Aggregation) (Aggregation, error) + ListAggregations(ctx context.Context) ([]Aggregation, error) + GetAggregation(ctx context.Context, id string) (Aggregation, error) + DeleteAggregation(ctx context.Context, id string) error } diff --git a/internal/accounts/types.go b/internal/accounts/types.go index adfbdad8..f8b06522 100644 --- a/internal/accounts/types.go +++ b/internal/accounts/types.go @@ -10,6 +10,7 @@ import ( var ErrAccountNotFound = errors.New("account not found") var ErrSecretNotFound = errors.New("secret not found") var ErrAPIKeyNotFound = errors.New("api key not found") +var ErrAggregationNotFound = errors.New("aggregation not found") const ( DefaultWorkBuddyCheckinTime = "09:00" diff --git a/internal/app/gateway.go b/internal/app/gateway.go index 15064b47..706f6274 100644 --- a/internal/app/gateway.go +++ b/internal/app/gateway.go @@ -29,6 +29,12 @@ func (a *App) newGateway() *apigateway.Handler { Models: func(refresh bool, accountID string) ([]map[string]any, error) { return a.fetchDisplayModels(refresh, accountID, control.CatalogModeMerge) }, + MergeAggregationModels: func(ctx context.Context, models []map[string]any) []map[string]any { + if a.Control == nil { + return models + } + return control.MergeAggregationModels(ctx, a.Control.Aggregations, models) + }, CatalogStatus: func() map[string]any { if a.Control == nil || a.Control.Catalog == nil { return nil @@ -45,6 +51,7 @@ func (a *App) newGateway() *apigateway.Handler { } if a.Control != nil { h.ModelContexts = a.Control.Settings + h.Aggregations = a.Control.Aggregations } if a.Manager != nil { h.Catalogs = a.Manager diff --git a/internal/app/handlers.go b/internal/app/handlers.go index a2305802..c91fa050 100644 --- a/internal/app/handlers.go +++ b/internal/app/handlers.go @@ -52,7 +52,8 @@ func (a *App) newConsole() *appconsole.Handler { FetchDisplayModels: func(refresh bool, accountID string, mode control.CatalogMode) ([]map[string]any, error) { return a.fetchDisplayModels(refresh, accountID, mode) }, - ConsoleKey: a.Auth.ConsoleKey, + PeekDisplayModels: a.peekDisplayModels, + ConsoleKey: a.Auth.ConsoleKey, DecorateModels: func(ctx context.Context, models []map[string]any) []map[string]any { return a.decorateModelsWithContext(ctx, models) }, diff --git a/internal/app/model_cache.go b/internal/app/model_cache.go index 9ea29364..eeb0733f 100644 --- a/internal/app/model_cache.go +++ b/internal/app/model_cache.go @@ -10,3 +10,19 @@ func (a *App) fetchDisplayModels(refresh bool, accountID string, mode control.Ca } return a.Control.Catalog.Get(refresh, accountID, mode) } + +// peekDisplayModels is cache-only. It reuses the catalog snapshot accessor so +// diagnostic endpoints never start a background/synchronous catalog refresh. +// Merge is persisted/restored on cold boot; Expand falls back to Merge. +func (a *App) peekDisplayModels(accountID string, mode control.CatalogMode) []map[string]any { + if a == nil || a.Control == nil || a.Control.Catalog == nil { + return nil + } + if models := a.Control.Catalog.Peek(accountID, mode); len(models) > 0 { + return models + } + if mode == control.CatalogModeExpand { + return a.Control.Catalog.Peek("", control.CatalogModeMerge) + } + return nil +} diff --git a/internal/console/aggregations.go b/internal/console/aggregations.go new file mode 100644 index 00000000..cd74d573 --- /dev/null +++ b/internal/console/aggregations.go @@ -0,0 +1,147 @@ +package console + +import ( + "encoding/json" + "errors" + "net/http" + "strings" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +type aggregationMemberInput struct { + Provider string `json:"provider"` + Region string `json:"region"` + Model string `json:"model"` + AccountID string `json:"account_id"` + Priority int `json:"priority"` + Weight int `json:"weight"` +} + +func decodeAggregationMembers(input []aggregationMemberInput) []accounts.AggregationMember { + members := make([]accounts.AggregationMember, 0, len(input)) + for _, m := range input { + members = append(members, accounts.AggregationMember{ + Provider: m.Provider, Region: m.Region, Model: m.Model, AccountID: m.AccountID, + Priority: m.Priority, Weight: m.Weight, + }) + } + return members +} + +func writeAggregationError(w http.ResponseWriter, err error, _ string) { + if errors.Is(err, accounts.ErrAggregationNotFound) { + writeErr(w, http.StatusNotFound, "aggregation_not_found", err.Error()) + return + } + // control wraps validation failures as OperationError("invalid_request"), + // which writeOperationError already maps to 400. + writeOperationError(w, err) +} + +func (h *Handler) HandleAggregations(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case http.MethodGet: + list, err := h.Control.Aggregations.List(r.Context()) + if err != nil { + writeAggregationError(w, err, "list") + return + } + writeJSON(w, http.StatusOK, map[string]any{"object": "list", "data": list}) + case http.MethodPost: + var input struct { + ID string `json:"id"` + Name string `json:"name"` + Enabled *bool `json:"enabled"` + Strategy string `json:"strategy"` + AllowFallbacks *bool `json:"allow_fallbacks"` + MaxAttempts int `json:"max_attempts"` + Members []aggregationMemberInput `json:"members"` + } + if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, maxConsoleBodyBytes)).Decode(&input); err != nil { + writeErr(w, http.StatusBadRequest, "invalid_request", err.Error()) + return + } + enabled := true + if input.Enabled != nil { + enabled = *input.Enabled + } + allowFallbacks := true + if input.AllowFallbacks != nil { + allowFallbacks = *input.AllowFallbacks + } + agg, err := h.Control.Aggregations.Create(r.Context(), accounts.CreateAggregation{ + ID: input.ID, + Name: input.Name, + Enabled: enabled, + Strategy: accounts.AggregationStrategy(input.Strategy), + AllowFallbacks: allowFallbacks, + MaxAttempts: input.MaxAttempts, + Members: decodeAggregationMembers(input.Members), + }) + if err != nil { + writeAggregationError(w, err, "create") + return + } + writeJSON(w, http.StatusCreated, agg) + default: + writeErr(w, http.StatusMethodNotAllowed, "method_not_allowed", "GET or POST only") + } +} + +func (h *Handler) HandleAggregationByID(w http.ResponseWriter, r *http.Request) { + id := strings.Trim(strings.TrimPrefix(r.URL.Path, "/api/aggregations/"), "/") + if id == "" { + writeErr(w, http.StatusNotFound, "aggregation_not_found", "aggregation id required") + return + } + switch r.Method { + case http.MethodGet: + agg, err := h.Control.Aggregations.Get(r.Context(), id) + if err != nil { + writeAggregationError(w, err, "get") + return + } + writeJSON(w, http.StatusOK, agg) + case http.MethodPatch: + var input struct { + Name *string `json:"name"` + Enabled *bool `json:"enabled"` + Strategy *string `json:"strategy"` + AllowFallbacks *bool `json:"allow_fallbacks"` + MaxAttempts *int `json:"max_attempts"` + Members *[]aggregationMemberInput `json:"members"` + } + if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, maxConsoleBodyBytes)).Decode(&input); err != nil { + writeErr(w, http.StatusBadRequest, "invalid_request", err.Error()) + return + } + var strategy *accounts.AggregationStrategy + if input.Strategy != nil { + value := accounts.AggregationStrategy(*input.Strategy) + strategy = &value + } + var members *[]accounts.AggregationMember + if input.Members != nil { + decoded := decodeAggregationMembers(*input.Members) + members = &decoded + } + agg, err := h.Control.Aggregations.Update(r.Context(), id, accounts.UpdateAggregation{ + Name: input.Name, Enabled: input.Enabled, Strategy: strategy, + AllowFallbacks: input.AllowFallbacks, MaxAttempts: input.MaxAttempts, Members: members, + }) + if err != nil { + writeAggregationError(w, err, "update") + return + } + writeJSON(w, http.StatusOK, agg) + case http.MethodDelete: + if err := h.Control.Aggregations.Delete(r.Context(), id); err != nil { + writeAggregationError(w, err, "delete") + return + } + w.WriteHeader(http.StatusNoContent) + default: + writeErr(w, http.StatusMethodNotAllowed, "method_not_allowed", "GET, PATCH, or DELETE only") + } +} diff --git a/internal/console/handler.go b/internal/console/handler.go index 997be15d..5a0a8a3a 100644 --- a/internal/console/handler.go +++ b/internal/console/handler.go @@ -34,7 +34,10 @@ type Handler struct { DecorateModels func(context.Context, []map[string]any) []map[string]any FetchWorkerModels func(refresh bool) []map[string]any FetchDisplayModels func(refresh bool, accountID string, mode appsvc.CatalogMode) ([]map[string]any, error) - ConsoleKey func() string + // PeekDisplayModels is cache-only: it never starts a catalog fetch. Used by + // diagnostic endpoints that must not trigger background refresh work. + PeekDisplayModels func(accountID string, mode appsvc.CatalogMode) []map[string]any + ConsoleKey func() string // Resources returns the latest server+worker process usage snapshot. app // wires it to the runtime manager so console stays runtime-free. Resources func() *SystemResources @@ -84,6 +87,13 @@ func (h *Handler) fetchDisplayModels(refresh bool, accountID string, mode appsvc return nil, nil } +func (h *Handler) peekDisplayModels(accountID string, mode appsvc.CatalogMode) []map[string]any { + if h != nil && h.PeekDisplayModels != nil { + return h.PeekDisplayModels(accountID, mode) + } + return nil +} + func (h *Handler) cfgPort() int { if h == nil || h.Cfg == nil { return 0 diff --git a/internal/console/model_probe.go b/internal/console/model_probe.go new file mode 100644 index 00000000..3e4ac891 --- /dev/null +++ b/internal/console/model_probe.go @@ -0,0 +1,156 @@ +package console + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "sort" + "strings" + "sync" + "time" + + appsvc "github.com/caigee-cmd/cli2api/internal/control" + "github.com/caigee-cmd/cli2api/internal/executor" +) + +const ( + maxProbeModels = 100 + maxProbeBatchDuration = 10 * time.Minute + maxConcurrentProbeJobs = 4 +) + +type modelProbeRequest struct { + Models []string `json:"models"` +} + +type modelProbeSummary struct { + Total int `json:"total"` + Passed int `json:"passed"` + Failed int `json:"failed"` + Skipped int `json:"skipped"` +} + +type modelProbeResponse struct { + Results []executorProbeResult `json:"results"` + Summary modelProbeSummary `json:"summary"` + Elapsed int `json:"elapsed_ms"` +} + +type executorProbeResult = executor.ProbeModelResult + +// HandleModelProbe checks a set of models with one minimal live chat request +// each. It returns 200 with per-model results; a failed model is a normal +// probe outcome, not a transport error for the whole batch. +func (h *Handler) HandleModelProbe(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + writeErr(w, http.StatusMethodNotAllowed, "method_not_allowed", "POST only") + return + } + if h == nil || h.Executor == nil { + writeErr(w, http.StatusServiceUnavailable, "probe_unavailable", "model probing is not configured") + return + } + var input modelProbeRequest + if r.Body != nil { + if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, maxConsoleBodyBytes)).Decode(&input); err != nil && !errors.Is(err, io.EOF) { + writeErr(w, http.StatusBadRequest, "invalid_request", err.Error()) + return + } + } + models := trimSpaceSlice(input.Models) + if len(models) == 0 { + // Cache-only enumeration: probing must never start a catalog fetch or + // background refresh. Merge view is the persisted/restored snapshot, so + // it is the stable source of model IDs for a diagnostic batch. + catalog := h.peekDisplayModels("", appsvc.CatalogModeMerge) + for _, entry := range catalog { + if id, ok := entry["id"].(string); ok && strings.TrimSpace(id) != "" { + models = append(models, strings.TrimSpace(id)) + } + } + } + models = uniqueStrings(models) + if len(models) == 0 { + writeErr(w, http.StatusBadRequest, "no_models", "no models available to probe") + return + } + if len(models) > maxProbeModels { + writeErr(w, http.StatusBadRequest, "too_many_models", fmt.Sprintf("at most %d models can be checked at once", maxProbeModels)) + return + } + + ctx, cancel := context.WithTimeout(r.Context(), maxProbeBatchDuration) + defer cancel() + started := time.Now() + results := make([]executorProbeResult, len(models)) + sem := make(chan struct{}, maxConcurrentProbeJobs) + var wg sync.WaitGroup + for i, model := range models { + // Do not start new work once the operator has disconnected or the + // batch deadline has passed. + if ctx.Err() != nil { + results[i] = executorProbeResult{Model: model, Code: "probe_canceled", Kind: "canceled", Message: "probe batch canceled"} + continue + } + wg.Add(1) + select { + case sem <- struct{}{}: + case <-ctx.Done(): + wg.Done() + results[i] = executorProbeResult{Model: model, Code: "probe_canceled", Kind: "canceled", Message: "probe batch canceled"} + continue + } + go func(i int, model string) { + defer wg.Done() + defer func() { <-sem }() + results[i] = executorProbeResult(h.Executor.ProbeModel(ctx, model)) + }(i, model) + } + wg.Wait() + + out := modelProbeResponse{ + Results: results, + Summary: modelProbeSummary{Total: len(results)}, + Elapsed: int(time.Since(started).Milliseconds()), + } + for _, res := range results { + switch { + case res.OK: + out.Summary.Passed++ + case strings.EqualFold(strings.TrimSpace(res.Code), "no_models") || strings.EqualFold(strings.TrimSpace(res.Message), "model required"): + out.Summary.Skipped++ + default: + out.Summary.Failed++ + } + } + writeJSON(w, http.StatusOK, out) +} + +func trimSpaceSlice(in []string) []string { + out := make([]string, 0, len(in)) + for _, item := range in { + out = append(out, strings.TrimSpace(item)) + } + return out +} + +func uniqueStrings(in []string) []string { + seen := make(map[string]struct{}, len(in)) + out := make([]string, 0, len(in)) + for _, item := range in { + item = strings.TrimSpace(item) + if item == "" { + continue + } + if _, ok := seen[item]; ok { + continue + } + seen[item] = struct{}{} + out = append(out, item) + } + sort.Strings(out) + return out +} diff --git a/internal/console/models.go b/internal/console/models.go index 03364198..0cb2cf30 100644 --- a/internal/console/models.go +++ b/internal/console/models.go @@ -40,6 +40,9 @@ func (h *Handler) HandleModelsAPI(w http.ResponseWriter, r *http.Request) { return } data := h.decorateModels(r.Context(), h.filterModels(r, models)) + if h.crossProviderPoolOn() && h.Control != nil { + data = control.MergeAggregationModels(r.Context(), h.Control.Aggregations, data) + } if !h.crossProviderPoolOn() { // The gateway refuses bare ids with the pool off; serve prefixed ids so // every client that picks from this list produces a request it accepts. diff --git a/internal/control/aggregation.go b/internal/control/aggregation.go new file mode 100644 index 00000000..5216ee3e --- /dev/null +++ b/internal/control/aggregation.go @@ -0,0 +1,201 @@ +package control + +import ( + "context" + "errors" + "sort" + "sync" + "sync/atomic" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +// ErrAggregationNotFound is re-exported for the console layer's convenience; +// it is the same sentinel used by accounts/store. +var ErrAggregationNotFound = accounts.ErrAggregationNotFound + +// AggregationStore is the narrow persistence surface the aggregation facade +// needs. *store.Store satisfies it via the AccountStore interface; keeping it +// narrow lets tests use a minimal stub. +type AggregationStore interface { + InsertAggregation(ctx context.Context, agg accounts.Aggregation) (accounts.Aggregation, error) + SaveAggregation(ctx context.Context, agg accounts.Aggregation) (accounts.Aggregation, error) + ListAggregations(ctx context.Context) ([]accounts.Aggregation, error) + GetAggregation(ctx context.Context, id string) (accounts.Aggregation, error) + DeleteAggregation(ctx context.Context, id string) error +} + +type Aggregations struct { + store AggregationStore + // mu serializes console write operations. This gateway runs as a single + // process, so a facade mutex is enough to keep Update's read-modify-write + // from losing a concurrent PATCH without a schema/version migration. + mu sync.Mutex + // resolveCache is a copy-on-write snapshot of all aggregations so the hot + // Resolve path does no SQL. Writes invalidate it under mu. The atomic value + // stores *aggregationSnapshot; a nil pointer means "not loaded". + resolveCache atomic.Value +} + +type aggregationSnapshot map[string]accounts.Aggregation + +func NewAggregations(store AggregationStore) *Aggregations { + if store == nil { + return nil + } + return &Aggregations{store: store} +} + +func (a *Aggregations) List(ctx context.Context) ([]accounts.Aggregation, error) { + list, err := a.store.ListAggregations(ctx) + if err != nil { + return nil, err + } + if list == nil { + list = []accounts.Aggregation{} + } + return list, nil +} + +func (a *Aggregations) Get(ctx context.Context, id string) (accounts.Aggregation, error) { + return a.store.GetAggregation(ctx, id) +} + +func (a *Aggregations) Create(ctx context.Context, input accounts.CreateAggregation) (accounts.Aggregation, error) { + a.mu.Lock() + defer a.mu.Unlock() + prepared, err := accounts.PrepareCreateAggregation(input) + if err != nil { + return accounts.Aggregation{}, operationError("invalid_request", err.Error()) + } + now := time.Now().UTC() + created, err := a.store.InsertAggregation(ctx, accounts.Aggregation{ + ID: prepared.ID, + Name: prepared.Name, + Enabled: prepared.Enabled, + Strategy: prepared.Strategy, + AllowFallbacks: prepared.AllowFallbacks, + MaxAttempts: prepared.MaxAttempts, + Members: prepared.Members, + CreatedAt: now, + UpdatedAt: now, + }) + if err != nil { + return accounts.Aggregation{}, err + } + a.invalidateResolveCache() + return created, nil +} + +func (a *Aggregations) Update(ctx context.Context, id string, input accounts.UpdateAggregation) (accounts.Aggregation, error) { + a.mu.Lock() + defer a.mu.Unlock() + current, err := a.store.GetAggregation(ctx, id) + if err != nil { + if errors.Is(err, accounts.ErrAggregationNotFound) { + return accounts.Aggregation{}, ErrAggregationNotFound + } + return accounts.Aggregation{}, err + } + merged, err := accounts.ApplyAggregationUpdate(current, input) + if err != nil { + return accounts.Aggregation{}, operationError("invalid_request", err.Error()) + } + merged.UpdatedAt = time.Now().UTC() + updated, err := a.store.SaveAggregation(ctx, merged) + if err != nil { + if errors.Is(err, accounts.ErrAggregationNotFound) { + return accounts.Aggregation{}, ErrAggregationNotFound + } + return accounts.Aggregation{}, err + } + a.invalidateResolveCache() + return updated, nil +} + +func (a *Aggregations) Delete(ctx context.Context, id string) error { + a.mu.Lock() + defer a.mu.Unlock() + err := a.store.DeleteAggregation(ctx, id) + if errors.Is(err, accounts.ErrAggregationNotFound) { + return ErrAggregationNotFound + } + if err == nil { + a.invalidateResolveCache() + } + return err +} + +// invalidateResolveCache must be called with a.mu held by writers. +func (a *Aggregations) invalidateResolveCache() { + a.resolveCache.Store((*aggregationSnapshot)(nil)) +} + +// resolveSnapshot returns the copy-on-write aggregation snapshot used by the +// hot path. It loads from the store once (or after a write invalidates it) and +// never mutates the stored maps/slices afterwards. +func (a *Aggregations) resolveSnapshot(ctx context.Context) (aggregationSnapshot, error) { + if a == nil || a.store == nil { + return nil, ErrAggregationNotFound + } + if cached, ok := a.resolveCache.Load().(*aggregationSnapshot); ok && cached != nil { + return *cached, nil + } + // Cold path: serialize the load so a burst of first requests cannot stampede + // the database. Writes use the same mutex, so a load cannot race with a + // write/invalidation and store a snapshot built from a half-updated state. + a.mu.Lock() + defer a.mu.Unlock() + if cached, ok := a.resolveCache.Load().(*aggregationSnapshot); ok && cached != nil { + return *cached, nil + } + list, err := a.store.ListAggregations(ctx) + if err != nil { + return nil, err + } + snapshot := make(aggregationSnapshot, len(list)) + for _, agg := range list { + snapshot[agg.ID] = agg + } + stored := aggregationSnapshot(snapshot) + a.resolveCache.Store(&stored) + return snapshot, nil +} + +// Resolve returns an immutable snapshot of one aggregation's members, already +// filtered by the caller's allowed providers. The executor calls this once per +// request before taking the Pool lock, and the result is read-only. The hot +// path is served from an in-memory snapshot, so normal requests add no SQL. +func (a *Aggregations) Resolve(ctx context.Context, id string, allowedProviders map[string]bool) (accounts.Aggregation, error) { + snapshot, err := a.resolveSnapshot(ctx) + if err != nil { + return accounts.Aggregation{}, err + } + agg, ok := snapshot[id] + if !ok || !agg.Enabled { + return accounts.Aggregation{}, ErrAggregationNotFound + } + members := make([]accounts.AggregationMember, 0, len(agg.Members)) + for _, member := range agg.Members { + if allowedProviders != nil && !allowedProviders[member.Provider] { + continue + } + members = append(members, member) + } + if len(members) == 0 { + return accounts.Aggregation{}, ErrAggregationNotFound + } + // Stable priority order; DoS-safe cap even if a stale row has more members. + if len(members) > accounts.MaxAggregationMembers { + members = members[:accounts.MaxAggregationMembers] + } + sort.SliceStable(members, func(i, j int) bool { + if members[i].Priority != members[j].Priority { + return members[i].Priority < members[j].Priority + } + return members[i].ID < members[j].ID + }) + agg.Members = members + return agg, nil +} diff --git a/internal/control/aggregation_catalog.go b/internal/control/aggregation_catalog.go new file mode 100644 index 00000000..37875862 --- /dev/null +++ b/internal/control/aggregation_catalog.go @@ -0,0 +1,96 @@ +package control + +import ( + "context" + "sort" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +type AggregationLister interface { + List(ctx context.Context) ([]accounts.Aggregation, error) +} + +// MergeAggregationModels folds enabled logical models into the display catalog. +// Each aggregated entry is built by merging the capability fields of all its +// member models (conservative intersection), then member models are hidden so +// clients see one stable ID instead of one row per provider. Models that are +// not part of any enabled aggregation are left untouched. +// +// The catalog slices passed in/out are plain value maps, so this never mutates +// the shared catalog cache. +func MergeAggregationModels(ctx context.Context, lister AggregationLister, models []map[string]any) []map[string]any { + if lister == nil || len(models) == 0 { + return models + } + aggs, err := lister.List(ctx) + if err != nil || len(aggs) == 0 { + return models + } + + byID := make(map[string]map[string]any, len(models)) + for _, model := range models { + id, _ := model["id"].(string) + if id != "" { + byID[id] = model + } + } + + hidden := map[string]bool{} + entries := make([]map[string]any, 0, len(aggs)) + for _, agg := range aggs { + if !agg.Enabled || len(agg.Members) == 0 { + continue + } + var merged map[string]any + for _, member := range agg.Members { + model := byID[member.Model] + if model == nil { + continue + } + hidden[member.Model] = true + if merged == nil { + merged = CloneModelEntry(model) + continue + } + MergeModelEntryCapabilities(merged, model) + } + if merged == nil { + // No member is currently in the catalog: still expose the logical + // model so clients do not lose the ID; use a minimal entry. + merged = map[string]any{ + "object": "model", + "owned_by": "aggregation", + } + } + merged["id"] = agg.ID + merged["display_name"] = agg.Name + merged["provider"] = "aggregation" + merged["owned_by"] = "aggregation" + merged["aggregation"] = true + merged["aggregation_strategy"] = string(agg.Strategy) + merged["aggregation_members"] = len(agg.Members) + delete(merged, "native_model") + delete(merged, "mapped_key") + entries = append(entries, merged) + } + if len(entries) == 0 && len(hidden) == 0 { + return models + } + + out := make([]map[string]any, 0, len(models)-len(hidden)+len(entries)) + for _, model := range models { + id, _ := model["id"].(string) + if hidden[id] { + continue + } + out = append(out, model) + } + out = append(out, entries...) + sort.SliceStable(out, func(i, j int) bool { + left, _ := out[i]["id"].(string) + right, _ := out[j]["id"].(string) + return left < right + }) + return out +} diff --git a/internal/control/aggregation_test.go b/internal/control/aggregation_test.go new file mode 100644 index 00000000..41940d7c --- /dev/null +++ b/internal/control/aggregation_test.go @@ -0,0 +1,94 @@ +package control + +import ( + "context" + "testing" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +func TestAggregationResolveFiltersByProviderAndOrders(t *testing.T) { + store := &aggTestStore{agg: accounts.Aggregation{ + ID: "my-model", Name: "My Model", Enabled: true, + Strategy: accounts.AggregationPriority, AllowFallbacks: true, MaxAttempts: 3, + Members: []accounts.AggregationMember{ + {Provider: "trae", Model: "m3", Priority: 2}, + {Provider: "qoder", Model: "m1", Priority: 0}, + {Provider: "workbuddy", Model: "m2", Priority: 1}, + }, + }} + svc := NewAggregations(store) + // Allow only qoder and workbuddy; trae member must be filtered out. + got, err := svc.Resolve(context.Background(), "my-model", map[string]bool{"qoder": true, "workbuddy": true}) + if err != nil { + t.Fatalf("resolve: %v", err) + } + if len(got.Members) != 2 || got.Members[0].Provider != "qoder" || got.Members[1].Provider != "workbuddy" { + t.Fatalf("unexpected members: %+v", got.Members) + } +} + +func TestAggregationResolveRejectsDisabledAndUnknown(t *testing.T) { + store := &aggTestStore{agg: accounts.Aggregation{ + ID: "my-model", Enabled: false, + Members: []accounts.AggregationMember{{Provider: "qoder", Model: "m1"}}, + }} + svc := NewAggregations(store) + if _, err := svc.Resolve(context.Background(), "my-model", nil); err != ErrAggregationNotFound { + t.Fatalf("disabled aggregation should be not-found, got %v", err) + } + if _, err := svc.Resolve(context.Background(), "nope", nil); err != ErrAggregationNotFound { + t.Fatalf("unknown aggregation should be not-found, got %v", err) + } +} + +func TestAggregationResolveUsesCacheAndInvalidatesOnWrite(t *testing.T) { + store := &aggTestStore{agg: accounts.Aggregation{ + ID: "my-model", Enabled: true, Strategy: accounts.AggregationRoundRobin, + MaxAttempts: 3, AllowFallbacks: true, + Members: []accounts.AggregationMember{{Provider: "qoder", Model: "m1"}}, + }} + svc := NewAggregations(store) + for i := 0; i < 5; i++ { + if _, err := svc.Resolve(context.Background(), "my-model", nil); err != nil { + t.Fatalf("resolve %d: %v", i, err) + } + } + if store.listCalls != 1 { + t.Fatalf("cache missed: ListAggregations called %d times, want 1", store.listCalls) + } + name := "renamed" + if _, err := svc.Update(context.Background(), "my-model", accounts.UpdateAggregation{Name: &name}); err != nil { + t.Fatalf("update: %v", err) + } + if _, err := svc.Resolve(context.Background(), "my-model", nil); err != nil { + t.Fatalf("resolve after write: %v", err) + } + if store.listCalls != 2 { + t.Fatalf("cache not invalidated: ListAggregations called %d times, want 2", store.listCalls) + } +} + +// aggTestStore implements only the narrow AggregationStore surface. +type aggTestStore struct { + agg accounts.Aggregation + listCalls int +} + +func (s *aggTestStore) GetAggregation(_ context.Context, id string) (accounts.Aggregation, error) { + if id != s.agg.ID { + return accounts.Aggregation{}, accounts.ErrAggregationNotFound + } + return s.agg, nil +} +func (s *aggTestStore) InsertAggregation(_ context.Context, agg accounts.Aggregation) (accounts.Aggregation, error) { + return agg, nil +} +func (s *aggTestStore) SaveAggregation(_ context.Context, agg accounts.Aggregation) (accounts.Aggregation, error) { + return agg, nil +} +func (s *aggTestStore) ListAggregations(_ context.Context) ([]accounts.Aggregation, error) { + s.listCalls++ + return []accounts.Aggregation{s.agg}, nil +} +func (s *aggTestStore) DeleteAggregation(_ context.Context, _ string) error { return nil } diff --git a/internal/control/catalog.go b/internal/control/catalog.go index d651c96a..d2693736 100644 --- a/internal/control/catalog.go +++ b/internal/control/catalog.go @@ -173,6 +173,12 @@ func (c *Catalog) snapshot(accountID string, mode CatalogMode) []map[string]any return CloneModelList(entry.Models) } +// Peek returns a cache-only snapshot for one catalog view. It never starts a +// refresh or fetch, so diagnostic callers can avoid mutating catalog state. +func (c *Catalog) Peek(accountID string, mode CatalogMode) []map[string]any { + return c.snapshot(accountID, mode) +} + // Get returns the display catalog for one view. A failed fetch never discards a // catalog that already served: the last successful list is returned and the // failure is reported through Status instead. diff --git a/internal/control/catalog_policy.go b/internal/control/catalog_policy.go index 00dd7d0b..2c70f58b 100644 --- a/internal/control/catalog_policy.go +++ b/internal/control/catalog_policy.go @@ -46,6 +46,7 @@ func EntryModelRegions(entry map[string]any) []string { // MergeModelEntryCapabilities folds a later source entry into the merged one // conservatively: numeric fields take the minimum and boolean fields are ANDed. func MergeModelEntryCapabilities(merged, incoming map[string]any) { + mergeReasoningOptions(merged, incoming) for _, field := range modelsNumericCapFields { mergedValue, ok1 := numericFieldValue(merged[field]) incomingValue, ok2 := numericFieldValue(incoming[field]) @@ -99,6 +100,61 @@ func MergeModelEntryPricing(merged, incoming map[string]any) { } } +func reasoningValues(entry map[string]any, keys ...string) []string { + if len(keys) == 0 { + keys = []string{"reasoning_option_values", "reasoning_options"} + } + for _, key := range keys { + switch typed := entry[key].(type) { + case []string: + if values := providers.UniqueReasoningOptionValues(typed); len(values) > 0 { + return values + } + case []any: + raw := make([]string, 0, len(typed)) + for _, item := range typed { + if value, ok := item.(string); ok { + raw = append(raw, value) + } + } + if values := providers.UniqueReasoningOptionValues(raw); len(values) > 0 { + return values + } + } + } + return nil +} + +func mergeReasoningOptionSet(merged, incoming map[string]any, key string) { + values := reasoningValues(merged, key) + seen := map[string]struct{}{} + for _, value := range values { + seen[strings.ToLower(value)] = struct{}{} + } + for _, value := range reasoningValues(incoming, key) { + if _, ok := seen[strings.ToLower(value)]; ok { + continue + } + seen[strings.ToLower(value)] = struct{}{} + values = append(values, value) + } + if len(values) > 0 { + merged[key] = values + } +} + +func mergeReasoningOptions(merged, incoming map[string]any) { + mergeReasoningOptionSet(merged, incoming, "reasoning_options") + mergeReasoningOptionSet(merged, incoming, "reasoning_option_values") + for _, key := range []string{"reasoning_default", "reasoning_type"} { + if _, ok := merged[key]; !ok { + if value, ok := incoming[key]; ok && value != "" { + merged[key] = value + } + } + } +} + func numericFieldValue(value any) (float64, bool) { switch typed := value.(type) { case int: @@ -142,6 +198,19 @@ func ModelCapabilitiesEntry(model providers.ModelInfo) map[string]any { if model.Capabilities.CanDisableThinking { entry["can_disable_thinking"] = true } + if len(model.Capabilities.ReasoningOptionValues) > 0 { + entry["reasoning_option_values"] = model.Capabilities.ReasoningOptionValues + } + reasoningOptions := providers.UniqueReasoningOptions(model.Capabilities.ReasoningOptions) + if len(reasoningOptions) > 0 { + entry["reasoning_options"] = reasoningOptions + } + if model.Capabilities.ReasoningDefault != "" { + entry["reasoning_default"] = model.Capabilities.ReasoningDefault + } + if model.Capabilities.ReasoningType != "" { + entry["reasoning_type"] = model.Capabilities.ReasoningType + } entry["supports_images"] = model.Capabilities.Images return entry } @@ -192,8 +261,12 @@ func ProviderModelEntry(model providers.ModelInfo, provider string) map[string]a if hasMaxTier(model.Capabilities) { entry["supports_max_mode"] = true } - if len(model.Capabilities.ReasoningOptions) > 0 { - entry["reasoning_options"] = model.Capabilities.ReasoningOptions + reasoningOptions := providers.UniqueReasoningOptions(model.Capabilities.ReasoningOptions) + if len(reasoningOptions) > 0 { + entry["reasoning_options"] = reasoningOptions + } + if len(model.Capabilities.ReasoningOptionValues) > 0 { + entry["reasoning_option_values"] = model.Capabilities.ReasoningOptionValues } if model.Capabilities.ReasoningDefault != "" { entry["reasoning_default"] = model.Capabilities.ReasoningDefault diff --git a/internal/control/catalog_policy_test.go b/internal/control/catalog_policy_test.go new file mode 100644 index 00000000..a1bff84f --- /dev/null +++ b/internal/control/catalog_policy_test.go @@ -0,0 +1,61 @@ +package control + +import "testing" + +func TestMergeModelEntryCapabilitiesMergesUpstreamReasoningOptionValues(t *testing.T) { + merged := map[string]any{ + "reasoning_option_values": []string{"off", "low"}, + "reasoning_options": []string{"none", "low"}, + } + incoming := map[string]any{ + "reasoning_option_values": []string{"medium", "max"}, + "reasoning_options": []string{"medium", "max"}, + } + MergeModelEntryCapabilities(merged, incoming) + values, ok := merged["reasoning_option_values"].([]string) + if !ok { + t.Fatalf("reasoning_option_values = %#v", merged["reasoning_option_values"]) + } + want := "off,low,medium,max" + got := "" + for i, value := range values { + if i > 0 { + got += "," + } + got += value + } + if got != want { + t.Fatalf("reasoning_option_values = %q, want %q", got, want) + } + options, ok := merged["reasoning_options"].([]string) + if !ok { + t.Fatalf("reasoning_options = %#v", merged["reasoning_options"]) + } + wantOptions := "none,low,medium,max" + gotOptions := "" + for i, value := range options { + if i > 0 { + gotOptions += "," + } + gotOptions += value + } + if gotOptions != wantOptions { + t.Fatalf("reasoning_options = %q, want %q", gotOptions, wantOptions) + } +} + +func TestMergeModelEntryCapabilitiesFillsReasoningFromLaterSource(t *testing.T) { + merged := map[string]any{} + incoming := map[string]any{ + "reasoning_option_values": []string{"off", "medium", "max"}, + "reasoning_options": []string{"none", "medium", "max"}, + "reasoning_default": "medium", + } + MergeModelEntryCapabilities(merged, incoming) + if _, ok := merged["reasoning_option_values"]; !ok { + t.Fatal("later source reasoning options were not merged") + } + if merged["reasoning_default"] != "medium" { + t.Fatalf("reasoning_default = %#v", merged["reasoning_default"]) + } +} diff --git a/internal/control/control.go b/internal/control/control.go index 3d7d37dc..c0da4f6b 100644 --- a/internal/control/control.go +++ b/internal/control/control.go @@ -2,11 +2,12 @@ package control // Services is the console application surface assembled by app.New. type Services struct { - Accounts *Accounts - Keys *Keys - Settings *Settings - Backup *Backup - Catalog *Catalog + Accounts *Accounts + Keys *Keys + Settings *Settings + Backup *Backup + Catalog *Catalog + Aggregations *Aggregations } func New(runtime Runtime) *Services { @@ -15,9 +16,10 @@ func New(runtime Runtime) *Services { } store := runtime.Store() return &Services{ - Accounts: NewAccounts(runtime), - Keys: NewKeys(store), - Settings: NewSettings(store), - Backup: NewBackup(store), + Accounts: NewAccounts(runtime), + Keys: NewKeys(store), + Settings: NewSettings(store), + Backup: NewBackup(store), + Aggregations: NewAggregations(store), } } diff --git a/internal/control/s06_control_test.go b/internal/control/s06_control_test.go index b6c075e4..b6e17e02 100644 --- a/internal/control/s06_control_test.go +++ b/internal/control/s06_control_test.go @@ -296,6 +296,26 @@ func (s *fakeStore) TouchAPIKey(_ context.Context, id string) error { return nil } +func (s *fakeStore) InsertAggregation(_ context.Context, agg accounts.Aggregation) (accounts.Aggregation, error) { + return agg, nil +} + +func (s *fakeStore) SaveAggregation(_ context.Context, agg accounts.Aggregation) (accounts.Aggregation, error) { + return agg, nil +} + +func (s *fakeStore) ListAggregations(_ context.Context) ([]accounts.Aggregation, error) { + return []accounts.Aggregation{}, nil +} + +func (s *fakeStore) GetAggregation(_ context.Context, id string) (accounts.Aggregation, error) { + return accounts.Aggregation{}, accounts.ErrAggregationNotFound +} + +func (s *fakeStore) DeleteAggregation(_ context.Context, _ string) error { + return nil +} + type fakeRuntime struct { log *callLog store *fakeStore diff --git a/internal/control/system.go b/internal/control/system.go index af4064b9..1da832b0 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 && rawStrategy != accounts.RoutingStrategyFEFO { - return operationError("invalid_routing_strategy", "routing_strategy must be round-robin, weighted-round-robin, fill-first, or fefo") + if rawStrategy != accounts.RoutingStrategyRoundRobin && rawStrategy != accounts.RoutingStrategyWeightedRoundRobin && rawStrategy != accounts.RoutingStrategyFillFirst && rawStrategy != accounts.RoutingStrategyFEFO && rawStrategy != accounts.RoutingStrategyLeastQuotaFirst && rawStrategy != accounts.RoutingStrategyMostQuotaFirst { + return operationError("invalid_routing_strategy", "routing_strategy must be round-robin, weighted-round-robin, fill-first, fefo, least-quota-first, or most-quota-first") } strategy = accounts.NormalizeRoutingStrategy(rawStrategy) } diff --git a/internal/executor/aggregation_e2e_test.go b/internal/executor/aggregation_e2e_test.go new file mode 100644 index 00000000..3b80f551 --- /dev/null +++ b/internal/executor/aggregation_e2e_test.go @@ -0,0 +1,119 @@ +package executor + +import ( + "context" + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/auth" + "github.com/caigee-cmd/cli2api/internal/translate" +) + +type aggResolverStub struct { + agg accounts.Aggregation + hit int +} + +func (s *aggResolverStub) Resolve(_ context.Context, id string, _ map[string]bool) (accounts.Aggregation, error) { + s.hit++ + if id != s.agg.ID { + return accounts.Aggregation{}, accounts.ErrAggregationNotFound + } + return s.agg, nil +} + +func TestAggregateFailoverSettingsDriveAttempts(t *testing.T) { + pool := aggTestPool() + resolver := &aggResolverStub{agg: accounts.Aggregation{ + ID: "my-model", Enabled: true, Strategy: accounts.AggregationPriority, + AllowFallbacks: false, MaxAttempts: 7, + Members: []accounts.AggregationMember{ + {Provider: "qoder", Model: "model-a", Priority: 0}, + {Provider: "workbuddy", Model: "model-b", Priority: 1}, + }, + }} + e := ChatExecutor{Pool: pool, MaxAttempts: 6} + prepared, err := e.Prepare(PrepareInput{ + Context: context.Background(), + Request: translate.ChatRequest{Model: "my-model", Messages: []translate.ChatMessage{{Role: "user", Content: "hi"}}}, + Identity: auth.ConsoleIdentity(), + CrossProviderPool: true, + Aggregations: resolver, + Now: time.Now(), + }) + if err != nil { + t.Fatalf("prepare: %v", err) + } + loop := e.newRouteLoop(prepared.Context, "", "", prepared.Request) + if loop.attempts != 1 { + t.Fatalf("allow_fallbacks=false must cap attempts to 1, got %d", loop.attempts) + } + + resolver.agg.AllowFallbacks = true + resolver.agg.MaxAttempts = 2 + prepared, err = e.Prepare(PrepareInput{ + Context: context.Background(), + Request: translate.ChatRequest{Model: "my-model", Messages: []translate.ChatMessage{{Role: "user", Content: "hi"}}}, + Identity: auth.ConsoleIdentity(), + CrossProviderPool: true, + Aggregations: resolver, + Now: time.Now(), + }) + if err != nil { + t.Fatalf("prepare: %v", err) + } + loop = e.newRouteLoop(prepared.Context, "", "", prepared.Request) + if loop.attempts != 2 { + t.Fatalf("max_attempts=2 must cap attempts to 2, got %d", loop.attempts) + } +} + +func TestAggregatePrepareToRoute(t *testing.T) { + pool := aggTestPool() + resolver := &aggResolverStub{agg: accounts.Aggregation{ + ID: "my-model", Enabled: true, Strategy: accounts.AggregationPriority, + AllowFallbacks: true, MaxAttempts: 3, + Members: []accounts.AggregationMember{ + {Provider: "qoder", Model: "model-a", Priority: 0}, + {Provider: "workbuddy", Model: "model-b", Priority: 1}, + }, + }} + e := ChatExecutor{Pool: pool} + + prepared, err := e.Prepare(PrepareInput{ + Context: context.Background(), + Request: translate.ChatRequest{Model: "my-model", Messages: []translate.ChatMessage{{Role: "user", Content: "hi"}}}, + Identity: auth.ConsoleIdentity(), + CrossProviderPool: true, + Aggregations: resolver, + Now: time.Now(), + }) + if err != nil { + t.Fatalf("prepare: %v", err) + } + if resolver.hit != 1 { + t.Fatalf("resolver called %d times, want 1 (snapshot once)", resolver.hit) + } + plan := aggregatePlanFrom(prepared.Context) + if plan == nil || plan.ID != "my-model" { + t.Fatalf("plan not attached to context: %+v", plan) + } + // The loop must not pin a provider for an aggregated request and must route + // only to members. + loop := e.newRouteLoop(prepared.Context, "", "", prepared.Request) + if loop.resolver == nil { + t.Fatal("route loop missing aggregate resolver") + } + counts := map[string]int{} + for i := 0; i < 10; i++ { + item, _, err := loop.pickNext(e, "my-model") + if err != nil { + t.Fatalf("pick: %v", err) + } + counts[item.ID]++ + } + if counts["trae"] != 0 || counts["qoder"]+counts["workbuddy"] != 10 { + t.Fatalf("unexpected aggregate routing: %v", counts) + } +} diff --git a/internal/executor/aggregation_plan.go b/internal/executor/aggregation_plan.go new file mode 100644 index 00000000..5cdc696c --- /dev/null +++ b/internal/executor/aggregation_plan.go @@ -0,0 +1,185 @@ +package executor + +import ( + "context" + "strings" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +// AggregatePlan is an immutable per-request snapshot of one logical model. +// It is resolved once in Prepare (before any Pool lock) and stored in the +// request context. Everything downstream treats it as read-only, so parallel +// requests never share mutable state and configuration updates cannot change +// the candidate set mid-flight. +type AggregatePlan struct { + ID string + Strategy accounts.AggregationStrategy + AllowFallbacks bool + MaxAttempts int + // Members already filtered by the caller's provider grants and sorted by + // priority. Immutable for the lifetime of the request. + Members []accounts.AggregationMember + // byProvider is a prebuilt index so resolver lookup is O(1) per item + // instead of scanning all members for every account (O(N*M)). + byProvider map[string][]accounts.AggregationMember +} + +// NewAggregatePlan builds a plan and its lookup index. The caller must pass a +// snapshot whose Members slice will not be mutated afterwards. +func NewAggregatePlan(agg accounts.Aggregation) *AggregatePlan { + plan := &AggregatePlan{ + ID: agg.ID, + Strategy: agg.Strategy, + AllowFallbacks: agg.AllowFallbacks, + MaxAttempts: agg.MaxAttempts, + Members: agg.Members, + byProvider: make(map[string][]accounts.AggregationMember, len(agg.Members)), + } + for _, member := range agg.Members { + key := strings.ToLower(strings.TrimSpace(member.Provider)) + plan.byProvider[key] = append(plan.byProvider[key], member) + } + return plan +} + +type aggregatePlanContextKey struct{} + +// WithAggregatePlan attaches a resolved plan to the context. +func WithAggregatePlan(ctx context.Context, plan *AggregatePlan) context.Context { + if ctx == nil || plan == nil { + return ctx + } + return context.WithValue(ctx, aggregatePlanContextKey{}, plan) +} + +func aggregatePlanFrom(ctx context.Context) *AggregatePlan { + if ctx == nil { + return nil + } + plan, _ := ctx.Value(aggregatePlanContextKey{}).(*AggregatePlan) + return plan +} + +// resolver returns a pure function that maps an Item to the concrete real +// model it should serve for this plan. The function: +// - reads only the immutable plan snapshot and the passed-in Item; +// - never calls Pool methods, the facade, DB, network, or channels; +// - is O(candidates for provider), typically O(1), with no allocation. +// +// It is safe to invoke while Pool.mu is held. If a member's region filter is +// set, only items in that region are considered; an empty region matches any. +// matchMember returns the member this item resolves to. Shared by resolver, +// priorityResolver and weightResolver so all three agree on the same member. +func (p *AggregatePlan) matchMember(item Item) (accounts.AggregationMember, bool) { + if p == nil { + return accounts.AggregationMember{}, false + } + candidates := p.byProvider[strings.ToLower(strings.TrimSpace(itemProvider(item)))] + region := NormalizeRegion(itemRegion(item)) + var wildcard *accounts.AggregationMember + for _, member := range candidates { + if member.AccountID != "" && member.AccountID != item.ID { + continue + } + if member.Region != "" && NormalizeRegion(member.Region) != region { + continue + } + if !itemHasModel(item, member.Model) { + continue + } + // A deployment pinned to this exact account is more specific than a + // legacy provider-wide member with the same model. It must supply the + // plan's priority/weight for this account even when the wildcard member + // sorts first. + if member.AccountID == item.ID { + return member, true + } + if wildcard == nil { + copy := member + wildcard = © + } + } + if wildcard != nil { + return *wildcard, true + } + return accounts.AggregationMember{}, false +} + +// CanServeAccount reports whether this account can serve at least one member +// of the logical model. Sticky routing uses it because the public model is a +// virtual ID that is intentionally absent from every account catalog. +func (p *AggregatePlan) CanServeAccount(item Item) bool { + _, ok := p.matchMember(item) + return ok +} + +// Priority returns the configured priority of the member this account serves. +func (p *AggregatePlan) Priority(item Item) (int, bool) { + member, ok := p.matchMember(item) + if !ok { + return 0, false + } + return member.Priority, true +} + +// PriorityTierCount counts distinct configured priority tiers. It is used to +// give each tier its own retry budget instead of spending the whole budget on +// sibling accounts of the first provider. +func (p *AggregatePlan) PriorityTierCount() int { + if p == nil { + return 1 + } + seen := make(map[int]struct{}, len(p.Members)) + for _, member := range p.Members { + seen[member.Priority] = struct{}{} + } + if len(seen) == 0 { + return 1 + } + return len(seen) +} + +func (p *AggregatePlan) resolver() func(Item) string { + if p == nil || len(p.Members) == 0 { + return nil + } + return func(item Item) string { + member, ok := p.matchMember(item) + if !ok { + return "" + } + return member.Model + } +} + +// priorityResolver exposes the matched member's configured priority so +// PickRoute can order candidates for a "priority" strategy. Lower is higher +// priority; unmatched items get a large value so they sort last. +func (p *AggregatePlan) priorityResolver() func(Item) int { + if p == nil || len(p.Members) == 0 { + return nil + } + return func(item Item) int { + member, ok := p.matchMember(item) + if !ok { + return 1 << 30 + } + return member.Priority + } +} + +// weightResolver exposes the matched member's weight for fill-first and +// weighted-round-robin strategies. Falls back to 100 for unmatched items. +func (p *AggregatePlan) weightResolver() func(Item) int { + if p == nil || len(p.Members) == 0 { + return nil + } + return func(item Item) int { + member, ok := p.matchMember(item) + if !ok { + return 100 + } + return member.Weight + } +} diff --git a/internal/executor/aggregation_strategy_test.go b/internal/executor/aggregation_strategy_test.go new file mode 100644 index 00000000..a3c33de0 --- /dev/null +++ b/internal/executor/aggregation_strategy_test.go @@ -0,0 +1,191 @@ +package executor + +import ( + "context" + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/translate" +) + +func aggRouteQuery(plan *AggregatePlan) RouteQuery { + return RouteQuery{ + PublicModel: "my-model", + ModelResolver: plan.resolver(), + StrategyOverride: string(plan.Strategy), + PriorityResolver: plan.priorityResolver(), + WeightResolver: plan.weightResolver(), + } +} + +func TestAggregatePriorityAlwaysPicksHighestPriority(t *testing.T) { + p := aggTestPool() + plan := NewAggregatePlan(accounts.Aggregation{ + ID: "my-model", Strategy: accounts.AggregationPriority, MaxAttempts: 3, + Members: []accounts.AggregationMember{ + {Provider: "workbuddy", Model: "model-b", Priority: 0, Weight: 100}, + {Provider: "qoder", Model: "model-a", Priority: 1, Weight: 100}, + }, + }) + q := aggRouteQuery(plan) + for i := 0; i < 10; i++ { + item, ok := p.PickRoute(q) + if !ok || item.ID != "workbuddy" { + t.Fatalf("priority strategy pick %d = %+v (%v), want workbuddy", i, item, ok) + } + } +} + +func TestAggregatePriorityFallsToNextOnCooldown(t *testing.T) { + p := aggTestPool() + plan := NewAggregatePlan(accounts.Aggregation{ + ID: "my-model", Strategy: accounts.AggregationPriority, MaxAttempts: 3, + Members: []accounts.AggregationMember{ + {Provider: "workbuddy", Model: "model-b", Priority: 0, Weight: 100}, + {Provider: "qoder", Model: "model-a", Priority: 1, Weight: 100}, + }, + }) + // Cool the top-priority member's real model. + top, _ := p.ByID("workbuddy") + p.MarkClassified("workbuddy", Classified{Kind: KindRateLimit, Model: effectiveModel(top, aggRouteQuery(plan)), Cooldown: time.Minute}) + item, ok := p.PickRoute(aggRouteQuery(plan)) + if !ok || item.ID != "qoder" { + t.Fatalf("after top-priority cooldown want qoder, got %+v ok=%v", item, ok) + } +} + +func TestAggregateFillFirstUsesMemberWeight(t *testing.T) { + p := aggTestPool() + plan := NewAggregatePlan(accounts.Aggregation{ + ID: "my-model", Strategy: accounts.AggregationFillFirst, MaxAttempts: 3, + Members: []accounts.AggregationMember{ + // Deliberately low account weight on workbuddy; member weight is high. + {Provider: "workbuddy", Model: "model-b", Priority: 0, Weight: 500}, + {Provider: "qoder", Model: "model-a", Priority: 1, Weight: 100}, + }, + }) + p.items[1].Weight = 1 // workbuddy account weight tiny + p.items[0].Weight = 200 // qoder account weight large + for i := 0; i < 6; i++ { + item, ok := p.PickRoute(aggRouteQuery(plan)) + if !ok || item.ID != "workbuddy" { + t.Fatalf("fill-first should use member weight, pick %d = %+v", i, item) + } + } +} + +func TestAggregateRoundRobinRotates(t *testing.T) { + p := aggTestPool() + p.SetRoutingStrategy(RoutingStrategyRoundRobin) + plan := NewAggregatePlan(accounts.Aggregation{ + ID: "my-model", Strategy: accounts.AggregationRoundRobin, MaxAttempts: 3, + Members: []accounts.AggregationMember{ + {Provider: "workbuddy", Model: "model-b", Priority: 0, Weight: 100}, + {Provider: "qoder", Model: "model-a", Priority: 1, Weight: 100}, + }, + }) + q := aggRouteQuery(plan) + seen := map[string]bool{} + for i := 0; i < 6; i++ { + item, ok := p.PickRoute(q) + if !ok { + t.Fatal("no route") + } + seen[item.ID] = true + } + if !seen["workbuddy"] || !seen["qoder"] { + t.Fatalf("round-robin should rotate across members, seen=%v", seen) + } +} + +// TestAggregateFailoverStaysInFirstRegion guards the cross-region invariant: +// once an aggregated route picks its first member, every failover attempt for +// that request must stay in the same region. Without the lock, a priority +// member in cn falling through could fail over to a global member. +func TestAggregateFailoverStaysInFirstRegion(t *testing.T) { + p := NewPool( + []string{"http://qoder-cn:3020", "http://wb-global:3020"}, + []string{"qoder", "workbuddy"}, + ) + p.items[0].Provider = "qoder" + p.items[0].Region = "cn" + p.items[1].Provider = "workbuddy" + p.items[1].Region = "global" + p.MergeModels("qoder", []string{"shared"}) + p.MergeModels("workbuddy", []string{"shared"}) + + plan := NewAggregatePlan(accounts.Aggregation{ + ID: "my-model", Strategy: accounts.AggregationPriority, + AllowFallbacks: true, MaxAttempts: 3, + Members: []accounts.AggregationMember{ + {Provider: "qoder", Region: "cn", Model: "shared", Priority: 0, Weight: 100}, + {Provider: "workbuddy", Region: "", Model: "shared", Priority: 1, Weight: 100}, + }, + }) + ctx := WithAggregatePlan(context.Background(), plan) + e := ChatExecutor{Pool: p} + loop := e.newRouteLoop(ctx, "", "", translate.ChatRequest{Model: "my-model"}) + + first, _, err := loop.pickNext(e, "my-model") + if err != nil { + t.Fatalf("first pick: %v", err) + } + if got := NormalizeRegion(first.Region); got != "cn" { + t.Fatalf("first pick region=%q, want cn", got) + } + if got := NormalizeRegion(loop.regionFilter); got != "cn" { + t.Fatalf("regionFilter after first pick=%q, want cn (must lock before failover)", got) + } + + // A second attempt must be confined to cn. There is no second cn member, + // so excluding the first must yield no candidate instead of a global one. + loop.excluded[first.ID] = struct{}{} + _, _, err = loop.pickNext(e, "my-model") + if err == nil { + t.Fatal("failover crossed region: second pick succeeded on a different region") + } +} + +func TestAggregateMemberAccountPin(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ID: "q1", Provider: "qoder", Region: "global", Models: []string{"model-a"}}) + p.Upsert(Item{ID: "q2", Provider: "qoder", Region: "global", Models: []string{"model-a"}}) + plan := NewAggregatePlan(accounts.Aggregation{ + ID: "my-model", Strategy: accounts.AggregationPriority, MaxAttempts: 2, + Members: []accounts.AggregationMember{ + {Provider: "qoder", Model: "model-a", AccountID: "q2", Priority: 0, Weight: 100}, + }, + }) + q1, _ := p.ByID("q1") + q2, _ := p.ByID("q2") + if _, ok := plan.matchMember(q1); ok { + t.Fatal("q1 must not satisfy a member pinned to q2") + } + if member, ok := plan.matchMember(q2); !ok || member.AccountID != "q2" { + t.Fatalf("q2 member = %+v ok=%v", member, ok) + } + for i := 0; i < 5; i++ { + item, ok := p.PickRoute(aggRouteQuery(plan)) + if !ok || item.ID != "q2" { + t.Fatalf("pinned member pick %d = %+v ok=%v", i, item, ok) + } + } +} + +func TestAggregatePinnedMemberWinsOverWildcard(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ID: "q1", Provider: "qoder", Region: "global", Models: []string{"model-a"}}) + plan := NewAggregatePlan(accounts.Aggregation{ + ID: "my-model", Strategy: accounts.AggregationPriority, MaxAttempts: 2, + Members: []accounts.AggregationMember{ + {Provider: "qoder", Model: "model-a", Priority: 0, Weight: 100}, + {Provider: "qoder", Model: "model-a", AccountID: "q1", Priority: 1, Weight: 400}, + }, + }) + q1, _ := p.ByID("q1") + member, ok := plan.matchMember(q1) + if !ok || member.AccountID != "q1" || member.Priority != 1 || member.Weight != 400 { + t.Fatalf("pinned member = %+v ok=%v, want account-specific priority/weight", member, ok) + } +} diff --git a/internal/executor/aggregation_test.go b/internal/executor/aggregation_test.go new file mode 100644 index 00000000..244c50d4 --- /dev/null +++ b/internal/executor/aggregation_test.go @@ -0,0 +1,143 @@ +package executor + +import ( + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +func aggTestPool() *Pool { + p := NewPool( + []string{"http://qoder:3020", "http://wb:3020", "http://trae:3020"}, + []string{"qoder", "workbuddy", "trae"}, + ) + // NewPool hardcodes provider=qoder; set explicit families for this test. + for i, provider := range []string{"qoder", "workbuddy", "trae"} { + p.items[i].Provider = provider + } + // Give each account a concrete model catalog. + p.MergeModels("qoder", []string{"model-a", "shared"}) + p.MergeModels("workbuddy", []string{"model-b", "shared"}) + p.MergeModels("trae", []string{"model-c"}) + return p +} + +func aggPlan(members ...accounts.AggregationMember) *AggregatePlan { + return NewAggregatePlan(accounts.Aggregation{ + ID: "my-model", Strategy: accounts.AggregationPriority, + AllowFallbacks: true, MaxAttempts: 3, Members: members, + }) +} + +func TestAggregateResolverSameNameAcrossProviders(t *testing.T) { + plan := aggPlan( + accounts.AggregationMember{Provider: "qoder", Model: "shared", Priority: 0}, + accounts.AggregationMember{Provider: "workbuddy", Model: "shared", Priority: 1}, + ) + resolver := plan.resolver() + qoder, _ := aggTestPool().ByID("qoder") + wb, _ := aggTestPool().ByID("workbuddy") + if got := resolver(qoder); got != "shared" { + t.Fatalf("qoder resolved=%q want shared", got) + } + if got := resolver(wb); got != "shared" { + t.Fatalf("workbuddy resolved=%q want shared", got) + } +} + +func TestAggregateResolverDifferentNames(t *testing.T) { + plan := aggPlan( + accounts.AggregationMember{Provider: "qoder", Model: "model-a", Priority: 0}, + accounts.AggregationMember{Provider: "workbuddy", Model: "model-b", Priority: 1}, + accounts.AggregationMember{Provider: "trae", Model: "model-c", Priority: 2}, + ) + resolver := plan.resolver() + p := aggTestPool() + for _, tc := range []struct{ id, want string }{ + {"qoder", "model-a"}, {"workbuddy", "model-b"}, {"trae", "model-c"}, + } { + item, _ := p.ByID(tc.id) + if got := resolver(item); got != tc.want { + t.Fatalf("%s resolved=%q want %q", tc.id, got, tc.want) + } + } +} + +func TestAggregateRouteOnlyMatchesMembers(t *testing.T) { + p := aggTestPool() + plan := aggPlan( + accounts.AggregationMember{Provider: "qoder", Model: "model-a", Priority: 0}, + accounts.AggregationMember{Provider: "workbuddy", Model: "model-b", Priority: 1}, + ) + resolver := plan.resolver() + q := RouteQuery{PublicModel: "my-model", ModelResolver: resolver} + // trae has model-c only; it must not be selected for this aggregation. + counts := map[string]int{} + for i := 0; i < 12; i++ { + item, ok := p.PickRoute(q) + if !ok { + t.Fatal("expected an aggregate route") + } + counts[item.ID]++ + } + if counts["trae"] != 0 { + t.Fatalf("aggregate route must exclude non-member account, counts=%v", counts) + } + if counts["qoder"] == 0 || counts["workbuddy"] == 0 { + t.Fatalf("both member accounts should be reachable, counts=%v", counts) + } +} + +func TestAggregateCooldownIsScopedToResolvedModel(t *testing.T) { + p := aggTestPool() + plan := aggPlan( + accounts.AggregationMember{Provider: "qoder", Model: "model-a", Priority: 0}, + accounts.AggregationMember{Provider: "workbuddy", Model: "model-b", Priority: 1}, + ) + resolver := plan.resolver() + // Cool only qoder's resolved model. + qoder, _ := p.ByID("qoder") + p.MarkClassified("qoder", Classified{Kind: KindRateLimit, Model: effectiveModel(qoder, RouteQuery{PublicModel: "my-model", ModelResolver: resolver}), Cooldown: time.Hour}) + q := RouteQuery{PublicModel: "my-model", ModelResolver: resolver} + // Failover must move to workbuddy, not stall on qoder. + for i := 0; i < 6; i++ { + item, ok := p.PickRoute(q) + if !ok { + t.Fatal("expected a live aggregate route after qoder cooldown") + } + if item.ID == "qoder" { + t.Fatalf("qoder must be cooling for its resolved model") + } + } +} + +func TestAggregateResolverDoesNotMutateItem(t *testing.T) { + p := aggTestPool() + plan := aggPlan(accounts.AggregationMember{Provider: "qoder", Model: "model-a", Priority: 0}) + before, _ := p.ByID("qoder") + resolver := plan.resolver() + _ = resolver(before) + after, _ := p.ByID("qoder") + if len(before.Models) != len(after.Models) || len(before.NativeModels) != len(after.NativeModels) { + t.Fatal("resolver must not mutate shared item state") + } +} + +func TestAggregateResolverIsBoundedForManyProviders(t *testing.T) { + members := make([]accounts.AggregationMember, 0, 200) + for i := 0; i < 200; i++ { + members = append(members, accounts.AggregationMember{Provider: "qoder", Model: "m", Priority: i}) + } + plan := aggPlan(members...) + resolver := plan.resolver() + item := Item{ID: "x", Provider: "qoder", Models: []string{"m"}} + if got := resolver(item); got != "m" { + t.Fatalf("resolved=%q want m", got) + } + // The plan caps at MaxAggregationMembers via PrepareCreate; resolver itself + // stays allocation-free and O(1) through the byProvider index. + if len(plan.byProvider["qoder"]) != 200 { + t.Fatalf("index size = %d", len(plan.byProvider["qoder"])) + } +} diff --git a/internal/executor/chat.go b/internal/executor/chat.go index a4968626..a143c8c5 100644 --- a/internal/executor/chat.go +++ b/internal/executor/chat.go @@ -339,8 +339,8 @@ func (e ChatExecutor) providerHasCapacity(pinnedProvider, pinnedRegion, publicMo return e.Pool.HasCapacity(query) } -func (e ChatExecutor) routeQuery(prefer, providerFilter, regionFilter, publicModel string, allowed []string, excluded map[string]struct{}, eligible func(Item) bool) RouteQuery { - return RouteQuery{ +func (e ChatExecutor) routeQuery(prefer, providerFilter, regionFilter, publicModel string, allowed []string, excluded map[string]struct{}, eligible func(Item) bool, plan ...*AggregatePlan) RouteQuery { + q := RouteQuery{ PublicModel: publicModel, PreferAccount: prefer, ProviderFilter: providerFilter, @@ -349,13 +349,23 @@ func (e ChatExecutor) routeQuery(prefer, providerFilter, regionFilter, publicMod Excluded: excluded, Eligible: eligible, } + if len(plan) > 0 && plan[0] != nil { + p := plan[0] + q.ModelResolver = p.resolver() + q.StrategyOverride = string(p.Strategy) + if p.Strategy == accounts.AggregationPriority { + q.PriorityResolver = p.priorityResolver() + } + q.WeightResolver = p.weightResolver() + } + return q } -func (e ChatExecutor) pick(requestID, prefer, providerFilter, regionFilter, publicModel string, allowed []string, excluded map[string]struct{}, eligible func(Item) bool) (Item, error) { - query := e.routeQuery(prefer, providerFilter, regionFilter, publicModel, allowed, excluded, eligible) +func (e ChatExecutor) pick(requestID, prefer, providerFilter, regionFilter, publicModel string, allowed []string, excluded map[string]struct{}, eligible func(Item) bool, plan *AggregatePlan) (Item, error) { + query := e.routeQuery(prefer, providerFilter, regionFilter, publicModel, allowed, excluded, eligible, plan) if e.Pool != nil { if item, ok := e.Pool.PickRoute(query); ok { - if retryAfter := e.Pool.RetryAfter(item, publicModel); retryAfter > 0 { + if retryAfter := e.Pool.RetryAfter(item, publicModel, query.ModelResolver); retryAfter > 0 { return Item{}, coolingPickError(item, publicModel, retryAfter) } return item, nil @@ -561,10 +571,10 @@ func coolingPickError(item Item, publicModel string, retryAfter time.Duration) e }, nil) } -func (e ChatExecutor) attemptsFor(providerFilter, regionFilter, publicModel string, allowed []string, eligible ...func(Item) bool) int { - var predicate func(Item) bool - if len(eligible) > 0 { - predicate = eligible[0] +func (e ChatExecutor) attemptsFor(providerFilter, regionFilter, publicModel string, allowed []string, predicate func(Item) bool, resolver ...func(Item) string) int { + var resolve func(Item) string + if len(resolver) > 0 { + resolve = resolver[0] } maxAttempts := e.MaxAttempts if maxAttempts <= 0 { @@ -574,7 +584,9 @@ func (e ChatExecutor) attemptsFor(providerFilter, regionFilter, publicModel stri maxAttempts = 64 } if e.Pool != nil { - if n := e.Pool.LenRoute(e.routeQuery("", providerFilter, regionFilter, publicModel, allowed, nil, predicate)); n > 0 { + query := e.routeQuery("", providerFilter, regionFilter, publicModel, allowed, nil, predicate) + query.ModelResolver = resolve + if n := e.Pool.LenRoute(query); n > 0 { if n > maxAttempts { return maxAttempts } @@ -923,11 +935,28 @@ type routeLoop struct { index int // eligible narrows candidates to one protocol capability; nil admits all. eligible func(Item) bool + // resolver maps an item to its concrete aggregated model. Nil for normal + // (non-aggregated) requests. Pure and read-only; safe under Pool.mu. + resolver func(Item) string + // plan is the immutable per-request aggregate plan; nil for normal routes. + // It carries the per-model strategy/weights used by Pool.PickRoute. + plan *AggregatePlan } func (e ChatExecutor) newRouteLoop(ctx context.Context, prefer, providerFilter string, req translate.ChatRequest) routeLoop { prefer, providerFilter, regionFilter, routing := e.prepareRouting(ctx, prefer, providerFilter, req) allowed := allowedProvidersFrom(ctx) + // Capture the aggregate resolver once from the immutable per-request plan. + // If a plan exists, the public model is virtual and must not be pinned by a + // provider prefix; the plan's members already carry provider/region. + var resolver func(Item) string + var aggPlan *AggregatePlan + if plan := aggregatePlanFrom(ctx); plan != nil { + aggPlan = plan + resolver = plan.resolver() + prefer, providerFilter, regionFilter = "", "", "" + routing = routingPlan{Source: routingPool, SessionKey: routing.SessionKey, PublicModel: req.Model} + } // A model-name region prefix (e.g. "workbuddy-cn/model") sets an explicit // region that overrides sticky-session and pin-derived regions. It // coexists with key grants: routeBaseMatches enforces both filters @@ -950,6 +979,30 @@ func (e ChatExecutor) newRouteLoop(ctx context.Context, prefer, providerFilter s regionFilter = pinRegion("", pinnedItem.Region) } } + // Per-model failover settings win over the executor global attempt budget. + // AllowFallbacks=false means the single best account only; MaxAttempts caps + // how many distinct accounts/members may be tried for one logical model. + // + // Keep aggregated routes at the same single candidate scan as normal routes: + // attemptsFor already does that scan, so a plan must not call attemptsFor and + // then LenRoute again. Only count candidates here when failover is possible. + var attempts int + if aggPlan != nil { + attempts = aggPlan.MaxAttempts + if attempts <= 0 { + attempts = 1 + } + if !aggPlan.AllowFallbacks { + attempts = 1 + } else if e.Pool != nil { + query := e.routeQuery("", providerFilter, regionFilter, req.Model, allowed, nil, nil, aggPlan) + if n := e.Pool.LenRoute(query); n > 0 && n < attempts { + attempts = n + } + } + } else { + attempts = e.attemptsFor(providerFilter, regionFilter, req.Model, allowed, nil) + } loop := routeLoop{ requestID: RequestIDFromContext(ctx), prefer: prefer, @@ -958,7 +1011,9 @@ func (e ChatExecutor) newRouteLoop(ctx context.Context, prefer, providerFilter s routing: routing, excluded: map[string]struct{}{}, allowed: allowed, - attempts: e.attemptsFor(providerFilter, regionFilter, req.Model, allowed, nil), + resolver: resolver, + plan: aggPlan, + attempts: attempts, } if routing.Source == routingPin { loop.pinned = prefer @@ -967,7 +1022,7 @@ func (e ChatExecutor) newRouteLoop(ctx context.Context, prefer, providerFilter s } func (l *routeLoop) pickNext(e ChatExecutor, publicModel string) (Item, int, error) { - item, err := e.pick(l.requestID, l.prefer, l.providerFilter, l.regionFilter, publicModel, l.allowed, l.excluded, l.eligible) + item, err := e.pick(l.requestID, l.prefer, l.providerFilter, l.regionFilter, publicModel, l.allowed, l.excluded, l.eligible, l.plan) if err != nil { // Sticky routing pins the bound provider and region before this pick. // A capacity check made before the pick races the slot: another request @@ -983,8 +1038,8 @@ func (l *routeLoop) pickNext(e ChatExecutor, publicModel string) (Item, int, err l.prefer = "" l.providerFilter = "" l.regionFilter = "" - l.attempts = e.attemptsFor(l.providerFilter, l.regionFilter, publicModel, l.allowed, l.eligible) - item, err = e.pick(l.requestID, l.prefer, l.providerFilter, l.regionFilter, publicModel, l.allowed, l.excluded, l.eligible) + l.attempts = e.attemptsFor(l.providerFilter, l.regionFilter, publicModel, l.allowed, l.eligible, l.resolver) + item, err = e.pick(l.requestID, l.prefer, l.providerFilter, l.regionFilter, publicModel, l.allowed, l.excluded, l.eligible, l.plan) } if err != nil { return Item{}, l.index, err @@ -995,12 +1050,33 @@ func (l *routeLoop) pickNext(e ChatExecutor, publicModel string) (Item, int, err l.prefer = "" if l.regionFilter == "" { l.regionFilter = pinRegion(l.regionFilter, item.Region) - l.attempts = e.attemptsFor(l.providerFilter, l.regionFilter, publicModel, l.allowed, l.eligible) + l.attempts = e.attemptsFor(l.providerFilter, l.regionFilter, publicModel, l.allowed, l.eligible, l.resolver) } l.index++ return item, attemptIndex, nil } +// attemptModel returns the concrete model used for this item. It is the +// resolved real model for aggregated requests, otherwise the public model. +// Cooldowns must be recorded against this value so different providers/models +// behind one virtual ID do not share a cooldown. +func (l routeLoop) attemptModel(item Item, req translate.ChatRequest) string { + if l.resolver != nil { + if model := l.resolver(item); model != "" { + return model + } + } + return req.Model +} + +// dispatchRequest returns the request for this attempt with an aggregated +// virtual model resolved to the concrete model chosen for this item. It only +// touches the local copy of the request; the shared Item is never modified. +func (l routeLoop) dispatchRequest(item Item, req translate.ChatRequest) translate.ChatRequest { + req.Model = l.attemptModel(item, req) + return req +} + func (l routeLoop) canFailover(classified Classified) bool { return classified.Failover && l.index < l.attempts } @@ -1099,7 +1175,7 @@ func (e ChatExecutor) ChatNonStream(ctx context.Context, req translate.ChatReque } release := func() { e.releaseInFlight(loop.requestID, poolID) } if isInProcessItem(item) || e.qoderDirect(item) { - result, classified, err := e.chatInProcessNonStreamAttempt(ctx, item, req, i) + result, classified, err := e.chatInProcessNonStreamAttempt(ctx, item, loop.dispatchRequest(item, req), i) if err == nil { result.AttemptCount = i + 1 e.observeRouting(&loop.routing, result.AccountID) @@ -1120,7 +1196,7 @@ func (e ChatExecutor) ChatNonStream(ctx context.Context, req translate.ChatReque release() return ChatResult{AttemptCount: i + 1, AccountID: item.ID, Provider: item.Provider}, err } - payload, err := json.Marshal(buildWorkerChatPayload(req, false)) + payload, err := json.Marshal(buildWorkerChatPayload(loop.dispatchRequest(item, req), false)) if err != nil { release() return ChatResult{}, err @@ -1145,7 +1221,7 @@ func (e ChatExecutor) ChatNonStream(ctx context.Context, req translate.ChatReque } classified := Classify(0, err.Error(), "", accounts.KindUnavailable, "") loop.lastErr = NewExecutionError(classified, fmt.Errorf("worker %s request failed: %w", item.ID, err)) - e.markClassified(item.ID, classified, req.Model) + e.markClassified(item.ID, classified, loop.attemptModel(item, req)) latency := int(time.Since(started).Milliseconds()) e.recordAttempt(ctx, accounts.RequestAttempt{ AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: ptrTime(time.Now().UTC()), @@ -1169,9 +1245,9 @@ func (e ChatExecutor) ChatNonStream(ctx context.Context, req translate.ChatReque classified := classifyWorkerErr(resp, msg) loop.lastErr = NewExecutionError(classified, nil) if classified.Kind == accounts.KindModelNotAvailable { - e.handleModelAvailabilityFailure(RequestIDFromContext(ctx), "worker_non_stream", item.ID, req.Model, classified) + e.handleModelAvailabilityFailure(RequestIDFromContext(ctx), "worker_non_stream", item.ID, loop.attemptModel(item, req), classified) } - e.markClassified(item.ID, classified, req.Model) + e.markClassified(item.ID, classified, loop.attemptModel(item, req)) status := accounts.AttemptStatusError if loop.canFailover(classified) { status = accounts.AttemptStatusFailover @@ -1211,7 +1287,7 @@ func (e ChatExecutor) ChatNonStream(ctx context.Context, req translate.ChatReque } e.observeRouting(&loop.routing, item.ID) e.bindSession(loop.routing, item.ID) - e.markOK(item.ID, req.Model) + e.markOK(item.ID, loop.attemptModel(item, req)) e.recordAttempt(ctx, accounts.RequestAttempt{ AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: &finished, Status: accounts.AttemptStatusOK, HTTPStatus: ptrInt(resp.StatusCode), LatencyMs: &latency, @@ -1553,7 +1629,7 @@ func (e ChatExecutor) chatStreamProxy(ctx context.Context, req translate.ChatReq adapter, ok := e.Providers.Get(itemProvider(item)) return ok && adapter.NativeResponses != nil } - loop.attempts = e.attemptsFor(loop.providerFilter, loop.regionFilter, req.Model, loop.allowed, loop.eligible) + loop.attempts = e.attemptsFor(loop.providerFilter, loop.regionFilter, req.Model, loop.allowed, loop.eligible, loop.resolver) } defer func() { result.Routing = loop.routing.Source }() startedAll := time.Now() @@ -1574,7 +1650,7 @@ func (e ChatExecutor) chatStreamProxy(ctx context.Context, req translate.ChatReq } release := func() { e.releaseInFlight(loop.requestID, poolID) } if isInProcessItem(item) || (e.qoderDirect(item) && !(preferNativeResponses && native != nil)) { - result, classified, err := e.chatInProcessStreamAttempt(ctx, item, req, native, i, preferNativeResponses) + result, classified, err := e.chatInProcessStreamAttempt(ctx, item, loop.dispatchRequest(item, req), native, i, preferNativeResponses) if err == nil { result.AttemptCount = i + 1 @@ -1595,7 +1671,7 @@ func (e ChatExecutor) chatStreamProxy(ctx context.Context, req translate.ChatReq release() return StreamResult{AttemptCount: i + 1, AccountID: item.ID, Provider: item.Provider}, err } - payload, err := json.Marshal(buildWorkerChatPayload(req, true)) + payload, err := json.Marshal(buildWorkerChatPayload(loop.dispatchRequest(item, req), true)) if err != nil { release() return StreamResult{}, err @@ -1620,7 +1696,7 @@ func (e ChatExecutor) chatStreamProxy(ctx context.Context, req translate.ChatReq } classified := Classify(0, err.Error(), "", accounts.KindUnavailable, "") loop.lastErr = NewExecutionError(classified, fmt.Errorf("worker %s stream request failed: %w", item.ID, err)) - e.markClassified(item.ID, classified, req.Model) + e.markClassified(item.ID, classified, loop.attemptModel(item, req)) latency := int(time.Since(started).Milliseconds()) e.recordAttempt(ctx, accounts.RequestAttempt{ AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: ptrTime(time.Now().UTC()), @@ -1641,9 +1717,9 @@ func (e ChatExecutor) chatStreamProxy(ctx context.Context, req translate.ChatReq classified := classifyWorkerErr(resp, msg) loop.lastErr = NewExecutionError(classified, nil) if classified.Kind == accounts.KindModelNotAvailable { - e.handleModelAvailabilityFailure(RequestIDFromContext(ctx), "worker_stream", item.ID, req.Model, classified) + e.handleModelAvailabilityFailure(RequestIDFromContext(ctx), "worker_stream", item.ID, loop.attemptModel(item, req), classified) } - e.markClassified(item.ID, classified, req.Model) + e.markClassified(item.ID, classified, loop.attemptModel(item, req)) finished := time.Now().UTC() latency := int(finished.Sub(started).Milliseconds()) status := accounts.AttemptStatusError @@ -1685,7 +1761,7 @@ func (e ChatExecutor) chatStreamProxy(ctx context.Context, req translate.ChatReq classified = Classify(0, probeErr.Error(), "", accounts.KindUnavailable, "") } loop.lastErr = NewExecutionError(classified, fmt.Errorf("worker %s stream failed before the first event: %w", item.ID, probeErr)) - e.markClassified(item.ID, classified, req.Model) + e.markClassified(item.ID, classified, loop.attemptModel(item, req)) finished := time.Now().UTC() latency := int(finished.Sub(started).Milliseconds()) status := accounts.AttemptStatusError @@ -1709,7 +1785,7 @@ func (e ChatExecutor) chatStreamProxy(ctx context.Context, req translate.ChatReq return StreamResult{AttemptCount: i + 1, AccountID: item.ID, Provider: loop.resultProvider(item)}, loop.lastErr } resp.Body = probed - e.markOK(item.ID, req.Model) + e.markOK(item.ID, loop.attemptModel(item, req)) ttfb := int(time.Since(startedAll).Milliseconds()) headerAt := time.Now().UTC() e.recordAttempt(ctx, accounts.RequestAttempt{ diff --git a/internal/executor/fefo.go b/internal/executor/fefo.go index 3ccebb83..b1297008 100644 --- a/internal/executor/fefo.go +++ b/internal/executor/fefo.go @@ -27,7 +27,10 @@ func effectiveCreditModel(item Item, publicModel string) string { // 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 + // An aggregated virtual ID must not be used to decide free/paid or to look + // up credit pricing: each member may resolve to a different real model + // with a different price. Resolve first so FEFO gates the concrete model. + model := effectiveModel(item, q) if !q.fefoNow.IsZero() { model = effectiveCreditModel(item, model) } @@ -38,8 +41,10 @@ func routeQuotaExceeded(item Item, q RouteQuery) bool { return true } if !q.fefoNow.IsZero() { - _, depleted := fefoExpiry(item, q.PublicModel, q.fefoNow) - if depleted { + if model == "" { + return false + } + if _, depleted, tracked := fefoQuotaState(item, q.fefoNow); tracked && depleted { return true } } @@ -142,14 +147,22 @@ func fefoCreditDay(expiry int64) int64 { // 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 { +func fefoCandidates(available []Item, publicModel string, now time.Time, resolver func(Item) string) []Item { if len(available) < 2 { return available } + resolved := func(item Item) string { + if resolver != nil { + if model := resolver(item); model != "" { + return model + } + } + return publicModel + } minDay := make(map[string]int64, 4) known := make(map[string]bool, 4) for _, item := range available { - expiry, _ := fefoExpiry(item, publicModel, now) + expiry, _ := fefoExpiry(item, resolved(item), now) if expiry <= 0 { continue } @@ -170,7 +183,7 @@ func fefoCandidates(available []Item, publicModel string, now time.Time) []Item out = append(out, item) continue } - expiry, _ := fefoExpiry(item, publicModel, now) + expiry, _ := fefoExpiry(item, resolved(item), now) if expiry <= 0 || fefoCreditDay(expiry) != minDay[family] { continue } diff --git a/internal/executor/ids.go b/internal/executor/ids.go index 8219613f..a7bc7b38 100644 --- a/internal/executor/ids.go +++ b/internal/executor/ids.go @@ -25,6 +25,11 @@ const ( RoutingStrategyWeightedRoundRobin = accounts.RoutingStrategyWeightedRoundRobin RoutingStrategyFillFirst = accounts.RoutingStrategyFillFirst RoutingStrategyFEFO = accounts.RoutingStrategyFEFO + RoutingStrategyLeastQuotaFirst = accounts.RoutingStrategyLeastQuotaFirst + RoutingStrategyMostQuotaFirst = accounts.RoutingStrategyMostQuotaFirst + // AggregationStrategyPriority is a per-model strategy that walks members + // in configured priority order. It is only meaningful for aggregated routes. + AggregationStrategyPriority = string(accounts.AggregationPriority) ) func NormalizeRoutingStrategy(strategy string) string { diff --git a/internal/executor/pool.go b/internal/executor/pool.go index a24399fe..667ecb41 100644 --- a/internal/executor/pool.go +++ b/internal/executor/pool.go @@ -118,6 +118,19 @@ type RouteQuery struct { // protocol (for example native Responses input the chat form cannot // carry). Nil admits every item. Eligible func(Item) bool + // ModelResolver, when set, maps an item to the concrete model it should + // serve for this request (used by aggregated/virtual model IDs). It MUST be + // a pure read-only function over an immutable per-request snapshot: no Pool + // calls, no facade/DB/network access, no shared state writes. It is invoked + // while Pool.mu is held, so keeping it side-effect free avoids deadlocks and + // lock-order inversions. Nil preserves the historical PublicModel behavior. + ModelResolver func(Item) string + // Aggregation routing overrides. When set, these steer a virtual model's + // per-model strategy instead of the global pool strategy. All are pure + // read-only functions over the immutable per-request plan. + StrategyOverride string + PriorityResolver func(Item) int + WeightResolver func(Item) int // 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 @@ -127,6 +140,18 @@ type RouteQuery struct { percentFloorDefault float64 } +// effectiveModel returns the concrete model to match/cooldown for an item. +// Without a resolver this is exactly PublicModel, so all existing routes are +// byte-for-byte equivalent. +func effectiveModel(item Item, q RouteQuery) string { + if q.ModelResolver != nil { + if resolved := q.ModelResolver(item); resolved != "" { + return resolved + } + } + return q.PublicModel +} + func itemRegion(item Item) string { return NormalizeRegion(item.Region) } @@ -320,6 +345,17 @@ func itemWeight(item Item) int { return NormalizeWeight(item.Weight) } +// routeItemWeight prefers an aggregation member's configured weight over the +// account weight when this is an aggregated route. Member weights are already +// normalized by accounts.PrepareCreateAggregation (1..1_000_000), so they are +// used as-is; only account weights go through NormalizeWeight (1..100). +func routeItemWeight(item Item, q RouteQuery) int { + if q.WeightResolver != nil { + return q.WeightResolver(item) + } + return itemWeight(item) +} + func itemReady(item Item) bool { return item.Ready == nil || *item.Ready } @@ -382,15 +418,15 @@ func routeBlockedByQuota(item Item, q RouteQuery) bool { if !routeQuotaExceeded(item, q) { return false } - return routeReadyAndScoped(item, q) && itemCouldServeModel(item, q.PublicModel) + return routeReadyAndScoped(item, q) && itemCouldServeModel(item, effectiveModel(item, q)) } func routeMatches(item Item, q RouteQuery) bool { - return routeBaseMatches(item, q) && itemHasModel(item, q.PublicModel) + return routeBaseMatches(item, q) && itemHasModel(item, effectiveModel(item, q)) } func routeHintMatches(item Item, q RouteQuery) bool { - return routeBaseMatches(item, q) && itemCouldServeModel(item, q.PublicModel) + return routeBaseMatches(item, q) && itemCouldServeModel(item, effectiveModel(item, q)) } type Pool struct { @@ -449,6 +485,22 @@ func providerFilterKey(q RouteQuery) string { return "*" } +// effectiveRoutingStrategy resolves the strategy actually used for one query. +// Model pools may override the global pool strategy; every route helper must +// agree with PickRoute or retry counts and quota gates diverge from selection. +func (p *Pool) effectiveRoutingStrategy(q RouteQuery) string { + strategy := p.routingStrategy + if q.StrategyOverride != "" { + raw := strings.ToLower(strings.TrimSpace(q.StrategyOverride)) + if raw == AggregationStrategyPriority { + strategy = AggregationStrategyPriority + } else { + strategy = NormalizeRoutingStrategy(q.StrategyOverride) + } + } + return strategy +} + func NewPool(urls []string, ids []string) *Pool { items := make([]Item, 0, len(urls)) for i, url := range urls { @@ -564,7 +616,7 @@ func (p *Pool) LenRoute(q RouteQuery) int { } p.mu.Lock() defer p.mu.Unlock() - if p.routingStrategy == RoutingStrategyFEFO { + if p.effectiveRoutingStrategy(q) == RoutingStrategyFEFO { q.fefoNow = time.Now() } q.creditFloorDefault = p.defaultCreditFloor @@ -589,7 +641,7 @@ func (p *Pool) HasCapacity(q RouteQuery) bool { p.mu.Lock() defer p.mu.Unlock() now := time.Now() - if p.routingStrategy == RoutingStrategyFEFO { + if p.effectiveRoutingStrategy(q) == RoutingStrategyFEFO { q.fefoNow = now } q.creditFloorDefault = p.defaultCreditFloor @@ -612,7 +664,7 @@ func (p *Pool) QuotaBlockedForModel(q RouteQuery) (Item, bool) { } p.mu.Lock() defer p.mu.Unlock() - if p.routingStrategy == RoutingStrategyFEFO { + if p.effectiveRoutingStrategy(q) == RoutingStrategyFEFO { q.fefoNow = time.Now() } q.creditFloorDefault = p.defaultCreditFloor @@ -662,7 +714,8 @@ func (p *Pool) PickRoute(q RouteQuery) (Item, bool) { p.mu.Lock() defer p.mu.Unlock() now := time.Now() - if p.routingStrategy == RoutingStrategyFEFO { + strategy := p.effectiveRoutingStrategy(q) + if strategy == RoutingStrategyFEFO { q.fefoNow = now } q.creditFloorDefault = p.defaultCreditFloor @@ -685,7 +738,7 @@ func (p *Pool) PickRoute(q RouteQuery) (Item, bool) { } if pinned != nil { if _, skip := q.Excluded[pinned.ID]; !skip { - if routeModel(q.PublicModel) != "" && !itemCouldServeModel(*pinned, q.PublicModel) { + if routeModel(q.PublicModel) != "" && !itemCouldServeModel(*pinned, effectiveModel(*pinned, q)) { return Item{}, false } if routeMatches(*pinned, q) && !itemDown(*pinned, now) && @@ -733,7 +786,21 @@ func (p *Pool) PickRoute(q RouteQuery) (Item, bool) { } return best, found } - sort.Slice(available, func(i, j int) bool { return available[i].ID < available[j].ID }) + // Priority strategy: order candidates by the aggregation member's + // configured priority (lower first), then ID for a stable tie-break. The + // existing failover loop excludes the picked account on error, which + // naturally falls through to the next priority. + if strategy == AggregationStrategyPriority && q.PriorityResolver != nil { + sort.SliceStable(available, func(i, j int) bool { + pi, pj := q.PriorityResolver(available[i]), q.PriorityResolver(available[j]) + if pi != pj { + return pi < pj + } + return available[i].ID < available[j].ID + }) + } else { + sort.Slice(available, func(i, j int) bool { return available[i].ID < available[j].ID }) + } key := rotationKey(q) p.ensureRotationKey(key) // When the caller has not pinned a region, keep serving the region this @@ -744,7 +811,7 @@ func (p *Pool) PickRoute(q RouteQuery) (Item, bool) { // pick the region with the most candidates and remember it — starting at // the alphabetically first account would otherwise let one small region // capture the route. - if q.RegionFilter == "" { + if q.RegionFilter == "" && !isQuotaRoutingStrategy(strategy) { if previous, ok := p.lastRegion[key]; ok { // The latch is a hint, not a commitment: the pool can change // underneath it. Keep the remembered region only while it still @@ -767,17 +834,31 @@ 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 strategy == RoutingStrategyFEFO { + available = fefoCandidates(available, q.PublicModel, now, q.ModelResolver) + } + // Priority order always uses the highest-priority available member; on + // failure the route loop excludes it and the next retry takes the next one. + if strategy == AggregationStrategyPriority { + picked := available[0] + p.lastPicked[key] = picked.ID + p.lastRegion[key] = itemRegion(picked) + return picked, true } - if p.routingStrategy == RoutingStrategyFillFirst { - picked := pickFillFirst(available) + if strategy == RoutingStrategyLeastQuotaFirst || strategy == RoutingStrategyMostQuotaFirst { + picked := pickQuotaStrategy(available, strategy == RoutingStrategyMostQuotaFirst) p.lastPicked[key] = picked.ID p.lastRegion[key] = itemRegion(picked) return picked, true } - if p.routingStrategy == RoutingStrategyWeightedRoundRobin { - weighted, ok := p.pickWeighted(available, key) + if strategy == RoutingStrategyFillFirst { + picked := pickFillFirstWithWeight(available, q) + p.lastPicked[key] = picked.ID + p.lastRegion[key] = itemRegion(picked) + return picked, true + } + if strategy == RoutingStrategyWeightedRoundRobin { + weighted, ok := p.pickWeighted(available, key, q) if !ok { picked := available[successorIndex(available, p.lastPicked[key])] p.lastPicked[key] = picked.ID @@ -797,27 +878,79 @@ func (p *Pool) PickRoute(q RouteQuery) (Item, bool) { } func pickFillFirst(available []Item) Item { + return pickFillFirstWithWeight(available, RouteQuery{}) +} + +func pickFillFirstWithWeight(available []Item, q RouteQuery) Item { picked := available[0] for _, item := range available[1:] { - if itemWeight(item) > itemWeight(picked) || - (itemWeight(item) == itemWeight(picked) && item.ID < picked.ID) { + if routeItemWeight(item, q) > routeItemWeight(picked, q) || + (routeItemWeight(item, q) == routeItemWeight(picked, q) && item.ID < picked.ID) { picked = item } } return picked } +func isQuotaRoutingStrategy(strategy string) bool { + return strategy == RoutingStrategyLeastQuotaFirst || strategy == RoutingStrategyMostQuotaFirst +} + +// quotaRemainingRatio returns the account's remaining quota as 0..1. Quota +// units differ across providers, so absolute Remaining values are not +// comparable; remaining/total is used when available, otherwise the used +// Percentage is converted to a remaining ratio. Unknown quota sorts last. +func quotaRemainingRatio(item Item) (float64, bool) { + q := item.Quota + if q == nil || q.Exceeded { + return 0, false + } + if q.Total > 0 { + ratio := q.Remaining / q.Total + if ratio < 0 { + ratio = 0 + } else if ratio > 1 { + ratio = 1 + } + return ratio, true + } + // Percentage is only meaningful when the provider actually reported one. + // A snapshot with neither Total nor Percentage is unknown (zero value means + // "unknown" in accounts.QuotaSnapshot), so it must not sort as 100% remaining. + if q.Percentage > 0 && q.Percentage <= 100 { + return (100 - q.Percentage) / 100, true + } + return 0, false +} + +func pickQuotaStrategy(available []Item, most bool) Item { + picked := available[0] + pickedRatio, pickedKnown := quotaRemainingRatio(picked) + for _, item := range available[1:] { + ratio, known := quotaRemainingRatio(item) + switch { + case known && !pickedKnown: + picked, pickedRatio, pickedKnown = item, ratio, true + case !known && pickedKnown: + continue + case known == pickedKnown && ((most && ratio > pickedRatio) || (!most && ratio < pickedRatio) || (ratio == pickedRatio && item.ID < picked.ID)): + picked, pickedRatio, pickedKnown = item, ratio, known + } + } + return picked +} + // pickWeighted runs smooth weighted round-robin when candidates have differing // weights. It reports false when every candidate shares one weight, which // leaves plain round-robin in charge: with a uniform pool the two are // equivalent, and the ID cursor is what keeps rotation stable across a // changing candidate set. -func (p *Pool) pickWeighted(available []Item, key string) (Item, bool) { +func (p *Pool) pickWeighted(available []Item, key string, q RouteQuery) (Item, bool) { total := int64(0) uniform := true - first := itemWeight(available[0]) + first := routeItemWeight(available[0], q) for _, item := range available { - weight := int64(itemWeight(item)) + weight := int64(routeItemWeight(item, q)) total += weight if weight != int64(first) { uniform = false @@ -838,7 +971,7 @@ func (p *Pool) pickWeighted(available []Item, key string) (Item, bool) { best := -1 var bestCurrent int64 for i := range available { - current := p.weightCounter[key][available[i].ID] + int64(itemWeight(available[i])) + current := p.weightCounter[key][available[i].ID] + int64(routeItemWeight(available[i], q)) p.weightCounter[key][available[i].ID] = current if best < 0 || current > bestCurrent { best = i @@ -950,7 +1083,7 @@ func itemSaturated(item Item) bool { // itemModelDown applies the per-model cooldown: one model hitting a limit // must not take the whole account offline for other models. func itemModelDown(item Item, q RouteQuery, now time.Time) bool { - model := cooldownModel(item, q.PublicModel) + model := cooldownModel(item, effectiveModel(item, q)) if model == "" { return false } @@ -966,7 +1099,7 @@ func cooldownModel(item Item, publicModel string) string { // considering both account-level and model-level cooldowns. func resumeAt(item Item, q RouteQuery) time.Time { next := item.DownUntil - model := cooldownModel(item, q.PublicModel) + model := cooldownModel(item, effectiveModel(item, q)) if model != "" { if until, ok := item.ModelDownUntil[model]; ok && (next.IsZero() || until.After(next)) { next = until @@ -991,11 +1124,15 @@ func (p *Pool) CooldownScope(item Item, publicModel string) string { // RetryAfter reports how long the selected item remains unavailable for a route. // PickRoute may return a cooling item as a retry hint; callers must check this // value before dispatching the request. -func (p *Pool) RetryAfter(item Item, publicModel string) time.Duration { +func (p *Pool) RetryAfter(item Item, publicModel string, resolver ...func(Item) string) time.Duration { if p == nil { return 0 } - until := resumeAt(item, RouteQuery{PublicModel: publicModel}) + q := RouteQuery{PublicModel: publicModel} + if len(resolver) > 0 && resolver[0] != nil { + q.ModelResolver = resolver[0] + } + until := resumeAt(item, q) if until.IsZero() { return 0 } @@ -1799,6 +1936,34 @@ func (p *Pool) Items() []Item { return items } +// RoutableItems returns a snapshot of accounts that can currently serve the +// route. Unlike PickRoute it never touches rotation cursors, region latches, +// or weight counters, so diagnostic probes cannot skew live scheduling. +func (p *Pool) RoutableItems(q RouteQuery) []Item { + if p == nil { + return nil + } + p.mu.Lock() + defer p.mu.Unlock() + // Probe/default probe routes have no FEFO batch; keep the gate consistent + // with the caller while never mutating scheduler state. + if p.routingStrategy == RoutingStrategyFEFO && q.fefoNow.IsZero() { + q.fefoNow = time.Now() + } + now := time.Now() + items := make([]Item, 0, len(p.items)) + for _, item := range p.items { + if !routeMatches(item, q) { + continue + } + if itemDown(item, now) || itemModelDown(item, q, now) || itemSaturated(item) { + continue + } + items = append(items, item.clone()) + } + return items +} + func (p *Pool) SetObserver(observer PoolObserver) { if p == nil { return diff --git a/internal/executor/pool_test.go b/internal/executor/pool_test.go index b6c93013..d60b2098 100644 --- a/internal/executor/pool_test.go +++ b/internal/executor/pool_test.go @@ -3,6 +3,8 @@ package executor import ( "testing" "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" ) func TestRoundRobinSkipsDownAccounts(t *testing.T) { @@ -309,6 +311,76 @@ func TestFillFirstUsesHighestPriorityUntilUnavailable(t *testing.T) { } } +func TestQuotaStrategiesRankByRemainingRatio(t *testing.T) { + newPool := func(strategy string) *Pool { + p := NewPool(nil, nil) + p.SetRoutingStrategy(strategy) + p.Upsert(Item{ID: "unknown", Quota: nil}) + p.Upsert(Item{ID: "mid", Quota: &QuotaSnapshot{Remaining: 50, Total: 100}}) + p.Upsert(Item{ID: "low", Quota: &QuotaSnapshot{Remaining: 10, Total: 100}}) + p.Upsert(Item{ID: "high", Quota: &QuotaSnapshot{Percentage: 10}}) + return p + } + + p := newPool(RoutingStrategyLeastQuotaFirst) + if item, ok := p.Pick("", nil); !ok || item.ID != "low" { + t.Fatalf("least quota first = %+v, ok=%v", item, ok) + } + excluded := map[string]struct{}{"low": {}} + if item, ok := p.Pick("", excluded); !ok || item.ID != "mid" { + t.Fatalf("least quota fallback = %+v, ok=%v", item, ok) + } + + p = newPool(RoutingStrategyMostQuotaFirst) + if item, ok := p.Pick("", nil); !ok || item.ID != "high" { + t.Fatalf("most quota first = %+v, ok=%v", item, ok) + } + excluded = map[string]struct{}{"high": {}} + if item, ok := p.Pick("", excluded); !ok || item.ID != "mid" { + t.Fatalf("most quota fallback = %+v, ok=%v", item, ok) + } + + p = newPool(RoutingStrategyMostQuotaFirst) + if item, ok := p.Pick("", map[string]struct{}{"high": {}, "mid": {}}); !ok || item.ID != "low" { + t.Fatalf("unknown quota must sort after known: %+v, ok=%v", item, ok) + } +} + +func TestModelPoolQuotaStrategyOverride(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ID: "low", Quota: &QuotaSnapshot{Remaining: 1, Total: 100}}) + p.Upsert(Item{ID: "high", Quota: &QuotaSnapshot{Remaining: 99, Total: 100}}) + item, ok := p.PickRoute(RouteQuery{StrategyOverride: string(accounts.AggregationLeastQuotaFirst)}) + if !ok || item.ID != "low" { + t.Fatalf("aggregation least quota override = %+v, ok=%v", item, ok) + } +} + +func TestFEFOStrategyOverrideAppliesToCandidates(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ + ID: "expired", + Quota: &QuotaSnapshot{ + Packages: []accounts.QuotaPackage{{ + Scope: accounts.QuotaPackageScopeAccountFEFO, + Unit: "credits", + Remain: 10, + EndsAt: time.Now().Add(-time.Hour).Unix(), + }}, + }, + }) + q := RouteQuery{PublicModel: "paid", StrategyOverride: RoutingStrategyFEFO} + if n := p.LenRoute(q); n != 0 { + t.Fatalf("FEFO override must exclude depleted package from candidate count, got %d", n) + } + if p.HasCapacity(q) { + t.Fatal("FEFO override must exclude depleted package from capacity") + } + if item, ok := p.PickRoute(q); ok { + t.Fatalf("FEFO override must exclude depleted package from selection, got %+v", item) + } +} + func TestModelCooldownLeavesOtherModelsAvailable(t *testing.T) { p := NewPool([]string{"http://a:3020"}, []string{"a"}) p.MarkClassified("a", Classified{Kind: KindRateLimit, Cooldown: time.Hour, Failover: true, Model: "glm-5.3"}) @@ -688,3 +760,26 @@ func TestUpsertPreservesInFlight(t *testing.T) { t.Fatalf("Upsert must keep InFlight, got %d", item.InFlight) } } + +func TestQuotaRemainingRatioTreatsZeroSnapshotAsUnknown(t *testing.T) { + if _, known := quotaRemainingRatio(Item{Quota: &accounts.QuotaSnapshot{}}); known { + t.Fatal("empty quota snapshot must be unknown, not 100% remaining") + } + if ratio, known := quotaRemainingRatio(Item{Quota: &accounts.QuotaSnapshot{Percentage: 40}}); !known || ratio != 0.6 { + t.Fatalf("percentage-only ratio = %v known=%v, want 0.6/true", ratio, known) + } + if ratio, known := quotaRemainingRatio(Item{Quota: &accounts.QuotaSnapshot{Total: 10, Remaining: 3}}); !known || ratio != 0.3 { + t.Fatalf("total/remaining ratio = %v known=%v, want 0.3/true", ratio, known) + } +} + +func TestPickQuotaStrategySortsUnknownQuotaLast(t *testing.T) { + unknown := Item{ID: "unknown", Quota: &accounts.QuotaSnapshot{}} + known := Item{ID: "known", Quota: &accounts.QuotaSnapshot{Total: 10, Remaining: 5}} + if picked := pickQuotaStrategy([]Item{unknown, known}, true); picked.ID != "known" { + t.Fatalf("most-quota-first picked %q, want known (unknown quota sorts last)", picked.ID) + } + if picked := pickQuotaStrategy([]Item{unknown, known}, false); picked.ID != "known" { + t.Fatalf("least-quota-first picked %q, want known (unknown quota sorts last)", picked.ID) + } +} diff --git a/internal/executor/prepare.go b/internal/executor/prepare.go index 95e552c8..3dd3c460 100644 --- a/internal/executor/prepare.go +++ b/internal/executor/prepare.go @@ -38,6 +38,13 @@ type CatalogPreparer interface { EnsureModelCatalogs(ctx context.Context, force bool) } +// AggregationResolver resolves a logical model ID to a read-only snapshot of +// its provider/model members. Implemented by control.Aggregations and injected +// by the gateway. The executor never imports control directly. +type AggregationResolver interface { + Resolve(ctx context.Context, id string, allowedProviders map[string]bool) (accounts.Aggregation, error) +} + type RequestStarter interface { Start(entry accounts.RequestLog) } @@ -69,6 +76,7 @@ type PrepareInput struct { NewRequestID func() string ModelContexts ModelContextStore Catalogs CatalogPreparer + Aggregations AggregationResolver Logs RequestStarter } @@ -112,6 +120,17 @@ func (e ChatExecutor) Prepare(in PrepareInput) (PreparedRequest, error) { Message: "cross-provider model pool is disabled; use a provider-prefixed model ID such as qoder/glm-5.2", } } + // Resolve a logical aggregation model into an immutable per-request plan. + // This happens once, before any Pool lock, and the plan is carried in the + // context so routing uses a stable snapshot (no DB/facade access under lock, + // no cross-request mutable state). + var aggregatePlan *AggregatePlan + if in.Aggregations != nil && (in.CrossProviderPool || in.ModelAggregation) && ProviderPrefix(publicModel) == "" { + if plan, ok := e.resolveAggregation(in.Context, in.Aggregations, publicModel, in.Identity.AllowedProviders); ok { + aggregatePlan = plan + } + } + providerFilter, modelRegion := ResolveProviderFilter(&request, in.CrossProviderPool || in.ModelAggregation) prefer := strings.TrimSpace(in.PreferAccount) providerFilter = ApplyPinnedProviderFilter(e.Pool, providerFilter, publicModel, prefer) @@ -161,7 +180,13 @@ func (e ChatExecutor) Prepare(in PrepareInput) (PreparedRequest, error) { MessageRoles: translate.MessageRoles(request.Messages), }) } - ctx := WithAllowedProviders(WithRequestID(in.Context, requestID), in.Identity.AllowedProviders) + effectiveAllow := in.Identity.AllowedProviders + if aggregatePlan != nil && accounts.IsAggregationOnly(in.Identity.AllowedProviders) { + // The sentinel grant must not filter real member accounts at the pool + // layer; membership is already constrained by the resolved plan. + effectiveAllow = nil + } + ctx := WithAllowedProviders(WithRequestID(in.Context, requestID), effectiveAllow) sessionKey := sessionKeyFor(in.SessionHeader, in.ConversationID, in.Identity, request) if sessionKey == "" && in.NativeRequest != nil { sessionKey = NativeSessionKeyFor(in.NativeRequest, in.Identity) @@ -186,6 +211,9 @@ func (e ChatExecutor) Prepare(in PrepareInput) (PreparedRequest, error) { if requestedReasoning != "" { log.Printf("request reasoning request_id=%q model=%q level=%q", requestID, request.Model, requestedReasoning) } + if aggregatePlan != nil { + ctx = WithAggregatePlan(ctx, aggregatePlan) + } if sessionKey != "" && sessionAffinityDebugOn() { source := "content-seed" if strings.TrimSpace(in.SessionHeader) != "" { @@ -210,6 +238,36 @@ func (e ChatExecutor) Prepare(in PrepareInput) (PreparedRequest, error) { }, nil } +// resolveAggregation attempts to resolve a bare public model ID as a logical +// aggregation model. It returns false for ordinary models so the normal route +// path is unchanged. Provider grants are reduced to a family set used to +// filter members; an empty allowlist means "all providers allowed" (nil map). +func (e ChatExecutor) resolveAggregation(ctx context.Context, resolver AggregationResolver, model string, grants []string) (*AggregatePlan, bool) { + allowed := map[string]bool(nil) + // An aggregation-only key must not filter members by its own sentinel + // grant (that would drop every real provider). nil means "no member + // filtering"; the pool-level allowlist is cleared for these requests too. + if accounts.IsAggregationOnly(grants) { + allowed = nil + } else if len(grants) > 0 { + allowed = make(map[string]bool, len(grants)) + for _, entry := range grants { + // ParseProviderGrant already lowercases and trims; do not pre-fold + // here so malformed entries keep their strict fail-closed behavior. + grant, err := accounts.ParseProviderGrant(entry) + if err != nil || grant.Provider == accounts.AggregationProvider { + continue + } + allowed[grant.Provider] = true + } + } + agg, err := resolver.Resolve(ctx, model, allowed) + if err != nil || len(agg.Members) == 0 { + return nil, false + } + return NewAggregatePlan(agg), true +} + // providerPrefixes are the provider segments a client may pin with a leading // "/" model id. Command Code's own model ids are org-namespaced // ("deepseek/…", "moonshotai/…"), so its provider prefix sits in front of an diff --git a/internal/executor/probe.go b/internal/executor/probe.go new file mode 100644 index 00000000..6bc38402 --- /dev/null +++ b/internal/executor/probe.go @@ -0,0 +1,279 @@ +package executor + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "sort" + "strings" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/providers" + "github.com/caigee-cmd/cli2api/internal/translate" +) + +// ProbeAccountResult is the outcome for one model on one account. +type ProbeAccountResult struct { + AccountID string `json:"account_id"` + Provider string `json:"provider,omitempty"` + Region string `json:"region,omitempty"` + OK bool `json:"ok"` + Status int `json:"status,omitempty"` + Code string `json:"code,omitempty"` + Kind string `json:"kind,omitempty"` + Message string `json:"message,omitempty"` + LatencyMS int `json:"latency_ms"` +} + +// ProbeModelResult is the outcome for one model across every currently +// routable account. A probe never starts a request log, changes cooldowns, +// or refreshes the catalog cache. +type ProbeModelResult struct { + Model string `json:"model"` + OK bool `json:"ok"` + AccountID string `json:"account_id,omitempty"` + Provider string `json:"provider,omitempty"` + Status int `json:"status,omitempty"` + Code string `json:"code,omitempty"` + Kind string `json:"kind,omitempty"` + Message string `json:"message,omitempty"` + LatencyMS int `json:"latency_ms"` + AttemptCount int `json:"attempt_count,omitempty"` + Accounts []ProbeAccountResult `json:"accounts"` +} + +// probeAttempts bounds live upstream calls made by all model probes combined. +// One operator action can check many models across many accounts; without a +// shared cap a single click could open hundreds of upstream requests at once. +const maxConcurrentProbeAttempts = 8 + +var probeAttemptSem = make(chan struct{}, maxConcurrentProbeAttempts) + +// ProbeModel checks publicModel against every currently routable account. It +// reuses normal routing and provider adapters, but caps output at one token so +// a full account/model matrix check stays cheap. Unlike a chat failover loop, +// it never stops after the first working account: the operator needs to know +// which accounts actually serve the model. +func (e ChatExecutor) ProbeModel(ctx context.Context, publicModel string) ProbeModelResult { + result := ProbeModelResult{Model: publicModel, Accounts: []ProbeAccountResult{}} + publicModel = strings.TrimSpace(publicModel) + if publicModel == "" { + result.Message = "model required" + return result + } + if ctx == nil { + ctx = context.Background() + } + probeCtx, cancel := context.WithTimeout(ctx, 10*time.Minute) + defer cancel() + + oneToken := json.RawMessage("1") + request := translate.ChatRequest{ + Model: publicModel, + Messages: []translate.ChatMessage{{Role: "user", Content: "hi"}}, + Stream: false, + MaxTokens: oneToken, + MaxCompletionTokens: append(json.RawMessage(nil), oneToken...), + ReasoningEffort: json.RawMessage(`"none"`), + Thinking: providers.DisabledThinkingFieldJSON(), + } + // Console model ids are provider-prefixed when the shared pool is off and + // bare when it is on. Resolve prefixes while allowing both; explicit + // region prefixes still pin the route. + providerFilter, modelRegion := ResolveProviderFilter(&request, true) + routeModel := request.Model + regionFilter := regionFilterFromContext(probeCtx) + if regionFilter == "" { + regionFilter = modelRegion + } + allowed := allowedProvidersFrom(probeCtx) + + items := e.probeAccounts(providerFilter, regionFilter, routeModel, allowed) + if len(items) == 0 { + result.Message = "no accounts available" + return result + } + + started := time.Now() + firstOK := -1 + firstFailure := -1 +probeAccountsLoop: + for _, item := range items { + // If the operator request (or the batch deadline) is gone, stop making + // new upstream calls instead of marking every remaining account as a + // client cancellation. + if err := probeCtx.Err(); err != nil { + break + } + accountResult := ProbeAccountResult{ + AccountID: item.ID, + Provider: firstNonEmpty(item.Provider, providerFilter), + Region: item.Region, + } + if !e.acquireInFlight("", item.ID) { + accountResult.Code = "account_busy" + accountResult.Kind = accounts.KindRateLimit + accountResult.Message = "account is at capacity" + result.Accounts = append(result.Accounts, accountResult) + if firstFailure < 0 { + firstFailure = len(result.Accounts) - 1 + } + continue + } + // Bound the number of simultaneous live calls across all probe batches. + select { + case probeAttemptSem <- struct{}{}: + case <-probeCtx.Done(): + e.releaseInFlight("", item.ID) + break probeAccountsLoop + } + accountStarted := time.Now() + accountCtx, accountCancel := context.WithTimeout(probeCtx, 15*time.Second) + probeErr := e.probeModelAttempt(accountCtx, item, request) + // Capture the deadline state before cancel(): cancel() always sets Err() + // to Canceled, which would hide a genuine probe-owned timeout. + accountTimedOut := errors.Is(accountCtx.Err(), context.DeadlineExceeded) + accountCancel() + <-probeAttemptSem + e.releaseInFlight("", item.ID) + accountResult.LatencyMS = int(time.Since(accountStarted).Milliseconds()) + if probeErr == nil { + accountResult.OK = true + accountResult.Status = http.StatusOK + result.Accounts = append(result.Accounts, accountResult) + if firstOK < 0 { + firstOK = len(result.Accounts) - 1 + } + continue + } + // A deadline owned by this probe is an upstream timeout, not a client + // cancellation. Only a cancelled parent request is a real cancellation. + if errors.Is(probeErr, context.DeadlineExceeded) && ctx.Err() == nil && accountTimedOut { + accountResult.Status = http.StatusBadGateway + accountResult.Code = "probe_timeout" + accountResult.Kind = accounts.KindUnavailable + accountResult.Message = "upstream probe timed out" + } else { + classified := classifyProbeError(probeErr) + accountResult.Status = classified.Status + accountResult.Code = classified.Code + accountResult.Kind = classified.Kind + accountResult.Message = classified.Message + } + result.Accounts = append(result.Accounts, accountResult) + if firstFailure < 0 { + firstFailure = len(result.Accounts) - 1 + } + } + + result.AttemptCount = len(result.Accounts) + result.LatencyMS = int(time.Since(started).Milliseconds()) + if firstOK >= 0 { + okAccount := result.Accounts[firstOK] + result.OK = true + result.AccountID = okAccount.AccountID + result.Provider = okAccount.Provider + result.LatencyMS = okAccount.LatencyMS + return result + } + if firstFailure >= 0 { + failed := result.Accounts[firstFailure] + result.Status = failed.Status + result.Code = failed.Code + result.Kind = failed.Kind + result.Message = fmt.Sprintf("all %d account checks failed; first error: %s", len(result.Accounts), failed.Message) + } + return result +} + +// probeAccounts enumerates every currently routable account for the model. +// It uses a read-only Pool snapshot so probing never advances rotation cursors, +// region latches, or weight counters used by live traffic. +func (e ChatExecutor) probeAccounts(providerFilter, regionFilter, publicModel string, allowed []string) []Item { + if e.Pool == nil { + return nil + } + q := RouteQuery{ + PublicModel: publicModel, + ProviderFilter: providerFilter, + RegionFilter: regionFilter, + AllowedProviders: allowed, + } + items := e.Pool.RoutableItems(q) + sort.Slice(items, func(i, j int) bool { + if items[i].Provider != items[j].Provider { + return items[i].Provider < items[j].Provider + } + return items[i].ID < items[j].ID + }) + return items +} + +func (e ChatExecutor) probeModelAttempt(ctx context.Context, item Item, request translate.ChatRequest) error { + if isInProcessItem(item) || e.qoderDirect(item) { + if e.Providers == nil { + return fmt.Errorf("provider registry unavailable") + } + adapter, ok := e.Providers.Get(itemProvider(item)) + if !ok || adapter.Chat == nil { + return fmt.Errorf("provider %s does not implement chat", itemProvider(item)) + } + _, err := adapter.Chat.ChatNonStream(ctx, item.ID, sanitizeForItem(item, request)) + return err + } + + payload, err := json.Marshal(buildWorkerChatPayload(request, false)) + if err != nil { + return err + } + httpReq, err := e.newWorkerRequest(ctx, item, payload, item.ID) + if err != nil { + return err + } + client := e.HTTPClient + if client == nil { + client = http.DefaultClient + } + resp, err := client.Do(httpReq) + if err != nil { + return NewExecutionError(Classified{ + Kind: accounts.KindUnavailable, Status: http.StatusBadGateway, + Code: "probe_request_failed", Message: err.Error(), Failover: true, + }, err) + } + defer resp.Body.Close() + body, _ := io.ReadAll(io.LimitReader(resp.Body, maxWorkerResponseBytes)) + if resp.StatusCode >= 300 { + classified := classifyWorkerErr(resp, string(body)) + return NewExecutionError(classified, nil) + } + if _, err := decodeChatResult(request, bytes.TrimSpace(body)); err != nil { + return NewExecutionError(Classified{ + Kind: accounts.KindUnavailable, Status: http.StatusBadGateway, + Code: "probe_decode_failed", Message: err.Error(), Failover: true, + }, nil) + } + return nil +} + +func classifyProbeError(err error) Classified { + classified := ClassifyError(err) + if classified.Kind == "" { + classified.Kind = accounts.KindUnavailable + } + if classified.Status == 0 { + classified.Status = http.StatusBadGateway + } + if classified.Code == "" { + classified.Code = classified.Kind + } + if classified.Message == "" && err != nil { + classified.Message = err.Error() + } + return classified +} diff --git a/internal/executor/probe_test.go b/internal/executor/probe_test.go new file mode 100644 index 00000000..5a055618 --- /dev/null +++ b/internal/executor/probe_test.go @@ -0,0 +1,163 @@ +package executor + +import ( + "context" + "net/http" + "testing" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/providers" + "github.com/caigee-cmd/cli2api/internal/translate" +) + +type probeCaptureChat struct { + req translate.ChatRequest + reqs []translate.ChatRequest + accounts []string + err error +} + +func (f *probeCaptureChat) ChatNonStream(_ context.Context, accountID string, req translate.ChatRequest) (providers.ChatOutcome, error) { + f.req = req + f.reqs = append(f.reqs, req) + f.accounts = append(f.accounts, accountID) + if f.err != nil { + return providers.ChatOutcome{}, f.err + } + return providers.ChatOutcome{Model: req.Model, Content: "OK", FinishReason: "stop"}, nil +} + +func (f *probeCaptureChat) ChatStream(_ context.Context, _ string, _ translate.ChatRequest) (*http.Response, providers.ResolvedChat, error) { + return nil, providers.ResolvedChat{}, nil +} + +func TestProbeModelUsesMinimalRequestAndDoesNotCoolAccount(t *testing.T) { + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "wb1", Provider: "workbuddy", Runtime: string(providers.RuntimeInProcess), Models: []string{"glm-5.2"}}) + chat := &probeCaptureChat{} + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "workbuddy", Chat: chat}) + e := ChatExecutor{Pool: pool, Providers: registry} + + res := e.ProbeModel(context.Background(), "glm-5.2") + if !res.OK { + t.Fatalf("probe failed: %+v", res) + } + if got := string(chat.req.MaxTokens); got != "1" { + t.Fatalf("max_tokens=%q want 1", got) + } + if got := string(chat.req.MaxCompletionTokens); got != "1" { + t.Fatalf("max_completion_tokens=%q want 1", got) + } + if !providers.RequestsDisabledThinking(chat.req) { + t.Fatal("probe must disable thinking to avoid reasoning token spend") + } + if chat.req.Stream { + t.Fatal("probe must be non-streaming") + } + if len(chat.req.Messages) != 1 || chat.req.Messages[0].Role != "user" || chat.req.Messages[0].Content != "hi" { + t.Fatalf("unexpected probe messages: %+v", chat.req.Messages) + } + if len(res.Accounts) != 1 { + t.Fatalf("account results=%d want 1: %+v", len(res.Accounts), res.Accounts) + } + item, ok := pool.ByID("wb1") + if !ok { + t.Fatal("probe account missing") + } + if !item.DownUntil.IsZero() || len(item.ModelDownUntil) != 0 { + t.Fatalf("probe must not cool the account: down=%v model=%v", item.DownUntil, item.ModelDownUntil) + } + if item.InFlight != 0 { + t.Fatalf("probe leaked in-flight slot: %d", item.InFlight) + } +} + +func TestProbeModelDoesNotMutateRoutingCursor(t *testing.T) { + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "wb1", Provider: "workbuddy", Runtime: string(providers.RuntimeInProcess), Models: []string{"glm-5.2"}}) + pool.Upsert(Item{ID: "wb2", Provider: "workbuddy", Runtime: string(providers.RuntimeInProcess), Models: []string{"glm-5.2"}}) + chat := &probeCaptureChat{} + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "workbuddy", Chat: chat}) + e := ChatExecutor{Pool: pool, Providers: registry} + + routeKey := rotationKey(RouteQuery{PublicModel: "glm-5.2"}) + pool.mu.Lock() + pool.ensureRotationKey(routeKey) + pool.lastPicked[routeKey] = "wb1" + before := pool.lastPicked[routeKey] + pool.mu.Unlock() + + _ = e.ProbeModel(context.Background(), "glm-5.2") + + pool.mu.Lock() + after := pool.lastPicked[routeKey] + pool.mu.Unlock() + if after != before { + t.Fatalf("probe mutated routing cursor: before=%q after=%q", before, after) + } +} + +func TestProbeModelChecksEveryAccountEvenAfterSuccess(t *testing.T) { + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "wb1", Provider: "workbuddy", Runtime: string(providers.RuntimeInProcess), Models: []string{"glm-5.2"}}) + pool.Upsert(Item{ID: "wb2", Provider: "workbuddy", Runtime: string(providers.RuntimeInProcess), Models: []string{"glm-5.2"}}) + chat := &probeCaptureChat{} + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "workbuddy", Chat: chat}) + e := ChatExecutor{Pool: pool, Providers: registry} + + res := e.ProbeModel(context.Background(), "glm-5.2") + if !res.OK { + t.Fatalf("probe failed: %+v", res) + } + if len(chat.accounts) != 2 { + t.Fatalf("probed accounts=%v want both wb1 and wb2", chat.accounts) + } + if len(res.Accounts) != 2 { + t.Fatalf("account results=%d want 2: %+v", len(res.Accounts), res.Accounts) + } + seen := map[string]bool{} + for _, account := range res.Accounts { + if !account.OK { + t.Fatalf("account result not OK: %+v", account) + } + seen[account.AccountID] = true + } + if !seen["wb1"] || !seen["wb2"] { + t.Fatalf("account results missing an account: %+v", res.Accounts) + } +} + +func TestProbeModelFailureDoesNotCoolAccount(t *testing.T) { + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "wb1", Provider: "workbuddy", Runtime: string(providers.RuntimeInProcess), Models: []string{"glm-5.2"}}) + chat := &probeCaptureChat{err: &providers.Error{ + Kind: accounts.KindRateLimit, + Status: http.StatusTooManyRequests, + Code: "rate_limit", + Message: "busy", + }} + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "workbuddy", Chat: chat}) + e := ChatExecutor{Pool: pool, Providers: registry} + + res := e.ProbeModel(context.Background(), "glm-5.2") + if res.OK { + t.Fatal("probe should report failure") + } + if res.Kind != accounts.KindRateLimit { + t.Fatalf("kind=%q want %q", res.Kind, accounts.KindRateLimit) + } + if len(res.Accounts) != 1 || res.Accounts[0].Kind != accounts.KindRateLimit { + t.Fatalf("account result missing failure kind: %+v", res.Accounts) + } + item, _ := pool.ByID("wb1") + if !item.DownUntil.IsZero() || len(item.ModelDownUntil) != 0 { + t.Fatalf("probe failure must not cool the account: down=%v model=%v", item.DownUntil, item.ModelDownUntil) + } + if item.InFlight != 0 { + t.Fatalf("probe leaked in-flight slot: %d", item.InFlight) + } +} diff --git a/internal/executor/providers_test.go b/internal/executor/providers_test.go index b4918372..bfdf6149 100644 --- a/internal/executor/providers_test.go +++ b/internal/executor/providers_test.go @@ -482,7 +482,7 @@ func TestNoRoutableAccountsClassifiedAs503(t *testing.T) { // permission_error, never the generic 502. func TestPickProviderNotAllowedFallback(t *testing.T) { ex := NewChatExecutor(NewPool(nil, nil), "") - _, err := ex.pick("req", "", "trae", "", "glm-5.2", []string{"workbuddy:cn"}, nil, nil) + _, err := ex.pick("req", "", "trae", "", "glm-5.2", []string{"workbuddy:cn"}, nil, nil, nil) if err == nil { t.Fatal("an ungranted provider filter must fail even with an empty pool") } diff --git a/internal/gateway/handler.go b/internal/gateway/handler.go index e630ac0a..94638d44 100644 --- a/internal/gateway/handler.go +++ b/internal/gateway/handler.go @@ -1,6 +1,7 @@ package gateway import ( + "context" "net/http" "sync/atomic" @@ -19,6 +20,7 @@ type Handler struct { Recorder *applogs.RequestRecorder ModelContexts executor.ModelContextStore Catalogs executor.CatalogPreparer + Aggregations executor.AggregationResolver Logs executor.RequestStarter CrossProviderPool *atomic.Bool Models CatalogQuery @@ -26,6 +28,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 + // MergeAggregationModels folds logical aggregation models into /v1/models. + // Injected by app so gateway does not import control/store. + MergeAggregationModels func(context.Context, []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) diff --git a/internal/gateway/models.go b/internal/gateway/models.go index b2907c8e..24046cb3 100644 --- a/internal/gateway/models.go +++ b/internal/gateway/models.go @@ -20,6 +20,10 @@ func (h *Handler) HandleModels(w http.ResponseWriter, r *http.Request) { if h != nil && h.DecorateModels != nil { models = h.DecorateModels(r, models) } + if h != nil && h.crossProviderPoolOn() && h.MergeAggregationModels != nil { + ctx := r.Context() + models = h.MergeAggregationModels(ctx, models) + } if h.crossProviderPoolOn() == false && !h.requestIdentity(r).ModelAggregation { // The gateway refuses bare ids with the pool off; serve prefixed ids so // OpenAI-compatible clients see exactly what the gateway accepts. diff --git a/internal/gateway/prepare.go b/internal/gateway/prepare.go index ad04cbba..b634be48 100644 --- a/internal/gateway/prepare.go +++ b/internal/gateway/prepare.go @@ -67,6 +67,10 @@ func (h *Handler) prepareExecution(r *http.Request, request translate.ChatReques if h != nil { catalogs = h.Catalogs } + var aggregations executor.AggregationResolver + if h != nil { + aggregations = h.Aggregations + } got, err := h.Executor.Prepare(executor.PrepareInput{ Context: ctx, Request: request, @@ -80,6 +84,7 @@ func (h *Handler) prepareExecution(r *http.Request, request translate.ChatReques ModelAggregation: identity.ModelAggregation, ModelContexts: modelContexts, Catalogs: catalogs, + Aggregations: aggregations, Logs: logs, }) if err != nil { diff --git a/internal/providers/codearts/catalog.go b/internal/providers/codearts/catalog.go index 740a3234..5f43bb01 100644 --- a/internal/providers/codearts/catalog.go +++ b/internal/providers/codearts/catalog.go @@ -24,7 +24,7 @@ type modelRecord struct { MaxTokens int64 Images bool Benefit bool - Reasoning []string + Reasoning []string // upstream spelling; normalized only when building internal caps } // fetchModels reads the account's currently billable models. Since 2026-10 @@ -135,7 +135,7 @@ func (c *Client) fetchThinkingVariants(ctx context.Context, accountID string, cr } variants := make(map[string][]string, len(out.Variants)) for model, value := range out.Variants { - options := normalizeReasoningOptions(value.Strengths) + options := providers.UniqueReasoningOptionValues(value.Strengths) if len(options) > 0 { variants[strings.ToLower(strings.TrimSpace(model))] = options } @@ -221,6 +221,7 @@ func toModelInfo(record modelRecord) providers.ModelInfo { } if options := normalizeReasoningOptions(record.Reasoning); len(options) > 0 { caps.ReasoningOptions = options + caps.ReasoningOptionValues = providers.UniqueReasoningOptionValues(record.Reasoning) caps.ReasoningDefault = defaultReasoningOption(options) for _, option := range options { if option == "none" { diff --git a/internal/providers/codex/catalog.go b/internal/providers/codex/catalog.go index 94752f80..402bcc70 100644 --- a/internal/providers/codex/catalog.go +++ b/internal/providers/codex/catalog.go @@ -58,14 +58,15 @@ func entryModelInfo(entry catalogEntry) providers.ModelInfo { } options := providers.UniqueReasoningOptions(entry.ReasoningLevels) caps := providers.ModelCapabilities{ - ContextWindow: entry.ContextWindow, - ContextWindowMax: entry.MaxContextWindow, - Tools: true, - Images: images, - Reasoning: len(options) > 0, - ReasoningOptions: options, - ReasoningDefault: providers.NormalizeReasoningLevel(entry.DefaultReasoning), - ReasoningType: "effort", + ContextWindow: entry.ContextWindow, + ContextWindowMax: entry.MaxContextWindow, + Tools: true, + Images: images, + Reasoning: len(options) > 0, + ReasoningOptions: options, + ReasoningOptionValues: providers.UniqueReasoningOptionValues(entry.ReasoningLevels), + ReasoningDefault: providers.NormalizeReasoningLevel(entry.DefaultReasoning), + ReasoningType: "effort", } return providers.ModelInfo{ NativeModel: entry.Slug, diff --git a/internal/providers/devin/catalog.go b/internal/providers/devin/catalog.go index 2114edc5..45c28670 100644 --- a/internal/providers/devin/catalog.go +++ b/internal/providers/devin/catalog.go @@ -118,7 +118,8 @@ func ParseCatalogJSON(raw []byte) ([]providers.ModelInfo, map[string][]string, e } if entry.Thinking != nil && len(entry.Thinking.Levels) > 0 { caps.Reasoning = true - caps.ReasoningOptions = append([]string(nil), entry.Thinking.Levels...) + caps.ReasoningOptions = providers.UniqueReasoningOptions(entry.Thinking.Levels) + caps.ReasoningOptionValues = providers.UniqueReasoningOptionValues(entry.Thinking.Levels) levels[id] = append([]string(nil), entry.Thinking.Levels...) } caps.Tools = true diff --git a/internal/providers/interfaces.go b/internal/providers/interfaces.go index 8894bd6b..7c65ab69 100644 --- a/internal/providers/interfaces.go +++ b/internal/providers/interfaces.go @@ -38,9 +38,12 @@ type ModelCapabilities struct { Images bool `json:"images"` Reasoning bool `json:"reasoning"` ReasoningOptions []string `json:"reasoning_options,omitempty"` - ReasoningDefault string `json:"reasoning_default,omitempty"` - ReasoningType string `json:"reasoning_type,omitempty"` - CanDisableThinking bool `json:"can_disable_thinking,omitempty"` + // ReasoningOptionValues keeps the exact upstream spelling for display. + // ReasoningOptions remains normalized for request clamping and routing. + ReasoningOptionValues []string `json:"reasoning_option_values,omitempty"` + ReasoningDefault string `json:"reasoning_default,omitempty"` + ReasoningType string `json:"reasoning_type,omitempty"` + CanDisableThinking bool `json:"can_disable_thinking,omitempty"` } type ModelInfo struct { diff --git a/internal/providers/kimi/catalog.go b/internal/providers/kimi/catalog.go index 133dd1de..a140c49a 100644 --- a/internal/providers/kimi/catalog.go +++ b/internal/providers/kimi/catalog.go @@ -147,6 +147,7 @@ func toModelInfo(record catalogRecord) providers.ModelInfo { if options := providers.UniqueReasoningOptions(efforts); len(options) > 0 { caps.ReasoningOptions = options + caps.ReasoningOptionValues = providers.UniqueReasoningOptionValues(efforts) caps.ReasoningType = "effort" caps.ReasoningDefault = resolveDefaultEffort(defaultEffort, options) caps.Reasoning = true diff --git a/internal/providers/meta/catalog.go b/internal/providers/meta/catalog.go index 674cf118..37034bf8 100644 --- a/internal/providers/meta/catalog.go +++ b/internal/providers/meta/catalog.go @@ -21,14 +21,15 @@ func modelWonder(id, display string) providers.ModelInfo { PublicModel: id, DisplayName: display, Capabilities: providers.ModelCapabilities{ - ContextWindow: 1007997, - MaxOutput: 128000, - Tools: true, - Images: true, - Reasoning: true, - ReasoningOptions: []string{"minimal", "low", "medium", "high", "xhigh", "max"}, - ReasoningDefault: "high", - CanDisableThinking: true, + ContextWindow: 1007997, + MaxOutput: 128000, + Tools: true, + Images: true, + Reasoning: true, + ReasoningOptions: []string{"minimal", "low", "medium", "high", "xhigh", "max"}, + ReasoningOptionValues: []string{"minimal", "low", "medium", "high", "xhigh", "max"}, + ReasoningDefault: "high", + CanDisableThinking: true, }, } } @@ -51,14 +52,15 @@ func modelSpark(id, display string, levels []string, images bool) providers.Mode PublicModel: id, DisplayName: display, Capabilities: providers.ModelCapabilities{ - ContextWindow: 1048576, - MaxOutput: 65536, - Tools: true, - Images: images, - Reasoning: true, - ReasoningOptions: append([]string(nil), levels...), - ReasoningDefault: def, - CanDisableThinking: true, + ContextWindow: 1048576, + MaxOutput: 65536, + Tools: true, + Images: images, + Reasoning: true, + ReasoningOptions: append([]string(nil), levels...), + ReasoningOptionValues: append([]string(nil), levels...), + ReasoningDefault: def, + CanDisableThinking: true, }, } } @@ -76,11 +78,13 @@ func capsFor(model string) providers.ModelCapabilities { } } // Unknown model: allow common Muse reasoning levels so clamp still works. + levels := []string{"minimal", "low", "medium", "high", "xhigh", "max"} return providers.ModelCapabilities{ - Reasoning: true, - ReasoningOptions: []string{"minimal", "low", "medium", "high", "xhigh", "max"}, - ReasoningDefault: "high", - Tools: true, - Images: true, + Reasoning: true, + ReasoningOptions: levels, + ReasoningOptionValues: levels, + ReasoningDefault: "high", + Tools: true, + Images: true, } } diff --git a/internal/providers/reasoning.go b/internal/providers/reasoning.go index f928c736..b11d5286 100644 --- a/internal/providers/reasoning.go +++ b/internal/providers/reasoning.go @@ -33,6 +33,36 @@ func NormalizeReasoningLevel(raw string) string { return "" } +// UniqueReasoningOptionValues keeps the upstream spelling of each reasoning +// level. Request/routing code uses NormalizeReasoningLevel instead; the console +// uses this list so it can display values such as off, minimal, or ultra +// exactly as the provider declared them. +func UniqueReasoningOptionValues(values []string) []string { + seen := map[string]struct{}{} + var options []string + for _, value := range values { + value = strings.TrimSpace(value) + if value == "" { + continue + } + key := strings.ToLower(value) + if _, dup := seen[key]; dup { + continue + } + seen[key] = struct{}{} + options = append(options, value) + } + return options +} + +// GatewayReasoningOptions returns the complete reasoning level vocabulary this +// gateway accepts from clients. Whether a level is actually forwarded is still +// decided by each provider's per-model catalog capabilities; models without a +// declared reasoning list keep their upstream default behavior. +func GatewayReasoningOptions() []string { + return []string{"none", "low", "medium", "high", "xhigh", "max"} +} + func UniqueReasoningOptions(values []string) []string { seen := map[string]struct{}{} var options []string diff --git a/internal/providers/thinking_toggle.go b/internal/providers/thinking_toggle.go index 5b2ff52b..487b163f 100644 --- a/internal/providers/thinking_toggle.go +++ b/internal/providers/thinking_toggle.go @@ -56,3 +56,11 @@ func RequestsDisabledThinking(req translate.ChatRequest) bool { func DisabledThinkingField() map[string]any { return map[string]any{"type": DisabledThinkingType} } + +// DisabledThinkingFieldJSON returns the canonical disabled-thinking marker as +// JSON for a provider-neutral request. It is used for diagnostic probes that +// must avoid reasoner token spend. +func DisabledThinkingFieldJSON() json.RawMessage { + raw, _ := json.Marshal(DisabledThinkingField()) + return raw +} diff --git a/internal/providers/workbuddy/catalog.go b/internal/providers/workbuddy/catalog.go index 0a99f3e7..a4dc7c5f 100644 --- a/internal/providers/workbuddy/catalog.go +++ b/internal/providers/workbuddy/catalog.go @@ -67,15 +67,16 @@ func catalogModel(model catalogModelEntry) providers.ModelInfo { Credits: credits, Free: catalogCreditsFree(credits), Capabilities: providers.ModelCapabilities{ - ContextWindow: window, - ContextWindowMax: windowMax, - MaxOutput: model.MaxOutputTokens, - Tools: true, - Images: model.SupportsImages, - Reasoning: model.SupportsReasoning || len(options) > 0 || defaultLevel != "", - ReasoningOptions: options, - ReasoningDefault: defaultLevel, - CanDisableThinking: canDisable, + ContextWindow: window, + ContextWindowMax: windowMax, + MaxOutput: model.MaxOutputTokens, + Tools: true, + Images: model.SupportsImages, + Reasoning: model.SupportsReasoning || len(options) > 0 || defaultLevel != "", + ReasoningOptions: options, + ReasoningOptionValues: providers.UniqueReasoningOptionValues(model.Reasoning.SupportedEfforts), + ReasoningDefault: defaultLevel, + CanDisableThinking: canDisable, }, } } diff --git a/internal/server/router.go b/internal/server/router.go index 08264e84..2b8f40eb 100644 --- a/internal/server/router.go +++ b/internal/server/router.go @@ -23,7 +23,10 @@ func (s *Server) routes() { s.mux.HandleFunc("/api/system/console-key", s.withConsoleKey(s.consoleHandler().HandleConsoleKey)) s.mux.HandleFunc("/api/keys", s.withConsoleKey(s.consoleHandler().HandleAPIKeys)) s.mux.HandleFunc("/api/keys/", s.withConsoleKey(s.consoleHandler().HandleAPIKeyByID)) + s.mux.HandleFunc("/api/aggregations", s.withConsoleKey(s.consoleHandler().HandleAggregations)) + s.mux.HandleFunc("/api/aggregations/", s.withConsoleKey(s.consoleHandler().HandleAggregationByID)) s.mux.HandleFunc("/api/models", s.withConsoleKey(s.consoleHandler().HandleModelsAPI)) + s.mux.HandleFunc("/api/models/check", s.withConsoleKey(s.consoleHandler().HandleModelProbe)) s.mux.HandleFunc("/api/model-catalog", s.withConsoleKey(s.consoleHandler().HandleCatalogStatus)) s.mux.HandleFunc("/api/models/", s.withConsoleKey(s.consoleHandler().HandleModelSetting)) s.mux.HandleFunc("/api/providers", s.withConsoleKey(s.consoleHandler().HandleProviders)) @@ -59,7 +62,7 @@ func (s *Server) routes() { r.URL.Path != "/og-card.svg" && r.URL.Path != "/site.webmanifest" { switch r.URL.Path { - case "/login", "/auth", "/providers", "/access", "/accounts", "/system", "/logs", "/keys", "/usage": + case "/login", "/auth", "/providers", "/model-pool", "/access", "/accounts", "/system", "/logs", "/keys", "/usage": default: http.NotFound(w, r) return diff --git a/internal/store/aggregation_account_test.go b/internal/store/aggregation_account_test.go new file mode 100644 index 00000000..3d53d8a4 --- /dev/null +++ b/internal/store/aggregation_account_test.go @@ -0,0 +1,35 @@ +package store + +import ( + "context" + "path/filepath" + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +func TestAggregationMemberAccountIDRoundTrip(t *testing.T) { + s, err := OpenStore(filepath.Join(t.TempDir(), "aggregation.db")) + if err != nil { + t.Fatal(err) + } + defer s.Close() + + agg := accounts.Aggregation{ + ID: "logical", Name: "Logical", Enabled: true, + Strategy: accounts.AggregationPriority, AllowFallbacks: true, MaxAttempts: 2, + CreatedAt: time.Now().UTC(), UpdatedAt: time.Now().UTC(), + Members: []accounts.AggregationMember{ + {Provider: "qoder", Region: "global", Model: "model-a", AccountID: "q2", Priority: 0, Weight: 100}, + {Provider: "workbuddy", Region: "cn", Model: "model-b", Priority: 1, Weight: 100}, + }, + } + saved, err := s.InsertAggregation(context.Background(), agg) + if err != nil { + t.Fatal(err) + } + if len(saved.Members) != 2 || saved.Members[0].AccountID != "q2" || saved.Members[1].AccountID != "" { + t.Fatalf("members = %+v", saved.Members) + } +} diff --git a/internal/store/aggregations.go b/internal/store/aggregations.go new file mode 100644 index 00000000..61239020 --- /dev/null +++ b/internal/store/aggregations.go @@ -0,0 +1,212 @@ +package store + +import ( + "context" + "crypto/rand" + "database/sql" + "encoding/hex" + "errors" + "fmt" + "strings" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +func newAggregationID() string { + raw := make([]byte, 6) + if _, err := rand.Read(raw); err != nil { + return fmt.Sprintf("agg-%d", time.Now().UnixNano()) + } + return "agg-" + hex.EncodeToString(raw) +} + +func (s *Store) InsertAggregation(ctx context.Context, agg accounts.Aggregation) (accounts.Aggregation, error) { + if strings.TrimSpace(agg.ID) == "" { + agg.ID = newAggregationID() + } + if agg.CreatedAt.IsZero() { + agg.CreatedAt = time.Now().UTC() + } + if agg.UpdatedAt.IsZero() { + agg.UpdatedAt = agg.CreatedAt + } + if agg.Members == nil { + agg.Members = []accounts.AggregationMember{} + } + changed, err := s.saveAggregation(ctx, agg, true) + if err != nil { + return accounts.Aggregation{}, err + } + if !changed { + return accounts.Aggregation{}, accounts.ErrAggregationNotFound + } + return s.GetAggregation(ctx, agg.ID) +} + +func (s *Store) SaveAggregation(ctx context.Context, agg accounts.Aggregation) (accounts.Aggregation, error) { + if agg.UpdatedAt.IsZero() { + agg.UpdatedAt = time.Now().UTC() + } + if agg.Members == nil { + agg.Members = []accounts.AggregationMember{} + } + changed, err := s.saveAggregation(ctx, agg, false) + if err != nil { + return accounts.Aggregation{}, err + } + if !changed { + return accounts.Aggregation{}, accounts.ErrAggregationNotFound + } + return s.GetAggregation(ctx, agg.ID) +} + +func (s *Store) ListAggregations(ctx context.Context) ([]accounts.Aggregation, error) { + rows, err := s.db.QueryContext(ctx, ` +SELECT id, name, enabled, strategy, allow_fallbacks, max_attempts, created_at, updated_at +FROM aggregation_models ORDER BY created_at DESC, id DESC`) + if err != nil { + return nil, fmt.Errorf("list aggregations: %w", err) + } + defer rows.Close() + var list []accounts.Aggregation + for rows.Next() { + agg, err := scanAggregation(rows) + if err != nil { + return nil, err + } + list = append(list, agg) + } + if err := rows.Err(); err != nil { + return nil, err + } + for i := range list { + members, err := s.listAggregationMembers(ctx, list[i].ID) + if err != nil { + return nil, err + } + list[i].Members = members + } + return list, nil +} + +func (s *Store) GetAggregation(ctx context.Context, id string) (accounts.Aggregation, error) { + row := s.db.QueryRowContext(ctx, ` +SELECT id, name, enabled, strategy, allow_fallbacks, max_attempts, created_at, updated_at +FROM aggregation_models WHERE id = ?`, strings.TrimSpace(id)) + agg, err := scanAggregation(row) + if errors.Is(err, sql.ErrNoRows) { + return accounts.Aggregation{}, accounts.ErrAggregationNotFound + } + if err != nil { + return accounts.Aggregation{}, fmt.Errorf("get aggregation: %w", err) + } + members, err := s.listAggregationMembers(ctx, agg.ID) + if err != nil { + return accounts.Aggregation{}, err + } + agg.Members = members + return agg, nil +} + +func (s *Store) DeleteAggregation(ctx context.Context, id string) error { + result, err := s.db.ExecContext(ctx, `DELETE FROM aggregation_models WHERE id = ?`, strings.TrimSpace(id)) + if err != nil { + return fmt.Errorf("delete aggregation: %w", err) + } + changed, _ := result.RowsAffected() + if changed == 0 { + return accounts.ErrAggregationNotFound + } + return nil +} + +// saveAggregation writes the body and its members in one transaction so a +// reader never observes a body without members (or a stale member set). +// It returns false when an update targeted a missing body. +func (s *Store) saveAggregation(ctx context.Context, agg accounts.Aggregation, insert bool) (bool, error) { + tx, err := s.db.BeginTx(ctx, nil) + if err != nil { + return false, err + } + defer tx.Rollback() + var result sql.Result + if insert { + result, err = tx.ExecContext(ctx, ` +INSERT INTO aggregation_models (id, name, enabled, strategy, allow_fallbacks, max_attempts, created_at, updated_at) +VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, + agg.ID, agg.Name, boolToInt(agg.Enabled), string(agg.Strategy), boolToInt(agg.AllowFallbacks), agg.MaxAttempts, + formatTime(agg.CreatedAt), formatTime(agg.UpdatedAt), + ) + } else { + result, err = tx.ExecContext(ctx, ` +UPDATE aggregation_models SET name = ?, enabled = ?, strategy = ?, allow_fallbacks = ?, max_attempts = ?, updated_at = ? +WHERE id = ?`, + agg.Name, boolToInt(agg.Enabled), string(agg.Strategy), boolToInt(agg.AllowFallbacks), agg.MaxAttempts, + formatTime(agg.UpdatedAt), agg.ID, + ) + } + if err != nil { + return false, fmt.Errorf("save aggregation body: %w", err) + } + changed, _ := result.RowsAffected() + if changed == 0 { + return false, nil + } + if err := s.saveAggregationMembersTx(ctx, tx, agg.ID, agg.Members); err != nil { + return false, err + } + if err := tx.Commit(); err != nil { + return false, err + } + return true, nil +} + +func (s *Store) saveAggregationMembersTx(ctx context.Context, tx *sql.Tx, id string, members []accounts.AggregationMember) error { + if _, err := tx.ExecContext(ctx, `DELETE FROM aggregation_members WHERE agg_id = ?`, id); err != nil { + return fmt.Errorf("clear aggregation members: %w", err) + } + for _, member := range members { + if _, err := tx.ExecContext(ctx, ` +INSERT INTO aggregation_members (agg_id, provider, region, model, account_id, priority, weight) +VALUES (?, ?, ?, ?, ?, ?, ?)`, id, member.Provider, member.Region, member.Model, member.AccountID, member.Priority, member.Weight); err != nil { + return fmt.Errorf("save aggregation member: %w", err) + } + } + return nil +} + +func (s *Store) listAggregationMembers(ctx context.Context, id string) ([]accounts.AggregationMember, error) { + rows, err := s.db.QueryContext(ctx, ` +SELECT id, provider, region, model, account_id, priority, weight +FROM aggregation_members WHERE agg_id = ? ORDER BY priority ASC, id ASC`, strings.TrimSpace(id)) + if err != nil { + return nil, fmt.Errorf("list aggregation members: %w", err) + } + defer rows.Close() + members := []accounts.AggregationMember{} + for rows.Next() { + var member accounts.AggregationMember + if err := rows.Scan(&member.ID, &member.Provider, &member.Region, &member.Model, &member.AccountID, &member.Priority, &member.Weight); err != nil { + return nil, err + } + members = append(members, member) + } + return members, rows.Err() +} + +func scanAggregation(row rowScanner) (accounts.Aggregation, error) { + var agg accounts.Aggregation + var enabled, allowFallbacks int + var created, updated sql.NullString + if err := row.Scan(&agg.ID, &agg.Name, &enabled, &agg.Strategy, &allowFallbacks, &agg.MaxAttempts, &created, &updated); err != nil { + return accounts.Aggregation{}, err + } + agg.Enabled = enabled != 0 + agg.Strategy = accounts.NormalizeAggregationStrategy(string(agg.Strategy)) + agg.AllowFallbacks = allowFallbacks != 0 + agg.CreatedAt = parseTime(created.String) + agg.UpdatedAt = parseTime(updated.String) + agg.Members = []accounts.AggregationMember{} + return agg, nil +} diff --git a/internal/store/backup_test.go b/internal/store/backup_test.go index 6dadbecc..bd8d58c3 100644 --- a/internal/store/backup_test.go +++ b/internal/store/backup_test.go @@ -110,6 +110,8 @@ func TestPublishedMigrationsKeepOrderedFilenameAndSQLDigest(t *testing.T) { {"028_account_credit_floor.sql", "1d0ce27561c054e36e0bacd6a8eb49ae8e58fb28835461f545f0ffab74272416"}, {"029_account_percent_floor.sql", "cf4c2790ca5f4dc1d95c8f7446fe87a5b35f8d5e7571b7b2b297c6b5112a0587"}, {"030_api_key_model_aggregation.sql", "373fe14496053692251b5260b8ad4daef4af0fd5105e461efdd37bf9639a79d1"}, + {"031_aggregations.sql", "3edaa45d50fe907d4ace839297d0264ad199ae19de97f007f248c6301239f928"}, + {"032_aggregation_member_account.sql", "2e24df6d7363faf5f383887d589ab47bf2f0398f1e30338812066587dbf0ea01"}, } if len(sqliteMigrations) != len(want) { t.Fatalf("migration count = %d, want %d", len(sqliteMigrations), len(want)) diff --git a/internal/store/migrations.go b/internal/store/migrations.go index e361be30..f49e1a07 100644 --- a/internal/store/migrations.go +++ b/internal/store/migrations.go @@ -262,6 +262,29 @@ ALTER TABLE accounts ADD COLUMN credit_floor REAL;`}, ALTER TABLE accounts ADD COLUMN percent_floor REAL;`}, {filename: "030_api_key_model_aggregation.sql", sql: ` ALTER TABLE api_keys ADD COLUMN model_aggregation INTEGER NOT NULL DEFAULT 0;`}, + {filename: "031_aggregations.sql", sql: ` +CREATE TABLE IF NOT EXISTS aggregation_models ( + id TEXT PRIMARY KEY, + name TEXT NOT NULL, + enabled INTEGER NOT NULL DEFAULT 1, + strategy TEXT NOT NULL DEFAULT 'priority', + allow_fallbacks INTEGER NOT NULL DEFAULT 1, + max_attempts INTEGER NOT NULL DEFAULT 3, + created_at TEXT NOT NULL, + updated_at TEXT NOT NULL +); +CREATE TABLE IF NOT EXISTS aggregation_members ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + agg_id TEXT NOT NULL REFERENCES aggregation_models(id) ON DELETE CASCADE, + provider TEXT NOT NULL, + region TEXT NOT NULL DEFAULT '', + model TEXT NOT NULL, + priority INTEGER NOT NULL DEFAULT 0, + weight INTEGER NOT NULL DEFAULT 100 +); +CREATE INDEX IF NOT EXISTS aggregation_members_agg ON aggregation_members(agg_id);`}, + {filename: "032_aggregation_member_account.sql", sql: ` +ALTER TABLE aggregation_members ADD COLUMN account_id TEXT NOT NULL DEFAULT '';`}, } const schemaMigrationsDDL = ` diff --git a/internal/webui/static/assets/AccessPage-BLB29enB.js b/internal/webui/static/assets/AccessPage-BLB29enB.js deleted file mode 100644 index a6d569c9..00000000 --- a/internal/webui/static/assets/AccessPage-BLB29enB.js +++ /dev/null @@ -1,10 +0,0 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{a as r,i,n as a,o,r as s,s as c,t as l}from"./CaiaiSoftLink-Cv7Cw6NC.js";import{n as u}from"./Check.es-BqA3iE7U.js";import{t as d}from"./clipboard-DfpIZ3R1.js";import{t as f}from"./Plus.es-Cg0e8UP-.js";import{n as p,pt as m,r as h}from"./useI18n-B77RWTNi.js";import{t as g}from"./label-DLoR3Z-C.js";import{t as _}from"./list-box-rbke8Feh.js";import{t as v}from"./PageAlert-r7ZVsH9h.js";import{t as y}from"./EmptyPanel-Bs-jQMvG.js";import{n as b,t as x}from"./tabs-BShFVox8.js";import{t as S}from"./select-BRn66sMj.js";import{r as C}from"./gsap-C3sDxib7.js";import{D as ee,I as te,J as ne,O as w,Y as T,_ as E,an as D,at as re,b as O,en as ie,in as ae,it as k,pn as oe,r as se,t as ce,tn as le,v as A,z as ue}from"./index-CmGY2WQi.js";import{t as de}from"./FilterToggle-Bygki2HF.js";import{d as fe,f as pe,i as me,o as he}from"./format-B6SmebW-.js";import{t as ge}from"./ProviderMark-IiAZTaQS.js";import{n as _e}from"./provider-gHnttGKq.js";import{t as ve}from"./LatencyStats-DmxRwO-O.js";var j=t(e(),1),ye=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M54.8,119.49A35.06,35.06,0,0,1,49.05,128a35.06,35.06,0,0,1,5.75,8.51C60,147.24,60,159.83,60,172c0,25.94,1.84,32,20,32a12,12,0,0,1,0,24c-19.14,0-32.2-6.9-38.8-20.51C36,196.76,36,184.17,36,172c0-25.94-1.84-32-20-32a12,12,0,0,1,0-24c18.16,0,20-6.06,20-32,0-12.17,0-24.76,5.2-35.49C47.8,34.9,60.86,28,80,28a12,12,0,0,1,0,24c-18.16,0-20,6.06-20,32C60,96.17,60,108.76,54.8,119.49ZM240,116c-18.16,0-20-6.06-20-32,0-12.17,0-24.76-5.2-35.49C208.2,34.9,195.14,28,176,28a12,12,0,0,0,0,24c18.16,0,20,6.06,20,32,0,12.17,0,24.76,5.2,35.49A35.06,35.06,0,0,0,207,128a35.06,35.06,0,0,0-5.75,8.51C196,147.24,196,159.83,196,172c0,25.94-1.84,32-20,32a12,12,0,0,0,0,24c19.14,0,32.2-6.9,38.8-20.51C220,196.76,220,184.17,220,172c0-25.94,1.84-32,20-32a12,12,0,0,0,0-24Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M240,128c-64,0,0,88-64,88H80c-64,0,0-88-64-88,64,0,0-88,64-88h96C240,40,176,128,240,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M43.18,128a29.78,29.78,0,0,1,8,10.26c4.8,9.9,4.8,22,4.8,33.74,0,24.31,1,36,24,36a8,8,0,0,1,0,16c-17.48,0-29.32-6.14-35.2-18.26-4.8-9.9-4.8-22-4.8-33.74,0-24.31-1-36-24-36a8,8,0,0,1,0-16c23,0,24-11.69,24-36,0-11.72,0-23.84,4.8-33.74C50.68,38.14,62.52,32,80,32a8,8,0,0,1,0,16C57,48,56,59.69,56,84c0,11.72,0,23.84-4.8,33.74A29.78,29.78,0,0,1,43.18,128ZM240,120c-23,0-24-11.69-24-36,0-11.72,0-23.84-4.8-33.74C205.32,38.14,193.48,32,176,32a8,8,0,0,0,0,16c23,0,24,11.69,24,36,0,11.72,0,23.84,4.8,33.74a29.78,29.78,0,0,0,8,10.26,29.78,29.78,0,0,0-8,10.26c-4.8,9.9-4.8,22-4.8,33.74,0,24.31-1,36-24,36a8,8,0,0,0,0,16c17.48,0,29.32-6.14,35.2-18.26,4.8-9.9,4.8-22,4.8-33.74,0-24.31,1-36,24-36a8,8,0,0,0,0-16Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM88,155.84c.29,14.26.41,20.16,16,20.16a8,8,0,0,1,0,16c-31.27,0-31.72-22.43-32-35.84C71.71,141.9,71.59,136,56,136a8,8,0,0,1,0-16c15.59,0,15.71-5.9,16-20.16C72.28,86.43,72.73,64,104,64a8,8,0,0,1,0,16c-15.59,0-15.71,5.9-16,20.16-.17,8.31-.41,20.09-8,27.84C87.59,135.75,87.83,147.53,88,155.84ZM200,136c-15.59,0-15.71,5.9-16,20.16-.28,13.41-.73,35.84-32,35.84a8,8,0,0,1,0-16c15.59,0,15.71-5.9,16-20.16.17-8.31.41-20.09,8-27.84-7.6-7.75-7.84-19.53-8-27.84C167.71,85.9,167.59,80,152,80a8,8,0,0,1,0-16c31.27,0,31.72,22.43,32,35.84.29,14.26.41,20.16,16,20.16a8,8,0,0,1,0,16Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M39.91,128a27.68,27.68,0,0,1,9.49,11.13C54,148.62,54,160.51,54,172c0,24.27,1.21,38,26,38a6,6,0,0,1,0,12c-16.88,0-27.81-5.6-33.4-17.13C42,195.38,42,183.49,42,172c0-24.27-1.21-38-26-38a6,6,0,0,1,0-12c24.79,0,26-13.73,26-38,0-11.49,0-23.38,4.6-32.87C52.19,39.6,63.12,34,80,34a6,6,0,0,1,0,12C55.21,46,54,59.73,54,84c0,11.49,0,23.38-4.6,32.87A27.68,27.68,0,0,1,39.91,128ZM240,122c-24.79,0-26-13.73-26-38,0-11.49,0-23.38-4.6-32.87C203.81,39.6,192.88,34,176,34a6,6,0,0,0,0,12c24.79,0,26,13.73,26,38,0,11.49,0,23.38,4.6,32.87A27.68,27.68,0,0,0,216.09,128a27.68,27.68,0,0,0-9.49,11.13C202,148.62,202,160.51,202,172c0,24.27-1.21,38-26,38a6,6,0,0,0,0,12c16.88,0,27.81-5.6,33.4-17.13,4.6-9.49,4.6-21.38,4.6-32.87,0-24.27,1.21-38,26-38a6,6,0,0,0,0-12Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M43.18,128a29.78,29.78,0,0,1,8,10.26c4.8,9.9,4.8,22,4.8,33.74,0,24.31,1,36,24,36a8,8,0,0,1,0,16c-17.48,0-29.32-6.14-35.2-18.26-4.8-9.9-4.8-22-4.8-33.74,0-24.31-1-36-24-36a8,8,0,0,1,0-16c23,0,24-11.69,24-36,0-11.72,0-23.84,4.8-33.74C50.68,38.14,62.52,32,80,32a8,8,0,0,1,0,16C57,48,56,59.69,56,84c0,11.72,0,23.84-4.8,33.74A29.78,29.78,0,0,1,43.18,128ZM240,120c-23,0-24-11.69-24-36,0-11.72,0-23.84-4.8-33.74C205.32,38.14,193.48,32,176,32a8,8,0,0,0,0,16c23,0,24,11.69,24,36,0,11.72,0,23.84,4.8,33.74a29.78,29.78,0,0,0,8,10.26,29.78,29.78,0,0,0-8,10.26c-4.8,9.9-4.8,22-4.8,33.74,0,24.31-1,36-24,36a8,8,0,0,0,0,16c17.48,0,29.32-6.14,35.2-18.26,4.8-9.9,4.8-22,4.8-33.74,0-24.31,1-36,24-36a8,8,0,0,0,0-16Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M35.89,128C52,136.23,52,155.64,52,172c0,24.8,1.35,40,28,40a4,4,0,0,1,0,8c-36,0-36-26.61-36-48,0-24.8-1.35-40-28-40a4,4,0,0,1,0-8c26.65,0,28-15.2,28-40,0-21.39,0-48,36-48a4,4,0,0,1,0,8C53.35,44,52,59.2,52,84,52,100.36,52,119.77,35.89,128ZM240,124c-26.65,0-28-15.2-28-40,0-21.39,0-48-36-48a4,4,0,0,0,0,8c26.65,0,28,15.2,28,40,0,16.36,0,35.77,16.11,44C204,136.23,204,155.64,204,172c0,24.8-1.35,40-28,40a4,4,0,0,0,0,8c36,0,36-26.61,36-48,0-24.8,1.35-40,28-40a4,4,0,0,0,0-8Z`}))]]),M=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M120,128a16,16,0,1,1-16-16A16,16,0,0,1,120,128Zm32-16a16,16,0,1,0,16,16A16,16,0,0,0,152,112Zm84,16A108,108,0,0,1,78.77,224.15L46.34,235A20,20,0,0,1,21,209.66l10.81-32.43A108,108,0,1,1,236,128Zm-24,0A84,84,0,1,0,55.27,170.06a12,12,0,0,1,1,9.81l-9.93,29.79,29.79-9.93a12.1,12.1,0,0,1,3.8-.62,12,12,0,0,1,6,1.62A84,84,0,0,0,212,128Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-4-1.08,7.85,7.85,0,0,0-2.53.42L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Zm12-88a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm-44,0a12,12,0,1,1-12-12A12,12,0,0,1,96,128Zm88,0a12,12,0,1,1-12-12A12,12,0,0,1,184,128Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24ZM84,140a12,12,0,1,1,12-12A12,12,0,0,1,84,140Zm44,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm44,0a12,12,0,1,1,12-12A12,12,0,0,1,172,140Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM84,118a10,10,0,1,0,10,10A10,10,0,0,0,84,118Zm88,0a10,10,0,1,0,10,10A10,10,0,0,0,172,118Zm58,10A102,102,0,0,1,79.31,217.65L44.44,229.27a14,14,0,0,1-17.71-17.71l11.62-34.87A102,102,0,1,1,230,128Zm-12,0A90,90,0,1,0,50.08,173.06a6,6,0,0,1,.5,4.91L38.12,215.35a2,2,0,0,0,2.53,2.53L78,205.42a6.2,6.2,0,0,1,1.9-.31,6.09,6.09,0,0,1,3,.81A90,90,0,0,0,218,128Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM84,116a12,12,0,1,0,12,12A12,12,0,0,0,84,116Zm88,0a12,12,0,1,0,12,12A12,12,0,0,0,172,116Zm60,12A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Zm-16,0A88,88,0,1,0,51.81,172.06a8,8,0,0,1,.66,6.54L40,216,77.4,203.53a7.85,7.85,0,0,1,2.53-.42,8,8,0,0,1,4,1.08A88,88,0,0,0,216,128Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-52-8a8,8,0,1,0,8,8A8,8,0,0,0,84,120Zm88,0a8,8,0,1,0,8,8A8,8,0,0,0,172,120Zm56,8A100,100,0,0,1,79.5,215.47l-35.69,11.9a12,12,0,0,1-15.18-15.18l11.9-35.69A100,100,0,1,1,228,128Zm-8,0A92,92,0,1,0,48.35,174.07a4,4,0,0,1,.33,3.27L36.22,214.72a4,4,0,0,0,5.06,5.06l37.38-12.46a3.93,3.93,0,0,1,1.27-.21,4.05,4.05,0,0,1,2,.54A92,92,0,0,0,220,128Z`}))]]),be=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M236,128a108,108,0,0,1-216,0c0-42.52,24.73-81.34,63-98.9A12,12,0,1,1,93,50.91C63.24,64.57,44,94.83,44,128a84,84,0,0,0,168,0c0-33.17-19.24-63.43-49-77.09A12,12,0,1,1,173,29.1C211.27,46.66,236,85.48,236,128Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,176A72,72,0,0,1,92,65.64a8,8,0,0,1,8,13.85,56,56,0,1,0,56,0,8,8,0,0,1,8-13.85A72,72,0,0,1,128,200Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M228,128a100,100,0,0,1-200,0c0-39.4,22.9-75.37,58.33-91.63a4,4,0,1,1,3.34,7.27C57.07,58.6,36,91.71,36,128a92,92,0,0,0,184,0c0-36.29-21.07-69.4-53.67-84.36a4,4,0,1,1,3.34-7.27C205.1,52.63,228,88.6,228,128Z`}))]]),xe=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z`}))]]),N=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M180,64H40A12,12,0,0,0,28,76V216a12,12,0,0,0,12,12H180a12,12,0,0,0,12-12V76A12,12,0,0,0,180,64ZM168,204H52V88H168ZM228,40V180a12,12,0,0,1-24,0V52H76a12,12,0,0,1,0-24H216A12,12,0,0,1,228,40Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,72V216H40V72Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M184,64H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H184a8,8,0,0,0,8-8V72A8,8,0,0,0,184,64Zm-8,144H48V80H176ZM224,40V184a8,8,0,0,1-16,0V48H72a8,8,0,0,1,0-16H216A8,8,0,0,1,224,40Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M192,72V216a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H184A8,8,0,0,1,192,72Zm24-40H72a8,8,0,0,0,0,16H208V184a8,8,0,0,0,16,0V40A8,8,0,0,0,216,32Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,66H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H184a6,6,0,0,0,6-6V72A6,6,0,0,0,184,66Zm-6,144H46V78H178ZM222,40V184a6,6,0,0,1-12,0V46H72a6,6,0,0,1,0-12H216A6,6,0,0,1,222,40Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,64H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H184a8,8,0,0,0,8-8V72A8,8,0,0,0,184,64Zm-8,144H48V80H176ZM224,40V184a8,8,0,0,1-16,0V48H72a8,8,0,0,1,0-16H216A8,8,0,0,1,224,40Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,68H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H184a4,4,0,0,0,4-4V72A4,4,0,0,0,184,68Zm-4,144H44V76H180ZM220,40V184a4,4,0,0,1-8,0V44H72a4,4,0,0,1,0-8H216A4,4,0,0,1,220,40Z`}))]]),P=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M216.49,79.52l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40V216a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V88A12,12,0,0,0,216.49,79.52ZM160,57l23,23H160ZM60,212V44h76V92a12,12,0,0,0,12,12h48V212Zm112-80a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,132Zm0,40a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,172Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M208,88H152V32Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-32-80a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,136Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,168Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,176H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm-8-56V44l44,44Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40V216a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM200,218H56a2,2,0,0,1-2-2V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216A2,2,0,0,1,200,218Zm-34-82a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,136Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,168Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-32-80a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,136Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,168Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40V216a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM200,220H56a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V216A4,4,0,0,1,200,220Zm-36-84a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,136Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,168Z`}))]]),F=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M71.76,148H31.7a12,12,0,1,1,0-24H65.33l12.45-18.66a12,12,0,0,1,20,0l22,33,6-9a12,12,0,0,1,10-5.34h24a12,12,0,1,1,0,24h-17.6l-12.46,18.66a12,12,0,0,1-20,0l-22-33-6,9A12,12,0,0,1,71.76,148ZM177.91,36c-20.12,0-38,7.93-50.07,21.56C115.74,43.93,97.89,36,77.76,36A66,66,0,0,0,12.07,94.68,12,12,0,0,0,36,97.32,42,42,0,0,1,77.76,60c17.83,0,32.75,9.4,38.95,24.54a12,12,0,0,0,22.25,0C145.16,69.4,160.08,60,177.91,60A42.08,42.08,0,0,1,220,102c0,29.42-25.86,57.77-47.56,76.36a329,329,0,0,1-44.58,31.81c-10.87-6.45-35.37-22-56.51-42.73a12,12,0,1,0-16.84,17.12c30.39,29.81,66.15,49.2,67.66,50a12.06,12.06,0,0,0,11.39,0C138,232.14,244,174.34,244,102A66.12,66.12,0,0,0,177.91,36Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M232,102c0,66-104,122-104,122S24,168,24,102A54,54,0,0,1,78,48c22.59,0,41.94,12.31,50,32,8.06-19.69,27.41-32,50-32A54,54,0,0,1,232,102Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M72,144H32a8,8,0,0,1,0-16H67.72l13.62-20.44a8,8,0,0,1,13.32,0l25.34,38,9.34-14A8,8,0,0,1,136,128h24a8,8,0,0,1,0,16H140.28l-13.62,20.44a8,8,0,0,1-13.32,0L88,126.42l-9.34,14A8,8,0,0,1,72,144ZM178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,.75,0,1.5,0,2.25a8,8,0,1,0,16-.5c0-.58,0-1.17,0-1.75A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46c0,53.61-77.76,102.15-96,112.8-10.83-6.31-42.63-26-66.68-52.21a8,8,0,1,0-11.8,10.82c31.17,34,72.93,56.68,74.69,57.63a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M240,102c0,70-103.79,126.66-108.21,129a8,8,0,0,1-7.58,0c-3.35-1.8-63.55-34.69-92.68-80.89A4,4,0,0,1,34.92,144H72a8,8,0,0,0,6.66-3.56l9.34-14,25.34,38a8,8,0,0,0,9.16,3.16,8.23,8.23,0,0,0,4.28-3.34L140.28,144H160a8,8,0,0,0,8-8.53,8.18,8.18,0,0,0-8.25-7.47H136a8,8,0,0,0-6.66,3.56l-9.34,14-25.34-38a8,8,0,0,0-9.17-3.16,8.25,8.25,0,0,0-4.27,3.34L67.72,128H23.53a4,4,0,0,1-3.83-2.81A76.93,76.93,0,0,1,16,102,62.07,62.07,0,0,1,78,40c20.65,0,38.73,8.88,50,23.89C139.27,48.88,157.35,40,178,40A62.07,62.07,0,0,1,240,102Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M72,142H32a6,6,0,0,1,0-12H68.79L83,108.67a6,6,0,0,1,10,0l27,40.51,11-16.51a6,6,0,0,1,5-2.67h24a6,6,0,0,1,0,12H139.21L125,163.33a6,6,0,0,1-10,0L88,122.82,77,139.33A6,6,0,0,1,72,142ZM178,42c-21,0-39.26,9.47-50,25.34C117.26,51.47,99,42,78,42a60.07,60.07,0,0,0-60,60q0,1.09,0,2.19a6,6,0,0,0,12-.38c0-.6,0-1.21,0-1.81A48.05,48.05,0,0,1,78,54c20.28,0,37.31,10.83,44.45,28.27a6,6,0,0,0,11.1,0C140.69,64.83,157.72,54,178,54a48.05,48.05,0,0,1,48,48c0,55.73-81.61,105.65-98,115.11-9.84-5.66-43.09-25.82-68.16-53.16a6,6,0,1,0-8.84,8.1c30.94,33.77,72.41,56.29,74.16,57.23a6,6,0,0,0,5.68,0,334.68,334.68,0,0,0,53.06-37C219.8,161.59,238,131.2,238,102A60.07,60.07,0,0,0,178,42Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M72,144H32a8,8,0,0,1,0-16H67.72l13.62-20.44a8,8,0,0,1,13.32,0l25.34,38,9.34-14A8,8,0,0,1,136,128h24a8,8,0,0,1,0,16H140.28l-13.62,20.44a8,8,0,0,1-13.32,0L88,126.42l-9.34,14A8,8,0,0,1,72,144ZM178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,.75,0,1.5,0,2.25a8,8,0,1,0,16-.5c0-.58,0-1.17,0-1.75A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46c0,53.61-77.76,102.15-96,112.8-10.83-6.31-42.63-26-66.68-52.21a8,8,0,1,0-11.8,10.82c31.17,34,72.93,56.68,74.69,57.63a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M72,140H32a4,4,0,0,1,0-8H69.86l14.81-22.22a4,4,0,0,1,6.66,0l28.67,43,12.67-19A4,4,0,0,1,136,132h24a4,4,0,0,1,0,8H138.14l-14.81,22.22a4,4,0,0,1-6.66,0L88,119.21l-12.67,19A4,4,0,0,1,72,140ZM178,44c-21.44,0-39.92,10.19-50,27.07C117.92,54.19,99.44,44,78,44a58.07,58.07,0,0,0-58,58q0,1.06,0,2.13a4,4,0,1,0,8-.26c0-.62,0-1.24,0-1.87A50.06,50.06,0,0,1,78,52c21.11,0,38.85,11.31,46.3,29.51a4,4,0,0,0,7.4,0C139.15,63.31,156.89,52,178,52a50.06,50.06,0,0,1,50,50c0,58-86,109.46-100,117.42-8.47-4.82-43.5-25.61-69.63-54.12a4,4,0,0,0-5.9,5.4c30.72,33.52,71.9,55.89,73.63,56.82a4,4,0,0,0,3.8,0,333.81,333.81,0,0,0,52.7-36.73C218,160.47,236,130.59,236,102A58.07,58.07,0,0,0,178,44Z`}))]]),Se=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M230.14,25.86a20,20,0,0,0-19.57-5.11l-.22.07L18.44,79a20,20,0,0,0-3.06,37.25L99,157l40.71,83.65a19.81,19.81,0,0,0,18,11.38c.57,0,1.15,0,1.73-.07A19.82,19.82,0,0,0,177,237.56L235.18,45.65a1.42,1.42,0,0,0,.07-.22A20,20,0,0,0,230.14,25.86ZM156.91,221.07l-34.37-70.64,46-45.95a12,12,0,0,0-17-17l-46,46L34.93,99.09,210,46Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M223.69,42.18l-58.22,192a8,8,0,0,1-14.92,1.25L108,148,20.58,105.45a8,8,0,0,1,1.25-14.92l192-58.22A8,8,0,0,1,223.69,42.18Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M231.4,44.34s0,.1,0,.15l-58.2,191.94a15.88,15.88,0,0,1-14,11.51q-.69.06-1.38.06a15.86,15.86,0,0,1-14.42-9.15L107,164.15a4,4,0,0,1,.77-4.58l57.92-57.92a8,8,0,0,0-11.31-11.31L96.43,148.26a4,4,0,0,1-4.58.77L17.08,112.64a16,16,0,0,1,2.49-29.8l191.94-58.2.15,0A16,16,0,0,1,231.4,44.34Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M225.88,30.12a13.83,13.83,0,0,0-13.7-3.58l-.11,0L20.14,84.77A14,14,0,0,0,18,110.85l85.56,41.64L145.12,238a13.87,13.87,0,0,0,12.61,8c.4,0,.81,0,1.21-.05a13.9,13.9,0,0,0,12.29-10.09l58.2-191.93,0-.11A13.83,13.83,0,0,0,225.88,30.12Zm-8,10.4L159.73,232.43l0,.11a2,2,0,0,1-3.76.26l-40.68-83.58,49-49a6,6,0,1,0-8.49-8.49l-49,49L23.15,100a2,2,0,0,1,.31-3.74l.11,0L215.48,38.08a1.94,1.94,0,0,1,1.92.52A2,2,0,0,1,217.92,40.52Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224.47,31.52a11.87,11.87,0,0,0-11.82-3L20.74,86.67a12,12,0,0,0-1.91,22.38L105,151l41.92,86.15A11.88,11.88,0,0,0,157.74,244c.34,0,.69,0,1,0a11.89,11.89,0,0,0,10.52-8.63l58.21-192,0-.08A11.85,11.85,0,0,0,224.47,31.52Zm-4.62,9.54-58.23,192a4,4,0,0,1-7.48.59l-41.3-84.86,50-50a4,4,0,1,0-5.66-5.66l-50,50-84.9-41.31a3.88,3.88,0,0,1-2.27-4,3.93,3.93,0,0,1,3-3.54L214.9,36.16A3.93,3.93,0,0,1,216,36a4,4,0,0,1,2.79,1.19A3.93,3.93,0,0,1,219.85,41.06Z`}))]]),I=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z`}))]]),L=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:ye}));L.displayName=`BracketsCurlyIcon`;var Ce=L,R=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:M}));R.displayName=`ChatCircleDotsIcon`;var z=R,B=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:be}));B.displayName=`CircleNotchIcon`;var we=B,Te=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:xe}));Te.displayName=`ClockIcon`;var Ee=Te,De=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:N}));De.displayName=`CopySimpleIcon`;var V=De,H=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:P}));H.displayName=`FileTextIcon`;var U=H,W=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:F}));W.displayName=`HeartbeatIcon`;var Oe=W,ke=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:Se}));ke.displayName=`PaperPlaneTiltIcon`;var G=ke,K=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:I}));K.displayName=`StopIcon`;var Ae=K;function q(){return`${location.protocol}//${location.host}`}function J(e){return e?/^https?:\/\//i.test(e)?e:e.startsWith(`/`)?`${q()}${e}`:`${q()}/${e}`:q()}var Y=n();function je({access:e}){let{t}=p(),[n,r]=(0,j.useState)(``),o=J(e?.openai_base_url||`/v1`),s=(0,j.useMemo)(()=>[{name:t(`endpointOpenAI`),url:o,method:`BASE`,hint:t(`endpointBaseHint`),icon:(0,Y.jsx)(Ce,{size:15})},{name:t(`endpointChat`),url:J(e?.chat_completions||`${o}/chat/completions`),method:`POST`,hint:t(`endpointChatHint`),icon:(0,Y.jsx)(G,{size:15})},{name:t(`endpointMessages`),url:J(e?.messages||`${o}/messages`),method:`POST`,hint:t(`endpointMessagesHint`),icon:(0,Y.jsx)(G,{size:15})},{name:t(`endpointResponses`),url:J(e?.responses||`${o}/responses`),method:`POST`,hint:t(`endpointResponsesHint`),icon:(0,Y.jsx)(G,{size:15})},{name:t(`endpointModels`),url:J(e?.models||`${o}/models`),method:`GET`,hint:t(`endpointModelsHint`),icon:(0,Y.jsx)(i,{size:15})},{name:t(`endpointHealth`),url:J(e?.health||`/health`),method:`GET`,hint:t(`endpointHealthHint`),icon:(0,Y.jsx)(Oe,{size:15})}],[e,o,t]);return(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`flex items-start justify-between gap-4 px-5 py-4 sm:px-6`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold`,children:t(`endpoints`)}),(0,Y.jsx)(re,{size:`sm`,variant:`soft`,children:t(`endpointCount`,{count:s.length-1})})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`routesHint`)})]})}),(0,Y.jsx)(`div`,{className:`grid gap-2 px-3 pb-3 sm:grid-cols-2 sm:px-4 sm:pb-4 lg:grid-cols-3`,children:s.map(e=>(0,Y.jsxs)(`div`,{className:`group min-w-0 rounded-xl bg-surface-secondary/40 p-3 transition-colors hover:bg-surface-secondary/70`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Y.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface text-muted`,children:e.icon}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`truncate text-body font-semibold`,children:e.name}),(0,Y.jsx)(`code`,{className:`mono mt-0.5 block truncate text-caption text-muted`,children:e.url})]})]}),(0,Y.jsx)(re,{size:`sm`,variant:`soft`,children:e.method})]}),(0,Y.jsx)(`p`,{className:`mt-2 text-caption leading-5 text-muted`,children:e.hint}),(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:e.method===`BASE`?t(`endpointBaseLabel`):t(`endpointAuthLabel`)}),(0,Y.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`copy`),onPress:()=>{d(e.url),r(e.name),window.setTimeout(()=>r(``),1100)},children:(0,Y.jsx)(a,{copied:n===e.name})}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`open`),onPress:()=>window.open(e.url,`_blank`,`noopener,noreferrer`),children:(0,Y.jsx)(c,{size:14})})]})]})]},e.name))})]})}var Me=new Set(`txt.md.markdown.json.csv.tsv.yml.yaml.toml.xml.html.htm.css.scss.js.jsx.ts.tsx.mjs.cjs.py.go.rs.java.kt.swift.c.h.cpp.hpp.sh.bash.zsh.sql.graphql.env.ini.conf.log.rst.tex`.split(`.`)),Ne=new Set([`image/png`,`image/jpeg`,`image/jpg`,`image/gif`,`image/webp`]);function X(e){let t=e.lastIndexOf(`.`);return t>=0?e.slice(t+1).toLowerCase():``}function Pe(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}async function Z(e){let t=X(e.name),n=e.type||`application/octet-stream`,r=`${e.name}-${e.size}-${e.lastModified}-${Math.random().toString(36).slice(2,8)}`;if(Ne.has(n)||[`png`,`jpg`,`jpeg`,`gif`,`webp`].includes(t)){let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error||Error(`read failed`)),r.readAsDataURL(e)});return{id:r,name:e.name,mime:n,kind:`image`,dataUrl:t,size:e.size}}if(Me.has(t)||n.startsWith(`text/`)||n===`application/json`){let t=await e.text();return{id:r,name:e.name,mime:n,kind:`text`,text:t,size:e.size}}return null}function Q({ariaLabel:e,value:t,onChange:n,placeholder:r,isDisabled:i,options:a,className:o,tone:s=`default`}){let c=a.find(e=>e.id===t),l=s===`muted`?`text-muted hover:text-foreground`:`text-foreground`;return(0,Y.jsxs)(S,{className:o??`w-auto max-w-[11rem] min-w-0`,"aria-label":e,value:t||null,placeholder:r,isDisabled:i,onChange:e=>{typeof e==`string`&&e&&n(e)},children:[(0,Y.jsxs)(S.Trigger,{className:`h-8 min-h-8 gap-1 rounded-[10px] border-0 bg-transparent px-2.5 shadow-none items-center hover:bg-surface-secondary/80 data-[focus-visible=true]:bg-surface-secondary/80 ${l}`,children:[(0,Y.jsx)(S.Value,{className:`min-w-0 truncate text-caption font-medium`,children:({defaultChildren:e,isPlaceholder:t})=>t||!c?e:(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[c.icon?(0,Y.jsx)(`span`,{className:`grid size-3.5 shrink-0 place-items-center opacity-80`,children:c.icon}):null,(0,Y.jsx)(`span`,{className:`truncate`,children:c.label})]})}),(0,Y.jsx)(S.Indicator,{className:`size-2.5 opacity-50`})]}),(0,Y.jsx)(S.Popover,{placement:`top end`,className:`max-h-72 min-w-48`,children:(0,Y.jsx)(_,{children:a.map(e=>(0,Y.jsxs)(_.Item,{id:e.id,textValue:e.textValue,className:`gap-2`,children:[e.icon?(0,Y.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center`,children:e.icon}):null,(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(g,{className:`block truncate text-caption`,children:e.label}),e.hint?(0,Y.jsx)(`span`,{className:`block truncate text-caption text-muted`,children:e.hint}):null]}),(0,Y.jsx)(_.ItemIndicator,{})]},e.id))})})]})}function Fe({value:e,onChange:t,attachments:n,onAttachmentsChange:r,disabled:i,streaming:a,canSend:o,onSend:c,onStop:l,accountValue:u,onAccountChange:d,accountOptions:m,modelValue:g,onModelChange:_,modelOptions:v,modelsLoading:y}){let{t:b}=p(),x=(0,j.useRef)(null);async function S(e){if(!e?.length)return;let t=[],i=[];for(let n of Array.from(e))try{let e=await Z(n);e?t.push(e):i.push(n.name)}catch{i.push(n.name)}t.length&&r([...n,...t]),i.length&&ce({type:`error`,title:b(`chatAttachUnsupported`,{names:i.join(`, `)})}),x.current&&(x.current.value=``)}function C(e){e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),!a&&o&&c())}return(0,Y.jsxs)(`div`,{className:`access-composer px-3 pb-3 pt-2.5 sm:px-4 sm:pb-3.5 sm:pt-3`,children:[(0,Y.jsxs)(`div`,{className:`access-composer-well overflow-hidden rounded-2xl`,children:[n.length?(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-3`,children:n.map(e=>(0,Y.jsxs)(`span`,{className:`inline-flex max-w-[14rem] items-center gap-2 rounded-xl bg-surface/80 px-1.5 py-1.5 text-caption text-foreground`,children:[e.kind===`image`&&e.dataUrl?(0,Y.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-8 shrink-0 rounded-lg object-cover`}):(0,Y.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-muted`,children:(0,Y.jsx)(U,{size:14})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate font-medium`,children:e.name}),(0,Y.jsx)(`span`,{className:`mono text-muted`,children:Pe(e.size)})]}),(0,Y.jsx)(`button`,{type:`button`,className:`grid size-6 shrink-0 place-items-center rounded-md text-muted hover:bg-surface-secondary hover:text-foreground`,"aria-label":b(`chatAttachRemove`),onClick:()=>r(n.filter(t=>t.id!==e.id)),children:(0,Y.jsx)(ie,{size:12})})]},e.id))}):null,(0,Y.jsx)(s,{fullWidth:!0,rows:3,className:`min-h-20 resize-none border-0 bg-transparent px-3.5 py-3 text-body leading-[1.65] shadow-none focus-visible:ring-0`,value:e,onChange:e=>t(e.target.value),onKeyDown:C,placeholder:b(`promptPlaceholder`),"aria-label":b(`prompt`),disabled:i||a}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-0.5 px-2 pb-2 pt-0.5`,children:[(0,Y.jsx)(`input`,{ref:x,type:`file`,className:`hidden`,multiple:!0,accept:`.txt,.md,.json,.csv,.yml,.yaml,.toml,.xml,.html,.css,.js,.jsx,.ts,.tsx,.py,.go,.rs,.sh,.sql,.png,.jpg,.jpeg,.gif,.webp,text/*,image/png,image/jpeg,image/gif,image/webp,application/json`,onChange:e=>void S(e.target.files)}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 shrink-0 rounded-[10px]`,"aria-label":b(`chatAttach`),isDisabled:i||a,onPress:()=>x.current?.click(),children:(0,Y.jsx)(f,{size:15})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,Y.jsx)(Q,{ariaLabel:b(`account`),value:u,onChange:d,options:m,isDisabled:i||a,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,Y.jsx)(Q,{ariaLabel:b(`model`),value:g,onChange:_,placeholder:b(y?`requesting`:`model`),options:v,isDisabled:i||a||y||!v.length,className:`w-auto max-w-[10.5rem] min-w-0`}),(0,Y.jsxs)(`div`,{className:`relative size-8 shrink-0`,children:[(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`secondary`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`opacity-100`:`pointer-events-none opacity-0`}`,"aria-label":b(`chatTryStop`),onPress:l,children:(0,Y.jsx)(Ae,{size:14,weight:`fill`})}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`pointer-events-none opacity-0`:`opacity-100`}`,"aria-label":b(`chatTrySend`),isDisabled:!o||i||a,onPress:c,children:(0,Y.jsx)(G,{size:14,weight:`fill`})})]})]})]}),(0,Y.jsx)(`p`,{className:`mt-1 px-1 text-caption leading-4 text-muted/65`,children:b(`chatTryHelper`)})]})}function Ie({collapsed:e,onCollapsedChange:t,items:n,activeId:i,onSelect:a,onNew:o}){let{t:s}=p(),c=(0,j.useRef)(null);return(0,j.useEffect)(()=>{let t=c.current;!t||O()||e||C.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:E.fast,ease:`power2.out`})},[e]),e?(0,Y.jsxs)(`div`,{className:`access-hist-rail flex w-9 shrink-0 flex-col items-center gap-1 border-r py-2`,children:[(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":s(`chatHistoryExpand`),onPress:()=>t(!1),children:(0,Y.jsx)(D,{size:15})}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":s(`chatHistoryNew`),onPress:o,children:(0,Y.jsx)(f,{size:14})})]}):(0,Y.jsxs)(`aside`,{ref:c,className:`access-hist-rail flex w-[13rem] shrink-0 flex-col border-r`,"aria-label":s(`chatHistoryTitle`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-2`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1 truncate px-1.5 text-caption font-medium text-muted`,children:s(`chatHistoryTitle`)}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":s(`chatHistoryCollapse`),onPress:()=>t(!0),children:(0,Y.jsx)(r,{size:14})})]}),(0,Y.jsx)(`div`,{className:`px-2 pb-1.5`,children:(0,Y.jsxs)(h,{size:`sm`,variant:`ghost`,className:`h-8 w-full justify-start gap-1.5 rounded-[10px] px-2.5 text-caption font-medium text-muted hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onPress:o,children:[(0,Y.jsx)(f,{size:13}),s(`chatHistoryNew`)]})}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 space-y-0.5 overflow-y-auto px-1.5 pb-2.5`,children:n.length?n.map(e=>{let t=e.id===i;return(0,Y.jsx)(`button`,{type:`button`,"data-active":t?`true`:void 0,className:`access-hist-item flex h-8 w-full items-center rounded-[10px] px-2.5 text-left text-caption leading-5 ${t?`font-medium text-foreground`:`font-normal text-muted`}`,onClick:()=>a(e.id),children:(0,Y.jsx)(`span`,{className:`line-clamp-1 tracking-tight`,children:e.title||s(`chatHistoryUntitled`)})},e.id)}):(0,Y.jsx)(`p`,{className:`px-2.5 py-6 text-center text-caption leading-5 text-muted/70`,children:s(`chatHistoryEmpty`)})})]})}function Le({text:e,streaming:t,defaultOpen:n}){let{t:r}=p(),[i,a]=(0,j.useState)(!!n),[o,s]=(0,j.useState)(0),c=(0,j.useRef)(0),l=(0,j.useRef)(null),d=(0,j.useRef)(null);if((0,j.useEffect)(()=>{t?a(!1):n!=null&&a(!!n)},[t,n]),(0,j.useEffect)(()=>{if(!t)return;let e=Date.now();s(0);let n=window.setInterval(()=>{let t=Math.floor((Date.now()-e)/1e3);s(t),c.current=t},250);return()=>window.clearInterval(n)},[t]),(0,j.useEffect)(()=>{!t&&o===0&&c.current>0&&s(c.current)},[t,o]),(0,j.useEffect)(()=>{let t=l.current,n=d.current;if(!t)return;let r=O();if(!i||!e){if(r){t.style.height=`0px`,t.style.opacity=`0`;return}C.to(t,{height:0,opacity:0,duration:E.fast,ease:A.inOut,overwrite:!0});return}let a=n?.scrollHeight??0;if(r){t.style.height=`auto`,t.style.opacity=`1`;return}C.fromTo(t,{height:0,opacity:0},{height:a,opacity:1,duration:E.base,ease:A.out,overwrite:!0,onComplete:()=>{t.style.height=`auto`}})},[i,e]),!e&&!t)return null;let f=O(),m=t?o:o||c.current;return(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-xl`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-surface-secondary px-2.5 py-1 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:t?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(we,{size:12,className:`shrink-0 text-muted ${f?``:`animate-spin`}`}),(0,Y.jsx)(`span`,{className:f?``:`access-thinking-shimmer`,children:r(`thinkingWorking`)}),(0,Y.jsxs)(`span`,{className:`mono text-muted/80`,children:[o,`s`]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(u,{size:11,className:`shrink-0 transition-transform duration-200 ease-out ${i?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{children:r(`thinkingDone`)}),m>0?(0,Y.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingElapsed`,{n:m})}):null,!m&&e?(0,Y.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingChars`,{count:e.length})}):null]})}),(0,Y.jsx)(`div`,{ref:l,className:`overflow-hidden`,style:{height:0,opacity:0},children:e?(0,Y.jsx)(`pre`,{ref:d,className:`mt-1.5 max-h-52 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-surface-secondary/80 px-3 py-2 text-caption leading-5 text-muted`,children:e}):null})]})}function Re(e,t){return t(e===`running`?`toolCallRunning`:e===`error`?`toolCallError`:`toolCallSuccess`)}function ze({status:e}){return e===`running`?(0,Y.jsx)(ae,{size:12,className:`animate-spin text-muted`}):e===`error`?(0,Y.jsx)(le,{size:12,weight:`fill`,className:`text-danger`}):(0,Y.jsx)(oe,{size:12,weight:`fill`,className:`text-success`})}function Be(e){if(!e.trim())return``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function Ve({call:e,forceOpen:t}){let{t:n}=p(),[r,i]=(0,j.useState)(e.status===`error`||!!t),[a,o]=(0,j.useState)(!1),s=(0,j.useMemo)(()=>Be(e.arguments||``),[e.arguments]);(0,j.useEffect)(()=>{e.status===`error`&&i(!0)},[e.status]),(0,j.useEffect)(()=>{t&&i(!0)},[t]);async function c(){s&&(await d(s),o(!0),window.setTimeout(()=>o(!1),1200))}return(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-lg`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left`,"aria-expanded":r,onClick:()=>i(e=>!e),children:[(0,Y.jsx)(u,{size:11,className:`shrink-0 text-muted transition-transform ${r?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-caption font-medium text-foreground`,children:e.name||n(`toolCallUntitled`)}),(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted`,children:[(0,Y.jsx)(ze,{status:e.status}),Re(e.status,n)]})]}),r?(0,Y.jsxs)(`div`,{className:`space-y-1.5 px-2 pb-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:n(`toolCallArgs`)}),(0,Y.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-caption text-muted hover:bg-surface-secondary hover:text-foreground`,onClick:e=>{e.stopPropagation(),c()},children:[(0,Y.jsx)(V,{size:12}),n(a?`copied`:`copy`)]})]}),(0,Y.jsx)(`pre`,{className:`mono max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary/80 px-2.5 py-2 text-caption leading-5 text-muted`,children:s||n(`toolCallArgsEmpty`)})]}):null]})}function He({calls:e}){let{t}=p(),n=e.some(e=>e.status===`error`),r=e.some(e=>e.status===`running`),[i,a]=(0,j.useState)(n||r||e.length===1);return(0,j.useEffect)(()=>{(n||r)&&a(!0)},[n,r]),e.length?e.length===1?(0,Y.jsx)(`div`,{className:`rounded-xl bg-surface-secondary/70`,children:(0,Y.jsx)(Ve,{call:e[0],forceOpen:e[0].status===`error`})}):(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-secondary/70`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[(0,Y.jsx)(u,{size:11,className:`shrink-0 transition-transform ${i?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:t(`toolCallGroup`,{n:e.length})}),r?(0,Y.jsx)(ae,{size:12,className:`animate-spin`}):null]}),i?(0,Y.jsx)(`div`,{className:`space-y-0.5 border-t border-separator/40 px-0.5 py-1`,children:e.map(e=>(0,Y.jsx)(Ve,{call:e},`${e.index}-${e.id||e.name}`))}):null]}):null}function Ue({message:e}){return e.attachments?.length?(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.attachments.map(e=>(0,Y.jsxs)(`span`,{className:`inline-flex max-w-[12rem] items-center gap-1.5 rounded-xl bg-surface/70 px-1.5 py-1 text-caption text-muted`,children:[e.kind===`image`&&e.dataUrl?(0,Y.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-7 shrink-0 rounded-lg object-cover`}):(0,Y.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface`,children:(0,Y.jsx)(U,{size:12})}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))}):null}function We({message:e}){let{t}=p(),n=e.usage;if(!n||n.credits==null)return null;let r=n.prompt_tokens,i=n.completion_tokens,a=typeof r==`number`||typeof i==`number`?t(`chatTryUsageTokens`,{prompt:me(r??0),completion:me(i??0)}):``;return(0,Y.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`chatTryUsageFoot`,{tokens:a,amount:he(n.credits)}):t(`chatTryCreditsUsed`,{amount:he(n.credits)})})}function Ge({text:e,streaming:t}){let n=e.split(/(\n{2,})/),r=-1;for(let e=n.length-1;e>=0;--e)if(n[e]&&!/^\n{2,}$/.test(n[e])){r=e;break}return(0,Y.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground ${t?`access-streaming`:``}`,children:n.map((e,n)=>e?/^\n{2,}$/.test(e)?(0,Y.jsx)(`span`,{children:e},`s-${n}`):(0,Y.jsx)(`span`,{className:t&&n===r?`access-stream-seg`:void 0,children:e},`p-${n}`):null)})}function Ke(){let e=(0,j.useRef)(null);return(0,j.useEffect)(()=>{let t=e.current;!t||O()||C.from(t,{autoAlpha:0,duration:E.fast,ease:`power2.out`})},[]),e}function qe({message:e}){let{t}=p(),[n,r]=(0,j.useState)(!1),i=e.role===`user`,o=Ke();if(i)return(0,Y.jsx)(`div`,{ref:o,className:`ml-auto max-w-[92%] sm:max-w-[78%]`,children:(0,Y.jsxs)(`div`,{className:`access-bubble access-bubble--user rounded-2xl rounded-br-md px-3.5 py-2.5`,children:[e.content?(0,Y.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground`,children:e.content}):null,(0,Y.jsx)(Ue,{message:e})]})});let s=e.status===`streaming`&&!e.content&&!e.reasoning&&!e.toolCalls?.length,c=!!e.content&&e.status===`done`,l=e.status===`streaming`,u=!!(e.usage&&e.usage.credits!=null),f=e.status===`done`&&(e.latency_ms!=null||e.ttfb_ms!=null||typeof e.usage?.completion_tokens==`number`);async function m(){e.content&&(await d(e.content),r(!0),window.setTimeout(()=>r(!1),1200))}return(0,Y.jsxs)(`div`,{className:`group/access-msg max-w-[96%] space-y-1.5 sm:max-w-[88%]`,children:[(0,Y.jsx)(`div`,{className:`flex items-center gap-1.5 px-0.5`,children:(0,Y.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center rounded-lg border border-border bg-surface-secondary`,children:(0,Y.jsx)(ge,{provider:e.provider,size:13})})}),e.reasoning||l?(0,Y.jsx)(Le,{text:e.reasoning||``,streaming:l&&(!e.content||!!e.reasoning),defaultOpen:e.reasoningOpen}):null,e.toolCalls?.length?(0,Y.jsx)(He,{calls:e.toolCalls}):null,e.status===`error`?(0,Y.jsx)(v,{status:`danger`,title:t(`requestFailed`),description:e.error||``}):s?(0,Y.jsxs)(`div`,{className:`space-y-2 pt-0.5`,children:[(0,Y.jsx)(k,{className:`h-3 w-28 rounded-md`}),(0,Y.jsx)(k,{className:`h-3 w-full rounded-md`}),(0,Y.jsx)(k,{className:`h-3 w-[86%] rounded-md`}),(0,Y.jsx)(k,{className:`h-3 w-[68%] rounded-md`})]}):e.content?(0,Y.jsx)(`div`,{className:`access-bubble access-bubble--assistant px-0.5 py-0`,children:(0,Y.jsx)(Ge,{text:e.content,streaming:l})}):null,c||u||f?(0,Y.jsxs)(`div`,{className:`access-msg-foot space-y-1 px-0.5 pt-0.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[c?(0,Y.jsxs)(h,{size:`sm`,variant:`ghost`,className:`h-5 min-h-5 gap-1 px-1.5 text-caption text-muted/80`,onPress:()=>void m(),children:[(0,Y.jsx)(a,{copied:n,size:12}),t(n?`copied`:`copy`)]}):null,(0,Y.jsx)(We,{message:e})]}),f?(0,Y.jsx)(ve,{variant:`inline`,latencyMs:e.latency_ms,ttfbMs:e.ttfb_ms,completionTokens:e.usage?.completion_tokens,stream:!0,className:`access-latency-inline max-h-0 overflow-hidden opacity-0 transition-[opacity,max-height] duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] group-hover/access-msg:max-h-5 group-hover/access-msg:opacity-100 focus-within:max-h-5 focus-within:opacity-100`,labels:{ttft:t(`logsColTTFT`),total:t(`logsLatencyTotal`),tps:t(`logsOutputTPS`)}}):null]}):null]})}function Je({messages:e,busy:t,onLoadDemo:n}){let{t:r}=p(),i=(0,j.useRef)(null);(0,j.useEffect)(()=>{i.current?.scrollIntoView({block:`end`})},[e,t]);let a=!e.length;return(0,Y.jsxs)(`div`,{className:`access-thread min-h-0 flex-1 overflow-y-auto px-4 sm:px-6 ${a?`py-5 sm:py-6`:`pb-2 pt-4 sm:pb-2.5 sm:pt-5`}`,"aria-live":`polite`,"aria-busy":t,children:[a?(0,Y.jsx)(y,{className:`min-h-56`,icon:(0,Y.jsx)(z,{size:22}),title:r(`chatTryEmptyTitle`),hint:r(`chatTryEmptyHint`),action:n?(0,Y.jsx)(`button`,{type:`button`,className:`inline-flex h-8 items-center rounded-[10px] px-2.5 text-caption font-medium text-muted transition-colors hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onClick:n,children:r(`chatDemoLoad`)}):void 0}):(0,Y.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,Y.jsx)(qe,{message:e},e.id))}),(0,Y.jsx)(`div`,{ref:i})]})}function Ye({format:e,onFormatChange:t,requestPath:n,prompt:r,onPromptChange:i,onTest:o,requestState:c,elapsedMs:l,output:u,responseStatus:d,curl:f,copiedCurl:m,onCopyCurl:g,canSend:_,accountValue:b,onAccountChange:x,accountOptions:S,modelValue:C,onModelChange:ee,modelOptions:te,modelsLoading:ne,disabled:w}){let{t:T}=p();return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`px-1 text-caption leading-5 text-muted`,children:T(`rawFormatHint`)}),(0,Y.jsx)(`div`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:(0,Y.jsxs)(`div`,{className:`grid xl:grid-cols-[minmax(420px,.92fr)_minmax(0,1.08fr)]`,children:[(0,Y.jsxs)(`div`,{className:`xl:border-r xl:border-[color-mix(in_oklab,var(--foreground)_6%,transparent)]`,children:[(0,Y.jsxs)(`div`,{className:`px-4 py-3.5 sm:px-5`,children:[(0,Y.jsx)(`h3`,{className:`text-body font-semibold`,children:T(`requestBuilder`)}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-caption text-muted`,children:[`POST `,n]})]}),(0,Y.jsxs)(`div`,{className:`space-y-4 px-4 pb-4 sm:px-5 sm:pb-5`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:T(`rawFormatLabel`)}),(0,Y.jsx)(de,{className:`access-format-chips`,ariaLabel:T(`rawFormatLabel`),value:e,onChange:e=>t(e),options:[{id:`chat`,label:T(`rawFormatChat`)},{id:`messages`,label:T(`rawFormatMessages`)},{id:`responses`,label:T(`rawFormatResponses`)}]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,Y.jsx)(Q,{ariaLabel:T(`account`),value:b,onChange:x,options:S,isDisabled:w||c===`loading`,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,Y.jsx)(Q,{ariaLabel:T(`model`),value:C,onChange:ee,placeholder:T(ne?`requesting`:`model`),options:te,isDisabled:w||c===`loading`||ne||!te.length,className:`w-auto max-w-[10.5rem] min-w-0`})]}),(0,Y.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:T(`prompt`)}),(0,Y.jsx)(`span`,{className:`mono text-caption text-muted`,children:r.length})]}),(0,Y.jsx)(s,{fullWidth:!0,rows:9,className:`min-h-52 resize-y rounded-xl border-0 bg-[var(--field-background)] px-3.5 py-3 text-body leading-[1.65] shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--field-border)_78%,var(--foreground))] focus-visible:ring-0`,value:r,onChange:e=>i(e.target.value),placeholder:T(`promptPlaceholder`),"aria-label":T(`prompt`),disabled:w||c===`loading`}),(0,Y.jsx)(`p`,{className:`text-caption leading-5 text-muted/70`,children:T(`promptHelper`)})]}),(0,Y.jsxs)(h,{fullWidth:!0,isPending:c===`loading`,isDisabled:!_||w,onPress:o,children:[(0,Y.jsx)(G,{size:15}),T(c===`loading`?`requesting`:`sendRequest`)]})]})]}),(0,Y.jsxs)(`div`,{className:`access-raw-panel__inspector flex min-h-[440px] min-w-0 flex-col`,"aria-live":`polite`,"aria-busy":c===`loading`,children:[(0,Y.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-body font-semibold`,children:T(`responseInspector`)}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:T(`responseInspectorHint`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l===null?null:(0,Y.jsxs)(`span`,{className:`mono flex items-center gap-1.5 text-caption text-muted`,children:[(0,Y.jsx)(Ee,{size:12}),l,` ms`]}),(0,Y.jsx)(re,{size:`sm`,variant:`soft`,color:c===`success`?`success`:c===`error`?`danger`:void 0,children:d})]})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 px-4 pb-4 sm:px-5 sm:pb-5`,children:c===`idle`?(0,Y.jsx)(y,{className:`min-h-64`,title:T(`responseEmptyTitle`),hint:T(`responseEmptyHint`)}):c===`loading`?(0,Y.jsxs)(`div`,{className:`space-y-3 pt-1`,children:[(0,Y.jsx)(k,{className:`h-3 w-32 rounded-lg`}),(0,Y.jsx)(k,{className:`h-3 w-full rounded-lg`}),(0,Y.jsx)(k,{className:`h-3 w-[88%] rounded-lg`}),(0,Y.jsx)(k,{className:`h-3 w-[72%] rounded-lg`}),(0,Y.jsx)(k,{className:`mt-7 h-3 w-[92%] rounded-lg`}),(0,Y.jsx)(k,{className:`h-3 w-[64%] rounded-lg`})]}):c===`error`?(0,Y.jsx)(`div`,{className:`space-y-3`,children:(0,Y.jsx)(v,{status:`danger`,title:T(`requestFailed`),description:u})}):(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-caption font-medium text-success`,children:[(0,Y.jsx)(oe,{size:14,weight:`fill`}),T(`responseReceived`)]}),(0,Y.jsx)(`pre`,{className:`mono overflow-x-auto whitespace-pre-wrap break-words text-caption leading-6 text-muted`,children:u})]})})]})]})}),(0,Y.jsxs)(`section`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-body font-semibold`,children:T(`curlExample`)}),(0,Y.jsx)(`div`,{className:`mt-0.5 truncate text-caption text-muted`,children:T(`curlGeneratedHint`)})]}),(0,Y.jsxs)(h,{size:`sm`,variant:`ghost`,onPress:g,children:[(0,Y.jsx)(a,{copied:m}),T(m?`copied`:`copy`)]})]}),(0,Y.jsx)(`pre`,{className:`mono max-h-72 overflow-auto whitespace-pre-wrap px-4 pb-4 text-caption leading-6 text-muted sm:px-5 sm:pb-5`,children:f})]})]})}function Xe(e,t){let n=t.filter(e=>e.kind===`text`),r=t.filter(e=>e.kind===`image`&&e.dataUrl),i=e.trim();for(let e of n){let t=e.text??``;i=`${i}${i?` - -`:``}--- file: ${e.name} ---\n${t}`}if(!r.length)return i;let a=[];i&&a.push({type:`text`,text:i});for(let e of r)a.push({type:`image_url`,image_url:{url:e.dataUrl}});return a}function Ze(e,t){let n=[];for(let t of e)if(!(t.status===`error`&&t.role===`assistant`&&!t.content)){if(t.role===`user`){n.push({role:`user`,content:Xe(t.content,t.attachments||[])});continue}t.content&&n.push({role:`assistant`,content:t.content})}return[...n,t]}var Qe=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNkYPhfz0AEYBxVSF+FABJADveWkH6aAAAAAElFTkSuQmCC`;function $e(){return[{id:`demo-user-1`,role:`user`,content:`Summarize the attached screenshot and look up the endpoint.`,attachments:[{id:`demo-img-1`,name:`screenshot.png`,mime:`image/png`,kind:`image`,dataUrl:Qe,size:2048},{id:`demo-txt-1`,name:`notes.md`,mime:`text/markdown`,kind:`text`,text:`# notes -placeholder`,size:128}],status:`done`},{id:`demo-assistant-1`,role:`assistant`,provider:`workbuddy`,content:`The screenshot shows the Access playground. I looked up the chat completions route and drafted a short summary below.`,reasoning:`User attached a UI screenshot and a notes file. -I should call the models/list helper, then summarize the visible chrome without inventing product claims. -Keep the reply short and ops-console toned.`,toolCalls:[{index:0,id:`call_demo_list`,name:`list_endpoints`,arguments:JSON.stringify({base:`/v1`,filter:`chat`},null,2),status:`success`},{index:1,id:`call_demo_read`,name:`read_attachment`,arguments:JSON.stringify({name:`notes.md`,max_chars:400},null,2),status:`success`}],reasoningOpen:!1,usage:{credits:.75,prompt_tokens:1840,completion_tokens:126,source:`upstream`},ttfb_ms:380,latency_ms:2140,status:`done`}]}function et(){return[{id:`demo-user-thinking`,role:`user`,content:`Walk through the Access playground layout.`,status:`done`},{id:`demo-assistant-thinking`,role:`assistant`,provider:`workbuddy`,content:``,reasoning:`Scan the stage chrome, then the composer controls, then draft a short reply without inventing product claims.`,status:`streaming`}]}function tt(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}function nt(e){return`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function rt(e,t){return e.map((e,n)=>({index:typeof e.index==`number`?e.index:n,id:e.id||`tool-${n}`,name:e.function?.name||``,arguments:e.function?.arguments||``,status:t?`running`:`success`}))}function $(){if(typeof window>`u`)return null;try{let e=new URLSearchParams(window.location.search).get(`demo`);return e===`1`||e===`full`?`full`:e===`thinking`?`thinking`:null}catch{return null}}function it(){let e=$();return e===`thinking`?et():e===`full`?$e():[]}function at(e){let t=e.find(e=>e.role===`user`&&e.content.trim());if(!t)return``;let n=t.content.trim().replace(/\s+/g,` `);return n.length>36?`${n.slice(0,36)}…`:n}function ot(e=[]){return{id:nt(`session`),title:at(e),messages:e,updatedAt:Date.now()}}var st=[{id:`hy3`,display_name:`HY3`,credits:`0.75 credits`,provider:`workbuddy`},{id:`glm-4.6`,display_name:`GLM-4.6`,credits:`0.5 credits`,provider:`workbuddy`},{id:`free-demo`,display_name:`Free Demo`,credits:`0 credits`,free:!0,provider:`workbuddy`}];function ct(){let{t:e}=p(),{overview:t,loading:n}=ee(),[r,i]=(0,j.useState)(`chat`),[s,c]=(0,j.useState)(`chat`),[u,f]=(0,j.useState)(!0),[m,g]=(0,j.useState)(()=>[ot(it())]),[_,v]=(0,j.useState)(``),y=_||m[0]?.id||``,S=(m.find(e=>e.id===y)||m[0])?.messages||[],[C,E]=(0,j.useState)([]),[D,O]=(0,j.useState)([]);(0,j.useEffect)(()=>{let e=!1;return Promise.allSettled([ue(),te(!1)]).then(([t,n])=>{e||(t.status===`fulfilled`&&E(t.value.data||[]),n.status===`fulfilled`&&O(n.value.data||[]))}),()=>{e=!0}},[]);let ie=J(t?.access?.openai_base_url||`/v1`),ae=t?.access?.chat_completions||`/v1/chat/completions`,k=t?.access?.messages||`/v1/messages`,oe=t?.access?.responses||`/v1/responses`,ce=s===`messages`?k:s===`responses`?oe:ae,le=J(ce),[A,de]=(0,j.useState)(``),[me,he]=(0,j.useState)(``),[ve,ye]=(0,j.useState)(null),[M,be]=(0,j.useState)(`只回复OK`),[xe,N]=(0,j.useState)(``),[P,F]=(0,j.useState)([]),[Se,I]=(0,j.useState)(`idle`),L=(0,j.useRef)(null),[Ce,R]=(0,j.useState)(``),[z,B]=(0,j.useState)(`idle`),[we,Te]=(0,j.useState)(null),[Ee,De]=(0,j.useState)(``),V=me||``,H=!V||ve?.accountId===V,U=V?H&&ve?.models||[]:C,W=!!V&&!H,Oe=H&&ve?.error||``,ke=$()==null?[]:st.map(e=>e.id),G=U.some(e=>e.id===A)||ke.includes(A)?A:U[0]?.id||ke[0]||``;(0,j.useEffect)(()=>{if(!V)return;let e=!1;return ue(V).then(t=>{e||ye({accountId:V,models:t.data||[],error:``})}).catch(t=>{e||ye({accountId:V,models:[],error:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},[V]),(0,j.useEffect)(()=>()=>{L.current?.abort()},[]);let K=D.filter(e=>e.enabled!==!1&&(e.ready===!0||e.hot===!0||e.status===`ready`||e.status===`hot`)),Ae=(0,j.useMemo)(()=>w(s,G,M),[M,s,G]),q=(0,j.useMemo)(()=>`curl -sS ${tt(le)} \\ - -H "Authorization: Bearer $CLI2API_API_KEY" \\ - -H ${tt(`Content-Type: application/json`)}${V?` \\ - -H ${tt(`X-Qoder-Account: ${V}`)}`:``} \\ - -d ${tt(JSON.stringify(Ae))}`,[Ae,le,V]);if(n&&!t)return(0,Y.jsx)(se,{});async function Me(e,t){await d(e),De(t),window.setTimeout(()=>De(``),1100)}async function Ne(){let e=performance.now();B(`loading`),Te(null),R(``);try{let e=await T(ce,Ae,V||void 0);R(JSON.stringify(e,null,2)),B(`success`)}catch(e){R(e instanceof Error?e.message:String(e)),B(`error`)}finally{Te(Math.round(performance.now()-e))}}function X(){L.current?.abort(),L.current=null}function Pe(e){let t=y;g(n=>n.map(n=>{if(n.id!==t)return n;let r=typeof e==`function`?e(n.messages):e;return{...n,messages:r,title:at(r)||n.title,updatedAt:Date.now()}}))}function Z(e,t){Pe(n=>n.map(n=>{if(n.id!==e)return n;let r=typeof t==`function`?t(n):t;return{...n,...r}}))}async function Q(){let e=xe.trim();if(!e&&!P.length||!G||W||Se===`loading`)return;X();let t=new AbortController;L.current=t;let n=P,r={id:nt(`user`),role:`user`,content:e,attachments:n,status:`done`},i=nt(`assistant`),a={id:i,role:`assistant`,provider:D.find(e=>e.id===V)?.provider||U.find(e=>e.id===G)?.provider||``,content:``,status:`streaming`},o=S;Pe([...o,r,a]),N(``),F([]),I(`loading`);let s=Ze(o,{role:`user`,content:Xe(e,n)}),c=performance.now(),l=null,u=()=>{l??=performance.now()},d=()=>{let e=performance.now();return{latency_ms:Math.max(0,Math.round(e-c)),ttfb_ms:l==null?void 0:Math.max(0,Math.round(l-c))}};try{await ne(G,s,V||void 0,{signal:t.signal,onContent:(e,t)=>{e&&u(),Z(i,{content:t})},onReasoning:(e,t)=>{e&&u(),Z(i,{reasoning:t})},onToolCalls:e=>{u(),Z(i,{toolCalls:rt(e,!0)})},onUsage:e=>Z(i,{usage:e})}),Z(i,e=>({status:`done`,...d(),toolCalls:e.toolCalls?.map(e=>({...e,status:`success`}))})),I(`success`)}catch(e){if(t.signal.aborted){Z(i,e=>({status:`done`,...d(),toolCalls:e.toolCalls?.map(e=>({...e,status:`success`}))})),I(`success`);return}Z(i,{status:`error`,error:e instanceof Error?e.message:String(e),...d()}),I(`error`)}finally{L.current===t&&(L.current=null)}}let Le=e(z===`success`?`requestComplete`:z===`error`?`requestFailed`:z===`loading`?`requesting`:`requestIdle`),Re=$()!=null,ze=[{id:`auto`,textValue:e(`autoAccount`),label:e(`autoAccount`),icon:(0,Y.jsx)(o,{size:14,className:`text-muted`})},...D.map(t=>({id:t.id,textValue:`${t.name||t.id} ${_e(t.provider,t.region,e)}`,label:t.name||t.id,hint:_e(t.provider,t.region,e),icon:(0,Y.jsx)(ge,{provider:t.provider,size:14})}))],Be=D.length||!Re?ze:[{id:`auto`,textValue:e(`autoAccount`),label:e(`autoAccount`),icon:(0,Y.jsx)(o,{size:14,className:`text-muted`})},{id:`demo-wb`,textValue:`wb-demo WorkBuddy`,label:`wb-demo`,hint:`WorkBuddy`}],Ve=U.map(t=>{let n=fe(t),r=pe(t),i=t.display_name||t.id,a=r?e(`modelFree`):n,o=t.provider||t.owned_by||``;return{id:t.id,textValue:`${i} ${t.id} ${o} ${n} ${r?`free`:``}`,label:a?`${i} ${a}`:i,hint:[t.id,o,a].filter(Boolean).join(` · `)}}),He=Ve.length||!Re?Ve:st.map(t=>{let n=fe(t),r=pe(t),i=t.display_name||t.id,a=r?e(`modelFree`):n;return{id:t.id,textValue:`${i} ${t.id} ${t.provider} ${n} ${r?`free`:``}`,label:a?`${i} ${a}`:i,hint:[t.id,t.provider,a].filter(Boolean).join(` · `)}}),Ue=!!((xe.trim()||P.length)&&G&&!W&&(D.length||Re));function We(){Pe($e()),I(`idle`)}function Ge(){X(),I(`idle`),N(``),F([]);let e=ot([]);g(t=>[e,...t]),v(e.id)}function Ke(e){e!==y&&(X(),I(`idle`),N(``),F([]),v(e))}let qe=m.slice().sort((e,t)=>t.updatedAt-e.updatedAt).map(t=>({id:t.id,title:t.title||e(`chatHistoryUntitled`),updatedAt:t.updatedAt}));return(0,Y.jsxs)(`div`,{className:`access-page space-y-4`,children:[(0,Y.jsxs)(`section`,{className:`access-info-row flex flex-wrap items-center gap-x-3 gap-y-2 px-0.5 py-0.5`,title:e(`apiPlaygroundHint`),children:[(0,Y.jsx)(`h2`,{className:`shrink-0 text-body font-semibold text-foreground`,children:e(`apiPlayground`)}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 text-caption text-muted`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:e(`baseUrl`)}),(0,Y.jsx)(`code`,{className:`mono min-w-0 truncate font-medium text-foreground`,children:ie}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-6 min-w-6 shrink-0`,"aria-label":e(`copyBaseUrl`),onPress:()=>void Me(ie,`base`),children:(0,Y.jsx)(a,{copied:Ee===`base`,size:13})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-caption text-muted`,children:[(0,Y.jsx)(`span`,{className:`status-dot`,"data-state":K.length?`ok`:void 0}),(0,Y.jsx)(`span`,{children:e(`readyAccounts`,{ready:K.length,total:D.length})}),(0,Y.jsx)(re,{size:`sm`,variant:`soft`,color:K.length?`success`:`warning`,children:K.length?e(`endpointReady`):e(`degraded`)})]})]}),D.length?null:(0,Y.jsxs)(`div`,{className:`space-y-1 px-1`,children:[(0,Y.jsx)(`p`,{className:`text-caption text-muted`,children:e(`noAccountsForTest`)}),(0,Y.jsx)(l,{})]}),Oe?(0,Y.jsx)(`p`,{className:`px-1 text-caption text-danger`,children:Oe}):null,(0,Y.jsxs)(x,{selectedKey:r,onSelectionChange:e=>i(String(e)),children:[(0,Y.jsx)(x.ListContainer,{className:`w-fit`,children:(0,Y.jsxs)(x.List,{"aria-label":e(`accessTabsLabel`),children:[(0,Y.jsxs)(b,{id:`chat`,className:`gap-1.5 whitespace-nowrap`,children:[(0,Y.jsx)(x.Indicator,{className:`transition-none`}),e(`accessTabChat`)]}),(0,Y.jsxs)(b,{id:`raw`,className:`gap-1.5 whitespace-nowrap`,children:[(0,Y.jsx)(x.Indicator,{className:`transition-none`}),e(`accessTabApi`)]})]})}),(0,Y.jsx)(x.Panel,{id:`chat`,className:`pt-4`,children:(0,Y.jsxs)(`div`,{className:`flex min-h-[640px] md:min-h-[72vh]`,children:[(0,Y.jsx)(Ie,{collapsed:u,onCollapsedChange:f,items:qe,activeId:y,onSelect:Ke,onNew:Ge}),(0,Y.jsxs)(`div`,{className:`access-chat-stage flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(Je,{messages:S,busy:Se===`loading`,onLoadDemo:We}),(0,Y.jsx)(Fe,{value:xe,onChange:N,attachments:P,onAttachmentsChange:F,disabled:!D.length&&$()==null,streaming:Se===`loading`,canSend:Ue,onSend:()=>void Q(),onStop:X,accountValue:V||`auto`,onAccountChange:e=>he(e===`auto`?``:e),accountOptions:Be,modelValue:G,onModelChange:de,modelOptions:He,modelsLoading:W})]})]})}),(0,Y.jsxs)(x.Panel,{id:`raw`,className:`space-y-4 pt-4`,children:[(0,Y.jsx)(Ye,{format:s,onFormatChange:c,requestPath:ce,prompt:M,onPromptChange:be,onTest:()=>void Ne(),requestState:z,elapsedMs:we,output:Ce,responseStatus:Le,curl:q,copiedCurl:Ee===`curl`,onCopyCurl:()=>void Me(q,`curl`),canSend:!!(M.trim()&&G&&!W),accountValue:V||`auto`,onAccountChange:e=>he(e===`auto`?``:e),accountOptions:Be,modelValue:G,onModelChange:de,modelOptions:He,modelsLoading:W,disabled:!D.length&&$()==null}),(0,Y.jsx)(je,{access:t?.access})]})]})]})}export{ct as AccessPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/AccessPage-BtrPkvzM.js b/internal/webui/static/assets/AccessPage-BtrPkvzM.js new file mode 100644 index 00000000..8ce4cc56 --- /dev/null +++ b/internal/webui/static/assets/AccessPage-BtrPkvzM.js @@ -0,0 +1,10 @@ +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{a as r,i,n as a,o,r as s,s as c,t as l}from"./CaiaiSoftLink-DUJ2V4Pr.js";import{n as u}from"./Check.es-DrOC94kl.js";import{t as d}from"./clipboard-DG4c5Ihq.js";import{t as f}from"./Plus.es-BKtgxOxU.js";import{n as p,pt as m,r as h}from"./useI18n-DAGWWg9N.js";import{t as g}from"./label-j5K3TFm8.js";import{t as _}from"./list-box-CGt1vjr2.js";import{t as v}from"./PageAlert-BTp9jdUz.js";import{t as y}from"./EmptyPanel-Bs-jQMvG.js";import{n as b,t as x}from"./tabs-CvBWSueW.js";import{t as S}from"./select-6cCnF9ka.js";import{C as ee,p as te,t as ne,u as re,w as C}from"./overview-DcWoRgOQ.js";import{r as w}from"./gsap-C3sDxib7.js";import{Dt as ie,M as ae,Mt as T,O as oe,Ot as se,Vt as ce,i as le,j as E,jt as ue,t as de,v as D,x as O,y as k}from"./index-BYut8qRj.js";import{t as fe}from"./FilterToggle-nA-ZS4oO.js";import{d as pe,f as me,i as he,o as A}from"./format-B6SmebW-.js";import{t as ge}from"./ProviderMark-IiAZTaQS.js";import{n as _e}from"./provider-gHnttGKq.js";import{t as ve}from"./LatencyStats-DmxRwO-O.js";var j=t(e(),1),ye=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M54.8,119.49A35.06,35.06,0,0,1,49.05,128a35.06,35.06,0,0,1,5.75,8.51C60,147.24,60,159.83,60,172c0,25.94,1.84,32,20,32a12,12,0,0,1,0,24c-19.14,0-32.2-6.9-38.8-20.51C36,196.76,36,184.17,36,172c0-25.94-1.84-32-20-32a12,12,0,0,1,0-24c18.16,0,20-6.06,20-32,0-12.17,0-24.76,5.2-35.49C47.8,34.9,60.86,28,80,28a12,12,0,0,1,0,24c-18.16,0-20,6.06-20,32C60,96.17,60,108.76,54.8,119.49ZM240,116c-18.16,0-20-6.06-20-32,0-12.17,0-24.76-5.2-35.49C208.2,34.9,195.14,28,176,28a12,12,0,0,0,0,24c18.16,0,20,6.06,20,32,0,12.17,0,24.76,5.2,35.49A35.06,35.06,0,0,0,207,128a35.06,35.06,0,0,0-5.75,8.51C196,147.24,196,159.83,196,172c0,25.94-1.84,32-20,32a12,12,0,0,0,0,24c19.14,0,32.2-6.9,38.8-20.51C220,196.76,220,184.17,220,172c0-25.94,1.84-32,20-32a12,12,0,0,0,0-24Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M240,128c-64,0,0,88-64,88H80c-64,0,0-88-64-88,64,0,0-88,64-88h96C240,40,176,128,240,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M43.18,128a29.78,29.78,0,0,1,8,10.26c4.8,9.9,4.8,22,4.8,33.74,0,24.31,1,36,24,36a8,8,0,0,1,0,16c-17.48,0-29.32-6.14-35.2-18.26-4.8-9.9-4.8-22-4.8-33.74,0-24.31-1-36-24-36a8,8,0,0,1,0-16c23,0,24-11.69,24-36,0-11.72,0-23.84,4.8-33.74C50.68,38.14,62.52,32,80,32a8,8,0,0,1,0,16C57,48,56,59.69,56,84c0,11.72,0,23.84-4.8,33.74A29.78,29.78,0,0,1,43.18,128ZM240,120c-23,0-24-11.69-24-36,0-11.72,0-23.84-4.8-33.74C205.32,38.14,193.48,32,176,32a8,8,0,0,0,0,16c23,0,24,11.69,24,36,0,11.72,0,23.84,4.8,33.74a29.78,29.78,0,0,0,8,10.26,29.78,29.78,0,0,0-8,10.26c-4.8,9.9-4.8,22-4.8,33.74,0,24.31-1,36-24,36a8,8,0,0,0,0,16c17.48,0,29.32-6.14,35.2-18.26,4.8-9.9,4.8-22,4.8-33.74,0-24.31,1-36,24-36a8,8,0,0,0,0-16Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM88,155.84c.29,14.26.41,20.16,16,20.16a8,8,0,0,1,0,16c-31.27,0-31.72-22.43-32-35.84C71.71,141.9,71.59,136,56,136a8,8,0,0,1,0-16c15.59,0,15.71-5.9,16-20.16C72.28,86.43,72.73,64,104,64a8,8,0,0,1,0,16c-15.59,0-15.71,5.9-16,20.16-.17,8.31-.41,20.09-8,27.84C87.59,135.75,87.83,147.53,88,155.84ZM200,136c-15.59,0-15.71,5.9-16,20.16-.28,13.41-.73,35.84-32,35.84a8,8,0,0,1,0-16c15.59,0,15.71-5.9,16-20.16.17-8.31.41-20.09,8-27.84-7.6-7.75-7.84-19.53-8-27.84C167.71,85.9,167.59,80,152,80a8,8,0,0,1,0-16c31.27,0,31.72,22.43,32,35.84.29,14.26.41,20.16,16,20.16a8,8,0,0,1,0,16Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M39.91,128a27.68,27.68,0,0,1,9.49,11.13C54,148.62,54,160.51,54,172c0,24.27,1.21,38,26,38a6,6,0,0,1,0,12c-16.88,0-27.81-5.6-33.4-17.13C42,195.38,42,183.49,42,172c0-24.27-1.21-38-26-38a6,6,0,0,1,0-12c24.79,0,26-13.73,26-38,0-11.49,0-23.38,4.6-32.87C52.19,39.6,63.12,34,80,34a6,6,0,0,1,0,12C55.21,46,54,59.73,54,84c0,11.49,0,23.38-4.6,32.87A27.68,27.68,0,0,1,39.91,128ZM240,122c-24.79,0-26-13.73-26-38,0-11.49,0-23.38-4.6-32.87C203.81,39.6,192.88,34,176,34a6,6,0,0,0,0,12c24.79,0,26,13.73,26,38,0,11.49,0,23.38,4.6,32.87A27.68,27.68,0,0,0,216.09,128a27.68,27.68,0,0,0-9.49,11.13C202,148.62,202,160.51,202,172c0,24.27-1.21,38-26,38a6,6,0,0,0,0,12c16.88,0,27.81-5.6,33.4-17.13,4.6-9.49,4.6-21.38,4.6-32.87,0-24.27,1.21-38,26-38a6,6,0,0,0,0-12Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M43.18,128a29.78,29.78,0,0,1,8,10.26c4.8,9.9,4.8,22,4.8,33.74,0,24.31,1,36,24,36a8,8,0,0,1,0,16c-17.48,0-29.32-6.14-35.2-18.26-4.8-9.9-4.8-22-4.8-33.74,0-24.31-1-36-24-36a8,8,0,0,1,0-16c23,0,24-11.69,24-36,0-11.72,0-23.84,4.8-33.74C50.68,38.14,62.52,32,80,32a8,8,0,0,1,0,16C57,48,56,59.69,56,84c0,11.72,0,23.84-4.8,33.74A29.78,29.78,0,0,1,43.18,128ZM240,120c-23,0-24-11.69-24-36,0-11.72,0-23.84-4.8-33.74C205.32,38.14,193.48,32,176,32a8,8,0,0,0,0,16c23,0,24,11.69,24,36,0,11.72,0,23.84,4.8,33.74a29.78,29.78,0,0,0,8,10.26,29.78,29.78,0,0,0-8,10.26c-4.8,9.9-4.8,22-4.8,33.74,0,24.31-1,36-24,36a8,8,0,0,0,0,16c17.48,0,29.32-6.14,35.2-18.26,4.8-9.9,4.8-22,4.8-33.74,0-24.31,1-36,24-36a8,8,0,0,0,0-16Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M35.89,128C52,136.23,52,155.64,52,172c0,24.8,1.35,40,28,40a4,4,0,0,1,0,8c-36,0-36-26.61-36-48,0-24.8-1.35-40-28-40a4,4,0,0,1,0-8c26.65,0,28-15.2,28-40,0-21.39,0-48,36-48a4,4,0,0,1,0,8C53.35,44,52,59.2,52,84,52,100.36,52,119.77,35.89,128ZM240,124c-26.65,0-28-15.2-28-40,0-21.39,0-48-36-48a4,4,0,0,0,0,8c26.65,0,28,15.2,28,40,0,16.36,0,35.77,16.11,44C204,136.23,204,155.64,204,172c0,24.8-1.35,40-28,40a4,4,0,0,0,0,8c36,0,36-26.61,36-48,0-24.8,1.35-40,28-40a4,4,0,0,0,0-8Z`}))]]),M=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M120,128a16,16,0,1,1-16-16A16,16,0,0,1,120,128Zm32-16a16,16,0,1,0,16,16A16,16,0,0,0,152,112Zm84,16A108,108,0,0,1,78.77,224.15L46.34,235A20,20,0,0,1,21,209.66l10.81-32.43A108,108,0,1,1,236,128Zm-24,0A84,84,0,1,0,55.27,170.06a12,12,0,0,1,1,9.81l-9.93,29.79,29.79-9.93a12.1,12.1,0,0,1,3.8-.62,12,12,0,0,1,6,1.62A84,84,0,0,0,212,128Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-4-1.08,7.85,7.85,0,0,0-2.53.42L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Zm12-88a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm-44,0a12,12,0,1,1-12-12A12,12,0,0,1,96,128Zm88,0a12,12,0,1,1-12-12A12,12,0,0,1,184,128Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24ZM84,140a12,12,0,1,1,12-12A12,12,0,0,1,84,140Zm44,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm44,0a12,12,0,1,1,12-12A12,12,0,0,1,172,140Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM84,118a10,10,0,1,0,10,10A10,10,0,0,0,84,118Zm88,0a10,10,0,1,0,10,10A10,10,0,0,0,172,118Zm58,10A102,102,0,0,1,79.31,217.65L44.44,229.27a14,14,0,0,1-17.71-17.71l11.62-34.87A102,102,0,1,1,230,128Zm-12,0A90,90,0,1,0,50.08,173.06a6,6,0,0,1,.5,4.91L38.12,215.35a2,2,0,0,0,2.53,2.53L78,205.42a6.2,6.2,0,0,1,1.9-.31,6.09,6.09,0,0,1,3,.81A90,90,0,0,0,218,128Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM84,116a12,12,0,1,0,12,12A12,12,0,0,0,84,116Zm88,0a12,12,0,1,0,12,12A12,12,0,0,0,172,116Zm60,12A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Zm-16,0A88,88,0,1,0,51.81,172.06a8,8,0,0,1,.66,6.54L40,216,77.4,203.53a7.85,7.85,0,0,1,2.53-.42,8,8,0,0,1,4,1.08A88,88,0,0,0,216,128Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-52-8a8,8,0,1,0,8,8A8,8,0,0,0,84,120Zm88,0a8,8,0,1,0,8,8A8,8,0,0,0,172,120Zm56,8A100,100,0,0,1,79.5,215.47l-35.69,11.9a12,12,0,0,1-15.18-15.18l11.9-35.69A100,100,0,1,1,228,128Zm-8,0A92,92,0,1,0,48.35,174.07a4,4,0,0,1,.33,3.27L36.22,214.72a4,4,0,0,0,5.06,5.06l37.38-12.46a3.93,3.93,0,0,1,1.27-.21,4.05,4.05,0,0,1,2,.54A92,92,0,0,0,220,128Z`}))]]),be=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M236,128a108,108,0,0,1-216,0c0-42.52,24.73-81.34,63-98.9A12,12,0,1,1,93,50.91C63.24,64.57,44,94.83,44,128a84,84,0,0,0,168,0c0-33.17-19.24-63.43-49-77.09A12,12,0,1,1,173,29.1C211.27,46.66,236,85.48,236,128Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,176A72,72,0,0,1,92,65.64a8,8,0,0,1,8,13.85,56,56,0,1,0,56,0,8,8,0,0,1,8-13.85A72,72,0,0,1,128,200Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M228,128a100,100,0,0,1-200,0c0-39.4,22.9-75.37,58.33-91.63a4,4,0,1,1,3.34,7.27C57.07,58.6,36,91.71,36,128a92,92,0,0,0,184,0c0-36.29-21.07-69.4-53.67-84.36a4,4,0,1,1,3.34-7.27C205.1,52.63,228,88.6,228,128Z`}))]]),xe=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z`}))]]),N=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M180,64H40A12,12,0,0,0,28,76V216a12,12,0,0,0,12,12H180a12,12,0,0,0,12-12V76A12,12,0,0,0,180,64ZM168,204H52V88H168ZM228,40V180a12,12,0,0,1-24,0V52H76a12,12,0,0,1,0-24H216A12,12,0,0,1,228,40Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,72V216H40V72Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M184,64H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H184a8,8,0,0,0,8-8V72A8,8,0,0,0,184,64Zm-8,144H48V80H176ZM224,40V184a8,8,0,0,1-16,0V48H72a8,8,0,0,1,0-16H216A8,8,0,0,1,224,40Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M192,72V216a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H184A8,8,0,0,1,192,72Zm24-40H72a8,8,0,0,0,0,16H208V184a8,8,0,0,0,16,0V40A8,8,0,0,0,216,32Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,66H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H184a6,6,0,0,0,6-6V72A6,6,0,0,0,184,66Zm-6,144H46V78H178ZM222,40V184a6,6,0,0,1-12,0V46H72a6,6,0,0,1,0-12H216A6,6,0,0,1,222,40Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,64H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H184a8,8,0,0,0,8-8V72A8,8,0,0,0,184,64Zm-8,144H48V80H176ZM224,40V184a8,8,0,0,1-16,0V48H72a8,8,0,0,1,0-16H216A8,8,0,0,1,224,40Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,68H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H184a4,4,0,0,0,4-4V72A4,4,0,0,0,184,68Zm-4,144H44V76H180ZM220,40V184a4,4,0,0,1-8,0V44H72a4,4,0,0,1,0-8H216A4,4,0,0,1,220,40Z`}))]]),P=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M216.49,79.52l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40V216a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V88A12,12,0,0,0,216.49,79.52ZM160,57l23,23H160ZM60,212V44h76V92a12,12,0,0,0,12,12h48V212Zm112-80a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,132Zm0,40a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,172Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M208,88H152V32Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-32-80a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,136Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,168Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,176H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm-8-56V44l44,44Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40V216a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM200,218H56a2,2,0,0,1-2-2V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216A2,2,0,0,1,200,218Zm-34-82a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,136Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,168Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-32-80a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,136Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,168Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40V216a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM200,220H56a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V216A4,4,0,0,1,200,220Zm-36-84a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,136Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,168Z`}))]]),F=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M71.76,148H31.7a12,12,0,1,1,0-24H65.33l12.45-18.66a12,12,0,0,1,20,0l22,33,6-9a12,12,0,0,1,10-5.34h24a12,12,0,1,1,0,24h-17.6l-12.46,18.66a12,12,0,0,1-20,0l-22-33-6,9A12,12,0,0,1,71.76,148ZM177.91,36c-20.12,0-38,7.93-50.07,21.56C115.74,43.93,97.89,36,77.76,36A66,66,0,0,0,12.07,94.68,12,12,0,0,0,36,97.32,42,42,0,0,1,77.76,60c17.83,0,32.75,9.4,38.95,24.54a12,12,0,0,0,22.25,0C145.16,69.4,160.08,60,177.91,60A42.08,42.08,0,0,1,220,102c0,29.42-25.86,57.77-47.56,76.36a329,329,0,0,1-44.58,31.81c-10.87-6.45-35.37-22-56.51-42.73a12,12,0,1,0-16.84,17.12c30.39,29.81,66.15,49.2,67.66,50a12.06,12.06,0,0,0,11.39,0C138,232.14,244,174.34,244,102A66.12,66.12,0,0,0,177.91,36Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M232,102c0,66-104,122-104,122S24,168,24,102A54,54,0,0,1,78,48c22.59,0,41.94,12.31,50,32,8.06-19.69,27.41-32,50-32A54,54,0,0,1,232,102Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M72,144H32a8,8,0,0,1,0-16H67.72l13.62-20.44a8,8,0,0,1,13.32,0l25.34,38,9.34-14A8,8,0,0,1,136,128h24a8,8,0,0,1,0,16H140.28l-13.62,20.44a8,8,0,0,1-13.32,0L88,126.42l-9.34,14A8,8,0,0,1,72,144ZM178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,.75,0,1.5,0,2.25a8,8,0,1,0,16-.5c0-.58,0-1.17,0-1.75A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46c0,53.61-77.76,102.15-96,112.8-10.83-6.31-42.63-26-66.68-52.21a8,8,0,1,0-11.8,10.82c31.17,34,72.93,56.68,74.69,57.63a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M240,102c0,70-103.79,126.66-108.21,129a8,8,0,0,1-7.58,0c-3.35-1.8-63.55-34.69-92.68-80.89A4,4,0,0,1,34.92,144H72a8,8,0,0,0,6.66-3.56l9.34-14,25.34,38a8,8,0,0,0,9.16,3.16,8.23,8.23,0,0,0,4.28-3.34L140.28,144H160a8,8,0,0,0,8-8.53,8.18,8.18,0,0,0-8.25-7.47H136a8,8,0,0,0-6.66,3.56l-9.34,14-25.34-38a8,8,0,0,0-9.17-3.16,8.25,8.25,0,0,0-4.27,3.34L67.72,128H23.53a4,4,0,0,1-3.83-2.81A76.93,76.93,0,0,1,16,102,62.07,62.07,0,0,1,78,40c20.65,0,38.73,8.88,50,23.89C139.27,48.88,157.35,40,178,40A62.07,62.07,0,0,1,240,102Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M72,142H32a6,6,0,0,1,0-12H68.79L83,108.67a6,6,0,0,1,10,0l27,40.51,11-16.51a6,6,0,0,1,5-2.67h24a6,6,0,0,1,0,12H139.21L125,163.33a6,6,0,0,1-10,0L88,122.82,77,139.33A6,6,0,0,1,72,142ZM178,42c-21,0-39.26,9.47-50,25.34C117.26,51.47,99,42,78,42a60.07,60.07,0,0,0-60,60q0,1.09,0,2.19a6,6,0,0,0,12-.38c0-.6,0-1.21,0-1.81A48.05,48.05,0,0,1,78,54c20.28,0,37.31,10.83,44.45,28.27a6,6,0,0,0,11.1,0C140.69,64.83,157.72,54,178,54a48.05,48.05,0,0,1,48,48c0,55.73-81.61,105.65-98,115.11-9.84-5.66-43.09-25.82-68.16-53.16a6,6,0,1,0-8.84,8.1c30.94,33.77,72.41,56.29,74.16,57.23a6,6,0,0,0,5.68,0,334.68,334.68,0,0,0,53.06-37C219.8,161.59,238,131.2,238,102A60.07,60.07,0,0,0,178,42Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M72,144H32a8,8,0,0,1,0-16H67.72l13.62-20.44a8,8,0,0,1,13.32,0l25.34,38,9.34-14A8,8,0,0,1,136,128h24a8,8,0,0,1,0,16H140.28l-13.62,20.44a8,8,0,0,1-13.32,0L88,126.42l-9.34,14A8,8,0,0,1,72,144ZM178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,.75,0,1.5,0,2.25a8,8,0,1,0,16-.5c0-.58,0-1.17,0-1.75A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46c0,53.61-77.76,102.15-96,112.8-10.83-6.31-42.63-26-66.68-52.21a8,8,0,1,0-11.8,10.82c31.17,34,72.93,56.68,74.69,57.63a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M72,140H32a4,4,0,0,1,0-8H69.86l14.81-22.22a4,4,0,0,1,6.66,0l28.67,43,12.67-19A4,4,0,0,1,136,132h24a4,4,0,0,1,0,8H138.14l-14.81,22.22a4,4,0,0,1-6.66,0L88,119.21l-12.67,19A4,4,0,0,1,72,140ZM178,44c-21.44,0-39.92,10.19-50,27.07C117.92,54.19,99.44,44,78,44a58.07,58.07,0,0,0-58,58q0,1.06,0,2.13a4,4,0,1,0,8-.26c0-.62,0-1.24,0-1.87A50.06,50.06,0,0,1,78,52c21.11,0,38.85,11.31,46.3,29.51a4,4,0,0,0,7.4,0C139.15,63.31,156.89,52,178,52a50.06,50.06,0,0,1,50,50c0,58-86,109.46-100,117.42-8.47-4.82-43.5-25.61-69.63-54.12a4,4,0,0,0-5.9,5.4c30.72,33.52,71.9,55.89,73.63,56.82a4,4,0,0,0,3.8,0,333.81,333.81,0,0,0,52.7-36.73C218,160.47,236,130.59,236,102A58.07,58.07,0,0,0,178,44Z`}))]]),Se=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M230.14,25.86a20,20,0,0,0-19.57-5.11l-.22.07L18.44,79a20,20,0,0,0-3.06,37.25L99,157l40.71,83.65a19.81,19.81,0,0,0,18,11.38c.57,0,1.15,0,1.73-.07A19.82,19.82,0,0,0,177,237.56L235.18,45.65a1.42,1.42,0,0,0,.07-.22A20,20,0,0,0,230.14,25.86ZM156.91,221.07l-34.37-70.64,46-45.95a12,12,0,0,0-17-17l-46,46L34.93,99.09,210,46Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M223.69,42.18l-58.22,192a8,8,0,0,1-14.92,1.25L108,148,20.58,105.45a8,8,0,0,1,1.25-14.92l192-58.22A8,8,0,0,1,223.69,42.18Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M231.4,44.34s0,.1,0,.15l-58.2,191.94a15.88,15.88,0,0,1-14,11.51q-.69.06-1.38.06a15.86,15.86,0,0,1-14.42-9.15L107,164.15a4,4,0,0,1,.77-4.58l57.92-57.92a8,8,0,0,0-11.31-11.31L96.43,148.26a4,4,0,0,1-4.58.77L17.08,112.64a16,16,0,0,1,2.49-29.8l191.94-58.2.15,0A16,16,0,0,1,231.4,44.34Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M225.88,30.12a13.83,13.83,0,0,0-13.7-3.58l-.11,0L20.14,84.77A14,14,0,0,0,18,110.85l85.56,41.64L145.12,238a13.87,13.87,0,0,0,12.61,8c.4,0,.81,0,1.21-.05a13.9,13.9,0,0,0,12.29-10.09l58.2-191.93,0-.11A13.83,13.83,0,0,0,225.88,30.12Zm-8,10.4L159.73,232.43l0,.11a2,2,0,0,1-3.76.26l-40.68-83.58,49-49a6,6,0,1,0-8.49-8.49l-49,49L23.15,100a2,2,0,0,1,.31-3.74l.11,0L215.48,38.08a1.94,1.94,0,0,1,1.92.52A2,2,0,0,1,217.92,40.52Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224.47,31.52a11.87,11.87,0,0,0-11.82-3L20.74,86.67a12,12,0,0,0-1.91,22.38L105,151l41.92,86.15A11.88,11.88,0,0,0,157.74,244c.34,0,.69,0,1,0a11.89,11.89,0,0,0,10.52-8.63l58.21-192,0-.08A11.85,11.85,0,0,0,224.47,31.52Zm-4.62,9.54-58.23,192a4,4,0,0,1-7.48.59l-41.3-84.86,50-50a4,4,0,1,0-5.66-5.66l-50,50-84.9-41.31a3.88,3.88,0,0,1-2.27-4,3.93,3.93,0,0,1,3-3.54L214.9,36.16A3.93,3.93,0,0,1,216,36a4,4,0,0,1,2.79,1.19A3.93,3.93,0,0,1,219.85,41.06Z`}))]]),I=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z`}))]]),L=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:ye}));L.displayName=`BracketsCurlyIcon`;var Ce=L,R=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:M}));R.displayName=`ChatCircleDotsIcon`;var z=R,B=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:be}));B.displayName=`CircleNotchIcon`;var we=B,Te=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:xe}));Te.displayName=`ClockIcon`;var Ee=Te,De=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:N}));De.displayName=`CopySimpleIcon`;var V=De,H=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:P}));H.displayName=`FileTextIcon`;var U=H,W=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:F}));W.displayName=`HeartbeatIcon`;var Oe=W,ke=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:Se}));ke.displayName=`PaperPlaneTiltIcon`;var G=ke,K=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:I}));K.displayName=`StopIcon`;var Ae=K;function q(){return`${location.protocol}//${location.host}`}function J(e){return e?/^https?:\/\//i.test(e)?e:e.startsWith(`/`)?`${q()}${e}`:`${q()}/${e}`:q()}var Y=n();function je({access:e}){let{t}=p(),[n,r]=(0,j.useState)(``),o=J(e?.openai_base_url||`/v1`),s=(0,j.useMemo)(()=>[{name:t(`endpointOpenAI`),url:o,method:`BASE`,hint:t(`endpointBaseHint`),icon:(0,Y.jsx)(Ce,{size:15})},{name:t(`endpointChat`),url:J(e?.chat_completions||`${o}/chat/completions`),method:`POST`,hint:t(`endpointChatHint`),icon:(0,Y.jsx)(G,{size:15})},{name:t(`endpointMessages`),url:J(e?.messages||`${o}/messages`),method:`POST`,hint:t(`endpointMessagesHint`),icon:(0,Y.jsx)(G,{size:15})},{name:t(`endpointResponses`),url:J(e?.responses||`${o}/responses`),method:`POST`,hint:t(`endpointResponsesHint`),icon:(0,Y.jsx)(G,{size:15})},{name:t(`endpointModels`),url:J(e?.models||`${o}/models`),method:`GET`,hint:t(`endpointModelsHint`),icon:(0,Y.jsx)(i,{size:15})},{name:t(`endpointHealth`),url:J(e?.health||`/health`),method:`GET`,hint:t(`endpointHealthHint`),icon:(0,Y.jsx)(Oe,{size:15})}],[e,o,t]);return(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`flex items-start justify-between gap-4 px-5 py-4 sm:px-6`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold`,children:t(`endpoints`)}),(0,Y.jsx)(ae,{size:`sm`,variant:`soft`,children:t(`endpointCount`,{count:s.length-1})})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`routesHint`)})]})}),(0,Y.jsx)(`div`,{className:`grid gap-2 px-3 pb-3 sm:grid-cols-2 sm:px-4 sm:pb-4 lg:grid-cols-3`,children:s.map(e=>(0,Y.jsxs)(`div`,{className:`group min-w-0 rounded-xl bg-surface-secondary/40 p-3 transition-colors hover:bg-surface-secondary/70`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Y.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface text-muted`,children:e.icon}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`truncate text-body font-semibold`,children:e.name}),(0,Y.jsx)(`code`,{className:`mono mt-0.5 block truncate text-caption text-muted`,children:e.url})]})]}),(0,Y.jsx)(ae,{size:`sm`,variant:`soft`,children:e.method})]}),(0,Y.jsx)(`p`,{className:`mt-2 text-caption leading-5 text-muted`,children:e.hint}),(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:e.method===`BASE`?t(`endpointBaseLabel`):t(`endpointAuthLabel`)}),(0,Y.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`copy`),onPress:()=>{d(e.url),r(e.name),window.setTimeout(()=>r(``),1100)},children:(0,Y.jsx)(a,{copied:n===e.name})}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`open`),onPress:()=>window.open(e.url,`_blank`,`noopener,noreferrer`),children:(0,Y.jsx)(c,{size:14})})]})]})]},e.name))})]})}var Me=new Set(`txt.md.markdown.json.csv.tsv.yml.yaml.toml.xml.html.htm.css.scss.js.jsx.ts.tsx.mjs.cjs.py.go.rs.java.kt.swift.c.h.cpp.hpp.sh.bash.zsh.sql.graphql.env.ini.conf.log.rst.tex`.split(`.`)),Ne=new Set([`image/png`,`image/jpeg`,`image/jpg`,`image/gif`,`image/webp`]);function X(e){let t=e.lastIndexOf(`.`);return t>=0?e.slice(t+1).toLowerCase():``}function Pe(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}async function Z(e){let t=X(e.name),n=e.type||`application/octet-stream`,r=`${e.name}-${e.size}-${e.lastModified}-${Math.random().toString(36).slice(2,8)}`;if(Ne.has(n)||[`png`,`jpg`,`jpeg`,`gif`,`webp`].includes(t)){let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error||Error(`read failed`)),r.readAsDataURL(e)});return{id:r,name:e.name,mime:n,kind:`image`,dataUrl:t,size:e.size}}if(Me.has(t)||n.startsWith(`text/`)||n===`application/json`){let t=await e.text();return{id:r,name:e.name,mime:n,kind:`text`,text:t,size:e.size}}return null}function Q({ariaLabel:e,value:t,onChange:n,placeholder:r,isDisabled:i,options:a,className:o,tone:s=`default`}){let c=a.find(e=>e.id===t),l=s===`muted`?`text-muted hover:text-foreground`:`text-foreground`;return(0,Y.jsxs)(S,{className:o??`w-auto max-w-[11rem] min-w-0`,"aria-label":e,value:t||null,placeholder:r,isDisabled:i,onChange:e=>{typeof e==`string`&&e&&n(e)},children:[(0,Y.jsxs)(S.Trigger,{className:`h-8 min-h-8 gap-1 rounded-[10px] border-0 bg-transparent px-2.5 shadow-none items-center hover:bg-surface-secondary/80 data-[focus-visible=true]:bg-surface-secondary/80 ${l}`,children:[(0,Y.jsx)(S.Value,{className:`min-w-0 truncate text-caption font-medium`,children:({defaultChildren:e,isPlaceholder:t})=>t||!c?e:(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[c.icon?(0,Y.jsx)(`span`,{className:`grid size-3.5 shrink-0 place-items-center opacity-80`,children:c.icon}):null,(0,Y.jsx)(`span`,{className:`truncate`,children:c.label})]})}),(0,Y.jsx)(S.Indicator,{className:`size-2.5 opacity-50`})]}),(0,Y.jsx)(S.Popover,{placement:`top end`,className:`max-h-72 min-w-48`,children:(0,Y.jsx)(_,{children:a.map(e=>(0,Y.jsxs)(_.Item,{id:e.id,textValue:e.textValue,className:`gap-2`,children:[e.icon?(0,Y.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center`,children:e.icon}):null,(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(g,{className:`block truncate text-caption`,children:e.label}),e.hint?(0,Y.jsx)(`span`,{className:`block truncate text-caption text-muted`,children:e.hint}):null]}),(0,Y.jsx)(_.ItemIndicator,{})]},e.id))})})]})}function Fe({value:e,onChange:t,attachments:n,onAttachmentsChange:r,disabled:i,streaming:a,canSend:o,onSend:c,onStop:l,accountValue:u,onAccountChange:d,accountOptions:m,modelValue:g,onModelChange:_,modelOptions:v,modelsLoading:y}){let{t:b}=p(),x=(0,j.useRef)(null);async function S(e){if(!e?.length)return;let t=[],i=[];for(let n of Array.from(e))try{let e=await Z(n);e?t.push(e):i.push(n.name)}catch{i.push(n.name)}t.length&&r([...n,...t]),i.length&&de({type:`error`,title:b(`chatAttachUnsupported`,{names:i.join(`, `)})}),x.current&&(x.current.value=``)}function ee(e){e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),!a&&o&&c())}return(0,Y.jsxs)(`div`,{className:`access-composer px-3 pb-3 pt-2.5 sm:px-4 sm:pb-3.5 sm:pt-3`,children:[(0,Y.jsxs)(`div`,{className:`access-composer-well overflow-hidden rounded-2xl`,children:[n.length?(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-3`,children:n.map(e=>(0,Y.jsxs)(`span`,{className:`inline-flex max-w-[14rem] items-center gap-2 rounded-xl bg-surface/80 px-1.5 py-1.5 text-caption text-foreground`,children:[e.kind===`image`&&e.dataUrl?(0,Y.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-8 shrink-0 rounded-lg object-cover`}):(0,Y.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-muted`,children:(0,Y.jsx)(U,{size:14})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate font-medium`,children:e.name}),(0,Y.jsx)(`span`,{className:`mono text-muted`,children:Pe(e.size)})]}),(0,Y.jsx)(`button`,{type:`button`,className:`grid size-6 shrink-0 place-items-center rounded-md text-muted hover:bg-surface-secondary hover:text-foreground`,"aria-label":b(`chatAttachRemove`),onClick:()=>r(n.filter(t=>t.id!==e.id)),children:(0,Y.jsx)(ie,{size:12})})]},e.id))}):null,(0,Y.jsx)(s,{fullWidth:!0,rows:3,className:`min-h-20 resize-none border-0 bg-transparent px-3.5 py-3 text-body leading-[1.65] shadow-none focus-visible:ring-0`,value:e,onChange:e=>t(e.target.value),onKeyDown:ee,placeholder:b(`promptPlaceholder`),"aria-label":b(`prompt`),disabled:i||a}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-0.5 px-2 pb-2 pt-0.5`,children:[(0,Y.jsx)(`input`,{ref:x,type:`file`,className:`hidden`,multiple:!0,accept:`.txt,.md,.json,.csv,.yml,.yaml,.toml,.xml,.html,.css,.js,.jsx,.ts,.tsx,.py,.go,.rs,.sh,.sql,.png,.jpg,.jpeg,.gif,.webp,text/*,image/png,image/jpeg,image/gif,image/webp,application/json`,onChange:e=>void S(e.target.files)}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 shrink-0 rounded-[10px]`,"aria-label":b(`chatAttach`),isDisabled:i||a,onPress:()=>x.current?.click(),children:(0,Y.jsx)(f,{size:15})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,Y.jsx)(Q,{ariaLabel:b(`account`),value:u,onChange:d,options:m,isDisabled:i||a,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,Y.jsx)(Q,{ariaLabel:b(`model`),value:g,onChange:_,placeholder:b(y?`requesting`:`model`),options:v,isDisabled:i||a||y||!v.length,className:`w-auto max-w-[10.5rem] min-w-0`}),(0,Y.jsxs)(`div`,{className:`relative size-8 shrink-0`,children:[(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`secondary`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`opacity-100`:`pointer-events-none opacity-0`}`,"aria-label":b(`chatTryStop`),onPress:l,children:(0,Y.jsx)(Ae,{size:14,weight:`fill`})}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`pointer-events-none opacity-0`:`opacity-100`}`,"aria-label":b(`chatTrySend`),isDisabled:!o||i||a,onPress:c,children:(0,Y.jsx)(G,{size:14,weight:`fill`})})]})]})]}),(0,Y.jsx)(`p`,{className:`mt-1 px-1 text-caption leading-4 text-muted/65`,children:b(`chatTryHelper`)})]})}function Ie({collapsed:e,onCollapsedChange:t,items:n,activeId:i,onSelect:a,onNew:o}){let{t:s}=p(),c=(0,j.useRef)(null);return(0,j.useEffect)(()=>{let t=c.current;!t||O()||e||w.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:D.fast,ease:`power2.out`})},[e]),e?(0,Y.jsxs)(`div`,{className:`access-hist-rail flex w-9 shrink-0 flex-col items-center gap-1 border-r py-2`,children:[(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":s(`chatHistoryExpand`),onPress:()=>t(!1),children:(0,Y.jsx)(T,{size:15})}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":s(`chatHistoryNew`),onPress:o,children:(0,Y.jsx)(f,{size:14})})]}):(0,Y.jsxs)(`aside`,{ref:c,className:`access-hist-rail flex w-[13rem] shrink-0 flex-col border-r`,"aria-label":s(`chatHistoryTitle`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-2`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1 truncate px-1.5 text-caption font-medium text-muted`,children:s(`chatHistoryTitle`)}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":s(`chatHistoryCollapse`),onPress:()=>t(!0),children:(0,Y.jsx)(r,{size:14})})]}),(0,Y.jsx)(`div`,{className:`px-2 pb-1.5`,children:(0,Y.jsxs)(h,{size:`sm`,variant:`ghost`,className:`h-8 w-full justify-start gap-1.5 rounded-[10px] px-2.5 text-caption font-medium text-muted hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onPress:o,children:[(0,Y.jsx)(f,{size:13}),s(`chatHistoryNew`)]})}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 space-y-0.5 overflow-y-auto px-1.5 pb-2.5`,children:n.length?n.map(e=>{let t=e.id===i;return(0,Y.jsx)(`button`,{type:`button`,"data-active":t?`true`:void 0,className:`access-hist-item flex h-8 w-full items-center rounded-[10px] px-2.5 text-left text-caption leading-5 ${t?`font-medium text-foreground`:`font-normal text-muted`}`,onClick:()=>a(e.id),children:(0,Y.jsx)(`span`,{className:`line-clamp-1 tracking-tight`,children:e.title||s(`chatHistoryUntitled`)})},e.id)}):(0,Y.jsx)(`p`,{className:`px-2.5 py-6 text-center text-caption leading-5 text-muted/70`,children:s(`chatHistoryEmpty`)})})]})}function Le({text:e,streaming:t,defaultOpen:n}){let{t:r}=p(),[i,a]=(0,j.useState)(!!n),[o,s]=(0,j.useState)(0),c=(0,j.useRef)(0),l=(0,j.useRef)(null),d=(0,j.useRef)(null);if((0,j.useEffect)(()=>{t?a(!1):n!=null&&a(!!n)},[t,n]),(0,j.useEffect)(()=>{if(!t)return;let e=Date.now();s(0);let n=window.setInterval(()=>{let t=Math.floor((Date.now()-e)/1e3);s(t),c.current=t},250);return()=>window.clearInterval(n)},[t]),(0,j.useEffect)(()=>{!t&&o===0&&c.current>0&&s(c.current)},[t,o]),(0,j.useEffect)(()=>{let t=l.current,n=d.current;if(!t)return;let r=O();if(!i||!e){if(r){t.style.height=`0px`,t.style.opacity=`0`;return}w.to(t,{height:0,opacity:0,duration:D.fast,ease:k.inOut,overwrite:!0});return}let a=n?.scrollHeight??0;if(r){t.style.height=`auto`,t.style.opacity=`1`;return}w.fromTo(t,{height:0,opacity:0},{height:a,opacity:1,duration:D.base,ease:k.out,overwrite:!0,onComplete:()=>{t.style.height=`auto`}})},[i,e]),!e&&!t)return null;let f=O(),m=t?o:o||c.current;return(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-xl`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-surface-secondary px-2.5 py-1 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:t?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(we,{size:12,className:`shrink-0 text-muted ${f?``:`animate-spin`}`}),(0,Y.jsx)(`span`,{className:f?``:`access-thinking-shimmer`,children:r(`thinkingWorking`)}),(0,Y.jsxs)(`span`,{className:`mono text-muted/80`,children:[o,`s`]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(u,{size:11,className:`shrink-0 transition-transform duration-200 ease-out ${i?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{children:r(`thinkingDone`)}),m>0?(0,Y.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingElapsed`,{n:m})}):null,!m&&e?(0,Y.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingChars`,{count:e.length})}):null]})}),(0,Y.jsx)(`div`,{ref:l,className:`overflow-hidden`,style:{height:0,opacity:0},children:e?(0,Y.jsx)(`pre`,{ref:d,className:`mt-1.5 max-h-52 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-surface-secondary/80 px-3 py-2 text-caption leading-5 text-muted`,children:e}):null})]})}function Re(e,t){return t(e===`running`?`toolCallRunning`:e===`error`?`toolCallError`:`toolCallSuccess`)}function ze({status:e}){return e===`running`?(0,Y.jsx)(ue,{size:12,className:`animate-spin text-muted`}):e===`error`?(0,Y.jsx)(se,{size:12,weight:`fill`,className:`text-danger`}):(0,Y.jsx)(ce,{size:12,weight:`fill`,className:`text-success`})}function Be(e){if(!e.trim())return``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function Ve({call:e,forceOpen:t}){let{t:n}=p(),[r,i]=(0,j.useState)(e.status===`error`||!!t),[a,o]=(0,j.useState)(!1),s=(0,j.useMemo)(()=>Be(e.arguments||``),[e.arguments]);(0,j.useEffect)(()=>{e.status===`error`&&i(!0)},[e.status]),(0,j.useEffect)(()=>{t&&i(!0)},[t]);async function c(){s&&(await d(s),o(!0),window.setTimeout(()=>o(!1),1200))}return(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-lg`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left`,"aria-expanded":r,onClick:()=>i(e=>!e),children:[(0,Y.jsx)(u,{size:11,className:`shrink-0 text-muted transition-transform ${r?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-caption font-medium text-foreground`,children:e.name||n(`toolCallUntitled`)}),(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted`,children:[(0,Y.jsx)(ze,{status:e.status}),Re(e.status,n)]})]}),r?(0,Y.jsxs)(`div`,{className:`space-y-1.5 px-2 pb-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:n(`toolCallArgs`)}),(0,Y.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-caption text-muted hover:bg-surface-secondary hover:text-foreground`,onClick:e=>{e.stopPropagation(),c()},children:[(0,Y.jsx)(V,{size:12}),n(a?`copied`:`copy`)]})]}),(0,Y.jsx)(`pre`,{className:`mono max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary/80 px-2.5 py-2 text-caption leading-5 text-muted`,children:s||n(`toolCallArgsEmpty`)})]}):null]})}function He({calls:e}){let{t}=p(),n=e.some(e=>e.status===`error`),r=e.some(e=>e.status===`running`),[i,a]=(0,j.useState)(n||r||e.length===1);return(0,j.useEffect)(()=>{(n||r)&&a(!0)},[n,r]),e.length?e.length===1?(0,Y.jsx)(`div`,{className:`rounded-xl bg-surface-secondary/70`,children:(0,Y.jsx)(Ve,{call:e[0],forceOpen:e[0].status===`error`})}):(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-secondary/70`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[(0,Y.jsx)(u,{size:11,className:`shrink-0 transition-transform ${i?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:t(`toolCallGroup`,{n:e.length})}),r?(0,Y.jsx)(ue,{size:12,className:`animate-spin`}):null]}),i?(0,Y.jsx)(`div`,{className:`space-y-0.5 border-t border-separator/40 px-0.5 py-1`,children:e.map(e=>(0,Y.jsx)(Ve,{call:e},`${e.index}-${e.id||e.name}`))}):null]}):null}function Ue({message:e}){return e.attachments?.length?(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.attachments.map(e=>(0,Y.jsxs)(`span`,{className:`inline-flex max-w-[12rem] items-center gap-1.5 rounded-xl bg-surface/70 px-1.5 py-1 text-caption text-muted`,children:[e.kind===`image`&&e.dataUrl?(0,Y.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-7 shrink-0 rounded-lg object-cover`}):(0,Y.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface`,children:(0,Y.jsx)(U,{size:12})}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))}):null}function We({message:e}){let{t}=p(),n=e.usage;if(!n||n.credits==null)return null;let r=n.prompt_tokens,i=n.completion_tokens,a=typeof r==`number`||typeof i==`number`?t(`chatTryUsageTokens`,{prompt:he(r??0),completion:he(i??0)}):``;return(0,Y.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`chatTryUsageFoot`,{tokens:a,amount:A(n.credits)}):t(`chatTryCreditsUsed`,{amount:A(n.credits)})})}function Ge({text:e,streaming:t}){let n=e.split(/(\n{2,})/),r=-1;for(let e=n.length-1;e>=0;--e)if(n[e]&&!/^\n{2,}$/.test(n[e])){r=e;break}return(0,Y.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground ${t?`access-streaming`:``}`,children:n.map((e,n)=>e?/^\n{2,}$/.test(e)?(0,Y.jsx)(`span`,{children:e},`s-${n}`):(0,Y.jsx)(`span`,{className:t&&n===r?`access-stream-seg`:void 0,children:e},`p-${n}`):null)})}function Ke(){let e=(0,j.useRef)(null);return(0,j.useEffect)(()=>{let t=e.current;!t||O()||w.from(t,{autoAlpha:0,duration:D.fast,ease:`power2.out`})},[]),e}function qe({message:e}){let{t}=p(),[n,r]=(0,j.useState)(!1),i=e.role===`user`,o=Ke();if(i)return(0,Y.jsx)(`div`,{ref:o,className:`ml-auto max-w-[92%] sm:max-w-[78%]`,children:(0,Y.jsxs)(`div`,{className:`access-bubble access-bubble--user rounded-2xl rounded-br-md px-3.5 py-2.5`,children:[e.content?(0,Y.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground`,children:e.content}):null,(0,Y.jsx)(Ue,{message:e})]})});let s=e.status===`streaming`&&!e.content&&!e.reasoning&&!e.toolCalls?.length,c=!!e.content&&e.status===`done`,l=e.status===`streaming`,u=!!(e.usage&&e.usage.credits!=null),f=e.status===`done`&&(e.latency_ms!=null||e.ttfb_ms!=null||typeof e.usage?.completion_tokens==`number`);async function m(){e.content&&(await d(e.content),r(!0),window.setTimeout(()=>r(!1),1200))}return(0,Y.jsxs)(`div`,{className:`group/access-msg max-w-[96%] space-y-1.5 sm:max-w-[88%]`,children:[(0,Y.jsx)(`div`,{className:`flex items-center gap-1.5 px-0.5`,children:(0,Y.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center rounded-lg border border-border bg-surface-secondary`,children:(0,Y.jsx)(ge,{provider:e.provider,size:13})})}),e.reasoning||l?(0,Y.jsx)(Le,{text:e.reasoning||``,streaming:l&&(!e.content||!!e.reasoning),defaultOpen:e.reasoningOpen}):null,e.toolCalls?.length?(0,Y.jsx)(He,{calls:e.toolCalls}):null,e.status===`error`?(0,Y.jsx)(v,{status:`danger`,title:t(`requestFailed`),description:e.error||``}):s?(0,Y.jsxs)(`div`,{className:`space-y-2 pt-0.5`,children:[(0,Y.jsx)(E,{className:`h-3 w-28 rounded-md`}),(0,Y.jsx)(E,{className:`h-3 w-full rounded-md`}),(0,Y.jsx)(E,{className:`h-3 w-[86%] rounded-md`}),(0,Y.jsx)(E,{className:`h-3 w-[68%] rounded-md`})]}):e.content?(0,Y.jsx)(`div`,{className:`access-bubble access-bubble--assistant px-0.5 py-0`,children:(0,Y.jsx)(Ge,{text:e.content,streaming:l})}):null,c||u||f?(0,Y.jsxs)(`div`,{className:`access-msg-foot space-y-1 px-0.5 pt-0.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[c?(0,Y.jsxs)(h,{size:`sm`,variant:`ghost`,className:`h-5 min-h-5 gap-1 px-1.5 text-caption text-muted/80`,onPress:()=>void m(),children:[(0,Y.jsx)(a,{copied:n,size:12}),t(n?`copied`:`copy`)]}):null,(0,Y.jsx)(We,{message:e})]}),f?(0,Y.jsx)(ve,{variant:`inline`,latencyMs:e.latency_ms,ttfbMs:e.ttfb_ms,completionTokens:e.usage?.completion_tokens,stream:!0,className:`access-latency-inline max-h-0 overflow-hidden opacity-0 transition-[opacity,max-height] duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] group-hover/access-msg:max-h-5 group-hover/access-msg:opacity-100 focus-within:max-h-5 focus-within:opacity-100`,labels:{ttft:t(`logsColTTFT`),total:t(`logsLatencyTotal`),tps:t(`logsOutputTPS`)}}):null]}):null]})}function Je({messages:e,busy:t,onLoadDemo:n}){let{t:r}=p(),i=(0,j.useRef)(null);(0,j.useEffect)(()=>{i.current?.scrollIntoView({block:`end`})},[e,t]);let a=!e.length;return(0,Y.jsxs)(`div`,{className:`access-thread min-h-0 flex-1 overflow-y-auto px-4 sm:px-6 ${a?`py-5 sm:py-6`:`pb-2 pt-4 sm:pb-2.5 sm:pt-5`}`,"aria-live":`polite`,"aria-busy":t,children:[a?(0,Y.jsx)(y,{className:`min-h-56`,icon:(0,Y.jsx)(z,{size:22}),title:r(`chatTryEmptyTitle`),hint:r(`chatTryEmptyHint`),action:n?(0,Y.jsx)(`button`,{type:`button`,className:`inline-flex h-8 items-center rounded-[10px] px-2.5 text-caption font-medium text-muted transition-colors hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onClick:n,children:r(`chatDemoLoad`)}):void 0}):(0,Y.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,Y.jsx)(qe,{message:e},e.id))}),(0,Y.jsx)(`div`,{ref:i})]})}function Ye({format:e,onFormatChange:t,requestPath:n,prompt:r,onPromptChange:i,onTest:o,requestState:c,elapsedMs:l,output:u,responseStatus:d,curl:f,copiedCurl:m,onCopyCurl:g,canSend:_,accountValue:b,onAccountChange:x,accountOptions:S,modelValue:ee,onModelChange:te,modelOptions:ne,modelsLoading:re,disabled:C}){let{t:w}=p();return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`px-1 text-caption leading-5 text-muted`,children:w(`rawFormatHint`)}),(0,Y.jsx)(`div`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:(0,Y.jsxs)(`div`,{className:`grid xl:grid-cols-[minmax(420px,.92fr)_minmax(0,1.08fr)]`,children:[(0,Y.jsxs)(`div`,{className:`xl:border-r xl:border-[color-mix(in_oklab,var(--foreground)_6%,transparent)]`,children:[(0,Y.jsxs)(`div`,{className:`px-4 py-3.5 sm:px-5`,children:[(0,Y.jsx)(`h3`,{className:`text-body font-semibold`,children:w(`requestBuilder`)}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-caption text-muted`,children:[`POST `,n]})]}),(0,Y.jsxs)(`div`,{className:`space-y-4 px-4 pb-4 sm:px-5 sm:pb-5`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:w(`rawFormatLabel`)}),(0,Y.jsx)(fe,{className:`access-format-chips`,ariaLabel:w(`rawFormatLabel`),value:e,onChange:e=>t(e),options:[{id:`chat`,label:w(`rawFormatChat`)},{id:`messages`,label:w(`rawFormatMessages`)},{id:`responses`,label:w(`rawFormatResponses`)}]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,Y.jsx)(Q,{ariaLabel:w(`account`),value:b,onChange:x,options:S,isDisabled:C||c===`loading`,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,Y.jsx)(Q,{ariaLabel:w(`model`),value:ee,onChange:te,placeholder:w(re?`requesting`:`model`),options:ne,isDisabled:C||c===`loading`||re||!ne.length,className:`w-auto max-w-[10.5rem] min-w-0`})]}),(0,Y.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:w(`prompt`)}),(0,Y.jsx)(`span`,{className:`mono text-caption text-muted`,children:r.length})]}),(0,Y.jsx)(s,{fullWidth:!0,rows:9,className:`min-h-52 resize-y rounded-xl border-0 bg-[var(--field-background)] px-3.5 py-3 text-body leading-[1.65] shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--field-border)_78%,var(--foreground))] focus-visible:ring-0`,value:r,onChange:e=>i(e.target.value),placeholder:w(`promptPlaceholder`),"aria-label":w(`prompt`),disabled:C||c===`loading`}),(0,Y.jsx)(`p`,{className:`text-caption leading-5 text-muted/70`,children:w(`promptHelper`)})]}),(0,Y.jsxs)(h,{fullWidth:!0,isPending:c===`loading`,isDisabled:!_||C,onPress:o,children:[(0,Y.jsx)(G,{size:15}),w(c===`loading`?`requesting`:`sendRequest`)]})]})]}),(0,Y.jsxs)(`div`,{className:`access-raw-panel__inspector flex min-h-[440px] min-w-0 flex-col`,"aria-live":`polite`,"aria-busy":c===`loading`,children:[(0,Y.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-body font-semibold`,children:w(`responseInspector`)}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:w(`responseInspectorHint`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l===null?null:(0,Y.jsxs)(`span`,{className:`mono flex items-center gap-1.5 text-caption text-muted`,children:[(0,Y.jsx)(Ee,{size:12}),l,` ms`]}),(0,Y.jsx)(ae,{size:`sm`,variant:`soft`,color:c===`success`?`success`:c===`error`?`danger`:void 0,children:d})]})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 px-4 pb-4 sm:px-5 sm:pb-5`,children:c===`idle`?(0,Y.jsx)(y,{className:`min-h-64`,title:w(`responseEmptyTitle`),hint:w(`responseEmptyHint`)}):c===`loading`?(0,Y.jsxs)(`div`,{className:`space-y-3 pt-1`,children:[(0,Y.jsx)(E,{className:`h-3 w-32 rounded-lg`}),(0,Y.jsx)(E,{className:`h-3 w-full rounded-lg`}),(0,Y.jsx)(E,{className:`h-3 w-[88%] rounded-lg`}),(0,Y.jsx)(E,{className:`h-3 w-[72%] rounded-lg`}),(0,Y.jsx)(E,{className:`mt-7 h-3 w-[92%] rounded-lg`}),(0,Y.jsx)(E,{className:`h-3 w-[64%] rounded-lg`})]}):c===`error`?(0,Y.jsx)(`div`,{className:`space-y-3`,children:(0,Y.jsx)(v,{status:`danger`,title:w(`requestFailed`),description:u})}):(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-caption font-medium text-success`,children:[(0,Y.jsx)(ce,{size:14,weight:`fill`}),w(`responseReceived`)]}),(0,Y.jsx)(`pre`,{className:`mono overflow-x-auto whitespace-pre-wrap break-words text-caption leading-6 text-muted`,children:u})]})})]})]})}),(0,Y.jsxs)(`section`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-body font-semibold`,children:w(`curlExample`)}),(0,Y.jsx)(`div`,{className:`mt-0.5 truncate text-caption text-muted`,children:w(`curlGeneratedHint`)})]}),(0,Y.jsxs)(h,{size:`sm`,variant:`ghost`,onPress:g,children:[(0,Y.jsx)(a,{copied:m}),w(m?`copied`:`copy`)]})]}),(0,Y.jsx)(`pre`,{className:`mono max-h-72 overflow-auto whitespace-pre-wrap px-4 pb-4 text-caption leading-6 text-muted sm:px-5 sm:pb-5`,children:f})]})]})}function Xe(e,t){let n=t.filter(e=>e.kind===`text`),r=t.filter(e=>e.kind===`image`&&e.dataUrl),i=e.trim();for(let e of n){let t=e.text??``;i=`${i}${i?` + +`:``}--- file: ${e.name} ---\n${t}`}if(!r.length)return i;let a=[];i&&a.push({type:`text`,text:i});for(let e of r)a.push({type:`image_url`,image_url:{url:e.dataUrl}});return a}function Ze(e,t){let n=[];for(let t of e)if(!(t.status===`error`&&t.role===`assistant`&&!t.content)){if(t.role===`user`){n.push({role:`user`,content:Xe(t.content,t.attachments||[])});continue}t.content&&n.push({role:`assistant`,content:t.content})}return[...n,t]}var Qe=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNkYPhfz0AEYBxVSF+FABJADveWkH6aAAAAAElFTkSuQmCC`;function $e(){return[{id:`demo-user-1`,role:`user`,content:`Summarize the attached screenshot and look up the endpoint.`,attachments:[{id:`demo-img-1`,name:`screenshot.png`,mime:`image/png`,kind:`image`,dataUrl:Qe,size:2048},{id:`demo-txt-1`,name:`notes.md`,mime:`text/markdown`,kind:`text`,text:`# notes +placeholder`,size:128}],status:`done`},{id:`demo-assistant-1`,role:`assistant`,provider:`workbuddy`,content:`The screenshot shows the Access playground. I looked up the chat completions route and drafted a short summary below.`,reasoning:`User attached a UI screenshot and a notes file. +I should call the models/list helper, then summarize the visible chrome without inventing product claims. +Keep the reply short and ops-console toned.`,toolCalls:[{index:0,id:`call_demo_list`,name:`list_endpoints`,arguments:JSON.stringify({base:`/v1`,filter:`chat`},null,2),status:`success`},{index:1,id:`call_demo_read`,name:`read_attachment`,arguments:JSON.stringify({name:`notes.md`,max_chars:400},null,2),status:`success`}],reasoningOpen:!1,usage:{credits:.75,prompt_tokens:1840,completion_tokens:126,source:`upstream`},ttfb_ms:380,latency_ms:2140,status:`done`}]}function et(){return[{id:`demo-user-thinking`,role:`user`,content:`Walk through the Access playground layout.`,status:`done`},{id:`demo-assistant-thinking`,role:`assistant`,provider:`workbuddy`,content:``,reasoning:`Scan the stage chrome, then the composer controls, then draft a short reply without inventing product claims.`,status:`streaming`}]}function tt(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}function nt(e){return`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function rt(e,t){return e.map((e,n)=>({index:typeof e.index==`number`?e.index:n,id:e.id||`tool-${n}`,name:e.function?.name||``,arguments:e.function?.arguments||``,status:t?`running`:`success`}))}function $(){if(typeof window>`u`)return null;try{let e=new URLSearchParams(window.location.search).get(`demo`);return e===`1`||e===`full`?`full`:e===`thinking`?`thinking`:null}catch{return null}}function it(){let e=$();return e===`thinking`?et():e===`full`?$e():[]}function at(e){let t=e.find(e=>e.role===`user`&&e.content.trim());if(!t)return``;let n=t.content.trim().replace(/\s+/g,` `);return n.length>36?`${n.slice(0,36)}…`:n}function ot(e=[]){return{id:nt(`session`),title:at(e),messages:e,updatedAt:Date.now()}}var st=[{id:`hy3`,display_name:`HY3`,credits:`0.75 credits`,provider:`workbuddy`},{id:`glm-4.6`,display_name:`GLM-4.6`,credits:`0.5 credits`,provider:`workbuddy`},{id:`free-demo`,display_name:`Free Demo`,credits:`0 credits`,free:!0,provider:`workbuddy`}];function ct(){let{t:e}=p(),{overview:t,loading:n}=oe(),[r,i]=(0,j.useState)(`chat`),[s,c]=(0,j.useState)(`chat`),[u,f]=(0,j.useState)(!0),[m,g]=(0,j.useState)(()=>[ot(it())]),[_,v]=(0,j.useState)(``),y=_||m[0]?.id||``,S=(m.find(e=>e.id===y)||m[0])?.messages||[],[w,ie]=(0,j.useState)([]),[T,se]=(0,j.useState)([]);(0,j.useEffect)(()=>{let e=!1;return Promise.allSettled([te(),re(!1)]).then(([t,n])=>{e||(t.status===`fulfilled`&&ie(t.value.data||[]),n.status===`fulfilled`&&se(n.value.data||[]))}),()=>{e=!0}},[]);let ce=J(t?.access?.openai_base_url||`/v1`),E=t?.access?.chat_completions||`/v1/chat/completions`,ue=t?.access?.messages||`/v1/messages`,de=t?.access?.responses||`/v1/responses`,D=s===`messages`?ue:s===`responses`?de:E,O=J(D),[k,fe]=(0,j.useState)(``),[he,A]=(0,j.useState)(``),[ve,ye]=(0,j.useState)(null),[M,be]=(0,j.useState)(`只回复OK`),[xe,N]=(0,j.useState)(``),[P,F]=(0,j.useState)([]),[Se,I]=(0,j.useState)(`idle`),L=(0,j.useRef)(null),[Ce,R]=(0,j.useState)(``),[z,B]=(0,j.useState)(`idle`),[we,Te]=(0,j.useState)(null),[Ee,De]=(0,j.useState)(``),V=he||``,H=!V||ve?.accountId===V,U=V?H&&ve?.models||[]:w,W=!!V&&!H,Oe=H&&ve?.error||``,ke=$()==null?[]:st.map(e=>e.id),G=U.some(e=>e.id===k)||ke.includes(k)?k:U[0]?.id||ke[0]||``;(0,j.useEffect)(()=>{if(!V)return;let e=!1;return te(V).then(t=>{e||ye({accountId:V,models:t.data||[],error:``})}).catch(t=>{e||ye({accountId:V,models:[],error:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},[V]),(0,j.useEffect)(()=>()=>{L.current?.abort()},[]);let K=T.filter(e=>e.enabled!==!1&&(e.ready===!0||e.hot===!0||e.status===`ready`||e.status===`hot`)),Ae=(0,j.useMemo)(()=>ne(s,G,M),[M,s,G]),q=(0,j.useMemo)(()=>`curl -sS ${tt(O)} \\ + -H "Authorization: Bearer $CLI2API_API_KEY" \\ + -H ${tt(`Content-Type: application/json`)}${V?` \\ + -H ${tt(`X-Qoder-Account: ${V}`)}`:``} \\ + -d ${tt(JSON.stringify(Ae))}`,[Ae,O,V]);if(n&&!t)return(0,Y.jsx)(le,{});async function Me(e,t){await d(e),De(t),window.setTimeout(()=>De(``),1100)}async function Ne(){let e=performance.now();B(`loading`),Te(null),R(``);try{let e=await C(D,Ae,V||void 0);R(JSON.stringify(e,null,2)),B(`success`)}catch(e){R(e instanceof Error?e.message:String(e)),B(`error`)}finally{Te(Math.round(performance.now()-e))}}function X(){L.current?.abort(),L.current=null}function Pe(e){let t=y;g(n=>n.map(n=>{if(n.id!==t)return n;let r=typeof e==`function`?e(n.messages):e;return{...n,messages:r,title:at(r)||n.title,updatedAt:Date.now()}}))}function Z(e,t){Pe(n=>n.map(n=>{if(n.id!==e)return n;let r=typeof t==`function`?t(n):t;return{...n,...r}}))}async function Q(){let e=xe.trim();if(!e&&!P.length||!G||W||Se===`loading`)return;X();let t=new AbortController;L.current=t;let n=P,r={id:nt(`user`),role:`user`,content:e,attachments:n,status:`done`},i=nt(`assistant`),a={id:i,role:`assistant`,provider:T.find(e=>e.id===V)?.provider||U.find(e=>e.id===G)?.provider||``,content:``,status:`streaming`},o=S;Pe([...o,r,a]),N(``),F([]),I(`loading`);let s=Ze(o,{role:`user`,content:Xe(e,n)}),c=performance.now(),l=null,u=()=>{l??=performance.now()},d=()=>{let e=performance.now();return{latency_ms:Math.max(0,Math.round(e-c)),ttfb_ms:l==null?void 0:Math.max(0,Math.round(l-c))}};try{await ee(G,s,V||void 0,{signal:t.signal,onContent:(e,t)=>{e&&u(),Z(i,{content:t})},onReasoning:(e,t)=>{e&&u(),Z(i,{reasoning:t})},onToolCalls:e=>{u(),Z(i,{toolCalls:rt(e,!0)})},onUsage:e=>Z(i,{usage:e})}),Z(i,e=>({status:`done`,...d(),toolCalls:e.toolCalls?.map(e=>({...e,status:`success`}))})),I(`success`)}catch(e){if(t.signal.aborted){Z(i,e=>({status:`done`,...d(),toolCalls:e.toolCalls?.map(e=>({...e,status:`success`}))})),I(`success`);return}Z(i,{status:`error`,error:e instanceof Error?e.message:String(e),...d()}),I(`error`)}finally{L.current===t&&(L.current=null)}}let Le=e(z===`success`?`requestComplete`:z===`error`?`requestFailed`:z===`loading`?`requesting`:`requestIdle`),Re=$()!=null,ze=[{id:`auto`,textValue:e(`autoAccount`),label:e(`autoAccount`),icon:(0,Y.jsx)(o,{size:14,className:`text-muted`})},...T.map(t=>({id:t.id,textValue:`${t.name||t.id} ${_e(t.provider,t.region,e)}`,label:t.name||t.id,hint:_e(t.provider,t.region,e),icon:(0,Y.jsx)(ge,{provider:t.provider,size:14})}))],Be=T.length||!Re?ze:[{id:`auto`,textValue:e(`autoAccount`),label:e(`autoAccount`),icon:(0,Y.jsx)(o,{size:14,className:`text-muted`})},{id:`demo-wb`,textValue:`wb-demo WorkBuddy`,label:`wb-demo`,hint:`WorkBuddy`}],Ve=U.map(t=>{let n=pe(t),r=me(t),i=t.display_name||t.id,a=r?e(`modelFree`):n,o=t.provider||t.owned_by||``;return{id:t.id,textValue:`${i} ${t.id} ${o} ${n} ${r?`free`:``}`,label:a?`${i} ${a}`:i,hint:[t.id,o,a].filter(Boolean).join(` · `)}}),He=Ve.length||!Re?Ve:st.map(t=>{let n=pe(t),r=me(t),i=t.display_name||t.id,a=r?e(`modelFree`):n;return{id:t.id,textValue:`${i} ${t.id} ${t.provider} ${n} ${r?`free`:``}`,label:a?`${i} ${a}`:i,hint:[t.id,t.provider,a].filter(Boolean).join(` · `)}}),Ue=!!((xe.trim()||P.length)&&G&&!W&&(T.length||Re));function We(){Pe($e()),I(`idle`)}function Ge(){X(),I(`idle`),N(``),F([]);let e=ot([]);g(t=>[e,...t]),v(e.id)}function Ke(e){e!==y&&(X(),I(`idle`),N(``),F([]),v(e))}let qe=m.slice().sort((e,t)=>t.updatedAt-e.updatedAt).map(t=>({id:t.id,title:t.title||e(`chatHistoryUntitled`),updatedAt:t.updatedAt}));return(0,Y.jsxs)(`div`,{className:`access-page space-y-4`,children:[(0,Y.jsxs)(`section`,{className:`access-info-row flex flex-wrap items-center gap-x-3 gap-y-2 px-0.5 py-0.5`,title:e(`apiPlaygroundHint`),children:[(0,Y.jsx)(`h2`,{className:`shrink-0 text-body font-semibold text-foreground`,children:e(`apiPlayground`)}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 text-caption text-muted`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:e(`baseUrl`)}),(0,Y.jsx)(`code`,{className:`mono min-w-0 truncate font-medium text-foreground`,children:ce}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-6 min-w-6 shrink-0`,"aria-label":e(`copyBaseUrl`),onPress:()=>void Me(ce,`base`),children:(0,Y.jsx)(a,{copied:Ee===`base`,size:13})})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-caption text-muted`,children:[(0,Y.jsx)(`span`,{className:`status-dot`,"data-state":K.length?`ok`:void 0}),(0,Y.jsx)(`span`,{children:e(`readyAccounts`,{ready:K.length,total:T.length})}),(0,Y.jsx)(ae,{size:`sm`,variant:`soft`,color:K.length?`success`:`warning`,children:K.length?e(`endpointReady`):e(`degraded`)})]})]}),T.length?null:(0,Y.jsxs)(`div`,{className:`space-y-1 px-1`,children:[(0,Y.jsx)(`p`,{className:`text-caption text-muted`,children:e(`noAccountsForTest`)}),(0,Y.jsx)(l,{})]}),Oe?(0,Y.jsx)(`p`,{className:`px-1 text-caption text-danger`,children:Oe}):null,(0,Y.jsxs)(x,{selectedKey:r,onSelectionChange:e=>i(String(e)),children:[(0,Y.jsx)(x.ListContainer,{className:`w-fit`,children:(0,Y.jsxs)(x.List,{"aria-label":e(`accessTabsLabel`),children:[(0,Y.jsxs)(b,{id:`chat`,className:`gap-1.5 whitespace-nowrap`,children:[(0,Y.jsx)(x.Indicator,{className:`transition-none`}),e(`accessTabChat`)]}),(0,Y.jsxs)(b,{id:`raw`,className:`gap-1.5 whitespace-nowrap`,children:[(0,Y.jsx)(x.Indicator,{className:`transition-none`}),e(`accessTabApi`)]})]})}),(0,Y.jsx)(x.Panel,{id:`chat`,className:`pt-4`,children:(0,Y.jsxs)(`div`,{className:`flex min-h-[640px] md:min-h-[72vh]`,children:[(0,Y.jsx)(Ie,{collapsed:u,onCollapsedChange:f,items:qe,activeId:y,onSelect:Ke,onNew:Ge}),(0,Y.jsxs)(`div`,{className:`access-chat-stage flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(Je,{messages:S,busy:Se===`loading`,onLoadDemo:We}),(0,Y.jsx)(Fe,{value:xe,onChange:N,attachments:P,onAttachmentsChange:F,disabled:!T.length&&$()==null,streaming:Se===`loading`,canSend:Ue,onSend:()=>void Q(),onStop:X,accountValue:V||`auto`,onAccountChange:e=>A(e===`auto`?``:e),accountOptions:Be,modelValue:G,onModelChange:fe,modelOptions:He,modelsLoading:W})]})]})}),(0,Y.jsxs)(x.Panel,{id:`raw`,className:`space-y-4 pt-4`,children:[(0,Y.jsx)(Ye,{format:s,onFormatChange:c,requestPath:D,prompt:M,onPromptChange:be,onTest:()=>void Ne(),requestState:z,elapsedMs:we,output:Ce,responseStatus:Le,curl:q,copiedCurl:Ee===`curl`,onCopyCurl:()=>void Me(q,`curl`),canSend:!!(M.trim()&&G&&!W),accountValue:V||`auto`,onAccountChange:e=>A(e===`auto`?``:e),accountOptions:Be,modelValue:G,onModelChange:fe,modelOptions:He,modelsLoading:W,disabled:!T.length&&$()==null}),(0,Y.jsx)(je,{access:t?.access})]})]})]})}export{ct as AccessPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/AccountsPage-CYqKOC4C.js b/internal/webui/static/assets/AccountsPage-CYqKOC4C.js new file mode 100644 index 00000000..62796ef1 --- /dev/null +++ b/internal/webui/static/assets/AccountsPage-CYqKOC4C.js @@ -0,0 +1 @@ +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{a as r,i,n as a,o,r as s,s as c,t as l}from"./CaiaiSoftLink-DUJ2V4Pr.js";import{n as u}from"./Check.es-DrOC94kl.js";import{n as d,t as f}from"./clipboard-DG4c5Ihq.js";import{i as p,n as m,r as ee,t as h}from"./SearchBar-UDaAllIT.js";import{t as g}from"./Plus.es-BKtgxOxU.js";import{t as _}from"./ShieldCheck.es-Dqq1rq1d.js";import{t as v}from"./TrashSimple.es-a96yoz9-.js";import{H as te,I as ne,Z as re,n as ie,nt as y,pt as b,r as x}from"./useI18n-DAGWWg9N.js";import{B as S,F as C,J as w,M as ae,N as T,c as oe,j as se,q as ce,s as le,z as ue}from"./SharedElementTransition-BlCsXfb1.js";import{_ as de,t as fe,v as pe}from"./label-j5K3TFm8.js";import{t as me}from"./list-box-CGt1vjr2.js";import{n as he,t as ge}from"./PageAlert-BTp9jdUz.js";import{t as _e}from"./ConfirmDialog-2wOP1m7E.js";import{n as ve}from"./useToggle-Zi1rbfHX.js";import{t as E}from"./checkbox-CVxi8har.js";import{n as D,r as O,t as k}from"./FormRow-6b4yVFYc.js";import{t as ye}from"./EmptyPanel-Bs-jQMvG.js";import{t as A}from"./modal-BqXo29An.js";import{n as be,r as xe,t as j}from"./number-field-CyPgNRvS.js";import{t as Se}from"./search-field-BuHlt4Rv.js";import{t as Ce}from"./select-6cCnF9ka.js";import{t as we}from"./CompactSwitch-CzZldrIr.js";import{S as M,T as Te,_ as Ee,a as De,b as N,c as P,d as F,f as Oe,g as ke,i as Ae,l as je,o as I,p as Me,r as Ne,s as Pe,u as Fe,v as Ie,x as Le,y as Re}from"./overview-DcWoRgOQ.js";import{t as ze}from"./textfield-BfjC-Swp.js";import{r as L}from"./gsap-C3sDxib7.js";import{Bt as Be,Dt as Ve,G as He,It as Ue,J as We,K as Ge,M as R,Ot as z,S as Ke,T as qe,Vt as B,Wt as Je,Y as V,_ as Ye,a as Xe,b as H,j as Ze,k as U,m as Qe,q as W,t as G,v as $e,y as K,yt as q}from"./index-BYut8qRj.js";import{t as et}from"./FilterToggle-nA-ZS4oO.js";import{d as tt,f as nt}from"./format-B6SmebW-.js";import{t as rt}from"./ProviderMark-IiAZTaQS.js";import{n as it,t as at}from"./provider-gHnttGKq.js";import{a as ot,c as st,d as ct,f as lt,i as ut,l as dt,m as ft,n as pt,o as mt,p as J,r as ht,s as gt,t as _t,u as vt}from"./account-BJHim5bc.js";var Y=t(e(),1),X=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,28H188V24a12,12,0,0,0-24,0v4H92V24a12,12,0,0,0-24,0v4H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28ZM68,52a12,12,0,0,0,24,0h72a12,12,0,0,0,24,0h16V76H52V52ZM52,204V100H204V204Zm120.49-84.49a12,12,0,0,1,0,17l-48,48a12,12,0,0,1-17,0l-24-24a12,12,0,0,1,17-17L116,159l39.51-39.52A12,12,0,0,1,172.49,119.51Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V88H40V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Zm-38.34-85.66a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L116,164.69l42.34-42.35A8,8,0,0,1,169.66,122.34Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM169.66,133.66l-48,48a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L116,164.69l42.34-42.35a8,8,0,0,1,11.32,11.32ZM48,80V48H72v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,34H182V24a6,6,0,0,0-12,0V34H86V24a6,6,0,0,0-12,0V34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34ZM48,46H74V56a6,6,0,0,0,12,0V46h84V56a6,6,0,0,0,12,0V46h26a2,2,0,0,1,2,2V82H46V48A2,2,0,0,1,48,46ZM208,210H48a2,2,0,0,1-2-2V94H210V208A2,2,0,0,1,208,210Zm-39.76-86.24a6,6,0,0,1,0,8.48l-48,48a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L116,167.51l43.76-43.75A6,6,0,0,1,168.24,123.76Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Zm-38.34-85.66a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L116,164.69l42.34-42.35A8,8,0,0,1,169.66,122.34Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,36H180V24a4,4,0,0,0-8,0V36H84V24a4,4,0,0,0-8,0V36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36ZM48,44H76V56a4,4,0,0,0,8,0V44h88V56a4,4,0,0,0,8,0V44h28a4,4,0,0,1,4,4V84H44V48A4,4,0,0,1,48,44ZM208,212H48a4,4,0,0,1-4-4V92H212V208A4,4,0,0,1,208,212Zm-41.17-86.83a4,4,0,0,1,0,5.66l-48,48a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L116,170.34l45.17-45.17A4,4,0,0,1,166.83,125.17Z`}))]]),yt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M79.51,144.49a12,12,0,1,1,17-17L112,143l47.51-47.52a12,12,0,0,1,17,17l-56,56a12,12,0,0,1-17,0ZM228,48V208a20,20,0,0,1-20,20H48a20,20,0,0,1-20-20V48A20,20,0,0,1,48,28H208A20,20,0,0,1,228,48Zm-24,4H52V204H204Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48ZM208,208V48H48V208H208Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm-34.34,77.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM222,48V208a14,14,0,0,1-14,14H48a14,14,0,0,1-14-14V48A14,14,0,0,1,48,34H208A14,14,0,0,1,222,48Zm-12,0a2,2,0,0,0-2-2H48a2,2,0,0,0-2,2V208a2,2,0,0,0,2,2H208a2,2,0,0,0,2-2Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48ZM208,208V48H48V208H208Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM220,48V208a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V48A12,12,0,0,1,48,36H208A12,12,0,0,1,220,48Zm-8,0a4,4,0,0,0-4-4H48a4,4,0,0,0-4,4V208a4,4,0,0,0,4,4H208a4,4,0,0,0,4-4Z`}))]]),bt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M176,32V224a16,16,0,0,1-16,16H96a16,16,0,0,1-16-16V32A16,16,0,0,1,96,16h64A16,16,0,0,1,176,32Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM128,72a12,12,0,1,0-12-12A12,12,0,0,0,128,72Zm0,112a12,12,0,1,0,12,12A12,12,0,0,0,128,184Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M160,16H96A16,16,0,0,0,80,32V224a16,16,0,0,0,16,16h64a16,16,0,0,0,16-16V32A16,16,0,0,0,160,16ZM128,208a12,12,0,1,1,12-12A12,12,0,0,1,128,208Zm0-68a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm0-68a12,12,0,1,1,12-12A12,12,0,0,1,128,72Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M118,60a10,10,0,1,1,10,10A10,10,0,0,1,118,60Zm10,58a10,10,0,1,0,10,10A10,10,0,0,0,128,118Zm0,68a10,10,0,1,0,10,10A10,10,0,0,0,128,186Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM128,72a12,12,0,1,0-12-12A12,12,0,0,0,128,72Zm0,112a12,12,0,1,0,12,12A12,12,0,0,0,128,184Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M120,60a8,8,0,1,1,8,8A8,8,0,0,1,120,60Zm8,60a8,8,0,1,0,8,8A8,8,0,0,0,128,120Zm0,68a8,8,0,1,0,8,8A8,8,0,0,0,128,188Z`}))]]),xt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M228,144v64a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V144a12,12,0,0,1,24,0v52H204V144a12,12,0,0,1,24,0Zm-108.49,8.49a12,12,0,0,0,17,0l40-40a12,12,0,0,0-17-17L140,115V32a12,12,0,0,0-24,0v83L96.49,95.51a12,12,0,0,0-17,17Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V208H40V48A16,16,0,0,1,56,32H200A16,16,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40A8,8,0,0,0,168,96H136V32a8,8,0,0,0-16,0V96H88a8,8,0,0,0-5.66,13.66Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M222,144v64a6,6,0,0,1-6,6H40a6,6,0,0,1-6-6V144a6,6,0,0,1,12,0v58H210V144a6,6,0,0,1,12,0Zm-98.24,4.24a6,6,0,0,0,8.48,0l40-40a6,6,0,0,0-8.48-8.48L134,129.51V32a6,6,0,0,0-12,0v97.51L92.24,99.76a6,6,0,0,0-8.48,8.48Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M220,144v64a4,4,0,0,1-4,4H40a4,4,0,0,1-4-4V144a4,4,0,0,1,8,0v60H212V144a4,4,0,0,1,8,0Zm-94.83,2.83a4,4,0,0,0,5.66,0l40-40a4,4,0,1,0-5.66-5.66L132,134.34V32a4,4,0,0,0-8,0V134.34L90.83,101.17a4,4,0,0,0-5.66,5.66Z`}))]]),St=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M180.49,143.51a12,12,0,0,1,0,17l-24,24a12,12,0,0,1-17-17L155,152l-15.52-15.51a12,12,0,1,1,17-17Zm-64-24a12,12,0,0,0-17,0l-24,24a12,12,0,0,0,0,17l24,24a12,12,0,0,0,17-17L101,152l15.52-15.51A12,12,0,0,0,116.49,119.51ZM220,88V216a20,20,0,0,1-20,20H56a20,20,0,0,1-20-20V40A20,20,0,0,1,56,20h96a12,12,0,0,1,8.49,3.52l56,56A12,12,0,0,1,220,88ZM160,57V80h23Zm36,155V104H148a12,12,0,0,1-12-12V44H60V212Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,88H152V32Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M181.66,146.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32Zm-72-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,0,11.32l24,24a8,8,0,0,0,11.32-11.32L91.31,152l18.35-18.34A8,8,0,0,0,109.66,122.34ZM216,88V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31Zm40,136V96H152a8,8,0,0,1-8-8V40H56V216H200Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34Zm-104,88a8,8,0,0,1-11.32,11.32l-24-24a8,8,0,0,1,0-11.32l24-24a8,8,0,0,1,11.32,11.32L91.31,152Zm72-12.68-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32l24,24A8,8,0,0,1,181.66,157.66ZM152,88V44l44,44Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M180.24,147.76a6,6,0,0,1,0,8.48l-24,24a6,6,0,0,1-8.48-8.48L167.51,152l-19.75-19.76a6,6,0,1,1,8.48-8.48Zm-72-24a6,6,0,0,0-8.48,0l-24,24a6,6,0,0,0,0,8.48l24,24a6,6,0,1,0,8.48-8.48L88.49,152l19.75-19.76A6,6,0,0,0,108.24,123.76ZM214,88V216a14,14,0,0,1-14,14H56a14,14,0,0,1-14-14V40A14,14,0,0,1,56,26h96a6,6,0,0,1,4.25,1.76l56,56A6,6,0,0,1,214,88Zm-56-6h35.52L158,46.48Zm44,134V94H152a6,6,0,0,1-6-6V38H56a2,2,0,0,0-2,2V216a2,2,0,0,0,2,2H200A2,2,0,0,0,202,216Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M181.66,146.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32Zm-72-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,0,11.32l24,24a8,8,0,0,0,11.32-11.32L91.31,152l18.35-18.34A8,8,0,0,0,109.66,122.34ZM216,88V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31Zm40,136V96H152a8,8,0,0,1-8-8V40H56V216H200Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M178.83,149.17a4,4,0,0,1,0,5.66l-24,24a4,4,0,0,1-5.66-5.66L170.34,152l-21.17-21.17a4,4,0,1,1,5.66-5.66Zm-72-24a4,4,0,0,0-5.66,0l-24,24a4,4,0,0,0,0,5.66l24,24a4,4,0,1,0,5.66-5.66L85.66,152l21.17-21.17A4,4,0,0,0,106.83,125.17ZM212,88V216a12,12,0,0,1-12,12H56a12,12,0,0,1-12-12V40A12,12,0,0,1,56,28h96a4,4,0,0,1,2.83,1.17l56,56A4,4,0,0,1,212,88Zm-56-4h42.34L156,41.65Zm48,132V92H152a4,4,0,0,1-4-4V36H56a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H200A4,4,0,0,0,204,216Z`}))]]),Ct=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),wt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,28H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28Zm-4,176H52V52H204Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V48H208V208Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34Zm2,174a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V48H208V208Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36Zm4,172a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Z`}))]]),Tt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,44a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,44Zm0,168a72,72,0,1,1,72-72A72.08,72.08,0,0,1,128,212ZM164.49,99.51a12,12,0,0,1,0,17l-28,28a12,12,0,0,1-17-17l28-28A12,12,0,0,1,164.49,99.51ZM92,16A12,12,0,0,1,104,4h48a12,12,0,0,1,0,24H104A12,12,0,0,1,92,16Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,136a88,88,0,1,1-88-88A88,88,0,0,1,216,136Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,216ZM173.66,90.34a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32-11.32l40-40A8,8,0,0,1,173.66,90.34ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm45.66,61.66-40,40a8,8,0,0,1-11.32-11.32l40-40a8,8,0,0,1,11.32,11.32ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,42a94,94,0,1,0,94,94A94.11,94.11,0,0,0,128,42Zm0,176a82,82,0,1,1,82-82A82.1,82.1,0,0,1,128,218ZM172.24,91.76a6,6,0,0,1,0,8.48l-40,40a6,6,0,1,1-8.48-8.48l40-40A6,6,0,0,1,172.24,91.76ZM98,16a6,6,0,0,1,6-6h48a6,6,0,0,1,0,12H104A6,6,0,0,1,98,16Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,216ZM173.66,90.34a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32-11.32l40-40A8,8,0,0,1,173.66,90.34ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,44a92,92,0,1,0,92,92A92.1,92.1,0,0,0,128,44Zm0,176a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,220ZM170.83,93.17a4,4,0,0,1,0,5.66l-40,40a4,4,0,1,1-5.66-5.66l40-40A4,4,0,0,1,170.83,93.17ZM100,16a4,4,0,0,1,4-4h48a4,4,0,0,1,0,8H104A4,4,0,0,1,100,16Z`}))]]),Et=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M228,144v64a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V144a12,12,0,0,1,24,0v52H204V144a12,12,0,0,1,24,0ZM96.49,80.49,116,61v83a12,12,0,0,0,24,0V61l19.51,19.52a12,12,0,1,0,17-17l-40-40a12,12,0,0,0-17,0l-40,40a12,12,0,1,0,17,17Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V208H40V48A16,16,0,0,1,56,32H200A16,16,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM93.66,77.66,120,51.31V144a8,8,0,0,0,16,0V51.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,77.66Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM88,80h32v64a8,8,0,0,0,16,0V80h32a8,8,0,0,0,5.66-13.66l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,88,80Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M222,144v64a6,6,0,0,1-6,6H40a6,6,0,0,1-6-6V144a6,6,0,0,1,12,0v58H210V144a6,6,0,0,1,12,0ZM92.24,76.24,122,46.49V144a6,6,0,0,0,12,0V46.49l29.76,29.75a6,6,0,0,0,8.48-8.48l-40-40a6,6,0,0,0-8.48,0l-40,40a6,6,0,0,0,8.48,8.48Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM93.66,77.66,120,51.31V144a8,8,0,0,0,16,0V51.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,77.66Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M220,144v64a4,4,0,0,1-4,4H40a4,4,0,0,1-4-4V144a4,4,0,0,1,8,0v60H212V144a4,4,0,0,1,8,0ZM90.83,74.83,124,41.66V144a4,4,0,0,0,8,0V41.66l33.17,33.17a4,4,0,1,0,5.66-5.66l-40-40a4,4,0,0,0-5.66,0l-40,40a4,4,0,0,0,5.66,5.66Z`}))]]),Dt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M168.49,104.49,145,128l23.52,23.51a12,12,0,0,1-17,17L128,145l-23.51,23.52a12,12,0,0,1-17-17L111,128,87.51,104.49a12,12,0,0,1,17-17L128,111l23.51-23.52a12,12,0,0,1,17,17ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,130.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M164.24,100.24,136.48,128l27.76,27.76a6,6,0,1,1-8.48,8.48L128,136.48l-27.76,27.76a6,6,0,0,1-8.48-8.48L119.52,128,91.76,100.24a6,6,0,0,1,8.48-8.48L128,119.52l27.76-27.76a6,6,0,0,1,8.48,8.48ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M162.83,98.83,133.66,128l29.17,29.17a4,4,0,0,1-5.66,5.66L128,133.66,98.83,162.83a4,4,0,0,1-5.66-5.66L122.34,128,93.17,98.83a4,4,0,0,1,5.66-5.66L128,122.34l29.17-29.17a4,4,0,1,1,5.66,5.66ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),Ot=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:X}));Ot.displayName=`CalendarCheckIcon`;var kt=Ot,At=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:yt}));At.displayName=`CheckSquareIcon`;var jt=At,Mt=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:bt}));Mt.displayName=`DotsThreeVerticalIcon`;var Nt=Mt,Pt=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:xt}));Pt.displayName=`DownloadSimpleIcon`;var Ft=Pt,It=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:St}));It.displayName=`FileCodeIcon`;var Lt=It,Rt=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:Ct}));Rt.displayName=`PencilSimpleIcon`;var zt=Rt,Bt=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:wt}));Bt.displayName=`SquareIcon`;var Vt=Bt,Ht=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:Tt}));Ht.displayName=`TimerIcon`;var Ut=Ht,Wt=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:Et}));Wt.displayName=`UploadSimpleIcon`;var Gt=Wt,Kt=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:Dt}));Kt.displayName=`XCircleIcon`;var qt=Kt,Jt=ue({slots:{menu:`dropdown__menu`,popover:`dropdown__popover`,root:`dropdown`,trigger:`dropdown__trigger`}}),Yt=ue({defaultVariants:{color:`accent`,size:`md`},slots:{base:`meter`,fill:`meter__fill`,output:`meter__output`,track:`meter__track`},variants:{color:{accent:{base:`meter--accent`},danger:{base:`meter--danger`},default:{base:`meter--default`},success:{base:`meter--success`},warning:{base:`meter--warning`}},size:{lg:{base:`meter--lg`},md:{base:`meter--md`},sm:{base:`meter--sm`}}}}),Xt=ue({defaultVariants:{variant:`default`},slots:{indicator:`menu-item__indicator`,item:`menu-item`,submenuIndicator:`menu-item__indicator menu-item__indicator--submenu`},variants:{variant:{danger:{item:`menu-item--danger`},default:{item:`menu-item--default`}}}}),Zt=ue({base:`menu-section`});function Qt(e){let{value:t=0,minValue:n=0,maxValue:r=100,valueLabel:i,isIndeterminate:a,formatOptions:o={style:`percent`}}=e,s=ce(e,{labelable:!0}),{labelProps:c,fieldProps:l}=de({...e,labelElementType:`span`});t=y(t,n,r);let u=r-n,d=u===0?0:(t-n)/u,f=xe(o);if(!a&&!i){let e=o.style===`percent`?d:t;i=f.format(e)}return{progressBarProps:w(s,{...l,"aria-valuenow":a?void 0:t,"aria-valuemin":n,"aria-valuemax":r,"aria-valuetext":a?void 0:i,role:`progressbar`}),labelProps:c}}function $t(e){let{progressBarProps:t,labelProps:n}=Qt(e);return{meterProps:{...t,role:`meter progressbar`},labelProps:n}}var en=(0,Y.createContext)(null),tn=(0,Y.forwardRef)(function(e,t){[e,t]=se(e,t,en);let{value:n=0,minValue:r=0,maxValue:i=100}=e;n=y(n,r,i);let a=i-r,[o,s]=T(!e[`aria-label`]&&!e[`aria-labelledby`]),{meterProps:c,labelProps:l}=$t({...e,label:s}),u=a===0?0:(n-r)/a*100,d=ae({...e,defaultClassName:`react-aria-Meter`,values:{percentage:u,valueText:c[`aria-valuetext`]}}),f=ce(e,{global:!0});return Y.createElement(C.div,{...w(f,d,c),ref:t,slot:e.slot||void 0},Y.createElement(pe.Provider,{value:{...l,ref:o,elementType:`span`}},d.children))}),Z=n(),nn=(0,Y.createContext)({}),rn=({children:e,className:t,variant:n,...r})=>{let i=Y.useMemo(()=>Xt({variant:n}),[n]);return(0,Z.jsx)(Ge,{className:oe(t,i.item()),"data-slot":`menu-item`,...r,children:t=>(0,Z.jsx)(nn,{value:{slots:i,state:t},children:typeof e==`function`?e(t):e})})},an=({children:e,className:t,type:n=`checkmark`,...r})=>{let{slots:i,state:a}=(0,Y.use)(nn),o=a?.isSelected,s=typeof e==`function`?e(a??{}):e||(n===`dot`?(0,Z.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`menu-item-indicator--dot`,fill:`currentColor`,fillRule:`evenodd`,role:`presentation`,viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`,children:(0,Z.jsx)(`path`,{clipRule:`evenodd`,d:`M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14`,fillRule:`evenodd`})}):(0,Z.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`menu-item-indicator--checkmark`,fill:`none`,role:`presentation`,stroke:`currentColor`,strokeDasharray:22,strokeDashoffset:o?44:66,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 17 18`,children:(0,Z.jsx)(`polyline`,{points:`1 9 7 14 15 4`})}));return(0,Z.jsx)(S.span,{"aria-hidden":`true`,className:le(i?.indicator,t),"data-slot":`menu-item-indicator`,"data-type":n,"data-visible":o||void 0,...r,children:s})},on=({children:e,className:t,...n})=>{let{slots:r,state:i}=(0,Y.use)(nn);if(!i?.hasSubmenu)return null;let a=e??(0,Z.jsx)(te,{});return(0,Z.jsx)(S.span,{"aria-hidden":`true`,className:le(r?.submenuIndicator,t),"data-slot":`submenu-indicator`,...n,children:a})},sn=({children:e,className:t,...n})=>{let r=Y.useMemo(()=>Zt({class:typeof t==`string`?t:void 0}),[t]);return(0,Z.jsx)(W,{className:r,...n,children:e})},cn=(0,Y.createContext)({}),ln=({children:e,...t})=>{let n=Y.useMemo(()=>Jt(),[]);return(0,Z.jsx)(cn,{value:{slots:n},children:(0,Z.jsx)(He,{...t,children:e})})},un=({children:e,className:t,...n})=>{let{slots:r}=(0,Y.use)(cn);return(0,Z.jsx)(re,{className:oe(t,r?.trigger()),"data-slot":`dropdown-trigger`,...n,children:t=>(0,Z.jsx)(Z.Fragment,{children:typeof e==`function`?e(t):e})})},dn=({children:e,className:t,placement:n,...r})=>{let{slots:i}=(0,Y.use)(cn);return(0,Z.jsx)(ne,{value:{variant:`default`},children:(0,Z.jsx)(q,{...r,className:oe(t,i?.popover()),"data-slot":`dropdown-popover`,placement:n,children:e})})};function fn({className:e,...t}){let{slots:n}=(0,Y.use)(cn);return(0,Z.jsx)(We,{className:oe(e,n?.menu()),"data-selection-mode":t.selectionMode,"data-slot":`dropdown-menu`,...t})}var pn=Object.assign(ln,{Root:ln,Trigger:un,Popover:dn,Menu:fn,Section:e=>(0,Z.jsx)(sn,{...e}),Item:e=>(0,Z.jsx)(rn,{...e}),ItemIndicator:e=>(0,Z.jsx)(an,{...e}),SubmenuIndicator:e=>(0,Z.jsx)(on,{...e}),SubmenuTrigger:({children:e,...t})=>(0,Z.jsx)(V,{"data-slot":`dropdown-submenu-trigger`,...t,children:e})}),mn=(0,Y.createContext)({}),hn=({children:e,className:t,color:n,size:r,...i})=>{let a=Y.useMemo(()=>Yt({color:n,size:r}),[n,r]);return(0,Z.jsx)(tn,{"data-slot":`meter`,...i,className:oe(t,a.base()),children:t=>(0,Z.jsx)(mn,{value:{slots:a,state:t},children:typeof e==`function`?e(t):e})})};hn.displayName=`HeroUI.Meter`;var gn=({children:e,className:t,...n})=>{let{slots:r,state:i}=(0,Y.use)(mn);return(0,Z.jsx)(S.span,{className:le(r?.output,t),"data-slot":`meter-output`,...n,children:e??i?.valueText})};gn.displayName=`HeroUI.Meter.Output`;var _n=({children:e,className:t,...n})=>{let{slots:r}=(0,Y.use)(mn);return(0,Z.jsx)(S.div,{className:le(r?.track,t),"data-slot":`meter-track`,...n,children:e})};_n.displayName=`HeroUI.Meter.Track`;var vn=({className:e,style:t,...n})=>{let{slots:r,state:i}=(0,Y.use)(mn);return(0,Z.jsx)(S.div,{className:le(r?.fill,e),"data-slot":`meter-fill`,style:{...t,width:`${i?.percentage??0}%`},...n})};vn.displayName=`HeroUI.Meter.Fill`;var yn=Object.assign(hn,{Root:hn,Output:gn,Track:_n,Fill:vn}),bn=()=>()=>{},xn=new Set,Sn=Date.now(),Cn=null;function wn(){Sn=Date.now();for(let e of xn)e()}function Tn(e){return xn.size===0&&(Sn=Date.now()),xn.add(e),Cn===null&&(Cn=window.setInterval(wn,1e3)),()=>{xn.delete(e),xn.size===0&&Cn!==null&&(window.clearInterval(Cn),Cn=null)}}function En(){return Sn}function Dn(e=!0){return(0,Y.useSyncExternalStore)(e?Tn:bn,En,En)}function On(e){(0,Y.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=L.context(()=>{L.matchMedia().add(`(prefers-reduced-motion: no-preference)`,()=>{let e=L.utils.toArray(`.meter__fill`);e.length&&L.from(e,{scaleX:0,transformOrigin:`left center`,duration:$e.calm,ease:K.emphasized,stagger:Ke.base,clearProps:`transform,transformOrigin`})})},t);return()=>n.revert()},[e])}function kn(e,t,n,r,i,a){return[e.has_add_on&&e.add_on_available!==!1?`${n} ${ot(e.add_on_used)} / ${ot(e.add_on_total)} ${e.add_on_unit||`credits`}`:``,e.has_resource_package&&e.resource_package_available!==!1?`${r} ${t} ${ot(e.resource_package_remaining)} ${e.resource_package_unit||`credits`}`:``,a===`workbuddy`?gt(e,i):``].filter(Boolean)}function An({window:e,t,extra:n}){let r=Math.round(e.percentage??0),i=ct(e,t),a=t(`quotaUsedPercent`,{n:r}),o=st(e.reset_at,t),s=`${i} · ${a}${o?` · ${o}`:``}`,c=vt(e),l=dt(e),u=l===`danger`?`danger`:l===`warn`?`warning`:`success`;return(0,Z.jsxs)(U,{children:[(0,Z.jsx)(U.Trigger,{className:`block w-full min-w-0`,children:(0,Z.jsxs)(`div`,{className:`w-full min-w-0 cursor-help`,children:[(0,Z.jsxs)(yn,{className:`account-meter account-meter--window w-full`,color:u,size:`md`,minValue:0,maxValue:100,value:Math.round(c*100),"aria-label":i,valueLabel:s,children:[(0,Z.jsxs)(yn.Output,{className:`flex w-full items-baseline justify-between gap-3 text-caption`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:i}),(0,Z.jsx)(`span`,{className:`mono shrink-0 text-foreground/70`,children:a})]}),(0,Z.jsx)(yn.Track,{children:(0,Z.jsx)(yn.Fill,{})})]}),o?(0,Z.jsx)(`div`,{className:`mt-1 text-caption leading-4 text-muted`,children:o}):null]})}),(0,Z.jsx)(U.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(`div`,{children:s}),n?.map(e=>(0,Z.jsx)(`div`,{children:e},e))]})})]})}function jn({quota:e,t,label:n,usedLabel:r,remainingLabel:i,addOnLabel:a,resourcePackageLabel:o,exceededLabel:s,provider:c}){let l=e.unit||`credits`,u=`${ot(e.used)} / ${ot(e.total)}`,d=`${ot(e.remaining)}`,f=kn(e,i,a,o,t,c),p=lt(e),m=c===`codex`||c===`kiro`?ht(e.plan):``,ee=vt(e),h=dt(e),g=h===`danger`?`danger`:h===`warn`?`warning`:`success`,_=(0,Y.useRef)(null);On(_);let v=`${r} ${u} ${l} · ${i} ${d} ${l}${f.length?` · ${f.join(` · `)}`:``}`;return p.length>0?(0,Z.jsxs)(`div`,{ref:_,className:`account-quota-windows flex w-full min-w-0 flex-col gap-3`,children:[m?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-caption`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:t(`quotaPlan`)}),(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:m})]}):null,p.map((e,n)=>(0,Z.jsx)(`div`,{className:`w-full min-w-0`,children:(0,Z.jsx)(An,{window:e,t,extra:n===0?f:void 0})},e.id||String(n)))]}):(0,Z.jsxs)(U,{children:[(0,Z.jsx)(U.Trigger,{children:(0,Z.jsx)(`div`,{ref:_,className:`w-full cursor-help`,children:(0,Z.jsxs)(yn,{className:`account-meter w-full`,color:g,size:`md`,minValue:0,maxValue:100,value:Math.round(ee*100),"aria-label":n,valueLabel:v,children:[(0,Z.jsxs)(yn.Output,{className:`flex w-full items-baseline justify-between text-caption`,children:[(0,Z.jsxs)(`span`,{className:`text-body font-semibold leading-5 text-foreground tabular-nums`,children:[e.exceeded?(0,Z.jsx)(`span`,{className:`mr-1.5 text-danger`,children:s}):(0,Z.jsx)(`span`,{className:`mr-1.5 text-caption font-normal text-muted`,children:i}),d,(0,Z.jsx)(`span`,{className:`ml-1 text-caption font-normal text-foreground/60`,children:l})]}),(0,Z.jsxs)(`span`,{className:`mono text-foreground/55`,children:[u,` · `,Math.round(ee*100),`%`]})]}),(0,Z.jsx)(yn.Track,{children:(0,Z.jsx)(yn.Fill,{})})]})})}),(0,Z.jsx)(U.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsxs)(`div`,{children:[r,` `,u,` `,l]}),(0,Z.jsxs)(`div`,{children:[i,` `,d,` `,l]}),f.map(e=>(0,Z.jsx)(`div`,{children:e},e))]})})]})}function Mn({state:e,stateCopy:t,t:n}){let r=(0,Y.useRef)(null),i=J(e),a=ft(e);return(0,Y.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=L.context(()=>{let e=L.utils.toArray(`[data-runtime-seg]`),t=e.filter((e,t)=>tt>=i),r=L.matchMedia();r.add(`(prefers-reduced-motion: reduce)`,()=>{L.set(t,{scaleY:1,autoAlpha:1}),L.set(n,{scaleY:.32,autoAlpha:.45})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{L.set(e,{transformOrigin:`center bottom`}),L.to(n,{scaleY:.32,autoAlpha:.45,duration:$e.fast,ease:K.out,overwrite:!0}),L.to(t,{scaleY:1,autoAlpha:1,duration:$e.base,ease:K.out,stagger:{amount:.08,from:`start`},overwrite:!0})})},e);return()=>t.revert()},[i,e]),(0,Z.jsx)(`div`,{ref:r,className:`flex items-center`,children:(0,Z.jsx)(`div`,{className:`runtime-meter min-w-[80px] flex-1`,"data-quiet":a===`ok`?`true`:void 0,role:`meter`,"aria-label":n(`runtimeState`),"aria-valuemin":0,"aria-valuemax":12,"aria-valuenow":i,"aria-valuetext":t,children:Array.from({length:12},(e,t)=>(0,Z.jsx)(`span`,{"data-runtime-seg":!0,"data-on":t{if(T)return Ce.current&&window.clearTimeout(Ce.current),Ce.current=window.setTimeout(()=>xe(T),3e3),()=>{Ce.current&&window.clearTimeout(Ce.current)}},[T]);let Ee=Nn(D,D===`dead`?ye:k,u),De=D===`hot`||D===`ready`?`success`:D===`cooling`?`warning`:D===`quota_exhausted`||D===`login`||D===`unavailable`||D===`dead`||D===`auth_failed`?`danger`:void 0,N=e.last_error||e.lastError,P=e.last_error_kind||e.kind,F=it(e.provider,e.region,u),Oe=String(e.region||``).toLowerCase(),ke=Oe===`cn`?u(`regionCN`):Oe===`global`?u(`regionGlobal`):``,Ae=e.remote_uid||e.id,je=Ae.length>12?Ae.slice(0,8):Ae,I=e.last_checkin_status,Me=I===`success`?`checkinRecordSuccess`:I===`already`?`checkinRecordAlready`:I===`skipped`?`checkinRecordSkipped`:I===`error`?`checkinRecordFailed`:`lastCheckinNone`,Ne=pt(e,S);return(0,Y.useLayoutEffect)(()=>{let e=le.current;if(!e)return;let t=E.current;if(E.current=D,!t||t===D)return;let n=L.context(()=>{let t=L.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{L.set(e,{scale:1,autoAlpha:1})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{L.fromTo(e,{scale:.94,autoAlpha:.65},{scale:1,autoAlpha:1,duration:.2,ease:`power2.out`,overwrite:!0})})},e);return()=>n.revert()},[D]),(0,Y.useLayoutEffect)(()=>{let e=ue.current;if(!e||!n)return;let t=L.context(()=>{let t=L.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{L.set(e,{autoAlpha:1,y:0})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{L.fromTo(e,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:.2,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[n]),(0,Z.jsxs)(ve,{"data-gsap-reveal":!0,"data-state":D,className:`account-card overflow-hidden p-0`,children:[(0,Z.jsxs)(ve.Header,{className:`flex-row items-start justify-between gap-2.5 px-4 pt-3.5 pb-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Z.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-tertiary`,title:F,children:(0,Z.jsx)(rt,{provider:e.provider,size:20})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(ve.Title,{className:`truncate text-body leading-5`,children:e.name||e.id}),ke?(0,Z.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-secondary px-1.5 py-px text-caption text-muted`,title:F,children:ke}):null]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Z.jsx)(ve.Description,{className:`mono truncate text-caption leading-4 text-foreground/60`,title:`${e.id}${e.remote_uid?` · UID ${e.remote_uid}`:``}`,children:je}),(0,Z.jsx)(x,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-5 min-w-0 shrink-0 text-muted`,"aria-label":u(me?`copied`:`copy`),onPress:()=>{f(Ae).then(e=>{e&&(he(!0),window.setTimeout(()=>he(!1),1100))})},children:(0,Z.jsx)(a,{copied:me,size:12})})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex max-w-[48%] shrink-0 flex-wrap justify-end gap-1.5`,children:[(0,Z.jsx)(`span`,{ref:le,children:A.length&&D===`cooling`?(0,Z.jsxs)(U,{children:[(0,Z.jsx)(U.Trigger,{children:(0,Z.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,Z.jsx)(R,{size:`sm`,variant:`soft`,color:De,children:Ee})})}),(0,Z.jsx)(U.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:u(`partialCooling`)}),A.map(([e,t])=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(`span`,{className:`mono text-foreground/65`,children:ut(t)})]},e))]})})]}):(0,Z.jsx)(R,{size:`sm`,variant:`soft`,color:De,children:Ee})}),A.length&&D!==`cooling`?(0,Z.jsxs)(U,{children:[(0,Z.jsx)(U.Trigger,{children:(0,Z.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,Z.jsx)(R,{size:`sm`,variant:`soft`,color:`warning`,children:u(`partialCooling`)})})}),(0,Z.jsx)(U.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:u(`partialCooling`)}),A.map(([e,t])=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(`span`,{className:`mono text-foreground/65`,children:ut(t)})]},e))]})})]}):null]})]}),(0,Z.jsxs)(ve.Content,{className:`gap-1.5 px-4 pb-3`,children:[(0,Z.jsx)(Mn,{state:D,stateCopy:Ee,t:u}),e.quota?(0,Z.jsx)(jn,{quota:e.quota,t:u,label:u(`quota`),usedLabel:u(`quotaUsed`),remainingLabel:u(`quotaRemaining`),addOnLabel:u(`quotaAddOn`),resourcePackageLabel:u(`quotaResourcePackage`),exceededLabel:u(`quotaExceeded`),provider:e.provider}):(0,Z.jsx)(`span`,{className:`text-caption text-foreground/65`,children:u(D===`hot`||D===`ready`||D===`loading`||D===`starting`?`quotaLoading`:`quotaUnavailable`)}),N?(0,Z.jsxs)(U,{children:[(0,Z.jsx)(U.Trigger,{children:(0,Z.jsxs)(`div`,{className:`flex w-full cursor-help gap-2 rounded-lg bg-surface-secondary p-2 text-left text-caption leading-5 text-foreground`,children:[(0,Z.jsx)(z,{size:14,className:`mt-0.5 shrink-0 text-danger`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[P?(0,Z.jsx)(`div`,{className:`mono mb-0.5 truncate text-caption opacity-75`,children:P}):null,(0,Z.jsx)(`p`,{className:`break-words line-clamp-3`,children:N})]})]})}),(0,Z.jsx)(U.Content,{children:(0,Z.jsxs)(`div`,{className:`max-w-md whitespace-pre-wrap break-words`,children:[P?(0,Z.jsx)(`div`,{className:`mono mb-1 text-caption opacity-75`,children:P}):null,N]})})]}):null,M?(0,Z.jsxs)(`div`,{className:`flex w-full items-start gap-2 rounded-lg bg-surface-secondary p-2 text-caption leading-5`,children:[M.kind===`success`?(0,Z.jsx)(B,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-success`}):M.kind===`error`?(0,Z.jsx)(qt,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-danger`}):(0,Z.jsx)(z,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-warning`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[M.kind===`success`?(0,Z.jsx)(`span`,{className:`font-medium text-success`,children:u(`checkinRecordSuccess`)}):M.kind===`already`?(0,Z.jsx)(`span`,{className:`font-medium text-warning`,children:u(`checkinRecordAlready`)}):M.kind===`skipped`?(0,Z.jsx)(`span`,{className:`font-medium text-warning`,children:u(`checkinRecordSkipped`)}):(0,Z.jsx)(`span`,{className:`font-medium text-danger`,children:u(`checkinRecordFailed`)}),M.message?(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[(0,Z.jsx)(`p`,{className:`break-words line-clamp-2 text-foreground/80`,children:M.message}),(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-caption text-muted`,children:u(`checkinTruncated`)}),(0,Z.jsxs)(x,{size:`sm`,variant:`ghost`,className:`h-6 min-w-0 gap-1 px-1.5 text-caption`,onPress:()=>{f(M.message||``).then(e=>{!e||!M||(Se(M),window.setTimeout(()=>Se(null),1100))})},children:[(0,Z.jsx)(a,{copied:Te,size:13}),u(Te?`copied`:`checkinCopyError`)]})]})]}):null]})]}):null]}),n&&e.enabled?(0,Z.jsx)(`section`,{ref:ue,className:`grid gap-3 bg-surface-secondary/55 px-3 py-3`,children:e.provider===`doubaowork`?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:u(`doubaoCookieLabel`)}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-caption leading-5 text-muted`,children:u(`doubaoCookieLead`)}),(0,Z.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,children:[(0,Z.jsxs)(ze,{className:`flex-1`,type:`password`,value:l,onChange:p,children:[(0,Z.jsx)(fe,{className:`sr-only`,children:u(`doubaoCookieLabel`)}),(0,Z.jsx)(O,{placeholder:u(`doubaoCookiePh`),"aria-label":u(`doubaoCookieLabel`)})]}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:t===`pat`,onPress:ee,children:[(0,Z.jsx)(Ue,{size:14}),u(`doubaoSaveCookie`)]})]}),o?(0,Z.jsx)(`p`,{className:`mt-1 text-caption text-muted`,children:o}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:u(`oauthDeviceFlow`)}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-caption leading-5 text-muted`,children:e.provider===`codex`?u(`wizardCodexBrowserLead`):u(`qoderLoginHint`)}),(0,Z.jsx)(`div`,{className:`mt-2.5 flex flex-wrap gap-2`,children:e.provider===`codex`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(x,{size:`sm`,isPending:t===`device`,onPress:()=>m(`cli`),children:[(0,Z.jsx)(_,{size:14}),u(`startCodexCliLogin`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`chatgpt`),children:[(0,Z.jsx)(_,{size:14}),u(`startCodexChatGPTLogin`)]})]}):e.provider===`kiro`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(x,{size:`sm`,isPending:t===`device`,onPress:()=>m(`builder_id`),children:[(0,Z.jsx)(_,{size:14}),u(`kiroLoginBuilder`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`idc`),children:[(0,Z.jsx)(_,{size:14}),u(`kiroLoginIDC`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`microsoft`),children:[(0,Z.jsx)(_,{size:14}),u(`kiroLoginMicrosoft`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`sso`),children:[(0,Z.jsx)(_,{size:14}),u(`kiroLoginSSO`)]})]}):(0,Z.jsxs)(x,{size:`sm`,isPending:t===`device`,onPress:()=>m(),children:[(0,Z.jsx)(_,{size:14}),u(`startBrowserLogin`)]})}),(e.provider===`trae`||e.provider===`codex`||e.provider===`devin`||e.provider===`kiro`)&&te&&g?(0,Z.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:u(`wizardCallbackLead`)}),(0,Z.jsx)(s,{className:`h-24 w-full resize-none font-mono text-caption leading-5`,value:h||``,onChange:e=>g(e.target.value),placeholder:u(`wizardCallbackPh`),"aria-label":u(`wizardCallbackPh`)}),(0,Z.jsx)(x,{size:`sm`,variant:`secondary`,isPending:t===`callback`,onPress:te,children:u(`wizardSubmitCallback`)})]}):null]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:u(`patFallback`)}),(0,Z.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,children:[(0,Z.jsxs)(ze,{className:`flex-1`,type:`password`,value:l,onChange:p,children:[(0,Z.jsx)(fe,{className:`sr-only`,children:u(`pat`)}),(0,Z.jsx)(O,{placeholder:u(`pasteToken`),"aria-label":u(`pat`)})]}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:t===`pat`,onPress:ee,children:[(0,Z.jsx)(Ue,{size:14}),u(`usePat`)]})]})]}),r||o?(0,Z.jsxs)(`div`,{className:`text-caption`,children:[r?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:u(`authUrl`)}),(0,Z.jsx)(`code`,{className:`mono block break-all text-foreground`,children:r}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,onPress:()=>window.open(r,`_blank`,`noopener,noreferrer`),children:[(0,Z.jsx)(c,{size:14}),u(`openAuthUrl`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`ghost`,onPress:()=>{f(r).then(e=>{e&&(pe(!0),window.setTimeout(()=>pe(!1),1100))})},children:[(0,Z.jsx)(a,{copied:de}),u(de?`copied`:`copy`)]})]})]}):null,o?(0,Z.jsx)(`p`,{className:`mt-1 text-muted`,children:o}):null]}):null]})}):null,w?(0,Z.jsxs)(`div`,{className:`mt-auto flex items-center justify-between gap-2 px-4 pb-2.5 text-caption text-muted`,children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(U.Trigger,{children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 cursor-help flex-wrap items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-foreground/75`,children:u(`checkinStatus`)}),(0,Z.jsx)(`span`,{className:I===`error`?`text-danger`:``,children:u(Me)}),Ne?null:(0,Z.jsx)(`span`,{className:`whitespace-nowrap rounded-full bg-warning/15 px-1.5 py-px font-medium text-warning`,children:u(`checkinPending`)})]})}),(0,Z.jsxs)(U.Content,{children:[e.last_checkin_at?new Date(e.last_checkin_at).toLocaleString():u(`lastCheckinNone`),e.last_checkin_msg?` · ${e.last_checkin_msg}`:``]})]}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(U.Trigger,{children:(0,Z.jsxs)(`span`,{className:`flex shrink-0 cursor-help items-center gap-1.5 whitespace-nowrap`,children:[(0,Z.jsx)(`span`,{children:u(`checkinDaily`)}),(0,Z.jsx)(`span`,{className:`mono text-caption text-foreground/55`,children:e.checkin_time||b}),(0,Z.jsx)(we,{isSelected:!!e.auto_checkin,isDisabled:!!t,ariaLabel:u(`autoCheckin`),onChange:e=>C?.(e)})]})}),(0,Z.jsx)(U.Content,{children:e.checkin_time?u(`checkinCustom`):u(`checkinInherit`)})]})]}):null,(0,Z.jsxs)(ve.Footer,{className:`flex flex-nowrap items-center gap-1 bg-surface-secondary px-2 py-2${w?``:` mt-auto`}`,children:[re?(0,Z.jsxs)(U,{children:[(0,Z.jsx)(U.Trigger,{children:(0,Z.jsx)(x,{isIconOnly:!0,size:`sm`,variant:`ghost`,isPending:t===`refresh`,onPress:re,"aria-label":u(`refreshAccount`),children:(0,Z.jsx)(Je,{size:15})})}),(0,Z.jsx)(U.Content,{children:u(`refreshAccount`)})]}):null,(0,Z.jsxs)(U,{children:[(0,Z.jsx)(U.Trigger,{children:(0,Z.jsx)(x,{isIconOnly:!0,size:`sm`,variant:n?`secondary`:`ghost`,isDisabled:!e.enabled,onPress:se,"aria-label":u(`authentication`),children:(0,Z.jsx)(Ue,{size:15})})}),(0,Z.jsx)(U.Content,{children:u(`authentication`)})]}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(U.Trigger,{children:(0,Z.jsx)(x,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:oe,"aria-label":u(`editAccount`),children:(0,Z.jsx)(zt,{size:15})})}),(0,Z.jsx)(U.Content,{children:u(`editAccount`)})]}),(0,Z.jsxs)(pn,{children:[(0,Z.jsx)(pn.Trigger,{children:(0,Z.jsxs)(x,{isIconOnly:!0,size:`sm`,variant:ge?`secondary`:`ghost`,isPending:t===`checkin`,"aria-label":u(`more`),className:`relative`,children:[(0,Z.jsx)(Nt,{size:16}),A.length?(0,Z.jsx)(`span`,{className:`absolute top-1 right-1 size-1.5 rounded-full bg-warning`,"aria-hidden":!0}):null]})}),(0,Z.jsx)(pn.Popover,{placement:`bottom start`,children:(0,Z.jsxs)(pn.Menu,{"aria-label":u(`more`),disabledKeys:!e.enabled||t?[`checkin`]:[],onAction:e=>{e===`models`&&ce(),e===`cooldowns`&&_e(e=>!e),e===`checkin`&&w?.(),e===`checkin-records`&&ae?.(),e===`export`&&ne(),e===`delete`&&ie()},children:[(0,Z.jsxs)(pn.Item,{id:`models`,textValue:u(`accountModels`),children:[(0,Z.jsx)(Be,{size:15}),u(`accountModels`)]}),(0,Z.jsxs)(pn.Item,{id:`cooldowns`,textValue:u(`modelCooldowns`),children:[(0,Z.jsx)(Ut,{size:15,className:A.length?`text-warning`:void 0}),u(`modelCooldowns`),A.length?(0,Z.jsx)(`span`,{className:`mono ml-auto text-caption text-warning`,children:A.length}):null]}),w?(0,Z.jsxs)(pn.Item,{id:`checkin`,textValue:u(`checkinNow`),children:[(0,Z.jsx)(kt,{size:15}),u(`checkinNow`)]}):null,ae?(0,Z.jsxs)(pn.Item,{id:`checkin-records`,textValue:u(`checkinRecords`),children:[(0,Z.jsx)(i,{size:15}),u(`checkinRecords`)]}):null,e.auth_type===`none`?null:(0,Z.jsxs)(pn.Item,{id:`export`,textValue:u(`export`),children:[(0,Z.jsx)(d,{size:15}),u(`export`)]}),(0,Z.jsxs)(pn.Item,{id:`delete`,textValue:u(`delete`),className:`text-danger`,children:[(0,Z.jsx)(v,{size:15}),u(`delete`)]})]})})]}),(0,Z.jsx)(`div`,{className:`ml-auto flex shrink-0 flex-nowrap items-center whitespace-nowrap`,children:(0,Z.jsx)(we,{isSelected:!!e.enabled,isDisabled:t===`toggle`,ariaLabel:e.enabled?u(`disable`):u(`enable`),label:e.enabled?u(`enabledState`):u(`disabled`),onChange:y})})]}),ge?(0,Z.jsxs)(`section`,{className:`border-t border-separator bg-surface-secondary/55 px-4 py-2.5`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:u(`modelCooldownsTitle`)}),(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:A.length})]}),A.length?(0,Z.jsx)(`div`,{className:`space-y-1`,children:A.map(([e,t])=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-surface px-2 py-1.5 text-caption`,children:[(0,Z.jsx)(`span`,{className:`mono min-w-0 truncate`,title:e,children:e}),(0,Z.jsx)(`span`,{className:`mono shrink-0 text-warning`,children:ut(t)})]},e))}):(0,Z.jsx)(`p`,{className:`text-caption text-muted`,children:u(`modelCooldownsEmpty`)})]}):null]})}function Fn(e,t){return e.status===`success`?{label:t(`checkinRecordSuccess`),color:`success`}:e.status===`already`?{label:t(`checkinRecordAlready`),color:`warning`}:e.status===`skipped`?{label:t(`checkinRecordSkipped`),color:`default`}:{label:t(`checkinRecordFailed`),color:`danger`}}function In(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Ln({account:e,t,onClose:n}){let[r,i]=(0,Y.useState)([]),[a,o]=(0,Y.useState)(!!e?.id),[s,c]=(0,Y.useState)(``),l=e?.id||``,u=t(`checkinRecordsTitle`,{name:e?.name||e?.id||``});async function d(){if(l){o(!0),c(``);try{let e=await F(l);i(e.data||[])}catch(e){i([]),c(e instanceof Error?e.message:String(e))}finally{o(!1)}}}return(0,Y.useEffect)(()=>{l&&d()},[l]),(0,Z.jsx)(A.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,Z.jsx)(A.Backdrop,{variant:`blur`,children:(0,Z.jsx)(A.Container,{size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(A.Dialog,{children:[(0,Z.jsxs)(A.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(A.Heading,{className:`text-section font-semibold`,children:u}),(0,Z.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`checkinRecordsHint`)})]}),(0,Z.jsx)(A.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ve,{size:16})})]}),(0,Z.jsxs)(A.Body,{className:`px-5 pb-2`,children:[s?(0,Z.jsx)(`div`,{className:`mb-3`,children:(0,Z.jsx)(ge,{title:s})}):null,a?(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,Z.jsx)(Qe,{className:`h-16 w-full`}),(0,Z.jsx)(Qe,{className:`h-16 w-full`}),(0,Z.jsx)(Qe,{className:`h-16 w-full`})]}):r.length?(0,Z.jsx)(`div`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(e=>{let n=Fn(e,t);return(0,Z.jsxs)(`div`,{className:`flex items-start gap-3 px-3 py-3`,children:[(0,Z.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0`,"data-state":e.status===`error`?`warn`:`ok`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,variant:`soft`,color:n.color,children:n.label}),(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:In(e.created_at)})]}),(0,Z.jsx)(`p`,{className:`mt-1 break-words text-caption leading-5 text-foreground/75`,children:e.message||`—`})]})]},e.id)})}):(0,Z.jsx)(ye,{className:`min-h-44 rounded-3xl bg-surface-secondary`,title:t(`checkinRecordsEmpty`),hint:t(`checkinRecordsHint`)})]}),(0,Z.jsxs)(A.Footer,{className:`justify-between px-5 pb-5`,children:[(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:t(`checkinRecordsCount`,{count:r.length})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(x,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:a,onPress:()=>void d(),children:[(0,Z.jsx)(Je,{size:14}),t(`refresh`)]})]})]})]})})})})}function Rn(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function zn({account:e,t,onClose:n}){let[r,i]=(0,Y.useState)([]),[a,o]=(0,Y.useState)(!!e?.id),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(1),[p,m]=(0,Y.useState)(20),[h,g]=(0,Y.useState)(0),[_,v]=(0,Y.useState)(1),te=(0,Y.useRef)(0),ne=e?.id||``,re=t(`accountModelsTitle`,{name:e?.name||e?.id||``}),ie=e?it(e.provider,e.region,t):``;async function y(e=1,t=p,n=!1){if(!ne)return;let r=++te.current;n?c(!0):o(!0),u(``);try{let a=await(n?Le(ne,void 0,{page:e,pageSize:t}):Me(ne,!1,void 0,{page:e,pageSize:t})),o=a.data||[],s=a.pagination,c=s?.total??o.length,l=s?.total_pages??Math.max(1,Math.ceil(c/t)),u=Math.min(Math.max(1,s?.page??e),l);if(r!==te.current)return;i(s?o:o.slice((u-1)*t,u*t)),g(c),v(l),f(u)}catch(e){if(r!==te.current)return;i([]),g(0),v(1),u(e instanceof Error?e.message:String(e))}finally{r===te.current&&(o(!1),c(!1))}}(0,Y.useEffect)(()=>{ne&&(f(1),y(1,p))},[ne]);let b=h===0?0:(d-1)*p+1,S=h===0?0:Math.min(h,b+r.length-1);return(0,Z.jsx)(A.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,Z.jsx)(A.Backdrop,{variant:`blur`,children:(0,Z.jsx)(A.Container,{size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(A.Dialog,{children:[(0,Z.jsxs)(A.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(A.Heading,{className:`text-section font-semibold`,children:re}),(0,Z.jsx)(`p`,{className:`mt-1 text-caption font-normal leading-5 text-muted`,children:t(`accountModelsHint`)}),e?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-caption text-muted`,children:[(0,Z.jsx)(rt,{provider:e.provider,size:14}),(0,Z.jsx)(`span`,{children:ie}),(0,Z.jsx)(`span`,{className:`text-border`,children:`·`}),(0,Z.jsx)(`span`,{className:`mono`,children:e.id})]}):null]}),(0,Z.jsx)(A.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ve,{size:16})})]}),(0,Z.jsxs)(A.Body,{className:`px-5 pb-2`,children:[l?(0,Z.jsx)(`div`,{className:`mb-3`,children:(0,Z.jsx)(ge,{title:t(`accountModelsError`,{msg:l})})}):null,a||s?(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,Z.jsx)(Qe,{className:`h-14 w-full`}),(0,Z.jsx)(Qe,{className:`h-14 w-full`}),(0,Z.jsx)(Qe,{className:`h-14 w-full`})]}):r.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(n=>{let r=n.provider||n.owned_by||e?.provider||`qoder`,i=Rn(n),a=tt(n),o=nt(n);return(0,Z.jsxs)(`li`,{className:`flex items-start gap-3 px-3 py-2.5`,children:[(0,Z.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":n.stale?void 0:`ok`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body font-medium`,children:n.display_name||n.id}),o?(0,Z.jsx)(R,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null,a?(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:a}):null,n.stale?(0,Z.jsx)(R,{size:`sm`,variant:`soft`,color:`warning`,children:t(`fallback`)}):null]}),(0,Z.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:n.id}),i?(0,Z.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:t(`routedTo`,{model:i})}):null]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 pt-0.5 text-caption text-muted`,children:[(0,Z.jsx)(rt,{provider:r,size:12}),(0,Z.jsx)(`span`,{children:r})]})]},n.id)})}):(0,Z.jsx)(ye,{className:`min-h-48 rounded-3xl bg-surface-secondary`,icon:(0,Z.jsx)(Be,{size:22}),title:t(`accountModelsEmpty`),hint:t(`noModelsYet`)})]}),(0,Z.jsxs)(A.Footer,{className:`flex-col items-stretch gap-3 px-5 pb-5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`refreshing`):t(`shownTotal`,{shown:h?`${b}–${S}`:0,total:h})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(x,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:s,onPress:()=>void y(1,p,!0),children:[(0,Z.jsx)(Je,{size:14}),t(s?`refreshing`:`refresh`)]})]})]}),h>0?(0,Z.jsx)(ee,{total:h,page:d,pageCount:_,pageSize:p,loading:a||s,pageSizeLabel:t(`logsPageSize`),pageLabel:t(`logsPage`,{page:d,pages:_}),prevLabel:t(`logsPrevPage`),nextLabel:t(`logsNextPage`),onPage:e=>void y(e,p),onPageSize:e=>{m(e),y(1,e)}}):null]})]})})})})}function Bn({catalog:e,selected:t,onChange:n,isDisabled:r,t:i}){let[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(t),l=(0,Y.useMemo)(()=>new Set(t),[t]),u=(0,Y.useMemo)(()=>{let t=new Set(s),n=a.trim().toLowerCase(),r=(e||[]).filter(e=>!n||e.toLowerCase().includes(n));return[...r.filter(e=>t.has(e)),...r.filter(e=>!t.has(e))]},[e,a,s]),d=(0,Y.useMemo)(()=>{if(!e)return[];let n=new Set(e);return t.filter(e=>!n.has(e))},[e,t]),f=e?.length??0,p=t.filter(e=>!d.includes(e)).length;function m(e){o(e),c(t)}function ee(e,r){n(r?[...t,e]:t.filter(t=>t!==e))}function h(){let e=new Set(t);u.forEach(t=>e.add(t)),n([...e])}function g(){let e=new Set(u);n(t.filter(t=>!e.has(t)))}return(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(Se,{"aria-label":i(`modelPickerSearch`),value:a,onChange:m,isDisabled:r,className:`min-w-0 flex-1 basis-48`,children:(0,Z.jsxs)(Se.Group,{children:[(0,Z.jsx)(Se.SearchIcon,{}),(0,Z.jsx)(Se.Input,{placeholder:i(`modelPickerSearch`)}),(0,Z.jsx)(Se.ClearButton,{})]})}),(0,Z.jsx)(`span`,{className:`mono shrink-0 text-caption text-muted`,children:i(`modelPickerCount`,{selected:p,total:f})}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,Z.jsxs)(x,{size:`sm`,variant:`ghost`,isDisabled:r||u.length===0,onPress:h,children:[(0,Z.jsx)(jt,{size:14}),i(`modelPickerSelectAll`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`ghost`,isDisabled:r||t.length===0,onPress:g,children:[(0,Z.jsx)(Vt,{size:14}),i(`modelPickerClear`)]})]})]}),(0,Z.jsxs)(`div`,{className:`max-h-[300px] overflow-y-auto overscroll-contain rounded-lg bg-surface-secondary p-1`,children:[e===null?(0,Z.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(`refreshing`)}):null,d.map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md px-2.5 py-1.5`,children:[(0,Z.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-body text-muted line-through`,children:e}),(0,Z.jsx)(`span`,{className:`shrink-0 text-caption text-warning`,children:i(`modelPickerOffline`)}),(0,Z.jsx)(x,{isIconOnly:!0,size:`sm`,variant:`ghost`,isDisabled:r,"aria-label":i(`modelPickerRemove`,{model:e}),onPress:()=>ee(e,!1),children:(0,Z.jsx)(Ve,{size:14})})]},`offline-${e}`)),u.map(e=>(0,Z.jsx)(E,{isSelected:l.has(e),isDisabled:r,onChange:t=>ee(e,t),className:`flex w-full cursor-pointer rounded-md px-2.5 py-1.5 transition-colors hover:bg-default`,children:(0,Z.jsxs)(E.Content,{className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,Z.jsx)(E.Control,{children:(0,Z.jsx)(E.Indicator,{})}),(0,Z.jsx)(`span`,{className:`mono min-w-0 truncate text-body text-foreground`,children:e})]})},e)),e!==null&&u.length===0?(0,Z.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(f===0?`noAccountModels`:`modelPickerNoMatch`)}):null]})]})}function Vn(e){let[t,n]=(0,Y.useState)(e);e&&!t&&n(!0);let r=(0,Y.useRef)(null),i=(0,Y.useRef)(null),a=(0,Y.useRef)(e);return(0,Y.useLayoutEffect)(()=>{let t=r.current,o=i.current;if(!t||!o)return;if(a.current){a.current=!1;return}L.killTweensOf([t,o]);let s=t.getBoundingClientRect().height;if(e){L.set(t,{overflow:`hidden`});let e=t.scrollHeight;L.fromTo(t,{height:s===e?0:s},{height:e,duration:H($e.base),ease:K.out,onComplete:()=>L.set(t,{clearProps:`height,overflow`})}),L.fromTo(o,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:H($e.base),ease:K.out})}else L.set(t,{overflow:`hidden`,height:s}),L.to(o,{autoAlpha:0,y:-4,duration:H($e.fast),ease:K.inOut}),L.to(t,{height:0,duration:H($e.fast+.04),ease:K.inOut,onComplete:()=>n(!1)});return()=>{L.killTweensOf([t,o])}},[e,t]),{mounted:t,outerRef:r,innerRef:i}}function Hn({account:e,checkinDefaultTime:t,checkinTimezone:n,busy:r,t:i,onClose:a,onSave:o}){let[s,c]=(0,Y.useState)(e?.name||``),[l,u]=(0,Y.useState)(e?.max_inflight??4),[d,f]=(0,Y.useState)(e?.priority??50),[p,m]=(0,Y.useState)(e?.credit_floor==null?`inherit`:`custom`),[ee,h]=(0,Y.useState)(e?.credit_floor??0),[g,_]=(0,Y.useState)(e?.percent_floor==null?`inherit`:`custom`),[v,te]=(0,Y.useState)(e?.percent_floor??0),[ne,re]=(0,Y.useState)(e?.proxy_url||``),[ie,y]=(0,Y.useState)(!!e?.drop_system_prompt),[b,S]=(0,Y.useState)(Object.entries(e?.model_aliases||{}).map(([e,t])=>({alias:e,model:t}))),[C,w]=(0,Y.useState)({alias:``,model:``}),[ae,T]=(0,Y.useState)(!!e?.models_restricted),[oe,se]=(0,Y.useState)(e?.enabled_models||[]),{mounted:ce,outerRef:le,innerRef:ue}=Vn(ae),[de,fe]=(0,Y.useState)(null),[pe,me]=(0,Y.useState)(!e?.checkin_time),[ge,_e]=(0,Y.useState)(e?.checkin_time||null),[ve,E]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{if(!e?.id)return;let t=!1;return Me(e.id).then(e=>{t||fe(e.data||[])}).catch(()=>{t||fe([])}),()=>{t=!0}},[e?.id]);let D=i(`editAccountTitle`,{name:e?.name||e?.id||``}),ye=e?it(e.provider,e.region,i):``;async function xe(n){n?.preventDefault();let r=s.trim();if(!r){E(i(`accountNameRequired`));return}if(!Number.isInteger(l)||l<1||l>32){E(i(`maxInflightInvalid`));return}if(!Number.isInteger(d)||d<1||d>100){E(i(`priorityInvalid`));return}if(p===`custom`&&(!Number.isFinite(ee)||ee<0)){E(i(`creditFloorInvalid`));return}if(g===`custom`&&(!Number.isFinite(v)||v<0||v>100)){E(i(`percentFloorInvalid`));return}if(t!==void 0&&!pe&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(ge??t)){E(i(`checkinTimeInvalid`));return}E(``);try{await o({name:r,max_inflight:l,priority:d,credit_floor:p===`custom`?ee:null,percent_floor:g===`custom`?v:null,proxy_url:ne.trim(),checkin_time:t===void 0?void 0:pe?``:ge??t,drop_system_prompt:e?.provider===`workbuddy`||e?.provider===`trae`?ie:void 0,model_aliases:Object.fromEntries(b.filter(e=>e.alias.trim()&&e.model.trim()).map(e=>[e.alias.trim(),e.model.trim()])),enabled_models:ae?oe:[],set_model_routing:!0}),a()}catch(e){E(e instanceof Error?e.message:String(e))}}return(0,Z.jsx)(A.Root,{isOpen:!!e,onOpenChange:e=>{!e&&!r&&a()},children:(0,Z.jsx)(A.Backdrop,{variant:`blur`,children:(0,Z.jsx)(A.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(A.Dialog,{className:`w-full sm:w-[42rem] sm:max-w-[calc(100vw-2rem)]`,children:[(0,Z.jsxs)(A.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(A.Heading,{className:`text-section font-semibold`,children:D}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-body font-normal leading-6 text-muted`,children:i(`editAccountHint`)}),e?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,variant:`soft`,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(rt,{provider:e.provider,size:14}),(0,Z.jsx)(`span`,{children:ye})]})}),(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:e.id})]}):null]}),(0,Z.jsx)(A.CloseTrigger,{isDisabled:r,"aria-label":i(`close`),className:`grid size-9 shrink-0 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,Z.jsx)(Ve,{size:18})})]}),(0,Z.jsxs)(A.Body,{className:`px-6 pb-2 pt-1`,children:[ve?(0,Z.jsxs)(he,{status:`danger`,className:`mb-4`,children:[(0,Z.jsx)(he.Indicator,{}),(0,Z.jsx)(he.Content,{children:(0,Z.jsx)(he.Title,{children:ve})})]}):null,(0,Z.jsxs)(be,{className:`space-y-4`,onSubmit:e=>void xe(e),children:[(0,Z.jsx)(k,{label:i(`accountName`),children:(0,Z.jsx)(O,{value:s,onChange:e=>c(e.target.value),placeholder:i(`wizardNamePh`),"aria-label":i(`accountName`),disabled:r,autoFocus:!0})}),(0,Z.jsx)(k,{label:i(`maxInflight`),hint:i(`maxInflightHint`),children:(0,Z.jsx)(j,{value:l,onChange:e=>u(e??4),minValue:1,maxValue:32,isDisabled:r,isRequired:!0,children:(0,Z.jsxs)(j.Group,{children:[(0,Z.jsx)(j.DecrementButton,{}),(0,Z.jsx)(j.Input,{"aria-label":i(`maxInflight`)}),(0,Z.jsx)(j.IncrementButton,{})]})})}),(0,Z.jsx)(k,{label:i(`priority`),hint:i(`priorityHint`),children:(0,Z.jsx)(j,{value:d,onChange:e=>f(e??50),minValue:1,maxValue:100,isDisabled:r,isRequired:!0,children:(0,Z.jsxs)(j.Group,{children:[(0,Z.jsx)(j.DecrementButton,{}),(0,Z.jsx)(j.Input,{"aria-label":i(`priority`)}),(0,Z.jsx)(j.IncrementButton,{})]})})}),(0,Z.jsx)(k,{label:i(`creditFloor`),hint:i(`creditFloorHint`),align:`start`,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(we,{isSelected:p===`custom`,isDisabled:r,ariaLabel:i(`creditFloorCustom`),label:i(`creditFloorCustom`),onChange:e=>m(e?`custom`:`inherit`)}),p===`custom`?(0,Z.jsx)(j,{value:ee,onChange:e=>h(e??0),minValue:0,step:1,isDisabled:r,isRequired:!0,children:(0,Z.jsxs)(j.Group,{children:[(0,Z.jsx)(j.DecrementButton,{}),(0,Z.jsx)(j.Input,{"aria-label":i(`creditFloor`)}),(0,Z.jsx)(j.IncrementButton,{})]})}):(0,Z.jsx)(`p`,{className:`text-caption text-muted`,children:i(`creditFloorInheritHint`)})]})}),(0,Z.jsx)(k,{label:i(`percentFloor`),hint:i(`percentFloorHint`),align:`start`,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(we,{isSelected:g===`custom`,isDisabled:r,ariaLabel:i(`percentFloorCustom`),label:i(`percentFloorCustom`),onChange:e=>_(e?`custom`:`inherit`)}),g===`custom`?(0,Z.jsx)(j,{value:v,onChange:e=>te(e??0),minValue:0,maxValue:100,step:1,isDisabled:r,isRequired:!0,children:(0,Z.jsxs)(j.Group,{children:[(0,Z.jsx)(j.DecrementButton,{}),(0,Z.jsx)(j.Input,{"aria-label":i(`percentFloor`)}),(0,Z.jsx)(j.IncrementButton,{})]})}):(0,Z.jsx)(`p`,{className:`text-caption text-muted`,children:i(`percentFloorInheritHint`)})]})}),(0,Z.jsx)(k,{label:i(`proxyUrl`),hint:i(`proxyUrlHint`),children:(0,Z.jsx)(O,{value:ne,onChange:e=>re(e.target.value),placeholder:i(`proxyUrlPlaceholder`),"aria-label":i(`proxyUrl`),disabled:r})}),e?.provider===`workbuddy`||e?.provider===`trae`?(0,Z.jsx)(k,{label:i(`dropSystemPrompt`),hint:i(e?.provider===`trae`?`dropSystemPromptTraeHint`:`dropSystemPromptHint`),children:(0,Z.jsx)(we,{isSelected:ie,isDisabled:r,ariaLabel:i(`dropSystemPrompt`),onChange:y})}):null,(0,Z.jsx)(k,{align:`start`,label:i(`accountModelAliases`),hint:i(`accountModelAliasesHint`),children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[b.map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsxs)(`span`,{className:`mono min-w-0 truncate text-body`,children:[e.alias,` → `,e.model]}),(0,Z.jsx)(x,{size:`sm`,variant:`ghost`,isDisabled:r,onPress:()=>S(t=>t.filter(t=>t.alias!==e.alias)),children:i(`modelAliasRemove`)})]},e.alias)),(0,Z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_1fr_auto]`,children:[(0,Z.jsx)(O,{"aria-label":i(`modelAliasName`),value:C.alias,onChange:e=>w(t=>({...t,alias:e.target.value})),placeholder:i(`modelAliasPlaceholder`),disabled:r}),(0,Z.jsx)(O,{"aria-label":i(`modelAliasTarget`),value:C.model,onChange:e=>w(t=>({...t,model:e.target.value})),placeholder:i(`accountModelAliasTargetPlaceholder`),disabled:r}),(0,Z.jsx)(x,{size:`sm`,variant:`secondary`,isDisabled:r||!C.alias.trim()||!C.model.trim(),onPress:()=>{S(e=>[...e.filter(e=>e.alias!==C.alias.trim()),{alias:C.alias.trim(),model:C.model.trim()}]),w({alias:``,model:``})},children:i(`modelAliasAdd`)})]})]})}),(0,Z.jsxs)(`section`,{className:`space-y-3 pt-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-body font-medium text-foreground`,children:i(`enabledModels`)}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:i(`enabledModelsHint`)})]}),(0,Z.jsx)(we,{isSelected:ae,isDisabled:r,ariaLabel:i(`restrictModels`),label:i(ae?`restrictModels`:`allModels`),onChange:T})]}),ce?(0,Z.jsx)(`div`,{ref:le,children:(0,Z.jsx)(`div`,{ref:ue,children:(0,Z.jsx)(Bn,{catalog:de?de.map(e=>e.id):null,selected:oe,onChange:se,isDisabled:r,t:i})})}):null]}),t===void 0?null:(0,Z.jsx)(k,{label:i(`autoCheckinTime`),hint:i(`checkinScheduleHint`),children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(we,{isSelected:pe,isDisabled:r,onChange:me,ariaLabel:i(`checkinInherit`),label:i(`checkinInherit`)}),(0,Z.jsxs)(`p`,{className:`text-caption text-muted`,children:[i(`checkinDefaultValue`,{time:t}),` · `,(0,Z.jsx)(`span`,{className:`mono`,children:n})]}),pe?null:(0,Z.jsx)(O,{type:`time`,value:ge??t,onChange:e=>_e(e.target.value),"aria-label":i(`autoCheckinTime`),disabled:r,required:!0})]})})]})]}),(0,Z.jsxs)(A.Footer,{className:`justify-end gap-2 px-6 pb-6`,children:[(0,Z.jsx)(x,{variant:`ghost`,isDisabled:r,onPress:a,children:i(`cancel`)}),(0,Z.jsx)(x,{isPending:r,onPress:()=>void xe(),children:i(`save`)})]})]})})})})}var Un={1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-3`};function Wn({options:e,value:t,onChange:n,ariaLabel:r,columns:i=2,className:a=``}){let o=(0,Y.useRef)(null);return(0,Y.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=L.context(()=>{let e=L.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{L.set(`[data-option-tile]`,{autoAlpha:1,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{L.fromTo(`[data-option-tile]`,{autoAlpha:0,y:8},{autoAlpha:1,y:0,duration:.32,stagger:.035,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[e.length]),(0,Z.jsx)(`div`,{ref:o,role:`radiogroup`,"aria-label":r,className:`grid gap-3 ${Un[i]} ${a}`.trim(),children:e.map(e=>{let r=e.value===t;return(0,Z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"data-option-tile":``,"data-selected":r||void 0,disabled:e.disabled,title:e.hint,onClick:()=>n(e.value),className:`flex h-16 min-w-0 items-center gap-3 rounded-xl bg-surface shadow-surface px-4 text-left transition-colors hover:bg-surface-secondary disabled:cursor-not-allowed disabled:opacity-50 data-selected:border-accent data-selected:bg-accent-soft`,children:[e.icon?(0,Z.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground [&_svg]:size-[18px]`,children:e.icon}):null,(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body font-medium leading-5 text-foreground`,children:e.label})]},e.value)})})}var Gn=new Set([`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`]),Kn=[`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`];function qn(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>{let r=n.get(e.id)??2**53-1,i=n.get(t.id)??2**53-1;return r===i?e.label.localeCompare(t.label):r-i})}function Jn(e,t){return!t||`${e.label} ${e.subtitle||``} ${e.hint||``} ${e.provider} ${e.id}`.toLowerCase().includes(t)}function Yn({ariaLabel:e}){return(0,Z.jsx)(`div`,{className:`space-y-8`,"aria-busy":`true`,"aria-label":e,children:Array.from({length:2},(e,t)=>(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(Ze,{className:`h-3 w-24 rounded-lg`}),(0,Z.jsx)(Ze,{className:`h-3 w-40 rounded-lg`})]}),(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:Array.from({length:t===0?5:6},(e,t)=>(0,Z.jsxs)(`div`,{className:`card flex flex-row items-center gap-3.5 rounded-xl bg-surface px-4 py-3.5`,children:[(0,Z.jsx)(Ze,{className:`size-10 shrink-0 rounded-lg`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,Z.jsx)(Ze,{className:`h-3.5 w-28 rounded-lg`}),(0,Z.jsx)(Ze,{className:`h-3 w-36 rounded-lg`})]})]},t))})]},t))})}function Xn({tile:e,disabled:t,onSelect:n}){return(0,Z.jsxs)(`button`,{type:`button`,disabled:t,title:e.hint||e.subtitle||e.label,onClick:()=>n(e.id),className:`card flex min-w-0 flex-row items-center gap-3 rounded-xl bg-surface px-3.5 py-3 text-left transition-[transform,opacity,background-color] duration-200 ease-out hover:bg-surface-secondary active:translate-y-px active:scale-[0.98] motion-reduce:transition-none motion-reduce:active:translate-y-0 motion-reduce:active:scale-100 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:translate-y-0 disabled:active:scale-100`,children:[(0,Z.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg text-foreground [&_svg]:size-[18px]`,children:(0,Z.jsx)(rt,{provider:e.provider,size:18})}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`block truncate text-body font-medium leading-5 text-foreground`,children:e.label}),e.subtitle?(0,Z.jsx)(`span`,{className:`mt-0.5 block truncate text-caption leading-4 text-muted`,children:e.subtitle}):null]})]})}function Zn({title:e,subtitle:t,tiles:n,disabled:r,onSelect:i}){return n.length?(0,Z.jsxs)(`section`,{className:`space-y-3.5`,children:[(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(`h3`,{className:`text-[10px] font-semibold tracking-[0.12em] uppercase text-muted`,children:e}),t?(0,Z.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:n.map(e=>(0,Z.jsx)(Xn,{tile:e,disabled:r,onSelect:i},e.id))})]}):null}function Qn({options:e,onSelect:t,disabled:n,empty:r,ariaLabel:i}){let{t:a}=ie(),[o,s]=(0,Y.useState)(``),c=o.trim().toLowerCase(),l=(0,Y.useMemo)(()=>{let t=qn(e.filter(e=>Gn.has(e.id)),Kn),n=e.filter(e=>!Gn.has(e.id)).sort((e,t)=>e.label.localeCompare(t.label));return[{id:`subscriptions`,titleKey:`providerGroupSubscriptions`,subtitleKey:`providerGroupSubscriptionsHint`,tiles:t.filter(e=>Jn(e,c))},{id:`experimental`,titleKey:`providerGroupExperimental`,subtitleKey:`providerGroupExperimentalHint`,tiles:n.filter(e=>Jn(e,c))}]},[c,e]),u=l.reduce((e,t)=>e+t.tiles.length,0);return(0,Z.jsxs)(`div`,{className:`space-y-8`,role:`listbox`,"aria-label":i,children:[(0,Z.jsx)(h,{value:o,onChange:s,placeholder:a(`providerFindPlaceholder`),ariaLabel:a(`providerFindPlaceholder`),className:`max-w-sm`}),u===0?r||(0,Z.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:a(`providerFindEmpty`)}):l.map(e=>(0,Z.jsx)(Zn,{title:a(e.titleKey),subtitle:a(e.subtitleKey),tiles:e.tiles,disabled:n,onSelect:t},e.id))]})}var $n={"workbuddy-accounts":`workbuddy`,"workbuddy-oauth-v1":`workbuddy`,"qoder-native-v1":`qoder`,"trae-oauth-v1":`trae`,"devin-session-v1":`devin`,"command-key-v1":`command`,"codex-oauth-v1":`codex`,"zhipu-key-v1":`zhipu`,"qwenwork-oauth-v1":`qwenwork`,"meta-oauth-v1":`meta`,"meta-key-v1":`meta`,"kiro-oauth-v1":`kiro`,"doubaowork-cookie-v1":`doubaowork`},er=[`codebuddy.cn`,`workbuddy.cn`],tr=[`workbuddy.ai`,`workbuddy.com`],nr=new Set([`us-east-1`,`eu-central-1`]),rr=/arn:aws:codewhisperer:([a-z0-9-]+):/;function Q(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function $(e){return typeof e==`string`?e.trim():``}function ir(e){let t=e.trim();if(!t)return``;let n=t.toLowerCase();return n===`workbuddy-accounts`?`workbuddy-accounts`:n}function ar(e){return typeof e.format==`string`&&e.format.trim()?ir(e.format):typeof e.exportType==`string`&&e.exportType.trim()?ir(e.exportType):``}function or(e){let t=[],n=e=>{typeof e==`string`&&e.trim()&&t.push(e.trim().toLowerCase())};if(n(e.domain),Q(e.account)&&n(e.account.domain),Q(e.auth)&&n(e.auth.domain),Array.isArray(e.accounts))for(let t of e.accounts)Q(t)&&(n(t.domain),Q(t.account)&&n(t.account.domain),Q(t.auth)&&n(t.auth.domain));return t}function sr(e){return er.some(t=>e.includes(t))}function cr(e){return tr.some(t=>e.includes(t))}function lr(e){return typeof e.accessToken==`string`||typeof e.access_token==`string`||typeof e.refreshToken==`string`||typeof e.refresh_token==`string`}function ur(e){if(!Q(e))return!1;if(lr(e)||typeof e.domain==`string`||typeof e.uid==`string`)return!0;if(Q(e.account)||Q(e.auth)){let t=Q(e.account)?e.account:null,n=Q(e.auth)?e.auth:null;if(n&&(lr(n)||typeof n.domain==`string`)||t&&(typeof t.uid==`string`||typeof t.domain==`string`))return!0}return!1}function dr(e){let t=or(e);if(t.length===0)return{region:`cn`,ambiguous:!0,warning:`region_unknown`};let n=t.some(sr),r=t.some(cr);return n&&r?{region:null,ambiguous:!0,warning:`region_mixed`}:n?{region:`cn`,ambiguous:!1}:r?{region:`global`,ambiguous:!1}:{region:`cn`,ambiguous:!0,warning:`region_unknown`}}function fr(e){let t=$(e.region).toLowerCase();if(nr.has(t))return t;if(t===`eu`||t===`europe`)return`eu-central-1`;let n=$(e.profileArn)||$(e.profile_arn),r=rr.exec(n);if(r&&nr.has(r[1]))return r[1];for(let t of[`kiroApiKey`,`apiKey`,`api_key`,`accessToken`,`access_token`]){let n=$(e[t]),r=n.split(`|`);if(n.startsWith(`ksk_`)&&r.length===2&&nr.has(r[1].trim().toLowerCase()))return r[1].trim().toLowerCase()}return null}function pr(e){if(ar(e)===`kiro-oauth-v1`||fr(e))return!0;let t=($(e.authMethod)||$(e.auth_method)).toLowerCase();if([`builder_id`,`builderid`,`external_idp`,`idc`,`social`].includes(t))return!0;let n=$(e.provider).toLowerCase();if([`builderid`,`kiro`,`apikey`,`github`,`google`,`social`].includes(n))return!0;for(let t of[`kiroApiKey`,`apiKey`,`api_key`,`accessToken`,`access_token`])if($(e[t]).startsWith(`ksk_`))return!0;let r=$(e.clientId)||$(e.client_id),i=$(e.clientSecret)||$(e.client_secret),a=$(e.refreshToken)||$(e.refresh_token),o=$(e.startUrl)||$(e.start_url);if(r&&i&&a||o.includes(`awsapps.com`)&&a||($(e.profileArn)||$(e.profile_arn)).includes(`codewhisperer`)&&(a||$(e.accessToken)||$(e.access_token)))return!0;let s=$(e.tokenEndpoint)||$(e.token_endpoint),c=$(e.issuerUrl)||$(e.issuer_url);return!!((s.includes(`microsoftonline`)||c.includes(`microsoftonline`))&&a)}function mr(e){return Array.isArray(e.accounts)?e.accounts.filter(e=>Q(e)&&pr(e)):[]}function hr(e){return pr(e)||mr(e).length>0?{format:`kiro-oauth-v1`,provider:`kiro`,confidence:`medium`}:Array.isArray(e.accounts)&&e.accounts.some(ur)?{format:`workbuddy-accounts`,provider:`workbuddy`,confidence:`medium`}:(typeof e.user_blob==`string`||typeof e.userBlob==`string`)&&(typeof e.machine_id==`string`||typeof e.machineId==`string`)?{format:`qoder-native-v1`,provider:`qoder`,confidence:`medium`}:typeof e.session_token==`string`||typeof e.sessionToken==`string`?{format:`devin-session-v1`,provider:`devin`,confidence:`low`}:lr(e)||Q(e.account)&&lr(e.account)||Q(e.auth)?{format:`workbuddy-oauth-v1`,provider:`workbuddy`,confidence:`low`}:typeof e.dca_token==`string`||typeof e.dcaToken==`string`||typeof e.access_token==`string`&&String(e.access_token).startsWith(`dca:`)||typeof e.accessToken==`string`&&String(e.accessToken).startsWith(`dca:`)?{format:`meta-oauth-v1`,provider:`meta`,confidence:`medium`}:typeof e.api_key==`string`||typeof e.apiKey==`string`?typeof e.organization==`string`||typeof e.project==`string`?{format:`zhipu-key-v1`,provider:`zhipu`,confidence:`low`}:typeof e.base_url==`string`&&String(e.base_url).includes(`meta.ai`)||typeof e.baseUrl==`string`&&String(e.baseUrl).includes(`meta.ai`)||typeof e.email==`string`?{format:`meta-key-v1`,provider:`meta`,confidence:`low`}:{format:`command-key-v1`,provider:`command`,confidence:`low`}:{format:null,provider:null,confidence:`low`}}function gr(e){let t=mr(e),n=t.length>0?t:[e],r=new Set(n.map(fr).filter(e=>e!=null));return r.size===1?{region:[...r][0],ambiguous:!1}:(r.size,{region:null,ambiguous:!0})}function _r(e){if(!Q(e))return{format:null,provider:null,region:null,regionAmbiguous:!0,confidence:`low`,warnings:[`not_object`],batchImportSupported:!1};let t=[],n=ar(e),r=typeof e.format==`string`?e.format.trim():``,i=typeof e.exportType==`string`?e.exportType.trim():``,a=r||i,o=n||null,s=o?$n[o]??null:null,c=o&&s?`high`:`low`;if(!s){let r=hr(e);o||=r.format,s=r.provider,c=n&&!$n[n]?`low`:r.confidence,a&&!$n[n]&&t.push(`unknown_format`)}s!==`kiro`&&(pr(e)||mr(e).length>0)&&(s=`kiro`,o=`kiro-oauth-v1`,c=n===`kiro-oauth-v1`?`high`:`medium`),s===`workbuddy`&&Array.isArray(e.accounts)&&(o=`workbuddy-accounts`);let l=null,u=!1;if(s===`workbuddy`){let n=dr(e);l=n.region,u=n.ambiguous,n.warning&&t.push(n.warning)}if(s===`kiro`){let n=gr(e);l=n.region,u=n.ambiguous,u&&t.push(mr(e).length>1?`region_mixed`:`region_unknown`)}return{format:o,provider:s,region:l,regionAmbiguous:u,confidence:c,warnings:t,batchImportSupported:s===`workbuddy`||s===`kiro`}}function vr(e){let t;try{t=JSON.parse(e)}catch{throw Error(`bad_json`)}if(Array.isArray(t)){if(t.length===0||!t.every(Q))throw Error(`bad_json`);return{accounts:t}}if(!Q(t))throw Error(`bad_json`);return t}function yr(e,t){let n={...e},r=n.format===`workbuddy-accounts`||Array.isArray(n.accounts);return n.format?r&&(n.format=`workbuddy-accounts`):n.format=r?`workbuddy-accounts`:`workbuddy-oauth-v1`,{...n,name:t.name?.trim()||n.name,enabled:t.enabled??!0,provider:`workbuddy`,region:t.region,max_inflight:t.max_inflight??4,priority:t.priority??50,drop_system_prompt:t.drop_system_prompt??!0,...t.proxy_url!=null&&t.proxy_url!==``?{proxy_url:t.proxy_url}:{}}}function br(e,t){let n=typeof e?.succeeded==`number`?e.succeeded:e?.id||e?1:0,r=typeof e?.failed==`number`?e.failed:0,i=(e?.errors||[]).slice(0,3).map(e=>e.message||`index ${e.index}`).filter(Boolean).join(`; `),a;return a=r>0?t(`accountImportPartial`).replace(`{ok}`,String(n)).replace(`{fail}`,String(r))+(i?` — ${i}`:``):n>1?t(`accountImportBatch`).replace(`{n}`,String(n)):t(`accountImported`),{succeeded:n,failed:r,message:a}}async function xr(e,t){let n=yr(e,t);return Ee(n)}var Sr={global:`Global`,cn:`CN`},Cr={"qoder-global":`accountTypeQoderGlobal`,"qoder-cn":`accountTypeQoderCN`,"workbuddy-cn":`accountTypeWorkBuddyCN`,"workbuddy-global":`accountTypeWorkBuddyGlobal`,"trae-cn":`accountTypeTraeCN`,"devin-global":`accountTypeDevinGlobal`,"command-global":`accountTypeCommandGlobal`,"codex-global":`accountTypeCodexGlobal`,"zhipu-cn":`accountTypeZhipuCN`,"qwenwork-global":`accountTypeQwenworkGlobal`,"qwenwork-cn":`accountTypeQwenworkCN`,"kimi-cn":`accountTypeKimiCN`,"codearts-cn-north-4":`accountTypeCodeArtsCN`,"doubaowork-cn":`accountTypeDoubaoworkCN`,"kiro-us-east-1":`accountTypeKiroUS`,"kiro-eu-central-1":`accountTypeKiroEU`,"meta-global":`accountTypeMetaGlobal`,"minimaxcode-cn":`accountTypeMiniMaxCodeCN`,"minimaxcode-global":`accountTypeMiniMaxCodeGlobal`},wr={"qoder-global":`accountTypeQoderGlobalHint`,"qoder-cn":`accountTypeQoderCNHint`,"workbuddy-cn":`accountTypeWorkBuddyCNHint`,"workbuddy-global":`accountTypeWorkBuddyGlobalHint`,"trae-cn":`accountTypeTraeCNHint`,"devin-global":`accountTypeDevinGlobalHint`,"command-global":`accountTypeCommandGlobalHint`,"codex-global":`accountTypeCodexGlobalHint`,"zhipu-cn":`accountTypeZhipuCNHint`,"qwenwork-global":`accountTypeQwenworkGlobalHint`,"qwenwork-cn":`accountTypeQwenworkCNHint`,"kimi-cn":`accountTypeKimiCNHint`,"codearts-cn-north-4":`accountTypeCodeArtsCNHint`,"doubaowork-cn":`accountTypeDoubaoworkCNHint`,"kiro-us-east-1":`accountTypeKiroUSHint`,"kiro-eu-central-1":`accountTypeKiroEUHint`,"meta-global":`accountTypeMetaGlobalHint`,"minimaxcode-cn":`accountTypeMiniMaxCodeCNHint`,"minimaxcode-global":`accountTypeMiniMaxCodeGlobalHint`};async function Tr(){let e=(await ke().catch(()=>null))?.data||[],t=[];for(let n of e)for(let e of n.regions)t.push({id:`${n.id}-${e.id}`,provider:n.id,region:e.id,descriptor:n});return t}function Er(e,t){let n=Cr[e.id];if(n){let e=t(n);if(e!==n)return e}let r=e.descriptor.regions.find(t=>t.id===e.region)?.label||Sr[e.region]||``,i=e.descriptor.regions.length>1&&r?` ${r}`:``;return`${e.descriptor.label}${i}`.trim()}function Dr(e,t){if(!e)return``;let n=wr[e.id];if(!n)return``;let r=t(n);return r===n?``:r}function Or({phase:e,busy:t,tab:n,forTab:r}){return e===`done`?(0,Z.jsx)(B,{size:16,className:`text-success`}):t&&n===r?(0,Z.jsx)(Ye,{size:16,loading:!0}):null}var kr=90,Ar=2e3;function jr({isOpen:e,onClose:t,onAdded:n}){let{t:i}=ie(),[o,d]=(0,Y.useState)(`method`),[p,m]=(0,Y.useState)(`browser`),[ee,h]=(0,Y.useState)(``),[g,v]=(0,Y.useState)([]),[te,ne]=(0,Y.useState)(!1),[re,y]=(0,Y.useState)(!1),[b,S]=(0,Y.useState)(``),[C,w]=(0,Y.useState)(4),[ae,T]=(0,Y.useState)(50),[oe,se]=(0,Y.useState)(!0),[ce,le]=(0,Y.useState)(``),[ue,de]=(0,Y.useState)(``),[pe,me]=(0,Y.useState)(``),[he,ge]=(0,Y.useState)(`payg`),[_e,ve]=(0,Y.useState)(``),[E,ye]=(0,Y.useState)(``),[be,xe]=(0,Y.useState)(``),[Se,Ce]=(0,Y.useState)(``),[Te,N]=(0,Y.useState)(`idle`),[P,F]=(0,Y.useState)(``),[ke,Ae]=(0,Y.useState)(``),[je,Me]=(0,Y.useState)(!1),[Ne,Pe]=(0,Y.useState)(``),[Fe,Ie]=(0,Y.useState)(`cli`),[Le,ze]=(0,Y.useState)(`builder_id`),[Be,He]=(0,Y.useState)(``),We=(0,Y.useRef)(null),Ge=(0,Y.useRef)(null),R=(0,Y.useRef)(null),z=(0,Y.useRef)(``),Ke=(0,Y.useRef)(null),qe=(0,Y.useRef)(null);function Je(){Ke.current!==null&&(window.clearTimeout(Ke.current),Ke.current=null)}(0,Y.useEffect)(()=>()=>Je(),[]),(0,Y.useEffect)(()=>{if(!e)return;let t=!1;return ne(!0),v([]),h(``),Tr().then(e=>{t||(v(e),h(``),m(`browser`))}).finally(()=>{t||ne(!1)}),()=>{t=!0}},[e]);let V=g.find(e=>e.id===ee),Ye=!te&&g.length>0,Xe=V?.descriptor.capabilities?.pat_login!==!1,H=V?.descriptor.capabilities?.import_export!==!1,Ze=V?.descriptor.capabilities?.browser_login!==!1,U=V?.provider===`workbuddy`||V?.provider===`trae`,Qe=V?.provider===`trae`||V?.provider===`devin`||V?.provider===`codex`||V?.provider===`codearts`,W=Te===`busy`||Te===`polling`,G=!!z.current||W,q=Te===`done`,tt=Dr(V,i);(0,Y.useEffect)(()=>{p===`pat`&&!Xe&&m(`browser`),p===`import`&&!H&&m(`browser`)},[H,Xe,p]),(0,Y.useEffect)(()=>{Ze||(Xe?m(`pat`):H&&m(`import`))},[Ze,H,Xe]);function nt(){return!Number.isInteger(C)||C<1||C>32?4:C}function it(){return!Number.isInteger(ae)||ae<1||ae>100?50:ae}function at(){return{max_inflight:nt(),priority:it(),drop_system_prompt:U?oe:V?.provider!==`kimi`&&V?.provider!==`codearts`,proxy_url:ce.trim()}}function ot(){Je(),d(`method`),m(`browser`),h(``),v([]),ne(!1),S(``),w(4),T(50),se(!0),le(``),de(``),me(``),ge(`payg`),ve(``),ye(``),xe(``),Ce(``),y(!1),N(`idle`),F(``),Ae(``),Me(!1),Pe(``),Ie(`cli`),z.current=``}function st(){W||(ot(),t())}function ct(){ot(),t()}(0,Y.useLayoutEffect)(()=>{let t=We.current;if(e||(R.current=null),!t||!e)return;let n=L.context(()=>{let e=L.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{L.set(t,{autoAlpha:1,x:0,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=R.current,n=e&&e!==o?o===`login`?1:-1:0;L.fromTo(t,{autoAlpha:0,x:20*n,y:n?0:12},{autoAlpha:1,x:0,y:0,duration:$e.slow,ease:K.out,overwrite:!0}),n&&Ge.current&&L.fromTo(Ge.current,{autoAlpha:0,y:6},{autoAlpha:1,y:0,duration:$e.base,ease:K.out,overwrite:!0})})},t);return R.current=o,()=>n.revert()},[e,o]);function lt(e){if(W||!Ye)return;let t=g.find(t=>t.id===e);h(e),m(t?.provider===`zhipu`||t?.provider===`doubaowork`?`pat`:`browser`),se(t?.provider!==`trae`&&t?.provider!==`kimi`&&t?.provider!==`codearts`),F(``),d(`login`)}async function ut(){if(z.current)return z.current;if(!V)throw Error(i(`accountTypeHint`));let e=at(),t=await I(b.trim()||i(`account`),V.provider,V.region,e),n=t?.id||t?.data?.id;if(!n)throw Error(`create account returned no id`);return z.current=n,n}async function dt(){F(``),Ae(``);try{N(`busy`);let e=await ut();F(i(`wizardStartingSession`)),N(`polling`);let t=V?.provider===`codex`?Fe:V?.provider===`kiro`?Le:void 0,r=await M(e,t,Le===`idc`?Be.trim():void 0);r.authUrl&&Ae(r.authUrl),F(i(`wizardWaitingBrowser`));for(let t=0;t{Ke.current=window.setTimeout(e,Ar)});let n=(await Oe(e)).login||{};if(n.message&&F(n.message),n.status===`ok`)break;if(n.status===`error`)throw Error(n.message||`login failed`);if(t===89)throw Error(i(`wizardLoginTimeout`))}N(`done`),F(i(`wizardAccountReady`)),n(),window.setTimeout(ct,900)}catch(e){N(`idle`),F(e instanceof Error?e.message:String(e))}}async function ft(){let e=Ne.trim();if(!e){F(i(`wizardCallbackPh`));return}try{N(`busy`);let t=await ut();Je(),await De(t,e),N(`done`),F(i(`wizardAccountReady`)),n(),window.setTimeout(ct,900)}catch(e){N(`polling`),F(e instanceof Error?e.message:String(e))}}async function pt(){let e=_e.trim();if(!e){F(i(`zhipuKeyRequired`));return}if(!V){F(i(`accountTypeHint`));return}F(``);try{N(`busy`);let t=at();await Ee({format:`zhipu-key-v1`,api_key:e,mode:he,organization:he===`coding`?E.trim():``,project:he===`coding`?be.trim():``,name:b.trim()||i(`accountTypeZhipuCN`),enabled:!0,provider:V.provider,region:V.region,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt,proxy_url:t.proxy_url}),N(`done`),F(i(`wizardAccountReady`)),n(),window.setTimeout(ct,700)}catch(e){N(`idle`),F(e instanceof Error?e.message:String(e))}}async function mt(){let e=ue.trim();if(!e){F(i(`pastePatFirst`));return}F(``);try{N(`busy`);let t=await ut();F(i(`wizardStartingSession`)),await Re(e,t),N(`done`),F(i(`patDone`)),n(),window.setTimeout(ct,700)}catch(e){N(`idle`),F(e instanceof Error?e.message:String(e))}}async function J(){let e=Se.trim();if(!e){F(i(`doubaoCookieRequired`));return}if(!V){F(i(`accountTypeHint`));return}F(``);try{N(`busy`);let t=at();await Ee({format:`doubaowork-cookie-v1`,cookie:e,name:b.trim()||i(`accountTypeDoubaoworkCN`),enabled:!0,provider:V.provider,region:V.region,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt,proxy_url:t.proxy_url}),N(`done`),F(i(`wizardAccountReady`)),n(),window.setTimeout(ct,900)}catch(e){N(`idle`),F(e instanceof Error?e.message:String(e))}}async function ht(){F(``);let e;try{e=JSON.parse(pe)}catch{F(i(`wizardBadJson`));return}if(Array.isArray(e)){if(!e.every(e=>e&&typeof e==`object`&&!Array.isArray(e))){F(i(`wizardBadJson`));return}e={accounts:e}}if(!e||typeof e!=`object`){F(i(`wizardBadJson`));return}if(!V){F(i(`accountTypeHint`));return}let t=_r(e),r=t.provider||V.provider;if(r===`qoder`&&(typeof e.user_blob!=`string`||typeof e.machine_id!=`string`)){F(i(`wizardBadJson`));return}let a=at(),o;if(r===`kiro`){let t=typeof e.email==`string`?e.email.trim():``,n=typeof e.nickname==`string`?e.nickname.trim():``,r=fr(e),{provider:i,accounts:s,...c}=e,l=Array.isArray(s)?s:[{...c,...i?{provider:i}:{}}];o={format:`kiro-oauth-v1`,provider:`kiro`,region:r||(V.provider===`kiro`?V.region:`us-east-1`),name:b.trim()||n||t||void 0,enabled:!0,accounts:l,max_inflight:a.max_inflight,priority:a.priority,drop_system_prompt:a.drop_system_prompt,proxy_url:a.proxy_url}}else if(r===`workbuddy`)o=yr(e,{region:V.region===`global`?`global`:`cn`,name:b.trim()||void 0,enabled:!0,max_inflight:a.max_inflight,priority:a.priority,drop_system_prompt:a.drop_system_prompt,proxy_url:a.proxy_url});else{if(!e.format){let t=r;t===`trae`?e.format=`trae-oauth-v1`:t===`devin`?e.format=`devin-session-v1`:t===`command`?e.format=`command-key-v1`:t===`qwenwork`?e.format=`qwenwork-oauth-v1`:t===`kimi`?e.format=`kimi-oauth-v1`:t===`codearts`?e.format=`codearts-oauth-v1`:t===`codex`?e.format=`codex-oauth-v1`:t===`meta`?e.format=`meta-oauth-v1`:e.format=`qoder-native-v1`}o={...e,name:b.trim()||e.name,enabled:!0,provider:r,region:t.region||V.region,max_inflight:a.max_inflight,priority:a.priority,drop_system_prompt:a.drop_system_prompt}}try{N(`busy`);let{failed:e,message:t}=br(await Ee(o),i);N(`done`),F(t),n(),window.setTimeout(ct,e>0?1600:700)}catch(e){N(`idle`),F(e instanceof Error?e.message:String(e))}}function gt(){qe.current?.click()}function _t(e){let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>me(String(n.result||``)),n.readAsText(t),e.target.value=``}let vt=e=>W&&p===e,X=V?.provider===`zhipu`,yt=V?.provider===`doubaowork`,bt=[V?.descriptor.capabilities?.browser_login===!1?null:{value:`browser`,label:i(`tabBrowser`)},Xe?{value:`pat`,label:i(`tabPat`)}:null,H?{value:`import`,label:i(`tabImport`)}:null].filter(Boolean),xt=i(p===`browser`?V?.provider===`codex`?`wizardCodexBrowserLead`:`wizardBrowserLead`:p===`pat`?V?.provider===`command`?`wizardPatLeadCommand`:V?.region===`cn`&&V?.provider===`qoder`?`wizardPatLeadCN`:`wizardPatLead`:`wizardImportLead`);return(0,Z.jsx)(A.Root,{isOpen:e,onOpenChange:e=>{e||st()},children:(0,Z.jsx)(A.Backdrop,{variant:`blur`,isDismissable:!W,children:(0,Z.jsx)(A.Container,{size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(A.Dialog,{className:`w-full sm:w-[36rem] sm:max-w-[calc(100vw-2rem)] sm:min-h-[36rem]`,children:[(0,Z.jsxs)(A.Header,{className:`relative items-center justify-center px-12 pt-5 text-center`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(A.Heading,{className:`text-section font-semibold`,children:i(`addAccountTitle`)}),(0,Z.jsx)(`p`,{ref:Ge,className:`mt-1 text-caption font-normal leading-5 text-muted`,children:o===`method`?i(`addAccountDesc`):tt||i(`addAccountDesc`)})]}),(0,Z.jsx)(A.CloseTrigger,{"aria-label":i(`close`),className:`absolute right-4 top-4 grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ve,{size:16})})]}),(0,Z.jsx)(A.Body,{className:o===`method`?`px-8 pb-5 sm:px-10`:`px-6 pb-2`,children:(0,Z.jsx)(`div`,{ref:We,children:o===`method`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`section`,{className:`space-y-2.5`,children:te?(0,Z.jsx)(Yn,{ariaLabel:i(`accountType`)}):Ye?(0,Z.jsx)(Qn,{ariaLabel:i(`accountType`),options:g.map(e=>{let t=e.descriptor.regions.find(t=>t.id===e.region)?.label||Sr[e.region]||``;return{id:e.id,provider:e.provider,label:Er(e,i),subtitle:t,hint:Dr(e,i)}}),onSelect:lt,disabled:G}):(0,Z.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:i(`accountTypeHint`)})}),(0,Z.jsx)(`div`,{className:`mt-4 text-center`,children:(0,Z.jsx)(l,{className:`text-xs`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`card flex flex-row items-center gap-3 rounded-xl bg-surface px-3 py-2.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:(0,Z.jsx)(rt,{provider:V?.provider,size:18})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`truncate text-body font-medium text-foreground`,children:V?Er(V,i):i(`accountType`)}),(0,Z.jsx)(`div`,{className:`truncate text-caption text-muted`,children:tt})]}),(0,Z.jsxs)(x,{size:`sm`,variant:`ghost`,onPress:()=>d(`method`),isDisabled:W||!!z.current,children:[(0,Z.jsx)(r,{size:12}),i(`wizardBack`)]})]}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(fe,{className:`text-body font-medium text-muted`,children:i(`accountName`)}),(0,Z.jsx)(O,{fullWidth:!0,value:b,onChange:e=>S(e.target.value),"aria-label":i(`accountName`),disabled:G,autoFocus:!0})]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>y(e=>!e),"aria-expanded":re,className:`inline-flex items-center gap-1 text-caption font-medium text-muted transition-colors hover:text-foreground`,children:[(0,Z.jsx)(u,{size:12,className:`transition-transform duration-200 ${re?`rotate-90`:``}`}),i(`wizardAdvanced`)]}),re?(0,Z.jsxs)(`div`,{className:`card gap-3 rounded-xl bg-surface px-3.5 py-3.5`,children:[(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(fe,{className:`text-body font-medium text-muted`,children:i(`maxInflight`)}),(0,Z.jsx)(j,{value:C,onChange:e=>w(e??4),minValue:1,maxValue:32,isDisabled:G,isRequired:!0,children:(0,Z.jsxs)(j.Group,{className:`w-full`,children:[(0,Z.jsx)(j.DecrementButton,{}),(0,Z.jsx)(j.Input,{"aria-label":i(`maxInflight`)}),(0,Z.jsx)(j.IncrementButton,{})]})}),(0,Z.jsx)(D,{className:`text-caption leading-5 text-muted`,children:i(`maxInflightHint`)})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(fe,{className:`text-body font-medium text-muted`,children:i(`priority`)}),(0,Z.jsx)(j,{value:ae,onChange:e=>T(e??50),minValue:1,maxValue:100,isDisabled:G,isRequired:!0,children:(0,Z.jsxs)(j.Group,{className:`w-full`,children:[(0,Z.jsx)(j.DecrementButton,{}),(0,Z.jsx)(j.Input,{"aria-label":i(`priority`)}),(0,Z.jsx)(j.IncrementButton,{})]})}),(0,Z.jsx)(D,{className:`text-caption leading-5 text-muted`,children:i(`priorityHint`)})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(fe,{className:`text-body font-medium text-muted`,children:i(`proxyUrl`)}),(0,Z.jsx)(O,{fullWidth:!0,value:ce,onChange:e=>le(e.target.value),placeholder:i(`proxyUrlPlaceholder`),"aria-label":i(`proxyUrl`),disabled:G}),(0,Z.jsx)(D,{className:`text-caption leading-5 text-muted`,children:i(`proxyUrlHint`)})]}),U?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(fe,{className:`text-body font-medium text-muted`,children:i(`dropSystemPrompt`)}),(0,Z.jsx)(D,{className:`text-caption leading-5 text-muted`,children:i(V?.provider===`trae`?`dropSystemPromptTraeHint`:`dropSystemPromptCreateHint`)}),(0,Z.jsx)(we,{isSelected:oe,isDisabled:G,ariaLabel:i(`dropSystemPrompt`),onChange:se})]}):null]}):null]}),X?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`span`,{className:`text-body font-medium text-muted`,children:i(`zhipuAccountMode`)}),(0,Z.jsx)(Wn,{ariaLabel:i(`zhipuAccountMode`),columns:2,value:he,onChange:e=>{W||ge(e)},options:[{value:`payg`,label:i(`zhipuModePayg`),hint:i(`zhipuModePaygHint`),disabled:W},{value:`coding`,label:i(`zhipuModeCoding`),hint:i(`zhipuModeCodingHint`),disabled:W}]})]}),(0,Z.jsx)(k,{label:i(`zhipuApiKey`),children:(0,Z.jsx)(O,{type:`password`,value:_e,onChange:e=>ve(e.target.value),placeholder:i(`zhipuApiKeyPh`),"aria-label":i(`zhipuApiKey`),disabled:W})}),he===`coding`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(k,{label:i(`zhipuOrganization`),children:(0,Z.jsx)(O,{value:E,onChange:e=>ye(e.target.value),placeholder:i(`zhipuOrganizationPh`),"aria-label":i(`zhipuOrganization`),disabled:W})}),(0,Z.jsx)(k,{label:i(`zhipuProject`),children:(0,Z.jsx)(O,{value:be,onChange:e=>xe(e.target.value),placeholder:i(`zhipuProjectPh`),"aria-label":i(`zhipuProject`),disabled:W})})]}):null,P?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[q?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:q?`font-medium text-foreground`:`text-muted`,children:P})]}):null]}):null,yt?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,Z.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:i(`doubaoCookieLead`)}),(0,Z.jsx)(k,{label:i(`doubaoCookieLabel`),children:(0,Z.jsx)(s,{className:`min-h-28 font-mono text-caption leading-5`,value:Se,onChange:e=>Ce(e.target.value),placeholder:i(`doubaoCookiePh`),"aria-label":i(`doubaoCookieLabel`),disabled:W})}),P?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[q?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:q?`font-medium text-foreground`:`text-muted`,children:P})]}):null]}):null,X||yt?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(et,{className:`mt-3`,value:p,onChange:e=>{!W&&e!==p&&(m(e),F(``),Ae(``),Me(!1))},ariaLabel:i(`authentication`),options:bt.map(e=>({id:e.value,label:e.label}))}),(0,Z.jsx)(`p`,{className:`mt-2 min-h-5 text-caption leading-5 text-muted`,children:xt}),(0,Z.jsx)(`div`,{className:`mt-3 flex flex-col gap-4`,children:p===`browser`?(0,Z.jsxs)(Z.Fragment,{children:[V?.provider===`codex`?(0,Z.jsx)(Wn,{ariaLabel:i(`codexLoginMethod`),columns:2,value:Fe,onChange:e=>{W||Ie(e)},options:[{value:`cli`,label:i(`codexLoginCli`),hint:i(`codexLoginCliHint`),disabled:W||!!z.current},{value:`chatgpt`,label:i(`codexLoginChatGPT`),hint:i(`codexLoginChatGPTHint`),disabled:W||!!z.current}]}):null,V?.provider===`kiro`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Wn,{ariaLabel:i(`kiroLoginMethod`),columns:2,value:Le,onChange:e=>{W||ze(e)},options:[{value:`builder_id`,label:i(`kiroLoginBuilder`),hint:i(`kiroLoginBuilderHint`),disabled:W||!!z.current},{value:`idc`,label:i(`kiroLoginIDC`),hint:i(`kiroLoginIDCHint`),disabled:W||!!z.current},{value:`sso`,label:i(`kiroLoginSSO`),hint:i(`kiroLoginSSOHint`),disabled:W||!!z.current},{value:`microsoft`,label:i(`kiroLoginMicrosoft`),hint:i(`kiroLoginMicrosoftHint`),disabled:W||!!z.current}]}),Le===`idc`?(0,Z.jsx)(k,{label:i(`kiroIDCStartURL`),children:(0,Z.jsx)(O,{value:Be,onChange:e=>He(e.target.value),placeholder:i(`kiroIDCStartURLPh`),"aria-label":i(`kiroIDCStartURL`),disabled:W})}):null]}):null,ke?(0,Z.jsxs)(`div`,{className:`card rounded-xl bg-surface px-3 py-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,Z.jsx)(Or,{phase:Te,busy:W,tab:p,forTab:`browser`}),(0,Z.jsx)(`span`,{className:`text-muted`,children:P||i(`loginOpenMsg`)})]}),(0,Z.jsx)(`code`,{className:`mono mt-2 block break-all text-caption leading-5 text-foreground`,children:ke}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,onPress:()=>window.open(ke,`_blank`,`noopener,noreferrer`),children:[(0,Z.jsx)(c,{size:14}),i(`openAuthUrl`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`ghost`,onPress:()=>{f(ke).then(e=>{e&&(Me(!0),window.setTimeout(()=>Me(!1),1100))})},children:[(0,Z.jsx)(a,{copied:je}),i(je?`copied`:`copy`)]})]})]}):null,P&&!ke?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[q?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:q?`font-medium text-foreground`:`text-muted`,children:P})]}):null,Qe?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:i(`wizardCallbackLead`)}),(0,Z.jsx)(s,{className:`h-28 w-full resize-none font-mono text-caption leading-5`,value:Ne,onChange:e=>Pe(e.target.value),placeholder:i(`wizardCallbackPh`),"aria-label":i(`wizardCallbackPh`),disabled:q}),(0,Z.jsx)(x,{size:`sm`,variant:`secondary`,isPending:Te===`busy`&&!!Ne.trim(),onPress:()=>void ft(),isDisabled:q,children:i(`wizardSubmitCallback`)})]}):null]}):p===`pat`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(k,{label:i(`tabPat`),children:(0,Z.jsx)(O,{type:`password`,value:ue,onChange:e=>de(e.target.value),placeholder:i(`wizardPatPh`),"aria-label":i(`wizardPatPh`),disabled:W})}),P?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[q?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:q?`font-medium text-foreground`:`text-muted`,children:P})]}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:`JSON`}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,onPress:gt,isDisabled:W,children:[(0,Z.jsx)(Lt,{size:13}),i(`wizardChooseFile`)]}),(0,Z.jsx)(`input`,{ref:qe,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:_t})]}),(0,Z.jsx)(s,{className:`min-h-32 font-mono text-caption`,value:pe,onChange:e=>me(e.target.value),placeholder:i(`wizardImportPh`),"aria-label":i(`tabImport`),disabled:W}),P?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[q?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:q?`font-medium text-foreground`:`text-muted`,children:P})]}):null]})})]})]})})}),(0,Z.jsxs)(A.Footer,{className:`justify-end gap-2 px-5 pb-5`,children:[(0,Z.jsx)(x,{variant:`ghost`,onPress:st,isDisabled:W,children:i(`cancel`)}),o===`login`&&X?(0,Z.jsx)(x,{isPending:Te===`busy`,onPress:()=>void pt(),isDisabled:q,children:q?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`wizardAccountReady`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ue,{size:15}),i(`zhipuCreate`)]})}):null,o===`login`&&yt?(0,Z.jsx)(x,{isPending:Te===`busy`,onPress:()=>void J(),isDisabled:q,children:q?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`wizardAccountReady`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ue,{size:15}),i(`doubaoImport`)]})}):null,o===`login`&&!X&&!yt&&p===`browser`?(0,Z.jsx)(x,{isPending:vt(`browser`),onPress:()=>void dt(),isDisabled:q,children:q?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`wizardAccountReady`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_,{size:15}),i(`wizardStartBrowser`)]})}):null,o===`login`&&!X&&!yt&&p===`pat`?(0,Z.jsx)(x,{isPending:vt(`pat`),onPress:()=>void mt(),isDisabled:q,children:q?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`patDone`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ue,{size:15}),i(`wizardCreateAndLogin`)]})}):null,o===`login`&&!X&&!yt&&p===`import`?(0,Z.jsx)(x,{isPending:vt(`import`),onPress:()=>void ht(),isDisabled:q,children:q?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`accountImported`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Lt,{size:15}),i(`importCredential`)]})}):null]})]})})})})}function Mr(e,t){return e===`region_mixed`?t(`batchImportRegionMixed`):e===`region_unknown`?t(`batchImportRegionUnknown`):e===`unknown_format`?t(`batchImportUnknownFormat`):``}function Nr({isOpen:e,detection:t,fileName:n,isPending:r,t:i,onClose:a,onConfirm:o}){let s=t?.provider===`kiro`?[`us-east-1`,`eu-central-1`]:[`cn`,`global`],[c,l]=(0,Y.useState)(t?.region&&s.includes(t.region)?t.region:s[0]);(0,Y.useEffect)(()=>{if(!t)return;let e=t.provider===`kiro`?[`us-east-1`,`eu-central-1`]:[`cn`,`global`];t.region&&e.includes(t.region)?l(t.region):l(e[0])},[t]);let u=!!t?.batchImportSupported,d=t?.provider,f=t?.format||i(`batchImportFormatUnknown`),p=d?at(d,i):i(`batchImportProviderUnknown`),m=(t?.warnings||[]).map(e=>Mr(e,i)).filter(Boolean);return(0,Z.jsx)(A.Root,{isOpen:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,Z.jsx)(A.Backdrop,{variant:`blur`,isDismissable:!r,children:(0,Z.jsx)(A.Container,{placement:`center`,size:`md`,scroll:`inside`,className:`mx-3 w-full max-w-[min(100%,32rem)] sm:mx-0`,children:(0,Z.jsxs)(A.Dialog,{children:[(0,Z.jsxs)(A.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(A.Heading,{className:`text-section font-semibold`,children:i(`batchImportConfirmTitle`)}),(0,Z.jsx)(`p`,{className:`mt-1 break-all text-caption leading-5 text-muted`,children:n?i(`batchImportConfirmHint`,{file:n}):i(`batchImportConfirmHintNoFile`)})]}),(0,Z.jsx)(A.CloseTrigger,{isDisabled:r,"aria-label":i(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ve,{size:16})})]}),(0,Z.jsxs)(A.Body,{className:`space-y-4 px-6 pb-2`,children:[(0,Z.jsx)(`div`,{className:`rounded-xl bg-surface-secondary px-3.5 py-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[d?(0,Z.jsx)(rt,{provider:d,size:18}):null,(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-body font-medium text-foreground`,children:p}),(0,Z.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:f})]})]})}),u?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`div`,{className:`text-body font-medium text-muted`,children:i(d===`kiro`?`batchImportKiroRegion`:`batchImportRegion`)}),(0,Z.jsx)(et,{value:c,onChange:e=>{s.includes(e)&&l(e)},ariaLabel:i(d===`kiro`?`batchImportKiroRegion`:`batchImportRegion`),options:d===`kiro`?[{id:`us-east-1`,label:i(`accountTypeKiroUS`)},{id:`eu-central-1`,label:i(`accountTypeKiroEU`)}]:[{id:`cn`,label:i(`accountTypeWorkBuddyCN`)},{id:`global`,label:i(`accountTypeWorkBuddyGlobal`)}]}),t?.regionAmbiguous?(0,Z.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:i(d===`kiro`?`batchImportKiroRegionPickHint`:`batchImportRegionPickHint`)}):null]}):(0,Z.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:i(`batchImportProviderUnsupported`)}),m.length?(0,Z.jsx)(`ul`,{className:`space-y-1 text-caption leading-5 text-muted`,children:m.map(e=>(0,Z.jsx)(`li`,{children:e},e))}):null]}),(0,Z.jsxs)(A.Footer,{className:`flex-col-reverse gap-2 px-6 pb-6 sm:flex-row sm:justify-end`,children:[(0,Z.jsx)(x,{size:`sm`,variant:`ghost`,className:`w-full sm:w-auto`,isDisabled:r,onPress:a,children:i(u?`cancel`:`close`)}),u?(0,Z.jsx)(x,{size:`sm`,className:`w-full sm:w-auto`,isPending:r,onPress:()=>o(c),children:i(`batchImportConfirmAction`)}):null]})]})})})})}function Pr(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.format==`string`&&t.format.trim().toLowerCase()===`cli2api-accounts`&&Array.isArray(t.accounts)}function Fr(e){let t;try{t=JSON.parse(e)}catch{throw Error(`bad_json`)}if(!Pr(t))throw Error(`bad_bundle`);return t}function Ir(e){let t=JSON.stringify(e,null,2),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=(e.exported_at||new Date().toISOString()).replace(/[:.]/g,`-`).slice(0,19),a=document.createElement(`a`);a.href=r,a.download=`cli2api-accounts-${i}.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(r)}function Lr({isOpen:e,bundle:t,fileName:n,isPending:r,t:i,onClose:a,onConfirm:o}){let s=t?.accounts?.length??0,c=t?.accounts?.filter(e=>!!e.credential).length??0;return(0,Z.jsx)(A.Root,{isOpen:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,Z.jsx)(A.Backdrop,{variant:`blur`,isDismissable:!r,children:(0,Z.jsx)(A.Container,{placement:`center`,size:`md`,scroll:`inside`,className:`mx-3 w-full max-w-[min(100%,32rem)] sm:mx-0`,children:(0,Z.jsxs)(A.Dialog,{children:[(0,Z.jsxs)(A.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(A.Heading,{className:`text-section font-semibold`,children:i(`bundleImportConfirmTitle`)}),(0,Z.jsx)(`p`,{className:`mt-1 break-all text-caption leading-5 text-muted`,children:n?i(`bundleImportConfirmHint`,{file:n}):i(`bundleImportConfirmHintNoFile`)})]}),(0,Z.jsx)(A.CloseTrigger,{isDisabled:r,"aria-label":i(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ve,{size:16})})]}),(0,Z.jsxs)(A.Body,{className:`space-y-3 px-6 pb-2`,children:[(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-secondary px-3.5 py-3 text-body leading-6 text-foreground`,children:[(0,Z.jsx)(`div`,{className:`mono text-lg font-semibold`,children:s}),(0,Z.jsx)(`div`,{className:`text-muted`,children:i(`bundleImportAccountCount`)})]}),(0,Z.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:i(`bundleImportCountDetail`,{credentials:c})}),(0,Z.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:i(`bundleImportAdditiveHint`)}),(0,Z.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:i(`bundleExportHint`)})]}),(0,Z.jsxs)(A.Footer,{className:`flex-col-reverse gap-2 px-6 pb-6 sm:flex-row sm:justify-end`,children:[(0,Z.jsx)(x,{size:`sm`,variant:`ghost`,className:`w-full sm:w-auto`,isDisabled:r,onPress:a,children:i(`cancel`)}),(0,Z.jsx)(x,{size:`sm`,className:`w-full sm:w-auto`,isPending:r,isDisabled:s===0,onPress:o,children:i(`bundleImportConfirmAction`)})]})]})})})})}function Rr(e){if(!Array.isArray(e.accounts))return[e];let t=e.accounts.filter(e=>!!e&&typeof e==`object`&&!Array.isArray(e)&&pr(e));return t.length>0?t:[e]}function zr(e,t){let n=Rr(e),r=n.find(e=>typeof e.nickname==`string`||typeof e.email==`string`),i=typeof r?.nickname==`string`?r.nickname.trim():``,a=typeof r?.email==`string`?r.email.trim():``;return{format:`kiro-oauth-v1`,provider:`kiro`,region:fr(n[0]||e)||t,enabled:!0,name:n.length===1&&(i||a)||void 0,accounts:n.map(e=>({...e,region:fr(e)||t}))}}var Br=`__all__`,Vr=[],Hr=2;function Ur(){let{t:e}=ie(),[t,n]=(0,Y.useState)([]),[r,i]=(0,Y.useState)(null),[a,s]=(0,Y.useState)(``),[c,u]=(0,Y.useState)([]),[d,_]=(0,Y.useState)(!0),v=c,te=v.length>0,[ne,re]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(!1),[w,ae]=(0,Y.useState)(!1),[T,oe]=(0,Y.useState)(!1),[se,ce]=(0,Y.useState)(null),[le,ue]=(0,Y.useState)(``),[de,pe]=(0,Y.useState)(!1),[he,ve]=(0,Y.useState)(null),[E,D]=(0,Y.useState)(null),[O,k]=(0,Y.useState)(``),[A,be]=(0,Y.useState)(null),[xe,j]=(0,Y.useState)({}),[Se,we]=(0,Y.useState)({}),[F,I]=(0,Y.useState)({}),[Me,Le]=(0,Y.useState)({}),[ze,L]=(0,Y.useState)({}),[Be,Ve]=(0,Y.useState)(null),[He,Ue]=(0,Y.useState)(null),[We,Ge]=(0,Y.useState)(null),[R,z]=(0,Y.useState)(null),[Ke,B]=(0,Y.useState)(null),[Je,V]=(0,Y.useState)(``),[H,Ze]=(0,Y.useState)(`all`),[U,Qe]=(0,Y.useState)(``),[W,$e]=(0,Y.useState)(1),[K,q]=(0,Y.useState)(20),[tt,nt]=(0,Y.useState)({}),[it,ot]=(0,Y.useState)({}),[st,ct]=(0,Y.useState)({}),[lt,ut]=(0,Y.useState)({}),[dt,ft]=(0,Y.useState)(!1),[pt,mt]=(0,Y.useState)(!1),J=(0,Y.useCallback)(async(e=!1)=>{try{let t=(await Fe(e)).data||Vr;return u(t),t}finally{_(!1)}},[]),ht=(0,Y.useCallback)(async(e,t=!0)=>{let n=[...new Set(e)];if(!n.length)return{total:0,failed:0,errors:[]};let r=n.length,i=new Map;for(let e=0;e{try{let n=await N(e,{quota:t});u(t=>t.map(t=>t.id===e?n:t))}catch(t){let n=t instanceof Error?t.message:String(t);i.set(e,n),I(t=>({...t,[e]:n}))}}))}return{total:r,failed:i.size,errors:[...i.values()]}},[]);(0,Y.useEffect)(()=>{J(!1).catch(()=>void 0)},[J]),(0,Y.useEffect)(()=>{let e=!0;return Promise.all([ke(),qe()]).then(([t,r])=>{e&&(n(t.data||[]),i(r))}).catch(t=>{e&&s(t instanceof Error?t.message:String(t))}),()=>{e=!1}},[]),(0,Y.useEffect)(()=>{let e=!0;return J(!1).then(t=>{if(e)return ht((t||[]).map(e=>e.id))}).catch(()=>void 0),()=>{e=!1}},[J,ht]);function gt(e){return t.find(t=>t.id===e.provider)?.regions.find(t=>t.id===e.region)?.checkin}function vt(e){let t=gt(e)?.timezone,n=t===`Local`?r?.timezone:t;if(!(!n||n===`Local`))try{return Intl.DateTimeFormat(`en-CA`,{timeZone:n}),n}catch{return}}let X=(0,Y.useMemo)(()=>v.map(e=>{let t=tt[e.id],n=it[e.id],r=st[e.id],i=lt[e.id],a=e;return t!==void 0&&(a={...a,enabled:t}),n!==void 0&&(a={...a,name:n}),r!==void 0&&(a={...a,max_inflight:r}),i!==void 0&&(a={...a,priority:i}),a}),[tt,st,it,lt,v]),yt=(0,Y.useMemo)(()=>{let e={all:X.length,available:0,attention:0,disabled:0};for(let t of X){let n=_t(t);n===`hot`||n===`ready`?e.available+=1:n===`disabled`&&(e.disabled+=1),t.enabled&&n!==`hot`&&n!==`ready`&&(e.attention+=1)}return e},[X]),bt=(0,Y.useMemo)(()=>{let e=new Map;for(let t of X){let n=String(t.provider||`qoder`).toLowerCase();e.set(n,(e.get(n)||0)+1)}return[...e.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))},[X]),xt=X.find(e=>e.id===Be),St=X.find(e=>e.id===He)||null,Ct=X.find(e=>e.id===We)||null,wt=X.find(e=>e.id===R)||null,Tt=(0,Y.useMemo)(()=>{let e=Je.trim().toLowerCase();return X.filter(t=>{let n=_t(t);return!(H===`all`||H===`available`&&(n===`hot`||n===`ready`)||H===`attention`&&t.enabled&&n!==`hot`&&n!==`ready`||H===`disabled`&&n===`disabled`)||U&&String(t.provider||`qoder`).toLowerCase()!==U?!1:!e||[t.name,t.id,t.remote_uid,t.provider,t.auth_type].some(t=>String(t||``).toLowerCase().includes(e))})},[X,H,U,Je]),Et=[Je,H,U,K].join(`\0`),[Dt,Ot]=(0,Y.useState)(Et);Dt!==Et&&(Ot(Et),$e(1));let At=Math.max(1,Math.ceil(Tt.length/K)),jt=Math.min(Dt===Et?Math.max(1,W):1,At);W!==jt&&$e(jt);let Mt=(0,Y.useMemo)(()=>{let e=(jt-1)*K;return Tt.slice(e,e+K)},[jt,Tt,K]);if(d&&!te)return(0,Z.jsx)(Xe,{});async function Nt(e,t,n){be({id:e,kind:t}),I(t=>({...t,[e]:``}));try{return await n(),!0}catch(t){return I(n=>({...n,[e]:t instanceof Error?t.message:String(t)})),!1}finally{be(null)}}async function Pt(t,n){B(t),await Nt(t,`device`,async()=>{I(n=>({...n,[t]:e(`wizardStartingSession`)}));let r=await M(t,n);r.authUrl&&L(e=>({...e,[t]:r.authUrl||``}));for(let n=0;n<60;n++){await new Promise(e=>window.setTimeout(e,2e3));let n=(await Oe(t)).login||{};if(I(r=>({...r,[t]:n.message||e(`waitingQoderLogin`)})),n.status===`ok`||n.status===`error`)break}await J(!1),await ht([t])})}async function It(t){let n=(Se[t]||``).trim();if(!n){I(n=>({...n,[t]:e(`wizardCallbackPh`)}));return}await Nt(t,`callback`,async()=>{I(n=>({...n,[t]:e(`wizardStartingSession`)})),await De(t,n),we(e=>({...e,[t]:``})),await J(!1),await ht([t])})&&(B(e=>e===t?null:e),I(e=>({...e,[t]:``})))}async function Lt(t){let n=(xe[t]||``).trim();if(!n){I(n=>({...n,[t]:e(`pastePatFirst`)}));return}await Nt(t,`pat`,async()=>{I(n=>({...n,[t]:e(`wizardStartingSession`)})),await Re(n,t),j(e=>({...e,[t]:``})),await J(!1),await ht([t])})}async function Rt(t){await Nt(t,`export`,async()=>{let n=await P(t);await f(JSON.stringify(n,null,2)),I(n=>({...n,[t]:e(`credentialCopied`)}))})}async function zt(){if(S)return;C(!0);let t=`accounts-export-all`;G({id:t,type:`loading`,title:e(`toastAccountsExporting`)});try{let n=await je();Ir(n),G({id:t,type:`success`,title:e(`toastAccountsExported`,{n:n.count??n.accounts.length}),description:e(`bundleExportHint`)})}catch(n){G({id:t,type:`error`,title:e(`toastFailed`),description:n instanceof Error?n.message:String(n)})}finally{C(!1)}}function Bt(){w||(oe(!1),ce(null),ue(``))}async function Vt(t){let n=t.target.files?.[0];if(t.target.value=``,n)try{let e=Fr(await n.text());ce(e),ue(n.name),oe(!0)}catch(t){let n=t instanceof Error?t.message:String(t);G({type:`error`,title:e(n===`bad_json`?`wizardBadJson`:`bundleImportUnrecognized`)})}}async function Ht(){if(!se||w)return;ae(!0);let t=`bundle-import-accounts`;G({id:t,type:`loading`,title:e(`bundleImportLoading`)});try{let n=await Ie(se),r=n.succeeded??0,i=n.failed??0,a=(n.errors||[]).slice(0,3).map(e=>e.message||`index ${e.index}`).filter(Boolean).join(`; `);G({id:t,type:i>0&&r===0?`error`:i>0?`info`:`success`,title:i>0?e(`accountImportPartial`).replace(`{ok}`,String(r)).replace(`{fail}`,String(i)):e(`accountImportBatch`).replace(`{n}`,String(r)),description:a||void 0}),oe(!1),ce(null),ue(``),r>0&&await J(!1)}catch(n){G({id:t,type:`error`,title:e(`toastFailed`),description:n instanceof Error?n.message:String(n)})}finally{ae(!1)}}async function Ut(e,t){nt(n=>({...n,[e]:t})),await Nt(e,`toggle`,async()=>{await Te(e,{enabled:t}),await J(!1)}),nt(t=>{let n={...t};return delete n[e],n})}async function Wt(t){G({id:`refresh-${t}`,type:`loading`,title:e(`toastRefreshingAccount`)}),be({id:t,kind:`refresh`}),I(e=>{let n={...e};return delete n[t],n});try{let n=await ht([t]);if(n.failed>0){G({id:`refresh-${t}`,type:`error`,title:e(`toastFailed`),description:n.errors[0]||e(`toastFailed`)});return}G({id:`refresh-${t}`,type:`success`,title:e(`toastAccountRefreshed`)})}finally{be(null)}}async function Kt(){ft(!0),G({id:`refresh-credits`,type:`loading`,title:e(`toastRefreshingCredits`)});try{let t=await ht(c.map(e=>e.id));if(t.failed>0){let n=t.failed0&&r===0?`error`:i>0?`info`:`success`,title:a}),pe(!1),ve(null),D(null),k(``),r>0&&await J(!1)}catch(t){G({id:n,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{b(!1)}}async function Xt(e,t){await Nt(e,`toggle`,async()=>{await Te(e,{auto_checkin:t}),await J(!1)})}async function Zt(){mt(!0),G({id:`checkin-all`,type:`loading`,title:e(`toastCheckingInAll`,{done:0,total:v.length})});try{let t=(await Ae()).data||[];if(t.length===0){G({id:`checkin-all`,type:`info`,title:e(`checkinAllEmpty`)});return}let n={checked:0,skipped:0,failed:0},r={};for(let i of t){let t=String(i.status||``).toLowerCase(),a=t===`already`||t===`skipped`||t===`error`?t:`success`;a===`error`?n.failed+=1:a===`skipped`||a===`already`?n.skipped+=1:n.checked+=1,r[i.account_id]={kind:a,message:a===`error`?i.message||e(`checkinRecordFailed`):i.message}}Le(e=>({...e,...r}));let i={checked:n.checked,skipped:n.skipped,failed:n.failed};G({id:`checkin-all`,type:n.failed?`error`:`success`,title:e(n.failed?`toastCheckedInAllFailed`:`toastCheckedInAll`,i)})}catch(t){G({id:`checkin-all`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{mt(!1),await J(!1).catch(()=>void 0)}}async function Qt(t){await Nt(t,`checkin`,async()=>{let n;try{n=await Ne(t)}catch(e){Le(n=>({...n,[t]:{kind:`error`,message:e instanceof Error?e.message:String(e)}})),await J(!1).catch(()=>void 0),await ht([t]).catch(()=>void 0);return}let r=n?.last_checkin_status,i=n?.last_checkin_msg,a=r===`already`?`already`:r===`skipped`?`skipped`:r===`error`?`error`:`success`;Le(n=>({...n,[t]:{kind:a,message:a===`error`?i||e(`checkinRecordFailed`):i}})),await J(!1).catch(()=>void 0),await ht([t]).catch(()=>void 0)})}async function $t(t,n){if(!t)throw Error(e(`accountNameRequired`));ot(e=>({...e,[t]:n.name})),ct(e=>({...e,[t]:n.max_inflight})),ut(e=>({...e,[t]:n.priority})),be({id:t,kind:`settings`});try{await Te(t,n),await J(!1)}catch(e){throw e instanceof Error?e:Error(String(e))}finally{be(null),ot(e=>{let n={...e};return delete n[t],n}),ct(e=>{let n={...e};return delete n[t],n}),ut(e=>{let n={...e};return delete n[t],n})}}return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[a?(0,Z.jsx)(ge,{title:a}):null,(0,Z.jsxs)(`section`,{"data-gsap-reveal":!0,className:`flex flex-wrap items-center gap-2`,children:[v.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(et,{value:H,onChange:e=>Ze(e),ariaLabel:e(`accountStatusFilter`),options:[{id:`all`,label:(0,Z.jsxs)(Z.Fragment,{children:[e(`filterAll`),(0,Z.jsx)(`span`,{className:`mono text-muted`,children:yt.all})]})},{id:`available`,label:(0,Z.jsxs)(Z.Fragment,{children:[e(`availableAccounts`),(0,Z.jsx)(`span`,{className:`mono text-muted`,children:yt.available})]})},{id:`attention`,label:(0,Z.jsxs)(Z.Fragment,{children:[e(`needsAttention`),(0,Z.jsx)(`span`,{className:`mono ${yt.attention?`text-danger`:`text-muted`}`,children:yt.attention})]})},{id:`disabled`,label:(0,Z.jsxs)(Z.Fragment,{children:[e(`disabled`),(0,Z.jsx)(`span`,{className:`mono text-muted`,children:yt.disabled})]})}]}),(0,Z.jsxs)(Ce,{className:`w-48`,"aria-label":e(`providerFilterAll`),value:U||Br,onChange:e=>{typeof e==`string`&&Qe(e===Br?``:e)},children:[(0,Z.jsxs)(Ce.Trigger,{className:`items-center`,children:[(0,Z.jsx)(Ce.Value,{className:`min-w-0 truncate`}),(0,Z.jsx)(Ce.Indicator,{})]}),(0,Z.jsx)(Ce.Popover,{children:(0,Z.jsxs)(me,{children:[(0,Z.jsxs)(me.Item,{id:Br,textValue:e(`providerFilterAll`),children:[(0,Z.jsxs)(fe,{className:`flex items-center gap-2`,children:[e(`providerFilterAll`),(0,Z.jsx)(`span`,{className:`mono text-muted`,children:v.length})]}),(0,Z.jsx)(me.ItemIndicator,{})]}),bt.map(([t,n])=>(0,Z.jsxs)(me.Item,{id:t,textValue:at(t,e),children:[(0,Z.jsxs)(fe,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(rt,{provider:t,size:13}),at(t,e),(0,Z.jsx)(`span`,{className:`mono text-muted`,children:n})]}),(0,Z.jsx)(me.ItemIndicator,{})]},t))]})})]}),(0,Z.jsx)(h,{className:`w-full sm:w-60`,value:Je,onChange:V,placeholder:e(`searchAccounts`),ariaLabel:e(`searchAccounts`)})]}):null,(0,Z.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:ml-auto sm:w-auto`,children:[(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:S,isDisabled:y||de||w||T,onPress:()=>void zt(),children:[(0,Z.jsx)(Ft,{size:14}),e(`exportAll`)]}),(0,Z.jsxs)(`label`,{htmlFor:`accounts-bundle-import-file`,className:`button button--sm button--secondary inline-flex items-center gap-1.5 ${w||T||y||de||S?`pointer-events-none opacity-60`:`cursor-pointer`}`,children:[w?(0,Z.jsx)(Ye,{size:14,loading:!0}):(0,Z.jsx)(Ft,{size:14}),e(`importAll`)]}),(0,Z.jsx)(`input`,{id:`accounts-bundle-import-file`,type:`file`,accept:`.json,application/json,text/json`,disabled:w||T||y||de||S,className:`sr-only`,onChange:e=>void Vt(e)}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:pt,isDisabled:dt,onPress:()=>void Zt(),children:[(0,Z.jsx)(kt,{size:14}),e(`checkinAll`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:dt,isDisabled:pt,onPress:()=>void Kt(),children:[(0,Z.jsx)(o,{size:14}),e(`refreshCredits`)]}),(0,Z.jsxs)(`label`,{htmlFor:`accounts-batch-import-file`,className:`button button--sm button--secondary inline-flex items-center gap-1.5 ${y||de||w||T||S?`pointer-events-none opacity-60`:`cursor-pointer`}`,children:[y?(0,Z.jsx)(Ye,{size:14,loading:!0}):(0,Z.jsx)(Gt,{size:14}),e(`batchImport`)]}),(0,Z.jsx)(`input`,{id:`accounts-batch-import-file`,type:`file`,accept:`.json,application/json,text/json`,disabled:y||de||w||T||S,className:`sr-only`,onChange:e=>void Jt(e)}),(0,Z.jsxs)(x,{size:`sm`,onPress:()=>re(!0),children:[(0,Z.jsx)(g,{size:14}),e(`addAccount`)]})]})]}),(0,Z.jsx)(jr,{isOpen:ne,onClose:()=>re(!1),onAdded:()=>{G({type:`success`,title:e(`toastAccountAdded`)}),J(!1)}}),(0,Z.jsx)(Lr,{isOpen:T,bundle:se,fileName:le,isPending:w,t:e,onClose:Bt,onConfirm:()=>{Ht()}}),(0,Z.jsx)(Nr,{isOpen:de,detection:he,fileName:O,isPending:y,t:e,onClose:qt,onConfirm:e=>{Yt(e)}}),(0,Z.jsx)(zn,{account:St,t:e,onClose:()=>Ue(null)},He??`closed`),(0,Z.jsx)(Ln,{account:Ct,t:e,onClose:()=>Ge(null)},We??`closed`),(0,Z.jsx)(Hn,{account:wt,checkinDefaultTime:wt&>(wt)?r?.checkin_times[wt.provider||``]:void 0,checkinTimezone:wt?vt(wt):void 0,busy:!!(A&&A.id===R&&A.kind===`settings`),t:e,onClose:()=>z(null),onSave:e=>$t(R||``,e)},R??`closed`),(0,Z.jsx)(_e,{isOpen:!!xt,title:e(`delete`),description:e(`deleteAccountConfirm`,{name:xt?.name||xt?.id||``}),confirmLabel:e(`delete`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:A?.id===Be&&A.kind===`delete`,onClose:()=>Ve(null),onConfirm:()=>{if(!xt)return;let t=xt.id;Ve(null),Nt(t,`delete`,async()=>{await Pe(t),await J(!1)}).then(t=>{t&&G({type:`success`,title:e(`toastAccountDeleted`)})})}}),te?null:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(ye,{className:`rounded-3xl bg-surface-secondary`,icon:(0,Z.jsx)(Ye,{size:28}),title:e(`noAccounts`),hint:e(`accountEmptyHint`),action:(0,Z.jsxs)(x,{size:`sm`,onPress:()=>re(!0),children:[(0,Z.jsx)(g,{size:14}),e(`addAccount`)]})}),(0,Z.jsx)(`div`,{className:`text-center`,children:(0,Z.jsx)(l,{})})]}),te&&!Tt.length?(0,Z.jsx)(ye,{className:`rounded-3xl bg-surface-secondary`,icon:(0,Z.jsx)(p,{size:22}),title:e(`noAccountsMatch`),action:(0,Z.jsx)(x,{size:`sm`,variant:`ghost`,onPress:()=>{V(``),Ze(`all`),Qe(``)},children:e(`clearFilters`)})}):null,(0,Z.jsx)(`section`,{className:`grid auto-rows-[minmax(280px,auto)] gap-2.5 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4`,children:Mt.map(t=>(0,Z.jsx)(Pn,{account:t,busyKind:A?.id===t.id?A.kind:``,authPanelOpen:Ke===t.id,authUrl:ze[t.id],note:F[t.id],pat:xe[t.id]||``,t:e,onPatChange:e=>j(n=>({...n,[t.id]:e})),callbackUrl:Se[t.id]||``,onCallbackChange:e=>we(n=>({...n,[t.id]:e})),onSubmitCallback:()=>void It(t.id),onDeviceLogin:e=>void Pt(t.id,e),onPatLogin:()=>void Lt(t.id),onExport:()=>void Rt(t.id),onRefresh:()=>void Wt(t.id),onDelete:()=>Ve(t.id),onToggle:e=>void Ut(t.id,e),checkinDefaultTime:r?.checkin_times[t.provider||``],checkinTimezone:vt(t),onToggleAutoCheckin:gt(t)?e=>void Xt(t.id,e):void 0,onCheckin:gt(t)?()=>void Qt(t.id):void 0,checkinFeedback:Me[t.id]??null,onViewCheckins:gt(t)?()=>Ge(t.id):void 0,onEdit:()=>z(t.id),onToggleAuthPanel:()=>B(e=>e===t.id?null:t.id),onViewModels:()=>Ue(t.id)},t.id))}),Tt.length?(0,Z.jsx)(ee,{total:Tt.length,page:jt,pageCount:At,pageSize:K,pageSizes:m,loading:!1,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:jt,pages:At}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:$e,onPageSize:q}):null]})}export{Ur as AccountsPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/AccountsPage-D2P-kXa_.js b/internal/webui/static/assets/AccountsPage-D2P-kXa_.js deleted file mode 100644 index ca2f36a2..00000000 --- a/internal/webui/static/assets/AccountsPage-D2P-kXa_.js +++ /dev/null @@ -1 +0,0 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{a as r,i,n as a,o,r as s,s as c,t as l}from"./CaiaiSoftLink-Cv7Cw6NC.js";import{n as u}from"./Check.es-BqA3iE7U.js";import{n as d,t as f}from"./clipboard-DfpIZ3R1.js";import{i as p,n as m,r as ee,t as h}from"./SearchBar-DwSqSsBT.js";import{t as g}from"./Plus.es-Cg0e8UP-.js";import{t as _}from"./ShieldCheck.es-F8LRNwGN.js";import{t as v}from"./TrashSimple.es-1c4RHqtF.js";import{H as te,I as ne,Z as re,n as ie,nt as y,pt as b,r as x}from"./useI18n-B77RWTNi.js";import{B as S,F as C,J as w,M as T,N as E,c as ae,j as oe,q as se,s as ce,z as le}from"./SharedElementTransition-BlCsXfb1.js";import{_ as ue,t as de,v as fe}from"./label-DLoR3Z-C.js";import{t as pe}from"./list-box-rbke8Feh.js";import{n as D,t as me}from"./PageAlert-r7ZVsH9h.js";import{t as he}from"./ConfirmDialog-CNztRgAW.js";import{n as ge}from"./useToggle-BRoRhkOA.js";import{i as O,n as k,r as _e,t as A}from"./number-field-DwLKuqPI.js";import{n as j,r as M,t as N}from"./FormRow-DvxQavWE.js";import{t as ve}from"./EmptyPanel-Bs-jQMvG.js";import{t as P}from"./modal-q_Ums9Et.js";import{t as ye}from"./search-field-d32AuGpH.js";import{t as be}from"./select-BRn66sMj.js";import{t as xe}from"./CompactSwitch-BinKb1rw.js";import{t as Se}from"./textfield-OcaUopTb.js";import{r as F}from"./gsap-C3sDxib7.js";import{A as I,F as L,G as R,H as Ce,I as we,K as Te,Kt as Ee,L as De,M as Oe,N as ke,P as Ae,R as je,St as Me,U as Ne,V as Pe,W as Fe,X as Ie,_ as Le,at as Re,bt as ze,cn as Be,en as Ve,fn as He,g as Ue,hn as We,i as z,it as Ge,j as Ke,k as qe,nt as B,p as V,pn as H,q as Je,t as U,tn as W,v as Ye,vt as Xe,w as Ze,x as Qe,xt as $e,y as G,yt as K,z as q}from"./index-CmGY2WQi.js";import{t as et}from"./FilterToggle-Bygki2HF.js";import{d as tt,f as nt}from"./format-B6SmebW-.js";import{t as rt}from"./ProviderMark-IiAZTaQS.js";import{n as it,t as at}from"./provider-gHnttGKq.js";import{a as ot,c as st,d as ct,f as lt,i as ut,l as dt,m as ft,n as pt,o as mt,p as J,r as ht,s as gt,t as _t,u as vt}from"./account-BJHim5bc.js";var Y=t(e(),1),X=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,28H188V24a12,12,0,0,0-24,0v4H92V24a12,12,0,0,0-24,0v4H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28ZM68,52a12,12,0,0,0,24,0h72a12,12,0,0,0,24,0h16V76H52V52ZM52,204V100H204V204Zm120.49-84.49a12,12,0,0,1,0,17l-48,48a12,12,0,0,1-17,0l-24-24a12,12,0,0,1,17-17L116,159l39.51-39.52A12,12,0,0,1,172.49,119.51Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V88H40V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Zm-38.34-85.66a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L116,164.69l42.34-42.35A8,8,0,0,1,169.66,122.34Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM169.66,133.66l-48,48a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L116,164.69l42.34-42.35a8,8,0,0,1,11.32,11.32ZM48,80V48H72v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,34H182V24a6,6,0,0,0-12,0V34H86V24a6,6,0,0,0-12,0V34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34ZM48,46H74V56a6,6,0,0,0,12,0V46h84V56a6,6,0,0,0,12,0V46h26a2,2,0,0,1,2,2V82H46V48A2,2,0,0,1,48,46ZM208,210H48a2,2,0,0,1-2-2V94H210V208A2,2,0,0,1,208,210Zm-39.76-86.24a6,6,0,0,1,0,8.48l-48,48a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L116,167.51l43.76-43.75A6,6,0,0,1,168.24,123.76Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Zm-38.34-85.66a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L116,164.69l42.34-42.35A8,8,0,0,1,169.66,122.34Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,36H180V24a4,4,0,0,0-8,0V36H84V24a4,4,0,0,0-8,0V36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36ZM48,44H76V56a4,4,0,0,0,8,0V44h88V56a4,4,0,0,0,8,0V44h28a4,4,0,0,1,4,4V84H44V48A4,4,0,0,1,48,44ZM208,212H48a4,4,0,0,1-4-4V92H212V208A4,4,0,0,1,208,212Zm-41.17-86.83a4,4,0,0,1,0,5.66l-48,48a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L116,170.34l45.17-45.17A4,4,0,0,1,166.83,125.17Z`}))]]),yt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M79.51,144.49a12,12,0,1,1,17-17L112,143l47.51-47.52a12,12,0,0,1,17,17l-56,56a12,12,0,0,1-17,0ZM228,48V208a20,20,0,0,1-20,20H48a20,20,0,0,1-20-20V48A20,20,0,0,1,48,28H208A20,20,0,0,1,228,48Zm-24,4H52V204H204Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48ZM208,208V48H48V208H208Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm-34.34,77.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM222,48V208a14,14,0,0,1-14,14H48a14,14,0,0,1-14-14V48A14,14,0,0,1,48,34H208A14,14,0,0,1,222,48Zm-12,0a2,2,0,0,0-2-2H48a2,2,0,0,0-2,2V208a2,2,0,0,0,2,2H208a2,2,0,0,0,2-2Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48ZM208,208V48H48V208H208Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM220,48V208a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V48A12,12,0,0,1,48,36H208A12,12,0,0,1,220,48Zm-8,0a4,4,0,0,0-4-4H48a4,4,0,0,0-4,4V208a4,4,0,0,0,4,4H208a4,4,0,0,0,4-4Z`}))]]),bt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M176,32V224a16,16,0,0,1-16,16H96a16,16,0,0,1-16-16V32A16,16,0,0,1,96,16h64A16,16,0,0,1,176,32Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM128,72a12,12,0,1,0-12-12A12,12,0,0,0,128,72Zm0,112a12,12,0,1,0,12,12A12,12,0,0,0,128,184Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M160,16H96A16,16,0,0,0,80,32V224a16,16,0,0,0,16,16h64a16,16,0,0,0,16-16V32A16,16,0,0,0,160,16ZM128,208a12,12,0,1,1,12-12A12,12,0,0,1,128,208Zm0-68a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm0-68a12,12,0,1,1,12-12A12,12,0,0,1,128,72Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M118,60a10,10,0,1,1,10,10A10,10,0,0,1,118,60Zm10,58a10,10,0,1,0,10,10A10,10,0,0,0,128,118Zm0,68a10,10,0,1,0,10,10A10,10,0,0,0,128,186Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM128,72a12,12,0,1,0-12-12A12,12,0,0,0,128,72Zm0,112a12,12,0,1,0,12,12A12,12,0,0,0,128,184Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M120,60a8,8,0,1,1,8,8A8,8,0,0,1,120,60Zm8,60a8,8,0,1,0,8,8A8,8,0,0,0,128,120Zm0,68a8,8,0,1,0,8,8A8,8,0,0,0,128,188Z`}))]]),xt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M228,144v64a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V144a12,12,0,0,1,24,0v52H204V144a12,12,0,0,1,24,0Zm-108.49,8.49a12,12,0,0,0,17,0l40-40a12,12,0,0,0-17-17L140,115V32a12,12,0,0,0-24,0v83L96.49,95.51a12,12,0,0,0-17,17Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V208H40V48A16,16,0,0,1,56,32H200A16,16,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40A8,8,0,0,0,168,96H136V32a8,8,0,0,0-16,0V96H88a8,8,0,0,0-5.66,13.66Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M222,144v64a6,6,0,0,1-6,6H40a6,6,0,0,1-6-6V144a6,6,0,0,1,12,0v58H210V144a6,6,0,0,1,12,0Zm-98.24,4.24a6,6,0,0,0,8.48,0l40-40a6,6,0,0,0-8.48-8.48L134,129.51V32a6,6,0,0,0-12,0v97.51L92.24,99.76a6,6,0,0,0-8.48,8.48Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M220,144v64a4,4,0,0,1-4,4H40a4,4,0,0,1-4-4V144a4,4,0,0,1,8,0v60H212V144a4,4,0,0,1,8,0Zm-94.83,2.83a4,4,0,0,0,5.66,0l40-40a4,4,0,1,0-5.66-5.66L132,134.34V32a4,4,0,0,0-8,0V134.34L90.83,101.17a4,4,0,0,0-5.66,5.66Z`}))]]),St=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M180.49,143.51a12,12,0,0,1,0,17l-24,24a12,12,0,0,1-17-17L155,152l-15.52-15.51a12,12,0,1,1,17-17Zm-64-24a12,12,0,0,0-17,0l-24,24a12,12,0,0,0,0,17l24,24a12,12,0,0,0,17-17L101,152l15.52-15.51A12,12,0,0,0,116.49,119.51ZM220,88V216a20,20,0,0,1-20,20H56a20,20,0,0,1-20-20V40A20,20,0,0,1,56,20h96a12,12,0,0,1,8.49,3.52l56,56A12,12,0,0,1,220,88ZM160,57V80h23Zm36,155V104H148a12,12,0,0,1-12-12V44H60V212Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,88H152V32Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M181.66,146.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32Zm-72-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,0,11.32l24,24a8,8,0,0,0,11.32-11.32L91.31,152l18.35-18.34A8,8,0,0,0,109.66,122.34ZM216,88V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31Zm40,136V96H152a8,8,0,0,1-8-8V40H56V216H200Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34Zm-104,88a8,8,0,0,1-11.32,11.32l-24-24a8,8,0,0,1,0-11.32l24-24a8,8,0,0,1,11.32,11.32L91.31,152Zm72-12.68-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32l24,24A8,8,0,0,1,181.66,157.66ZM152,88V44l44,44Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M180.24,147.76a6,6,0,0,1,0,8.48l-24,24a6,6,0,0,1-8.48-8.48L167.51,152l-19.75-19.76a6,6,0,1,1,8.48-8.48Zm-72-24a6,6,0,0,0-8.48,0l-24,24a6,6,0,0,0,0,8.48l24,24a6,6,0,1,0,8.48-8.48L88.49,152l19.75-19.76A6,6,0,0,0,108.24,123.76ZM214,88V216a14,14,0,0,1-14,14H56a14,14,0,0,1-14-14V40A14,14,0,0,1,56,26h96a6,6,0,0,1,4.25,1.76l56,56A6,6,0,0,1,214,88Zm-56-6h35.52L158,46.48Zm44,134V94H152a6,6,0,0,1-6-6V38H56a2,2,0,0,0-2,2V216a2,2,0,0,0,2,2H200A2,2,0,0,0,202,216Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M181.66,146.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32Zm-72-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,0,11.32l24,24a8,8,0,0,0,11.32-11.32L91.31,152l18.35-18.34A8,8,0,0,0,109.66,122.34ZM216,88V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31Zm40,136V96H152a8,8,0,0,1-8-8V40H56V216H200Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M178.83,149.17a4,4,0,0,1,0,5.66l-24,24a4,4,0,0,1-5.66-5.66L170.34,152l-21.17-21.17a4,4,0,1,1,5.66-5.66Zm-72-24a4,4,0,0,0-5.66,0l-24,24a4,4,0,0,0,0,5.66l24,24a4,4,0,1,0,5.66-5.66L85.66,152l21.17-21.17A4,4,0,0,0,106.83,125.17ZM212,88V216a12,12,0,0,1-12,12H56a12,12,0,0,1-12-12V40A12,12,0,0,1,56,28h96a4,4,0,0,1,2.83,1.17l56,56A4,4,0,0,1,212,88Zm-56-4h42.34L156,41.65Zm48,132V92H152a4,4,0,0,1-4-4V36H56a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H200A4,4,0,0,0,204,216Z`}))]]),Ct=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),wt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,28H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28Zm-4,176H52V52H204Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V48H208V208Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34Zm2,174a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V48H208V208Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36Zm4,172a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Z`}))]]),Tt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,44a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,44Zm0,168a72,72,0,1,1,72-72A72.08,72.08,0,0,1,128,212ZM164.49,99.51a12,12,0,0,1,0,17l-28,28a12,12,0,0,1-17-17l28-28A12,12,0,0,1,164.49,99.51ZM92,16A12,12,0,0,1,104,4h48a12,12,0,0,1,0,24H104A12,12,0,0,1,92,16Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,136a88,88,0,1,1-88-88A88,88,0,0,1,216,136Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,216ZM173.66,90.34a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32-11.32l40-40A8,8,0,0,1,173.66,90.34ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm45.66,61.66-40,40a8,8,0,0,1-11.32-11.32l40-40a8,8,0,0,1,11.32,11.32ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,42a94,94,0,1,0,94,94A94.11,94.11,0,0,0,128,42Zm0,176a82,82,0,1,1,82-82A82.1,82.1,0,0,1,128,218ZM172.24,91.76a6,6,0,0,1,0,8.48l-40,40a6,6,0,1,1-8.48-8.48l40-40A6,6,0,0,1,172.24,91.76ZM98,16a6,6,0,0,1,6-6h48a6,6,0,0,1,0,12H104A6,6,0,0,1,98,16Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,216ZM173.66,90.34a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32-11.32l40-40A8,8,0,0,1,173.66,90.34ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,44a92,92,0,1,0,92,92A92.1,92.1,0,0,0,128,44Zm0,176a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,220ZM170.83,93.17a4,4,0,0,1,0,5.66l-40,40a4,4,0,1,1-5.66-5.66l40-40A4,4,0,0,1,170.83,93.17ZM100,16a4,4,0,0,1,4-4h48a4,4,0,0,1,0,8H104A4,4,0,0,1,100,16Z`}))]]),Et=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M228,144v64a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V144a12,12,0,0,1,24,0v52H204V144a12,12,0,0,1,24,0ZM96.49,80.49,116,61v83a12,12,0,0,0,24,0V61l19.51,19.52a12,12,0,1,0,17-17l-40-40a12,12,0,0,0-17,0l-40,40a12,12,0,1,0,17,17Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V208H40V48A16,16,0,0,1,56,32H200A16,16,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM93.66,77.66,120,51.31V144a8,8,0,0,0,16,0V51.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,77.66Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM88,80h32v64a8,8,0,0,0,16,0V80h32a8,8,0,0,0,5.66-13.66l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,88,80Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M222,144v64a6,6,0,0,1-6,6H40a6,6,0,0,1-6-6V144a6,6,0,0,1,12,0v58H210V144a6,6,0,0,1,12,0ZM92.24,76.24,122,46.49V144a6,6,0,0,0,12,0V46.49l29.76,29.75a6,6,0,0,0,8.48-8.48l-40-40a6,6,0,0,0-8.48,0l-40,40a6,6,0,0,0,8.48,8.48Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM93.66,77.66,120,51.31V144a8,8,0,0,0,16,0V51.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,77.66Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M220,144v64a4,4,0,0,1-4,4H40a4,4,0,0,1-4-4V144a4,4,0,0,1,8,0v60H212V144a4,4,0,0,1,8,0ZM90.83,74.83,124,41.66V144a4,4,0,0,0,8,0V41.66l33.17,33.17a4,4,0,1,0,5.66-5.66l-40-40a4,4,0,0,0-5.66,0l-40,40a4,4,0,0,0,5.66,5.66Z`}))]]),Dt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M168.49,104.49,145,128l23.52,23.51a12,12,0,0,1-17,17L128,145l-23.51,23.52a12,12,0,0,1-17-17L111,128,87.51,104.49a12,12,0,0,1,17-17L128,111l23.51-23.52a12,12,0,0,1,17,17ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,130.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M164.24,100.24,136.48,128l27.76,27.76a6,6,0,1,1-8.48,8.48L128,136.48l-27.76,27.76a6,6,0,0,1-8.48-8.48L119.52,128,91.76,100.24a6,6,0,0,1,8.48-8.48L128,119.52l27.76-27.76a6,6,0,0,1,8.48,8.48ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M162.83,98.83,133.66,128l29.17,29.17a4,4,0,0,1-5.66,5.66L128,133.66,98.83,162.83a4,4,0,0,1-5.66-5.66L122.34,128,93.17,98.83a4,4,0,0,1,5.66-5.66L128,122.34l29.17-29.17a4,4,0,1,1,5.66,5.66ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),Ot=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:X}));Ot.displayName=`CalendarCheckIcon`;var kt=Ot,At=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:yt}));At.displayName=`CheckSquareIcon`;var jt=At,Mt=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:bt}));Mt.displayName=`DotsThreeVerticalIcon`;var Nt=Mt,Pt=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:xt}));Pt.displayName=`DownloadSimpleIcon`;var Ft=Pt,It=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:St}));It.displayName=`FileCodeIcon`;var Lt=It,Rt=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:Ct}));Rt.displayName=`PencilSimpleIcon`;var zt=Rt,Bt=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:wt}));Bt.displayName=`SquareIcon`;var Vt=Bt,Ht=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:Tt}));Ht.displayName=`TimerIcon`;var Ut=Ht,Wt=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:Et}));Wt.displayName=`UploadSimpleIcon`;var Gt=Wt,Kt=Y.forwardRef((e,t)=>Y.createElement(b,{ref:t,...e,weights:Dt}));Kt.displayName=`XCircleIcon`;var qt=Kt,Jt=le({slots:{menu:`dropdown__menu`,popover:`dropdown__popover`,root:`dropdown`,trigger:`dropdown__trigger`}}),Yt=le({defaultVariants:{color:`accent`,size:`md`},slots:{base:`meter`,fill:`meter__fill`,output:`meter__output`,track:`meter__track`},variants:{color:{accent:{base:`meter--accent`},danger:{base:`meter--danger`},default:{base:`meter--default`},success:{base:`meter--success`},warning:{base:`meter--warning`}},size:{lg:{base:`meter--lg`},md:{base:`meter--md`},sm:{base:`meter--sm`}}}}),Xt=le({defaultVariants:{variant:`default`},slots:{indicator:`menu-item__indicator`,item:`menu-item`,submenuIndicator:`menu-item__indicator menu-item__indicator--submenu`},variants:{variant:{danger:{item:`menu-item--danger`},default:{item:`menu-item--default`}}}}),Zt=le({base:`menu-section`});function Qt(e){let{value:t=0,minValue:n=0,maxValue:r=100,valueLabel:i,isIndeterminate:a,formatOptions:o={style:`percent`}}=e,s=se(e,{labelable:!0}),{labelProps:c,fieldProps:l}=ue({...e,labelElementType:`span`});t=y(t,n,r);let u=r-n,d=u===0?0:(t-n)/u,f=O(o);if(!a&&!i){let e=o.style===`percent`?d:t;i=f.format(e)}return{progressBarProps:w(s,{...l,"aria-valuenow":a?void 0:t,"aria-valuemin":n,"aria-valuemax":r,"aria-valuetext":a?void 0:i,role:`progressbar`}),labelProps:c}}function $t(e){let{progressBarProps:t,labelProps:n}=Qt(e);return{meterProps:{...t,role:`meter progressbar`},labelProps:n}}var en=(0,Y.createContext)(null),tn=(0,Y.forwardRef)(function(e,t){[e,t]=oe(e,t,en);let{value:n=0,minValue:r=0,maxValue:i=100}=e;n=y(n,r,i);let a=i-r,[o,s]=E(!e[`aria-label`]&&!e[`aria-labelledby`]),{meterProps:c,labelProps:l}=$t({...e,label:s}),u=a===0?0:(n-r)/a*100,d=T({...e,defaultClassName:`react-aria-Meter`,values:{percentage:u,valueText:c[`aria-valuetext`]}}),f=se(e,{global:!0});return Y.createElement(C.div,{...w(f,d,c),ref:t,slot:e.slot||void 0},Y.createElement(fe.Provider,{value:{...l,ref:o,elementType:`span`}},d.children))}),Z=n(),nn=(0,Y.createContext)({}),rn=({children:e,className:t,variant:n,...r})=>{let i=Y.useMemo(()=>Xt({variant:n}),[n]);return(0,Z.jsx)(K,{className:ae(t,i.item()),"data-slot":`menu-item`,...r,children:t=>(0,Z.jsx)(nn,{value:{slots:i,state:t},children:typeof e==`function`?e(t):e})})},an=({children:e,className:t,type:n=`checkmark`,...r})=>{let{slots:i,state:a}=(0,Y.use)(nn),o=a?.isSelected,s=typeof e==`function`?e(a??{}):e||(n===`dot`?(0,Z.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`menu-item-indicator--dot`,fill:`currentColor`,fillRule:`evenodd`,role:`presentation`,viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`,children:(0,Z.jsx)(`path`,{clipRule:`evenodd`,d:`M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14`,fillRule:`evenodd`})}):(0,Z.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`menu-item-indicator--checkmark`,fill:`none`,role:`presentation`,stroke:`currentColor`,strokeDasharray:22,strokeDashoffset:o?44:66,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 17 18`,children:(0,Z.jsx)(`polyline`,{points:`1 9 7 14 15 4`})}));return(0,Z.jsx)(S.span,{"aria-hidden":`true`,className:ce(i?.indicator,t),"data-slot":`menu-item-indicator`,"data-type":n,"data-visible":o||void 0,...r,children:s})},on=({children:e,className:t,...n})=>{let{slots:r,state:i}=(0,Y.use)(nn);if(!i?.hasSubmenu)return null;let a=e??(0,Z.jsx)(te,{});return(0,Z.jsx)(S.span,{"aria-hidden":`true`,className:ce(r?.submenuIndicator,t),"data-slot":`submenu-indicator`,...n,children:a})},sn=({children:e,className:t,...n})=>{let r=Y.useMemo(()=>Zt({class:typeof t==`string`?t:void 0}),[t]);return(0,Z.jsx)(ze,{className:r,...n,children:e})},cn=(0,Y.createContext)({}),ln=({children:e,...t})=>{let n=Y.useMemo(()=>Jt(),[]);return(0,Z.jsx)(cn,{value:{slots:n},children:(0,Z.jsx)(Xe,{...t,children:e})})},un=({children:e,className:t,...n})=>{let{slots:r}=(0,Y.use)(cn);return(0,Z.jsx)(re,{className:ae(t,r?.trigger()),"data-slot":`dropdown-trigger`,...n,children:t=>(0,Z.jsx)(Z.Fragment,{children:typeof e==`function`?e(t):e})})},dn=({children:e,className:t,placement:n,...r})=>{let{slots:i}=(0,Y.use)(cn);return(0,Z.jsx)(ne,{value:{variant:`default`},children:(0,Z.jsx)(Ee,{...r,className:ae(t,i?.popover()),"data-slot":`dropdown-popover`,placement:n,children:e})})};function fn({className:e,...t}){let{slots:n}=(0,Y.use)(cn);return(0,Z.jsx)($e,{className:ae(e,n?.menu()),"data-selection-mode":t.selectionMode,"data-slot":`dropdown-menu`,...t})}var pn=Object.assign(ln,{Root:ln,Trigger:un,Popover:dn,Menu:fn,Section:e=>(0,Z.jsx)(sn,{...e}),Item:e=>(0,Z.jsx)(rn,{...e}),ItemIndicator:e=>(0,Z.jsx)(an,{...e}),SubmenuIndicator:e=>(0,Z.jsx)(on,{...e}),SubmenuTrigger:({children:e,...t})=>(0,Z.jsx)(Me,{"data-slot":`dropdown-submenu-trigger`,...t,children:e})}),mn=(0,Y.createContext)({}),hn=({children:e,className:t,color:n,size:r,...i})=>{let a=Y.useMemo(()=>Yt({color:n,size:r}),[n,r]);return(0,Z.jsx)(tn,{"data-slot":`meter`,...i,className:ae(t,a.base()),children:t=>(0,Z.jsx)(mn,{value:{slots:a,state:t},children:typeof e==`function`?e(t):e})})};hn.displayName=`HeroUI.Meter`;var gn=({children:e,className:t,...n})=>{let{slots:r,state:i}=(0,Y.use)(mn);return(0,Z.jsx)(S.span,{className:ce(r?.output,t),"data-slot":`meter-output`,...n,children:e??i?.valueText})};gn.displayName=`HeroUI.Meter.Output`;var _n=({children:e,className:t,...n})=>{let{slots:r}=(0,Y.use)(mn);return(0,Z.jsx)(S.div,{className:ce(r?.track,t),"data-slot":`meter-track`,...n,children:e})};_n.displayName=`HeroUI.Meter.Track`;var vn=({className:e,style:t,...n})=>{let{slots:r,state:i}=(0,Y.use)(mn);return(0,Z.jsx)(S.div,{className:ce(r?.fill,e),"data-slot":`meter-fill`,style:{...t,width:`${i?.percentage??0}%`},...n})};vn.displayName=`HeroUI.Meter.Fill`;var yn=Object.assign(hn,{Root:hn,Output:gn,Track:_n,Fill:vn}),bn=()=>()=>{},xn=new Set,Sn=Date.now(),Cn=null;function wn(){Sn=Date.now();for(let e of xn)e()}function Tn(e){return xn.size===0&&(Sn=Date.now()),xn.add(e),Cn===null&&(Cn=window.setInterval(wn,1e3)),()=>{xn.delete(e),xn.size===0&&Cn!==null&&(window.clearInterval(Cn),Cn=null)}}function En(){return Sn}function Dn(e=!0){return(0,Y.useSyncExternalStore)(e?Tn:bn,En,En)}function On(e){(0,Y.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=F.context(()=>{F.matchMedia().add(`(prefers-reduced-motion: no-preference)`,()=>{let e=F.utils.toArray(`.meter__fill`);e.length&&F.from(e,{scaleX:0,transformOrigin:`left center`,duration:Le.calm,ease:Ye.emphasized,stagger:Qe.base,clearProps:`transform,transformOrigin`})})},t);return()=>n.revert()},[e])}function kn(e,t,n,r,i,a){return[e.has_add_on&&e.add_on_available!==!1?`${n} ${ot(e.add_on_used)} / ${ot(e.add_on_total)} ${e.add_on_unit||`credits`}`:``,e.has_resource_package&&e.resource_package_available!==!1?`${r} ${t} ${ot(e.resource_package_remaining)} ${e.resource_package_unit||`credits`}`:``,a===`workbuddy`?gt(e,i):``].filter(Boolean)}function An({window:e,t,extra:n}){let r=Math.round(e.percentage??0),i=ct(e,t),a=t(`quotaUsedPercent`,{n:r}),o=st(e.reset_at,t),s=`${i} · ${a}${o?` · ${o}`:``}`,c=vt(e),l=dt(e),u=l===`danger`?`danger`:l===`warn`?`warning`:`success`;return(0,Z.jsxs)(B,{children:[(0,Z.jsx)(B.Trigger,{className:`block w-full min-w-0`,children:(0,Z.jsxs)(`div`,{className:`w-full min-w-0 cursor-help`,children:[(0,Z.jsxs)(yn,{className:`account-meter account-meter--window w-full`,color:u,size:`md`,minValue:0,maxValue:100,value:Math.round(c*100),"aria-label":i,valueLabel:s,children:[(0,Z.jsxs)(yn.Output,{className:`flex w-full items-baseline justify-between gap-3 text-caption`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:i}),(0,Z.jsx)(`span`,{className:`mono shrink-0 text-foreground/70`,children:a})]}),(0,Z.jsx)(yn.Track,{children:(0,Z.jsx)(yn.Fill,{})})]}),o?(0,Z.jsx)(`div`,{className:`mt-1 text-caption leading-4 text-muted`,children:o}):null]})}),(0,Z.jsx)(B.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(`div`,{children:s}),n?.map(e=>(0,Z.jsx)(`div`,{children:e},e))]})})]})}function jn({quota:e,t,label:n,usedLabel:r,remainingLabel:i,addOnLabel:a,resourcePackageLabel:o,exceededLabel:s,provider:c}){let l=e.unit||`credits`,u=`${ot(e.used)} / ${ot(e.total)}`,d=`${ot(e.remaining)}`,f=kn(e,i,a,o,t,c),p=lt(e),m=c===`codex`||c===`kiro`?ht(e.plan):``,ee=vt(e),h=dt(e),g=h===`danger`?`danger`:h===`warn`?`warning`:`success`,_=(0,Y.useRef)(null);On(_);let v=`${r} ${u} ${l} · ${i} ${d} ${l}${f.length?` · ${f.join(` · `)}`:``}`;return p.length>0?(0,Z.jsxs)(`div`,{ref:_,className:`account-quota-windows flex w-full min-w-0 flex-col gap-3`,children:[m?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-caption`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:t(`quotaPlan`)}),(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:m})]}):null,p.map((e,n)=>(0,Z.jsx)(`div`,{className:`w-full min-w-0`,children:(0,Z.jsx)(An,{window:e,t,extra:n===0?f:void 0})},e.id||String(n)))]}):(0,Z.jsxs)(B,{children:[(0,Z.jsx)(B.Trigger,{children:(0,Z.jsx)(`div`,{ref:_,className:`w-full cursor-help`,children:(0,Z.jsxs)(yn,{className:`account-meter w-full`,color:g,size:`md`,minValue:0,maxValue:100,value:Math.round(ee*100),"aria-label":n,valueLabel:v,children:[(0,Z.jsxs)(yn.Output,{className:`flex w-full items-baseline justify-between text-caption`,children:[(0,Z.jsxs)(`span`,{className:`text-body font-semibold leading-5 text-foreground tabular-nums`,children:[e.exceeded?(0,Z.jsx)(`span`,{className:`mr-1.5 text-danger`,children:s}):(0,Z.jsx)(`span`,{className:`mr-1.5 text-caption font-normal text-muted`,children:i}),d,(0,Z.jsx)(`span`,{className:`ml-1 text-caption font-normal text-foreground/60`,children:l})]}),(0,Z.jsxs)(`span`,{className:`mono text-foreground/55`,children:[u,` · `,Math.round(ee*100),`%`]})]}),(0,Z.jsx)(yn.Track,{children:(0,Z.jsx)(yn.Fill,{})})]})})}),(0,Z.jsx)(B.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsxs)(`div`,{children:[r,` `,u,` `,l]}),(0,Z.jsxs)(`div`,{children:[i,` `,d,` `,l]}),f.map(e=>(0,Z.jsx)(`div`,{children:e},e))]})})]})}function Mn({state:e,stateCopy:t,t:n}){let r=(0,Y.useRef)(null),i=J(e),a=ft(e);return(0,Y.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=F.context(()=>{let e=F.utils.toArray(`[data-runtime-seg]`),t=e.filter((e,t)=>tt>=i),r=F.matchMedia();r.add(`(prefers-reduced-motion: reduce)`,()=>{F.set(t,{scaleY:1,autoAlpha:1}),F.set(n,{scaleY:.32,autoAlpha:.45})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{F.set(e,{transformOrigin:`center bottom`}),F.to(n,{scaleY:.32,autoAlpha:.45,duration:Le.fast,ease:Ye.out,overwrite:!0}),F.to(t,{scaleY:1,autoAlpha:1,duration:Le.base,ease:Ye.out,stagger:{amount:.08,from:`start`},overwrite:!0})})},e);return()=>t.revert()},[i,e]),(0,Z.jsx)(`div`,{ref:r,className:`flex items-center`,children:(0,Z.jsx)(`div`,{className:`runtime-meter min-w-[80px] flex-1`,"data-quiet":a===`ok`?`true`:void 0,role:`meter`,"aria-label":n(`runtimeState`),"aria-valuemin":0,"aria-valuemax":12,"aria-valuenow":i,"aria-valuetext":t,children:Array.from({length:12},(e,t)=>(0,Z.jsx)(`span`,{"data-runtime-seg":!0,"data-on":t{if(E)return be.current&&window.clearTimeout(be.current),be.current=window.setTimeout(()=>ve(E),3e3),()=>{be.current&&window.clearTimeout(be.current)}},[E]);let R=Nn(k,k===`dead`?A:_e,u),Ce=k===`hot`||k===`ready`?`success`:k===`cooling`?`warning`:k===`quota_exhausted`||k===`login`||k===`unavailable`||k===`dead`||k===`auth_failed`?`danger`:void 0,we=e.last_error||e.lastError,Te=e.last_error_kind||e.kind,Ee=it(e.provider,e.region,u),De=String(e.region||``).toLowerCase(),Oe=De===`cn`?u(`regionCN`):De===`global`?u(`regionGlobal`):``,ke=e.remote_uid||e.id,Ae=ke.length>12?ke.slice(0,8):ke,je=e.last_checkin_status,Me=je===`success`?`checkinRecordSuccess`:je===`already`?`checkinRecordAlready`:je===`skipped`?`checkinRecordSkipped`:je===`error`?`checkinRecordFailed`:`lastCheckinNone`,Ne=pt(e,S);return(0,Y.useLayoutEffect)(()=>{let e=ce.current;if(!e)return;let t=O.current;if(O.current=k,!t||t===k)return;let n=F.context(()=>{let t=F.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{F.set(e,{scale:1,autoAlpha:1})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{F.fromTo(e,{scale:.94,autoAlpha:.65},{scale:1,autoAlpha:1,duration:.2,ease:`power2.out`,overwrite:!0})})},e);return()=>n.revert()},[k]),(0,Y.useLayoutEffect)(()=>{let e=le.current;if(!e||!n)return;let t=F.context(()=>{let t=F.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{F.set(e,{autoAlpha:1,y:0})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{F.fromTo(e,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:.2,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[n]),(0,Z.jsxs)(ge,{"data-gsap-reveal":!0,"data-state":k,className:`account-card overflow-hidden p-0`,children:[(0,Z.jsxs)(ge.Header,{className:`flex-row items-start justify-between gap-2.5 px-4 pt-3.5 pb-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Z.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-tertiary`,title:Ee,children:(0,Z.jsx)(rt,{provider:e.provider,size:20})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(ge.Title,{className:`truncate text-body leading-5`,children:e.name||e.id}),Oe?(0,Z.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-secondary px-1.5 py-px text-caption text-muted`,title:Ee,children:Oe}):null]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Z.jsx)(ge.Description,{className:`mono truncate text-caption leading-4 text-foreground/60`,title:`${e.id}${e.remote_uid?` · UID ${e.remote_uid}`:``}`,children:Ae}),(0,Z.jsx)(x,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-5 min-w-0 shrink-0 text-muted`,"aria-label":u(pe?`copied`:`copy`),onPress:()=>{f(ke).then(e=>{e&&(D(!0),window.setTimeout(()=>D(!1),1100))})},children:(0,Z.jsx)(a,{copied:pe,size:12})})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex max-w-[48%] shrink-0 flex-wrap justify-end gap-1.5`,children:[(0,Z.jsx)(`span`,{ref:ce,children:j.length&&k===`cooling`?(0,Z.jsxs)(B,{children:[(0,Z.jsx)(B.Trigger,{children:(0,Z.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,Z.jsx)(Re,{size:`sm`,variant:`soft`,color:Ce,children:R})})}),(0,Z.jsx)(B.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:u(`partialCooling`)}),j.map(([e,t])=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(`span`,{className:`mono text-foreground/65`,children:ut(t)})]},e))]})})]}):(0,Z.jsx)(Re,{size:`sm`,variant:`soft`,color:Ce,children:R})}),j.length&&k!==`cooling`?(0,Z.jsxs)(B,{children:[(0,Z.jsx)(B.Trigger,{children:(0,Z.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,Z.jsx)(Re,{size:`sm`,variant:`soft`,color:`warning`,children:u(`partialCooling`)})})}),(0,Z.jsx)(B.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:u(`partialCooling`)}),j.map(([e,t])=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(`span`,{className:`mono text-foreground/65`,children:ut(t)})]},e))]})})]}):null]})]}),(0,Z.jsxs)(ge.Content,{className:`gap-1.5 px-4 pb-3`,children:[(0,Z.jsx)(Mn,{state:k,stateCopy:R,t:u}),e.quota?(0,Z.jsx)(jn,{quota:e.quota,t:u,label:u(`quota`),usedLabel:u(`quotaUsed`),remainingLabel:u(`quotaRemaining`),addOnLabel:u(`quotaAddOn`),resourcePackageLabel:u(`quotaResourcePackage`),exceededLabel:u(`quotaExceeded`),provider:e.provider}):(0,Z.jsx)(`span`,{className:`text-caption text-foreground/65`,children:u(k===`hot`||k===`ready`||k===`loading`||k===`starting`?`quotaLoading`:`quotaUnavailable`)}),we?(0,Z.jsxs)(B,{children:[(0,Z.jsx)(B.Trigger,{children:(0,Z.jsxs)(`div`,{className:`flex w-full cursor-help gap-2 rounded-lg bg-surface-secondary p-2 text-left text-caption leading-5 text-foreground`,children:[(0,Z.jsx)(W,{size:14,className:`mt-0.5 shrink-0 text-danger`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[Te?(0,Z.jsx)(`div`,{className:`mono mb-0.5 truncate text-caption opacity-75`,children:Te}):null,(0,Z.jsx)(`p`,{className:`break-words line-clamp-3`,children:we})]})]})}),(0,Z.jsx)(B.Content,{children:(0,Z.jsxs)(`div`,{className:`max-w-md whitespace-pre-wrap break-words`,children:[Te?(0,Z.jsx)(`div`,{className:`mono mb-1 text-caption opacity-75`,children:Te}):null,we]})})]}):null,I?(0,Z.jsxs)(`div`,{className:`flex w-full items-start gap-2 rounded-lg bg-surface-secondary p-2 text-caption leading-5`,children:[I.kind===`success`?(0,Z.jsx)(H,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-success`}):I.kind===`error`?(0,Z.jsx)(qt,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-danger`}):(0,Z.jsx)(W,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-warning`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[I.kind===`success`?(0,Z.jsx)(`span`,{className:`font-medium text-success`,children:u(`checkinRecordSuccess`)}):I.kind===`already`?(0,Z.jsx)(`span`,{className:`font-medium text-warning`,children:u(`checkinRecordAlready`)}):I.kind===`skipped`?(0,Z.jsx)(`span`,{className:`font-medium text-warning`,children:u(`checkinRecordSkipped`)}):(0,Z.jsx)(`span`,{className:`font-medium text-danger`,children:u(`checkinRecordFailed`)}),I.message?(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[(0,Z.jsx)(`p`,{className:`break-words line-clamp-2 text-foreground/80`,children:I.message}),(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-caption text-muted`,children:u(`checkinTruncated`)}),(0,Z.jsxs)(x,{size:`sm`,variant:`ghost`,className:`h-6 min-w-0 gap-1 px-1.5 text-caption`,onPress:()=>{f(I.message||``).then(e=>{!e||!I||(ye(I),window.setTimeout(()=>ye(null),1100))})},children:[(0,Z.jsx)(a,{copied:L,size:13}),u(L?`copied`:`checkinCopyError`)]})]})]}):null]})]}):null]}),n&&e.enabled?(0,Z.jsx)(`section`,{ref:le,className:`grid gap-3 bg-surface-secondary/55 px-3 py-3`,children:e.provider===`doubaowork`?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:u(`doubaoCookieLabel`)}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-caption leading-5 text-muted`,children:u(`doubaoCookieLead`)}),(0,Z.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,children:[(0,Z.jsxs)(Se,{className:`flex-1`,type:`password`,value:l,onChange:p,children:[(0,Z.jsx)(de,{className:`sr-only`,children:u(`doubaoCookieLabel`)}),(0,Z.jsx)(M,{placeholder:u(`doubaoCookiePh`),"aria-label":u(`doubaoCookieLabel`)})]}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:t===`pat`,onPress:ee,children:[(0,Z.jsx)(Be,{size:14}),u(`doubaoSaveCookie`)]})]}),o?(0,Z.jsx)(`p`,{className:`mt-1 text-caption text-muted`,children:o}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:u(`oauthDeviceFlow`)}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-caption leading-5 text-muted`,children:e.provider===`codex`?u(`wizardCodexBrowserLead`):u(`qoderLoginHint`)}),(0,Z.jsx)(`div`,{className:`mt-2.5 flex flex-wrap gap-2`,children:e.provider===`codex`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(x,{size:`sm`,isPending:t===`device`,onPress:()=>m(`cli`),children:[(0,Z.jsx)(_,{size:14}),u(`startCodexCliLogin`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`chatgpt`),children:[(0,Z.jsx)(_,{size:14}),u(`startCodexChatGPTLogin`)]})]}):e.provider===`kiro`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(x,{size:`sm`,isPending:t===`device`,onPress:()=>m(`builder_id`),children:[(0,Z.jsx)(_,{size:14}),u(`kiroLoginBuilder`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`idc`),children:[(0,Z.jsx)(_,{size:14}),u(`kiroLoginIDC`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`microsoft`),children:[(0,Z.jsx)(_,{size:14}),u(`kiroLoginMicrosoft`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`sso`),children:[(0,Z.jsx)(_,{size:14}),u(`kiroLoginSSO`)]})]}):(0,Z.jsxs)(x,{size:`sm`,isPending:t===`device`,onPress:()=>m(),children:[(0,Z.jsx)(_,{size:14}),u(`startBrowserLogin`)]})}),(e.provider===`trae`||e.provider===`codex`||e.provider===`devin`||e.provider===`kiro`)&&te&&g?(0,Z.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:u(`wizardCallbackLead`)}),(0,Z.jsx)(s,{className:`h-24 w-full resize-none font-mono text-caption leading-5`,value:h||``,onChange:e=>g(e.target.value),placeholder:u(`wizardCallbackPh`),"aria-label":u(`wizardCallbackPh`)}),(0,Z.jsx)(x,{size:`sm`,variant:`secondary`,isPending:t===`callback`,onPress:te,children:u(`wizardSubmitCallback`)})]}):null]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:u(`patFallback`)}),(0,Z.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,children:[(0,Z.jsxs)(Se,{className:`flex-1`,type:`password`,value:l,onChange:p,children:[(0,Z.jsx)(de,{className:`sr-only`,children:u(`pat`)}),(0,Z.jsx)(M,{placeholder:u(`pasteToken`),"aria-label":u(`pat`)})]}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:t===`pat`,onPress:ee,children:[(0,Z.jsx)(Be,{size:14}),u(`usePat`)]})]})]}),r||o?(0,Z.jsxs)(`div`,{className:`text-caption`,children:[r?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:u(`authUrl`)}),(0,Z.jsx)(`code`,{className:`mono block break-all text-foreground`,children:r}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,onPress:()=>window.open(r,`_blank`,`noopener,noreferrer`),children:[(0,Z.jsx)(c,{size:14}),u(`openAuthUrl`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`ghost`,onPress:()=>{f(r).then(e=>{e&&(fe(!0),window.setTimeout(()=>fe(!1),1100))})},children:[(0,Z.jsx)(a,{copied:ue}),u(ue?`copied`:`copy`)]})]})]}):null,o?(0,Z.jsx)(`p`,{className:`mt-1 text-muted`,children:o}):null]}):null]})}):null,w?(0,Z.jsxs)(`div`,{className:`mt-auto flex items-center justify-between gap-2 px-4 pb-2.5 text-caption text-muted`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(B.Trigger,{children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 cursor-help flex-wrap items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-foreground/75`,children:u(`checkinStatus`)}),(0,Z.jsx)(`span`,{className:je===`error`?`text-danger`:``,children:u(Me)}),Ne?null:(0,Z.jsx)(`span`,{className:`whitespace-nowrap rounded-full bg-warning/15 px-1.5 py-px font-medium text-warning`,children:u(`checkinPending`)})]})}),(0,Z.jsxs)(B.Content,{children:[e.last_checkin_at?new Date(e.last_checkin_at).toLocaleString():u(`lastCheckinNone`),e.last_checkin_msg?` · ${e.last_checkin_msg}`:``]})]}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(B.Trigger,{children:(0,Z.jsxs)(`span`,{className:`flex shrink-0 cursor-help items-center gap-1.5 whitespace-nowrap`,children:[(0,Z.jsx)(`span`,{children:u(`checkinDaily`)}),(0,Z.jsx)(`span`,{className:`mono text-caption text-foreground/55`,children:e.checkin_time||b}),(0,Z.jsx)(xe,{isSelected:!!e.auto_checkin,isDisabled:!!t,ariaLabel:u(`autoCheckin`),onChange:e=>C?.(e)})]})}),(0,Z.jsx)(B.Content,{children:e.checkin_time?u(`checkinCustom`):u(`checkinInherit`)})]})]}):null,(0,Z.jsxs)(ge.Footer,{className:`flex flex-nowrap items-center gap-1 bg-surface-secondary px-2 py-2${w?``:` mt-auto`}`,children:[re?(0,Z.jsxs)(B,{children:[(0,Z.jsx)(B.Trigger,{children:(0,Z.jsx)(x,{isIconOnly:!0,size:`sm`,variant:`ghost`,isPending:t===`refresh`,onPress:re,"aria-label":u(`refreshAccount`),children:(0,Z.jsx)(We,{size:15})})}),(0,Z.jsx)(B.Content,{children:u(`refreshAccount`)})]}):null,(0,Z.jsxs)(B,{children:[(0,Z.jsx)(B.Trigger,{children:(0,Z.jsx)(x,{isIconOnly:!0,size:`sm`,variant:n?`secondary`:`ghost`,isDisabled:!e.enabled,onPress:oe,"aria-label":u(`authentication`),children:(0,Z.jsx)(Be,{size:15})})}),(0,Z.jsx)(B.Content,{children:u(`authentication`)})]}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(B.Trigger,{children:(0,Z.jsx)(x,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:ae,"aria-label":u(`editAccount`),children:(0,Z.jsx)(zt,{size:15})})}),(0,Z.jsx)(B.Content,{children:u(`editAccount`)})]}),(0,Z.jsxs)(pn,{children:[(0,Z.jsx)(pn.Trigger,{children:(0,Z.jsxs)(x,{isIconOnly:!0,size:`sm`,variant:me?`secondary`:`ghost`,isPending:t===`checkin`,"aria-label":u(`more`),className:`relative`,children:[(0,Z.jsx)(Nt,{size:16}),j.length?(0,Z.jsx)(`span`,{className:`absolute top-1 right-1 size-1.5 rounded-full bg-warning`,"aria-hidden":!0}):null]})}),(0,Z.jsx)(pn.Popover,{placement:`bottom start`,children:(0,Z.jsxs)(pn.Menu,{"aria-label":u(`more`),disabledKeys:!e.enabled||t?[`checkin`]:[],onAction:e=>{e===`models`&&se(),e===`cooldowns`&&he(e=>!e),e===`checkin`&&w?.(),e===`checkin-records`&&T?.(),e===`export`&&ne(),e===`delete`&&ie()},children:[(0,Z.jsxs)(pn.Item,{id:`models`,textValue:u(`accountModels`),children:[(0,Z.jsx)(He,{size:15}),u(`accountModels`)]}),(0,Z.jsxs)(pn.Item,{id:`cooldowns`,textValue:u(`modelCooldowns`),children:[(0,Z.jsx)(Ut,{size:15,className:j.length?`text-warning`:void 0}),u(`modelCooldowns`),j.length?(0,Z.jsx)(`span`,{className:`mono ml-auto text-caption text-warning`,children:j.length}):null]}),w?(0,Z.jsxs)(pn.Item,{id:`checkin`,textValue:u(`checkinNow`),children:[(0,Z.jsx)(kt,{size:15}),u(`checkinNow`)]}):null,T?(0,Z.jsxs)(pn.Item,{id:`checkin-records`,textValue:u(`checkinRecords`),children:[(0,Z.jsx)(i,{size:15}),u(`checkinRecords`)]}):null,e.auth_type===`none`?null:(0,Z.jsxs)(pn.Item,{id:`export`,textValue:u(`export`),children:[(0,Z.jsx)(d,{size:15}),u(`export`)]}),(0,Z.jsxs)(pn.Item,{id:`delete`,textValue:u(`delete`),className:`text-danger`,children:[(0,Z.jsx)(v,{size:15}),u(`delete`)]})]})})]}),(0,Z.jsx)(`div`,{className:`ml-auto flex shrink-0 flex-nowrap items-center whitespace-nowrap`,children:(0,Z.jsx)(xe,{isSelected:!!e.enabled,isDisabled:t===`toggle`,ariaLabel:e.enabled?u(`disable`):u(`enable`),label:e.enabled?u(`enabledState`):u(`disabled`),onChange:y})})]}),me?(0,Z.jsxs)(`section`,{className:`border-t border-separator bg-surface-secondary/55 px-4 py-2.5`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:u(`modelCooldownsTitle`)}),(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:j.length})]}),j.length?(0,Z.jsx)(`div`,{className:`space-y-1`,children:j.map(([e,t])=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-surface px-2 py-1.5 text-caption`,children:[(0,Z.jsx)(`span`,{className:`mono min-w-0 truncate`,title:e,children:e}),(0,Z.jsx)(`span`,{className:`mono shrink-0 text-warning`,children:ut(t)})]},e))}):(0,Z.jsx)(`p`,{className:`text-caption text-muted`,children:u(`modelCooldownsEmpty`)})]}):null]})}function Fn(e,t){return e.status===`success`?{label:t(`checkinRecordSuccess`),color:`success`}:e.status===`already`?{label:t(`checkinRecordAlready`),color:`warning`}:e.status===`skipped`?{label:t(`checkinRecordSkipped`),color:`default`}:{label:t(`checkinRecordFailed`),color:`danger`}}function In(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Ln({account:e,t,onClose:n}){let[r,i]=(0,Y.useState)([]),[a,o]=(0,Y.useState)(!!e?.id),[s,c]=(0,Y.useState)(``),l=e?.id||``,u=t(`checkinRecordsTitle`,{name:e?.name||e?.id||``});async function d(){if(l){o(!0),c(``);try{let e=await De(l);i(e.data||[])}catch(e){i([]),c(e instanceof Error?e.message:String(e))}finally{o(!1)}}}return(0,Y.useEffect)(()=>{l&&d()},[l]),(0,Z.jsx)(P.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,Z.jsx)(P.Backdrop,{variant:`blur`,children:(0,Z.jsx)(P.Container,{size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(P.Dialog,{children:[(0,Z.jsxs)(P.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(P.Heading,{className:`text-section font-semibold`,children:u}),(0,Z.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`checkinRecordsHint`)})]}),(0,Z.jsx)(P.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ve,{size:16})})]}),(0,Z.jsxs)(P.Body,{className:`px-5 pb-2`,children:[s?(0,Z.jsx)(`div`,{className:`mb-3`,children:(0,Z.jsx)(me,{title:s})}):null,a?(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,Z.jsx)(V,{className:`h-16 w-full`}),(0,Z.jsx)(V,{className:`h-16 w-full`}),(0,Z.jsx)(V,{className:`h-16 w-full`})]}):r.length?(0,Z.jsx)(`div`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(e=>{let n=Fn(e,t);return(0,Z.jsxs)(`div`,{className:`flex items-start gap-3 px-3 py-3`,children:[(0,Z.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0`,"data-state":e.status===`error`?`warn`:`ok`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(Re,{size:`sm`,variant:`soft`,color:n.color,children:n.label}),(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:In(e.created_at)})]}),(0,Z.jsx)(`p`,{className:`mt-1 break-words text-caption leading-5 text-foreground/75`,children:e.message||`—`})]})]},e.id)})}):(0,Z.jsx)(ve,{className:`min-h-44 rounded-3xl bg-surface-secondary`,title:t(`checkinRecordsEmpty`),hint:t(`checkinRecordsHint`)})]}),(0,Z.jsxs)(P.Footer,{className:`justify-between px-5 pb-5`,children:[(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:t(`checkinRecordsCount`,{count:r.length})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(x,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:a,onPress:()=>void d(),children:[(0,Z.jsx)(We,{size:14}),t(`refresh`)]})]})]})]})})})})}function Rn(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function zn({account:e,t,onClose:n}){let[r,i]=(0,Y.useState)([]),[a,o]=(0,Y.useState)(!!e?.id),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(1),[p,m]=(0,Y.useState)(20),[h,g]=(0,Y.useState)(0),[_,v]=(0,Y.useState)(1),te=(0,Y.useRef)(0),ne=e?.id||``,re=t(`accountModelsTitle`,{name:e?.name||e?.id||``}),ie=e?it(e.provider,e.region,t):``;async function y(e=1,t=p,n=!1){if(!ne)return;let r=++te.current;n?c(!0):o(!0),u(``);try{let a=await(n?Te(ne,void 0,{page:e,pageSize:t}):q(ne,!1,void 0,{page:e,pageSize:t})),o=a.data||[],s=a.pagination,c=s?.total??o.length,l=s?.total_pages??Math.max(1,Math.ceil(c/t)),u=Math.min(Math.max(1,s?.page??e),l);if(r!==te.current)return;i(s?o:o.slice((u-1)*t,u*t)),g(c),v(l),f(u)}catch(e){if(r!==te.current)return;i([]),g(0),v(1),u(e instanceof Error?e.message:String(e))}finally{r===te.current&&(o(!1),c(!1))}}(0,Y.useEffect)(()=>{ne&&(f(1),y(1,p))},[ne]);let b=h===0?0:(d-1)*p+1,S=h===0?0:Math.min(h,b+r.length-1);return(0,Z.jsx)(P.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,Z.jsx)(P.Backdrop,{variant:`blur`,children:(0,Z.jsx)(P.Container,{size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(P.Dialog,{children:[(0,Z.jsxs)(P.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(P.Heading,{className:`text-section font-semibold`,children:re}),(0,Z.jsx)(`p`,{className:`mt-1 text-caption font-normal leading-5 text-muted`,children:t(`accountModelsHint`)}),e?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-caption text-muted`,children:[(0,Z.jsx)(rt,{provider:e.provider,size:14}),(0,Z.jsx)(`span`,{children:ie}),(0,Z.jsx)(`span`,{className:`text-border`,children:`·`}),(0,Z.jsx)(`span`,{className:`mono`,children:e.id})]}):null]}),(0,Z.jsx)(P.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ve,{size:16})})]}),(0,Z.jsxs)(P.Body,{className:`px-5 pb-2`,children:[l?(0,Z.jsx)(`div`,{className:`mb-3`,children:(0,Z.jsx)(me,{title:t(`accountModelsError`,{msg:l})})}):null,a||s?(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,Z.jsx)(V,{className:`h-14 w-full`}),(0,Z.jsx)(V,{className:`h-14 w-full`}),(0,Z.jsx)(V,{className:`h-14 w-full`})]}):r.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(n=>{let r=n.provider||n.owned_by||e?.provider||`qoder`,i=Rn(n),a=tt(n),o=nt(n);return(0,Z.jsxs)(`li`,{className:`flex items-start gap-3 px-3 py-2.5`,children:[(0,Z.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":n.stale?void 0:`ok`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body font-medium`,children:n.display_name||n.id}),o?(0,Z.jsx)(Re,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null,a?(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:a}):null,n.stale?(0,Z.jsx)(Re,{size:`sm`,variant:`soft`,color:`warning`,children:t(`fallback`)}):null]}),(0,Z.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:n.id}),i?(0,Z.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:t(`routedTo`,{model:i})}):null]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 pt-0.5 text-caption text-muted`,children:[(0,Z.jsx)(rt,{provider:r,size:12}),(0,Z.jsx)(`span`,{children:r})]})]},n.id)})}):(0,Z.jsx)(ve,{className:`min-h-48 rounded-3xl bg-surface-secondary`,icon:(0,Z.jsx)(He,{size:22}),title:t(`accountModelsEmpty`),hint:t(`noModelsYet`)})]}),(0,Z.jsxs)(P.Footer,{className:`flex-col items-stretch gap-3 px-5 pb-5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`refreshing`):t(`shownTotal`,{shown:h?`${b}–${S}`:0,total:h})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(x,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:s,onPress:()=>void y(1,p,!0),children:[(0,Z.jsx)(We,{size:14}),t(s?`refreshing`:`refresh`)]})]})]}),h>0?(0,Z.jsx)(ee,{total:h,page:d,pageCount:_,pageSize:p,loading:a||s,pageSizeLabel:t(`logsPageSize`),pageLabel:t(`logsPage`,{page:d,pages:_}),prevLabel:t(`logsPrevPage`),nextLabel:t(`logsNextPage`),onPage:e=>void y(e,p),onPageSize:e=>{m(e),y(1,e)}}):null]})]})})})})}function Bn({catalog:e,selected:t,onChange:n,isDisabled:r,t:i}){let[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(t),l=(0,Y.useMemo)(()=>new Set(t),[t]),u=(0,Y.useMemo)(()=>{let t=new Set(s),n=a.trim().toLowerCase(),r=(e||[]).filter(e=>!n||e.toLowerCase().includes(n));return[...r.filter(e=>t.has(e)),...r.filter(e=>!t.has(e))]},[e,a,s]),d=(0,Y.useMemo)(()=>{if(!e)return[];let n=new Set(e);return t.filter(e=>!n.has(e))},[e,t]),f=e?.length??0,p=t.filter(e=>!d.includes(e)).length;function m(e){o(e),c(t)}function ee(e,r){n(r?[...t,e]:t.filter(t=>t!==e))}function h(){let e=new Set(t);u.forEach(t=>e.add(t)),n([...e])}function g(){let e=new Set(u);n(t.filter(t=>!e.has(t)))}return(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(ye,{"aria-label":i(`modelPickerSearch`),value:a,onChange:m,isDisabled:r,className:`min-w-0 flex-1 basis-48`,children:(0,Z.jsxs)(ye.Group,{children:[(0,Z.jsx)(ye.SearchIcon,{}),(0,Z.jsx)(ye.Input,{placeholder:i(`modelPickerSearch`)}),(0,Z.jsx)(ye.ClearButton,{})]})}),(0,Z.jsx)(`span`,{className:`mono shrink-0 text-caption text-muted`,children:i(`modelPickerCount`,{selected:p,total:f})}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,Z.jsxs)(x,{size:`sm`,variant:`ghost`,isDisabled:r||u.length===0,onPress:h,children:[(0,Z.jsx)(jt,{size:14}),i(`modelPickerSelectAll`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`ghost`,isDisabled:r||t.length===0,onPress:g,children:[(0,Z.jsx)(Vt,{size:14}),i(`modelPickerClear`)]})]})]}),(0,Z.jsxs)(`div`,{className:`max-h-[300px] overflow-y-auto overscroll-contain rounded-lg bg-surface-secondary p-1`,children:[e===null?(0,Z.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(`refreshing`)}):null,d.map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md px-2.5 py-1.5`,children:[(0,Z.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-body text-muted line-through`,children:e}),(0,Z.jsx)(`span`,{className:`shrink-0 text-caption text-warning`,children:i(`modelPickerOffline`)}),(0,Z.jsx)(x,{isIconOnly:!0,size:`sm`,variant:`ghost`,isDisabled:r,"aria-label":i(`modelPickerRemove`,{model:e}),onPress:()=>ee(e,!1),children:(0,Z.jsx)(Ve,{size:14})})]},`offline-${e}`)),u.map(e=>(0,Z.jsx)(_e,{isSelected:l.has(e),isDisabled:r,onChange:t=>ee(e,t),className:`flex w-full cursor-pointer rounded-md px-2.5 py-1.5 transition-colors hover:bg-default`,children:(0,Z.jsxs)(_e.Content,{className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,Z.jsx)(_e.Control,{children:(0,Z.jsx)(_e.Indicator,{})}),(0,Z.jsx)(`span`,{className:`mono min-w-0 truncate text-body text-foreground`,children:e})]})},e)),e!==null&&u.length===0?(0,Z.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(f===0?`noAccountModels`:`modelPickerNoMatch`)}):null]})]})}function Vn(e){let[t,n]=(0,Y.useState)(e);e&&!t&&n(!0);let r=(0,Y.useRef)(null),i=(0,Y.useRef)(null),a=(0,Y.useRef)(e);return(0,Y.useLayoutEffect)(()=>{let t=r.current,o=i.current;if(!t||!o)return;if(a.current){a.current=!1;return}F.killTweensOf([t,o]);let s=t.getBoundingClientRect().height;if(e){F.set(t,{overflow:`hidden`});let e=t.scrollHeight;F.fromTo(t,{height:s===e?0:s},{height:e,duration:G(Le.base),ease:Ye.out,onComplete:()=>F.set(t,{clearProps:`height,overflow`})}),F.fromTo(o,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:G(Le.base),ease:Ye.out})}else F.set(t,{overflow:`hidden`,height:s}),F.to(o,{autoAlpha:0,y:-4,duration:G(Le.fast),ease:Ye.inOut}),F.to(t,{height:0,duration:G(Le.fast+.04),ease:Ye.inOut,onComplete:()=>n(!1)});return()=>{F.killTweensOf([t,o])}},[e,t]),{mounted:t,outerRef:r,innerRef:i}}function Hn({account:e,checkinDefaultTime:t,checkinTimezone:n,busy:r,t:i,onClose:a,onSave:o}){let[s,c]=(0,Y.useState)(e?.name||``),[l,u]=(0,Y.useState)(e?.max_inflight??4),[d,f]=(0,Y.useState)(e?.priority??50),[p,m]=(0,Y.useState)(e?.credit_floor==null?`inherit`:`custom`),[ee,h]=(0,Y.useState)(e?.credit_floor??0),[g,_]=(0,Y.useState)(e?.percent_floor==null?`inherit`:`custom`),[v,te]=(0,Y.useState)(e?.percent_floor??0),[ne,re]=(0,Y.useState)(e?.proxy_url||``),[ie,y]=(0,Y.useState)(!!e?.drop_system_prompt),[b,S]=(0,Y.useState)(Object.entries(e?.model_aliases||{}).map(([e,t])=>({alias:e,model:t}))),[C,w]=(0,Y.useState)({alias:``,model:``}),[T,E]=(0,Y.useState)(!!e?.models_restricted),[ae,oe]=(0,Y.useState)(e?.enabled_models||[]),{mounted:se,outerRef:ce,innerRef:le}=Vn(T),[ue,de]=(0,Y.useState)(null),[fe,pe]=(0,Y.useState)(!e?.checkin_time),[me,he]=(0,Y.useState)(e?.checkin_time||null),[ge,O]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{if(!e?.id)return;let t=!1;return q(e.id).then(e=>{t||de(e.data||[])}).catch(()=>{t||de([])}),()=>{t=!0}},[e?.id]);let _e=i(`editAccountTitle`,{name:e?.name||e?.id||``}),j=e?it(e.provider,e.region,i):``;async function ve(n){n?.preventDefault();let r=s.trim();if(!r){O(i(`accountNameRequired`));return}if(!Number.isInteger(l)||l<1||l>32){O(i(`maxInflightInvalid`));return}if(!Number.isInteger(d)||d<1||d>100){O(i(`priorityInvalid`));return}if(p===`custom`&&(!Number.isFinite(ee)||ee<0)){O(i(`creditFloorInvalid`));return}if(g===`custom`&&(!Number.isFinite(v)||v<0||v>100)){O(i(`percentFloorInvalid`));return}if(t!==void 0&&!fe&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(me??t)){O(i(`checkinTimeInvalid`));return}O(``);try{await o({name:r,max_inflight:l,priority:d,credit_floor:p===`custom`?ee:null,percent_floor:g===`custom`?v:null,proxy_url:ne.trim(),checkin_time:t===void 0?void 0:fe?``:me??t,drop_system_prompt:e?.provider===`workbuddy`||e?.provider===`trae`?ie:void 0,model_aliases:Object.fromEntries(b.filter(e=>e.alias.trim()&&e.model.trim()).map(e=>[e.alias.trim(),e.model.trim()])),enabled_models:T?ae:[],set_model_routing:!0}),a()}catch(e){O(e instanceof Error?e.message:String(e))}}return(0,Z.jsx)(P.Root,{isOpen:!!e,onOpenChange:e=>{!e&&!r&&a()},children:(0,Z.jsx)(P.Backdrop,{variant:`blur`,children:(0,Z.jsx)(P.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(P.Dialog,{className:`w-full sm:w-[42rem] sm:max-w-[calc(100vw-2rem)]`,children:[(0,Z.jsxs)(P.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(P.Heading,{className:`text-section font-semibold`,children:_e}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-body font-normal leading-6 text-muted`,children:i(`editAccountHint`)}),e?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(Re,{size:`sm`,variant:`soft`,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(rt,{provider:e.provider,size:14}),(0,Z.jsx)(`span`,{children:j})]})}),(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:e.id})]}):null]}),(0,Z.jsx)(P.CloseTrigger,{isDisabled:r,"aria-label":i(`close`),className:`grid size-9 shrink-0 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,Z.jsx)(Ve,{size:18})})]}),(0,Z.jsxs)(P.Body,{className:`px-6 pb-2 pt-1`,children:[ge?(0,Z.jsxs)(D,{status:`danger`,className:`mb-4`,children:[(0,Z.jsx)(D.Indicator,{}),(0,Z.jsx)(D.Content,{children:(0,Z.jsx)(D.Title,{children:ge})})]}):null,(0,Z.jsxs)(k,{className:`space-y-4`,onSubmit:e=>void ve(e),children:[(0,Z.jsx)(N,{label:i(`accountName`),children:(0,Z.jsx)(M,{value:s,onChange:e=>c(e.target.value),placeholder:i(`wizardNamePh`),"aria-label":i(`accountName`),disabled:r,autoFocus:!0})}),(0,Z.jsx)(N,{label:i(`maxInflight`),hint:i(`maxInflightHint`),children:(0,Z.jsx)(A,{value:l,onChange:e=>u(e??4),minValue:1,maxValue:32,isDisabled:r,isRequired:!0,children:(0,Z.jsxs)(A.Group,{children:[(0,Z.jsx)(A.DecrementButton,{}),(0,Z.jsx)(A.Input,{"aria-label":i(`maxInflight`)}),(0,Z.jsx)(A.IncrementButton,{})]})})}),(0,Z.jsx)(N,{label:i(`priority`),hint:i(`priorityHint`),children:(0,Z.jsx)(A,{value:d,onChange:e=>f(e??50),minValue:1,maxValue:100,isDisabled:r,isRequired:!0,children:(0,Z.jsxs)(A.Group,{children:[(0,Z.jsx)(A.DecrementButton,{}),(0,Z.jsx)(A.Input,{"aria-label":i(`priority`)}),(0,Z.jsx)(A.IncrementButton,{})]})})}),(0,Z.jsx)(N,{label:i(`creditFloor`),hint:i(`creditFloorHint`),align:`start`,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(xe,{isSelected:p===`custom`,isDisabled:r,ariaLabel:i(`creditFloorCustom`),label:i(`creditFloorCustom`),onChange:e=>m(e?`custom`:`inherit`)}),p===`custom`?(0,Z.jsx)(A,{value:ee,onChange:e=>h(e??0),minValue:0,step:1,isDisabled:r,isRequired:!0,children:(0,Z.jsxs)(A.Group,{children:[(0,Z.jsx)(A.DecrementButton,{}),(0,Z.jsx)(A.Input,{"aria-label":i(`creditFloor`)}),(0,Z.jsx)(A.IncrementButton,{})]})}):(0,Z.jsx)(`p`,{className:`text-caption text-muted`,children:i(`creditFloorInheritHint`)})]})}),(0,Z.jsx)(N,{label:i(`percentFloor`),hint:i(`percentFloorHint`),align:`start`,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(xe,{isSelected:g===`custom`,isDisabled:r,ariaLabel:i(`percentFloorCustom`),label:i(`percentFloorCustom`),onChange:e=>_(e?`custom`:`inherit`)}),g===`custom`?(0,Z.jsx)(A,{value:v,onChange:e=>te(e??0),minValue:0,maxValue:100,step:1,isDisabled:r,isRequired:!0,children:(0,Z.jsxs)(A.Group,{children:[(0,Z.jsx)(A.DecrementButton,{}),(0,Z.jsx)(A.Input,{"aria-label":i(`percentFloor`)}),(0,Z.jsx)(A.IncrementButton,{})]})}):(0,Z.jsx)(`p`,{className:`text-caption text-muted`,children:i(`percentFloorInheritHint`)})]})}),(0,Z.jsx)(N,{label:i(`proxyUrl`),hint:i(`proxyUrlHint`),children:(0,Z.jsx)(M,{value:ne,onChange:e=>re(e.target.value),placeholder:i(`proxyUrlPlaceholder`),"aria-label":i(`proxyUrl`),disabled:r})}),e?.provider===`workbuddy`||e?.provider===`trae`?(0,Z.jsx)(N,{label:i(`dropSystemPrompt`),hint:i(e?.provider===`trae`?`dropSystemPromptTraeHint`:`dropSystemPromptHint`),children:(0,Z.jsx)(xe,{isSelected:ie,isDisabled:r,ariaLabel:i(`dropSystemPrompt`),onChange:y})}):null,(0,Z.jsx)(N,{align:`start`,label:i(`accountModelAliases`),hint:i(`accountModelAliasesHint`),children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[b.map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsxs)(`span`,{className:`mono min-w-0 truncate text-body`,children:[e.alias,` → `,e.model]}),(0,Z.jsx)(x,{size:`sm`,variant:`ghost`,isDisabled:r,onPress:()=>S(t=>t.filter(t=>t.alias!==e.alias)),children:i(`modelAliasRemove`)})]},e.alias)),(0,Z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_1fr_auto]`,children:[(0,Z.jsx)(M,{"aria-label":i(`modelAliasName`),value:C.alias,onChange:e=>w(t=>({...t,alias:e.target.value})),placeholder:i(`modelAliasPlaceholder`),disabled:r}),(0,Z.jsx)(M,{"aria-label":i(`modelAliasTarget`),value:C.model,onChange:e=>w(t=>({...t,model:e.target.value})),placeholder:i(`accountModelAliasTargetPlaceholder`),disabled:r}),(0,Z.jsx)(x,{size:`sm`,variant:`secondary`,isDisabled:r||!C.alias.trim()||!C.model.trim(),onPress:()=>{S(e=>[...e.filter(e=>e.alias!==C.alias.trim()),{alias:C.alias.trim(),model:C.model.trim()}]),w({alias:``,model:``})},children:i(`modelAliasAdd`)})]})]})}),(0,Z.jsxs)(`section`,{className:`space-y-3 pt-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-body font-medium text-foreground`,children:i(`enabledModels`)}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:i(`enabledModelsHint`)})]}),(0,Z.jsx)(xe,{isSelected:T,isDisabled:r,ariaLabel:i(`restrictModels`),label:i(T?`restrictModels`:`allModels`),onChange:E})]}),se?(0,Z.jsx)(`div`,{ref:ce,children:(0,Z.jsx)(`div`,{ref:le,children:(0,Z.jsx)(Bn,{catalog:ue?ue.map(e=>e.id):null,selected:ae,onChange:oe,isDisabled:r,t:i})})}):null]}),t===void 0?null:(0,Z.jsx)(N,{label:i(`autoCheckinTime`),hint:i(`checkinScheduleHint`),children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(xe,{isSelected:fe,isDisabled:r,onChange:pe,ariaLabel:i(`checkinInherit`),label:i(`checkinInherit`)}),(0,Z.jsxs)(`p`,{className:`text-caption text-muted`,children:[i(`checkinDefaultValue`,{time:t}),` · `,(0,Z.jsx)(`span`,{className:`mono`,children:n})]}),fe?null:(0,Z.jsx)(M,{type:`time`,value:me??t,onChange:e=>he(e.target.value),"aria-label":i(`autoCheckinTime`),disabled:r,required:!0})]})})]})]}),(0,Z.jsxs)(P.Footer,{className:`justify-end gap-2 px-6 pb-6`,children:[(0,Z.jsx)(x,{variant:`ghost`,isDisabled:r,onPress:a,children:i(`cancel`)}),(0,Z.jsx)(x,{isPending:r,onPress:()=>void ve(),children:i(`save`)})]})]})})})})}var Un={1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-3`};function Wn({options:e,value:t,onChange:n,ariaLabel:r,columns:i=2,className:a=``}){let o=(0,Y.useRef)(null);return(0,Y.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=F.context(()=>{let e=F.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{F.set(`[data-option-tile]`,{autoAlpha:1,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{F.fromTo(`[data-option-tile]`,{autoAlpha:0,y:8},{autoAlpha:1,y:0,duration:.32,stagger:.035,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[e.length]),(0,Z.jsx)(`div`,{ref:o,role:`radiogroup`,"aria-label":r,className:`grid gap-3 ${Un[i]} ${a}`.trim(),children:e.map(e=>{let r=e.value===t;return(0,Z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"data-option-tile":``,"data-selected":r||void 0,disabled:e.disabled,title:e.hint,onClick:()=>n(e.value),className:`flex h-16 min-w-0 items-center gap-3 rounded-xl bg-surface shadow-surface px-4 text-left transition-colors hover:bg-surface-secondary disabled:cursor-not-allowed disabled:opacity-50 data-selected:border-accent data-selected:bg-accent-soft`,children:[e.icon?(0,Z.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground [&_svg]:size-[18px]`,children:e.icon}):null,(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body font-medium leading-5 text-foreground`,children:e.label})]},e.value)})})}var Gn=new Set([`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`]),Kn=[`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`];function qn(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>{let r=n.get(e.id)??2**53-1,i=n.get(t.id)??2**53-1;return r===i?e.label.localeCompare(t.label):r-i})}function Jn(e,t){return!t||`${e.label} ${e.subtitle||``} ${e.hint||``} ${e.provider} ${e.id}`.toLowerCase().includes(t)}function Yn({ariaLabel:e}){return(0,Z.jsx)(`div`,{className:`space-y-8`,"aria-busy":`true`,"aria-label":e,children:Array.from({length:2},(e,t)=>(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(Ge,{className:`h-3 w-24 rounded-lg`}),(0,Z.jsx)(Ge,{className:`h-3 w-40 rounded-lg`})]}),(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:Array.from({length:t===0?5:6},(e,t)=>(0,Z.jsxs)(`div`,{className:`card flex flex-row items-center gap-3.5 rounded-xl bg-surface px-4 py-3.5`,children:[(0,Z.jsx)(Ge,{className:`size-10 shrink-0 rounded-lg`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,Z.jsx)(Ge,{className:`h-3.5 w-28 rounded-lg`}),(0,Z.jsx)(Ge,{className:`h-3 w-36 rounded-lg`})]})]},t))})]},t))})}function Xn({tile:e,disabled:t,onSelect:n}){return(0,Z.jsxs)(`button`,{type:`button`,disabled:t,title:e.hint||e.subtitle||e.label,onClick:()=>n(e.id),className:`card flex min-w-0 flex-row items-center gap-3 rounded-xl bg-surface px-3.5 py-3 text-left transition-[transform,opacity,background-color] duration-200 ease-out hover:bg-surface-secondary active:translate-y-px active:scale-[0.98] motion-reduce:transition-none motion-reduce:active:translate-y-0 motion-reduce:active:scale-100 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:translate-y-0 disabled:active:scale-100`,children:[(0,Z.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg text-foreground [&_svg]:size-[18px]`,children:(0,Z.jsx)(rt,{provider:e.provider,size:18})}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`block truncate text-body font-medium leading-5 text-foreground`,children:e.label}),e.subtitle?(0,Z.jsx)(`span`,{className:`mt-0.5 block truncate text-caption leading-4 text-muted`,children:e.subtitle}):null]})]})}function Zn({title:e,subtitle:t,tiles:n,disabled:r,onSelect:i}){return n.length?(0,Z.jsxs)(`section`,{className:`space-y-3.5`,children:[(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(`h3`,{className:`text-[10px] font-semibold tracking-[0.12em] uppercase text-muted`,children:e}),t?(0,Z.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:n.map(e=>(0,Z.jsx)(Xn,{tile:e,disabled:r,onSelect:i},e.id))})]}):null}function Qn({options:e,onSelect:t,disabled:n,empty:r,ariaLabel:i}){let{t:a}=ie(),[o,s]=(0,Y.useState)(``),c=o.trim().toLowerCase(),l=(0,Y.useMemo)(()=>{let t=qn(e.filter(e=>Gn.has(e.id)),Kn),n=e.filter(e=>!Gn.has(e.id)).sort((e,t)=>e.label.localeCompare(t.label));return[{id:`subscriptions`,titleKey:`providerGroupSubscriptions`,subtitleKey:`providerGroupSubscriptionsHint`,tiles:t.filter(e=>Jn(e,c))},{id:`experimental`,titleKey:`providerGroupExperimental`,subtitleKey:`providerGroupExperimentalHint`,tiles:n.filter(e=>Jn(e,c))}]},[c,e]),u=l.reduce((e,t)=>e+t.tiles.length,0);return(0,Z.jsxs)(`div`,{className:`space-y-8`,role:`listbox`,"aria-label":i,children:[(0,Z.jsx)(h,{value:o,onChange:s,placeholder:a(`providerFindPlaceholder`),ariaLabel:a(`providerFindPlaceholder`),className:`max-w-sm`}),u===0?r||(0,Z.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:a(`providerFindEmpty`)}):l.map(e=>(0,Z.jsx)(Zn,{title:a(e.titleKey),subtitle:a(e.subtitleKey),tiles:e.tiles,disabled:n,onSelect:t},e.id))]})}var $n={"workbuddy-accounts":`workbuddy`,"workbuddy-oauth-v1":`workbuddy`,"qoder-native-v1":`qoder`,"trae-oauth-v1":`trae`,"devin-session-v1":`devin`,"command-key-v1":`command`,"codex-oauth-v1":`codex`,"zhipu-key-v1":`zhipu`,"qwenwork-oauth-v1":`qwenwork`,"meta-oauth-v1":`meta`,"meta-key-v1":`meta`,"kiro-oauth-v1":`kiro`,"doubaowork-cookie-v1":`doubaowork`},er=[`codebuddy.cn`,`workbuddy.cn`],tr=[`workbuddy.ai`,`workbuddy.com`],nr=new Set([`us-east-1`,`eu-central-1`]),rr=/arn:aws:codewhisperer:([a-z0-9-]+):/;function Q(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function $(e){return typeof e==`string`?e.trim():``}function ir(e){let t=e.trim();if(!t)return``;let n=t.toLowerCase();return n===`workbuddy-accounts`?`workbuddy-accounts`:n}function ar(e){return typeof e.format==`string`&&e.format.trim()?ir(e.format):typeof e.exportType==`string`&&e.exportType.trim()?ir(e.exportType):``}function or(e){let t=[],n=e=>{typeof e==`string`&&e.trim()&&t.push(e.trim().toLowerCase())};if(n(e.domain),Q(e.account)&&n(e.account.domain),Q(e.auth)&&n(e.auth.domain),Array.isArray(e.accounts))for(let t of e.accounts)Q(t)&&(n(t.domain),Q(t.account)&&n(t.account.domain),Q(t.auth)&&n(t.auth.domain));return t}function sr(e){return er.some(t=>e.includes(t))}function cr(e){return tr.some(t=>e.includes(t))}function lr(e){return typeof e.accessToken==`string`||typeof e.access_token==`string`||typeof e.refreshToken==`string`||typeof e.refresh_token==`string`}function ur(e){if(!Q(e))return!1;if(lr(e)||typeof e.domain==`string`||typeof e.uid==`string`)return!0;if(Q(e.account)||Q(e.auth)){let t=Q(e.account)?e.account:null,n=Q(e.auth)?e.auth:null;if(n&&(lr(n)||typeof n.domain==`string`)||t&&(typeof t.uid==`string`||typeof t.domain==`string`))return!0}return!1}function dr(e){let t=or(e);if(t.length===0)return{region:`cn`,ambiguous:!0,warning:`region_unknown`};let n=t.some(sr),r=t.some(cr);return n&&r?{region:null,ambiguous:!0,warning:`region_mixed`}:n?{region:`cn`,ambiguous:!1}:r?{region:`global`,ambiguous:!1}:{region:`cn`,ambiguous:!0,warning:`region_unknown`}}function fr(e){let t=$(e.region).toLowerCase();if(nr.has(t))return t;if(t===`eu`||t===`europe`)return`eu-central-1`;let n=$(e.profileArn)||$(e.profile_arn),r=rr.exec(n);if(r&&nr.has(r[1]))return r[1];for(let t of[`kiroApiKey`,`apiKey`,`api_key`,`accessToken`,`access_token`]){let n=$(e[t]),r=n.split(`|`);if(n.startsWith(`ksk_`)&&r.length===2&&nr.has(r[1].trim().toLowerCase()))return r[1].trim().toLowerCase()}return null}function pr(e){if(ar(e)===`kiro-oauth-v1`||fr(e))return!0;let t=($(e.authMethod)||$(e.auth_method)).toLowerCase();if([`builder_id`,`builderid`,`external_idp`,`idc`,`social`].includes(t))return!0;let n=$(e.provider).toLowerCase();if([`builderid`,`kiro`,`apikey`,`github`,`google`,`social`].includes(n))return!0;for(let t of[`kiroApiKey`,`apiKey`,`api_key`,`accessToken`,`access_token`])if($(e[t]).startsWith(`ksk_`))return!0;let r=$(e.clientId)||$(e.client_id),i=$(e.clientSecret)||$(e.client_secret),a=$(e.refreshToken)||$(e.refresh_token),o=$(e.startUrl)||$(e.start_url);if(r&&i&&a||o.includes(`awsapps.com`)&&a||($(e.profileArn)||$(e.profile_arn)).includes(`codewhisperer`)&&(a||$(e.accessToken)||$(e.access_token)))return!0;let s=$(e.tokenEndpoint)||$(e.token_endpoint),c=$(e.issuerUrl)||$(e.issuer_url);return!!((s.includes(`microsoftonline`)||c.includes(`microsoftonline`))&&a)}function mr(e){return Array.isArray(e.accounts)?e.accounts.filter(e=>Q(e)&&pr(e)):[]}function hr(e){return pr(e)||mr(e).length>0?{format:`kiro-oauth-v1`,provider:`kiro`,confidence:`medium`}:Array.isArray(e.accounts)&&e.accounts.some(ur)?{format:`workbuddy-accounts`,provider:`workbuddy`,confidence:`medium`}:(typeof e.user_blob==`string`||typeof e.userBlob==`string`)&&(typeof e.machine_id==`string`||typeof e.machineId==`string`)?{format:`qoder-native-v1`,provider:`qoder`,confidence:`medium`}:typeof e.session_token==`string`||typeof e.sessionToken==`string`?{format:`devin-session-v1`,provider:`devin`,confidence:`low`}:lr(e)||Q(e.account)&&lr(e.account)||Q(e.auth)?{format:`workbuddy-oauth-v1`,provider:`workbuddy`,confidence:`low`}:typeof e.dca_token==`string`||typeof e.dcaToken==`string`||typeof e.access_token==`string`&&String(e.access_token).startsWith(`dca:`)||typeof e.accessToken==`string`&&String(e.accessToken).startsWith(`dca:`)?{format:`meta-oauth-v1`,provider:`meta`,confidence:`medium`}:typeof e.api_key==`string`||typeof e.apiKey==`string`?typeof e.organization==`string`||typeof e.project==`string`?{format:`zhipu-key-v1`,provider:`zhipu`,confidence:`low`}:typeof e.base_url==`string`&&String(e.base_url).includes(`meta.ai`)||typeof e.baseUrl==`string`&&String(e.baseUrl).includes(`meta.ai`)||typeof e.email==`string`?{format:`meta-key-v1`,provider:`meta`,confidence:`low`}:{format:`command-key-v1`,provider:`command`,confidence:`low`}:{format:null,provider:null,confidence:`low`}}function gr(e){let t=mr(e),n=t.length>0?t:[e],r=new Set(n.map(fr).filter(e=>e!=null));return r.size===1?{region:[...r][0],ambiguous:!1}:(r.size,{region:null,ambiguous:!0})}function _r(e){if(!Q(e))return{format:null,provider:null,region:null,regionAmbiguous:!0,confidence:`low`,warnings:[`not_object`],batchImportSupported:!1};let t=[],n=ar(e),r=typeof e.format==`string`?e.format.trim():``,i=typeof e.exportType==`string`?e.exportType.trim():``,a=r||i,o=n||null,s=o?$n[o]??null:null,c=o&&s?`high`:`low`;if(!s){let r=hr(e);o||=r.format,s=r.provider,c=n&&!$n[n]?`low`:r.confidence,a&&!$n[n]&&t.push(`unknown_format`)}s!==`kiro`&&(pr(e)||mr(e).length>0)&&(s=`kiro`,o=`kiro-oauth-v1`,c=n===`kiro-oauth-v1`?`high`:`medium`),s===`workbuddy`&&Array.isArray(e.accounts)&&(o=`workbuddy-accounts`);let l=null,u=!1;if(s===`workbuddy`){let n=dr(e);l=n.region,u=n.ambiguous,n.warning&&t.push(n.warning)}if(s===`kiro`){let n=gr(e);l=n.region,u=n.ambiguous,u&&t.push(mr(e).length>1?`region_mixed`:`region_unknown`)}return{format:o,provider:s,region:l,regionAmbiguous:u,confidence:c,warnings:t,batchImportSupported:s===`workbuddy`||s===`kiro`}}function vr(e){let t;try{t=JSON.parse(e)}catch{throw Error(`bad_json`)}if(Array.isArray(t)){if(t.length===0||!t.every(Q))throw Error(`bad_json`);return{accounts:t}}if(!Q(t))throw Error(`bad_json`);return t}function yr(e,t){let n={...e},r=n.format===`workbuddy-accounts`||Array.isArray(n.accounts);return n.format?r&&(n.format=`workbuddy-accounts`):n.format=r?`workbuddy-accounts`:`workbuddy-oauth-v1`,{...n,name:t.name?.trim()||n.name,enabled:t.enabled??!0,provider:`workbuddy`,region:t.region,max_inflight:t.max_inflight??4,priority:t.priority??50,drop_system_prompt:t.drop_system_prompt??!0,...t.proxy_url!=null&&t.proxy_url!==``?{proxy_url:t.proxy_url}:{}}}function br(e,t){let n=typeof e?.succeeded==`number`?e.succeeded:e?.id||e?1:0,r=typeof e?.failed==`number`?e.failed:0,i=(e?.errors||[]).slice(0,3).map(e=>e.message||`index ${e.index}`).filter(Boolean).join(`; `),a;return a=r>0?t(`accountImportPartial`).replace(`{ok}`,String(n)).replace(`{fail}`,String(r))+(i?` — ${i}`:``):n>1?t(`accountImportBatch`).replace(`{n}`,String(n)):t(`accountImported`),{succeeded:n,failed:r,message:a}}async function xr(e,t){let n=yr(e,t);return Ce(n)}var Sr={global:`Global`,cn:`CN`},Cr={"qoder-global":`accountTypeQoderGlobal`,"qoder-cn":`accountTypeQoderCN`,"workbuddy-cn":`accountTypeWorkBuddyCN`,"workbuddy-global":`accountTypeWorkBuddyGlobal`,"trae-cn":`accountTypeTraeCN`,"devin-global":`accountTypeDevinGlobal`,"command-global":`accountTypeCommandGlobal`,"codex-global":`accountTypeCodexGlobal`,"zhipu-cn":`accountTypeZhipuCN`,"qwenwork-global":`accountTypeQwenworkGlobal`,"qwenwork-cn":`accountTypeQwenworkCN`,"kimi-cn":`accountTypeKimiCN`,"codearts-cn-north-4":`accountTypeCodeArtsCN`,"doubaowork-cn":`accountTypeDoubaoworkCN`,"kiro-us-east-1":`accountTypeKiroUS`,"kiro-eu-central-1":`accountTypeKiroEU`,"meta-global":`accountTypeMetaGlobal`,"minimaxcode-cn":`accountTypeMiniMaxCodeCN`,"minimaxcode-global":`accountTypeMiniMaxCodeGlobal`},wr={"qoder-global":`accountTypeQoderGlobalHint`,"qoder-cn":`accountTypeQoderCNHint`,"workbuddy-cn":`accountTypeWorkBuddyCNHint`,"workbuddy-global":`accountTypeWorkBuddyGlobalHint`,"trae-cn":`accountTypeTraeCNHint`,"devin-global":`accountTypeDevinGlobalHint`,"command-global":`accountTypeCommandGlobalHint`,"codex-global":`accountTypeCodexGlobalHint`,"zhipu-cn":`accountTypeZhipuCNHint`,"qwenwork-global":`accountTypeQwenworkGlobalHint`,"qwenwork-cn":`accountTypeQwenworkCNHint`,"kimi-cn":`accountTypeKimiCNHint`,"codearts-cn-north-4":`accountTypeCodeArtsCNHint`,"doubaowork-cn":`accountTypeDoubaoworkCNHint`,"kiro-us-east-1":`accountTypeKiroUSHint`,"kiro-eu-central-1":`accountTypeKiroEUHint`,"meta-global":`accountTypeMetaGlobalHint`,"minimaxcode-cn":`accountTypeMiniMaxCodeCNHint`,"minimaxcode-global":`accountTypeMiniMaxCodeGlobalHint`};async function Tr(){let e=(await Pe().catch(()=>null))?.data||[],t=[];for(let n of e)for(let e of n.regions)t.push({id:`${n.id}-${e.id}`,provider:n.id,region:e.id,descriptor:n});return t}function Er(e,t){let n=Cr[e.id];if(n){let e=t(n);if(e!==n)return e}let r=e.descriptor.regions.find(t=>t.id===e.region)?.label||Sr[e.region]||``,i=e.descriptor.regions.length>1&&r?` ${r}`:``;return`${e.descriptor.label}${i}`.trim()}function Dr(e,t){if(!e)return``;let n=wr[e.id];if(!n)return``;let r=t(n);return r===n?``:r}function Or({phase:e,busy:t,tab:n,forTab:r}){return e===`done`?(0,Z.jsx)(H,{size:16,className:`text-success`}):t&&n===r?(0,Z.jsx)(Ue,{size:16,loading:!0}):null}var kr=90,Ar=2e3;function jr({isOpen:e,onClose:t,onAdded:n}){let{t:i}=ie(),[o,d]=(0,Y.useState)(`method`),[p,m]=(0,Y.useState)(`browser`),[ee,h]=(0,Y.useState)(``),[g,v]=(0,Y.useState)([]),[te,ne]=(0,Y.useState)(!1),[re,y]=(0,Y.useState)(!1),[b,S]=(0,Y.useState)(``),[C,w]=(0,Y.useState)(4),[T,E]=(0,Y.useState)(50),[ae,oe]=(0,Y.useState)(!0),[se,ce]=(0,Y.useState)(``),[le,ue]=(0,Y.useState)(``),[fe,pe]=(0,Y.useState)(``),[D,me]=(0,Y.useState)(`payg`),[he,ge]=(0,Y.useState)(``),[O,k]=(0,Y.useState)(``),[_e,ve]=(0,Y.useState)(``),[ye,be]=(0,Y.useState)(``),[Se,I]=(0,Y.useState)(`idle`),[L,R]=(0,Y.useState)(``),[we,Te]=(0,Y.useState)(``),[Ee,De]=(0,Y.useState)(!1),[ke,Ae]=(0,Y.useState)(``),[Me,Ne]=(0,Y.useState)(`cli`),[Pe,Ie]=(0,Y.useState)(`builder_id`),[Re,ze]=(0,Y.useState)(``),He=(0,Y.useRef)(null),Ue=(0,Y.useRef)(null),We=(0,Y.useRef)(null),z=(0,Y.useRef)(``),Ge=(0,Y.useRef)(null),qe=(0,Y.useRef)(null);function B(){Ge.current!==null&&(window.clearTimeout(Ge.current),Ge.current=null)}(0,Y.useEffect)(()=>()=>B(),[]),(0,Y.useEffect)(()=>{if(!e)return;let t=!1;return ne(!0),v([]),h(``),Tr().then(e=>{t||(v(e),h(``),m(`browser`))}).finally(()=>{t||ne(!1)}),()=>{t=!0}},[e]);let V=g.find(e=>e.id===ee),U=!te&&g.length>0,W=V?.descriptor.capabilities?.pat_login!==!1,Xe=V?.descriptor.capabilities?.import_export!==!1,Ze=V?.descriptor.capabilities?.browser_login!==!1,Qe=V?.provider===`workbuddy`||V?.provider===`trae`,$e=V?.provider===`trae`||V?.provider===`devin`||V?.provider===`codex`||V?.provider===`codearts`,G=Se===`busy`||Se===`polling`,K=!!z.current||G,q=Se===`done`,tt=Dr(V,i);(0,Y.useEffect)(()=>{p===`pat`&&!W&&m(`browser`),p===`import`&&!Xe&&m(`browser`)},[Xe,W,p]),(0,Y.useEffect)(()=>{Ze||(W?m(`pat`):Xe&&m(`import`))},[Ze,Xe,W]);function nt(){return!Number.isInteger(C)||C<1||C>32?4:C}function it(){return!Number.isInteger(T)||T<1||T>100?50:T}function at(){return{max_inflight:nt(),priority:it(),drop_system_prompt:Qe?ae:V?.provider!==`kimi`&&V?.provider!==`codearts`,proxy_url:se.trim()}}function ot(){B(),d(`method`),m(`browser`),h(``),v([]),ne(!1),S(``),w(4),E(50),oe(!0),ce(``),ue(``),pe(``),me(`payg`),ge(``),k(``),ve(``),be(``),y(!1),I(`idle`),R(``),Te(``),De(!1),Ae(``),Ne(`cli`),z.current=``}function st(){G||(ot(),t())}function ct(){ot(),t()}(0,Y.useLayoutEffect)(()=>{let t=He.current;if(e||(We.current=null),!t||!e)return;let n=F.context(()=>{let e=F.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{F.set(t,{autoAlpha:1,x:0,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=We.current,n=e&&e!==o?o===`login`?1:-1:0;F.fromTo(t,{autoAlpha:0,x:20*n,y:n?0:12},{autoAlpha:1,x:0,y:0,duration:Le.slow,ease:Ye.out,overwrite:!0}),n&&Ue.current&&F.fromTo(Ue.current,{autoAlpha:0,y:6},{autoAlpha:1,y:0,duration:Le.base,ease:Ye.out,overwrite:!0})})},t);return We.current=o,()=>n.revert()},[e,o]);function lt(e){if(G||!U)return;let t=g.find(t=>t.id===e);h(e),m(t?.provider===`zhipu`||t?.provider===`doubaowork`?`pat`:`browser`),oe(t?.provider!==`trae`&&t?.provider!==`kimi`&&t?.provider!==`codearts`),R(``),d(`login`)}async function ut(){if(z.current)return z.current;if(!V)throw Error(i(`accountTypeHint`));let e=at(),t=await Oe(b.trim()||i(`account`),V.provider,V.region,e),n=t?.id||t?.data?.id;if(!n)throw Error(`create account returned no id`);return z.current=n,n}async function dt(){R(``),Te(``);try{I(`busy`);let e=await ut();R(i(`wizardStartingSession`)),I(`polling`);let t=V?.provider===`codex`?Me:V?.provider===`kiro`?Pe:void 0,r=await Je(e,t,Pe===`idc`?Re.trim():void 0);r.authUrl&&Te(r.authUrl),R(i(`wizardWaitingBrowser`));for(let t=0;t{Ge.current=window.setTimeout(e,Ar)});let n=(await je(e)).login||{};if(n.message&&R(n.message),n.status===`ok`)break;if(n.status===`error`)throw Error(n.message||`login failed`);if(t===89)throw Error(i(`wizardLoginTimeout`))}I(`done`),R(i(`wizardAccountReady`)),n(),window.setTimeout(ct,900)}catch(e){I(`idle`),R(e instanceof Error?e.message:String(e))}}async function ft(){let e=ke.trim();if(!e){R(i(`wizardCallbackPh`));return}try{I(`busy`);let t=await ut();B(),await Ke(t,e),I(`done`),R(i(`wizardAccountReady`)),n(),window.setTimeout(ct,900)}catch(e){I(`polling`),R(e instanceof Error?e.message:String(e))}}async function pt(){let e=he.trim();if(!e){R(i(`zhipuKeyRequired`));return}if(!V){R(i(`accountTypeHint`));return}R(``);try{I(`busy`);let t=at();await Ce({format:`zhipu-key-v1`,api_key:e,mode:D,organization:D===`coding`?O.trim():``,project:D===`coding`?_e.trim():``,name:b.trim()||i(`accountTypeZhipuCN`),enabled:!0,provider:V.provider,region:V.region,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt,proxy_url:t.proxy_url}),I(`done`),R(i(`wizardAccountReady`)),n(),window.setTimeout(ct,700)}catch(e){I(`idle`),R(e instanceof Error?e.message:String(e))}}async function mt(){let e=le.trim();if(!e){R(i(`pastePatFirst`));return}R(``);try{I(`busy`);let t=await ut();R(i(`wizardStartingSession`)),await Fe(e,t),I(`done`),R(i(`patDone`)),n(),window.setTimeout(ct,700)}catch(e){I(`idle`),R(e instanceof Error?e.message:String(e))}}async function J(){let e=ye.trim();if(!e){R(i(`doubaoCookieRequired`));return}if(!V){R(i(`accountTypeHint`));return}R(``);try{I(`busy`);let t=at();await Ce({format:`doubaowork-cookie-v1`,cookie:e,name:b.trim()||i(`accountTypeDoubaoworkCN`),enabled:!0,provider:V.provider,region:V.region,max_inflight:t.max_inflight,priority:t.priority,drop_system_prompt:t.drop_system_prompt,proxy_url:t.proxy_url}),I(`done`),R(i(`wizardAccountReady`)),n(),window.setTimeout(ct,900)}catch(e){I(`idle`),R(e instanceof Error?e.message:String(e))}}async function ht(){R(``);let e;try{e=JSON.parse(fe)}catch{R(i(`wizardBadJson`));return}if(Array.isArray(e)){if(!e.every(e=>e&&typeof e==`object`&&!Array.isArray(e))){R(i(`wizardBadJson`));return}e={accounts:e}}if(!e||typeof e!=`object`){R(i(`wizardBadJson`));return}if(!V){R(i(`accountTypeHint`));return}let t=_r(e),r=t.provider||V.provider;if(r===`qoder`&&(typeof e.user_blob!=`string`||typeof e.machine_id!=`string`)){R(i(`wizardBadJson`));return}let a=at(),o;if(r===`kiro`){let t=typeof e.email==`string`?e.email.trim():``,n=typeof e.nickname==`string`?e.nickname.trim():``,r=fr(e),{provider:i,accounts:s,...c}=e,l=Array.isArray(s)?s:[{...c,...i?{provider:i}:{}}];o={format:`kiro-oauth-v1`,provider:`kiro`,region:r||(V.provider===`kiro`?V.region:`us-east-1`),name:b.trim()||n||t||void 0,enabled:!0,accounts:l,max_inflight:a.max_inflight,priority:a.priority,drop_system_prompt:a.drop_system_prompt,proxy_url:a.proxy_url}}else if(r===`workbuddy`)o=yr(e,{region:V.region===`global`?`global`:`cn`,name:b.trim()||void 0,enabled:!0,max_inflight:a.max_inflight,priority:a.priority,drop_system_prompt:a.drop_system_prompt,proxy_url:a.proxy_url});else{if(!e.format){let t=r;t===`trae`?e.format=`trae-oauth-v1`:t===`devin`?e.format=`devin-session-v1`:t===`command`?e.format=`command-key-v1`:t===`qwenwork`?e.format=`qwenwork-oauth-v1`:t===`kimi`?e.format=`kimi-oauth-v1`:t===`codearts`?e.format=`codearts-oauth-v1`:t===`codex`?e.format=`codex-oauth-v1`:t===`meta`?e.format=`meta-oauth-v1`:e.format=`qoder-native-v1`}o={...e,name:b.trim()||e.name,enabled:!0,provider:r,region:t.region||V.region,max_inflight:a.max_inflight,priority:a.priority,drop_system_prompt:a.drop_system_prompt}}try{I(`busy`);let{failed:e,message:t}=br(await Ce(o),i);I(`done`),R(t),n(),window.setTimeout(ct,e>0?1600:700)}catch(e){I(`idle`),R(e instanceof Error?e.message:String(e))}}function gt(){qe.current?.click()}function _t(e){let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>pe(String(n.result||``)),n.readAsText(t),e.target.value=``}let vt=e=>G&&p===e,X=V?.provider===`zhipu`,yt=V?.provider===`doubaowork`,bt=[V?.descriptor.capabilities?.browser_login===!1?null:{value:`browser`,label:i(`tabBrowser`)},W?{value:`pat`,label:i(`tabPat`)}:null,Xe?{value:`import`,label:i(`tabImport`)}:null].filter(Boolean),xt=i(p===`browser`?V?.provider===`codex`?`wizardCodexBrowserLead`:`wizardBrowserLead`:p===`pat`?V?.provider===`command`?`wizardPatLeadCommand`:V?.region===`cn`&&V?.provider===`qoder`?`wizardPatLeadCN`:`wizardPatLead`:`wizardImportLead`);return(0,Z.jsx)(P.Root,{isOpen:e,onOpenChange:e=>{e||st()},children:(0,Z.jsx)(P.Backdrop,{variant:`blur`,isDismissable:!G,children:(0,Z.jsx)(P.Container,{size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(P.Dialog,{className:`w-full sm:w-[36rem] sm:max-w-[calc(100vw-2rem)] sm:min-h-[36rem]`,children:[(0,Z.jsxs)(P.Header,{className:`relative items-center justify-center px-12 pt-5 text-center`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(P.Heading,{className:`text-section font-semibold`,children:i(`addAccountTitle`)}),(0,Z.jsx)(`p`,{ref:Ue,className:`mt-1 text-caption font-normal leading-5 text-muted`,children:o===`method`?i(`addAccountDesc`):tt||i(`addAccountDesc`)})]}),(0,Z.jsx)(P.CloseTrigger,{"aria-label":i(`close`),className:`absolute right-4 top-4 grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ve,{size:16})})]}),(0,Z.jsx)(P.Body,{className:o===`method`?`px-8 pb-5 sm:px-10`:`px-6 pb-2`,children:(0,Z.jsx)(`div`,{ref:He,children:o===`method`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`section`,{className:`space-y-2.5`,children:te?(0,Z.jsx)(Yn,{ariaLabel:i(`accountType`)}):U?(0,Z.jsx)(Qn,{ariaLabel:i(`accountType`),options:g.map(e=>{let t=e.descriptor.regions.find(t=>t.id===e.region)?.label||Sr[e.region]||``;return{id:e.id,provider:e.provider,label:Er(e,i),subtitle:t,hint:Dr(e,i)}}),onSelect:lt,disabled:K}):(0,Z.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:i(`accountTypeHint`)})}),(0,Z.jsx)(`div`,{className:`mt-4 text-center`,children:(0,Z.jsx)(l,{className:`text-xs`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`card flex flex-row items-center gap-3 rounded-xl bg-surface px-3 py-2.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:(0,Z.jsx)(rt,{provider:V?.provider,size:18})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`truncate text-body font-medium text-foreground`,children:V?Er(V,i):i(`accountType`)}),(0,Z.jsx)(`div`,{className:`truncate text-caption text-muted`,children:tt})]}),(0,Z.jsxs)(x,{size:`sm`,variant:`ghost`,onPress:()=>d(`method`),isDisabled:G||!!z.current,children:[(0,Z.jsx)(r,{size:12}),i(`wizardBack`)]})]}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(de,{className:`text-body font-medium text-muted`,children:i(`accountName`)}),(0,Z.jsx)(M,{fullWidth:!0,value:b,onChange:e=>S(e.target.value),"aria-label":i(`accountName`),disabled:K,autoFocus:!0})]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>y(e=>!e),"aria-expanded":re,className:`inline-flex items-center gap-1 text-caption font-medium text-muted transition-colors hover:text-foreground`,children:[(0,Z.jsx)(u,{size:12,className:`transition-transform duration-200 ${re?`rotate-90`:``}`}),i(`wizardAdvanced`)]}),re?(0,Z.jsxs)(`div`,{className:`card gap-3 rounded-xl bg-surface px-3.5 py-3.5`,children:[(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(de,{className:`text-body font-medium text-muted`,children:i(`maxInflight`)}),(0,Z.jsx)(A,{value:C,onChange:e=>w(e??4),minValue:1,maxValue:32,isDisabled:K,isRequired:!0,children:(0,Z.jsxs)(A.Group,{className:`w-full`,children:[(0,Z.jsx)(A.DecrementButton,{}),(0,Z.jsx)(A.Input,{"aria-label":i(`maxInflight`)}),(0,Z.jsx)(A.IncrementButton,{})]})}),(0,Z.jsx)(j,{className:`text-caption leading-5 text-muted`,children:i(`maxInflightHint`)})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(de,{className:`text-body font-medium text-muted`,children:i(`priority`)}),(0,Z.jsx)(A,{value:T,onChange:e=>E(e??50),minValue:1,maxValue:100,isDisabled:K,isRequired:!0,children:(0,Z.jsxs)(A.Group,{className:`w-full`,children:[(0,Z.jsx)(A.DecrementButton,{}),(0,Z.jsx)(A.Input,{"aria-label":i(`priority`)}),(0,Z.jsx)(A.IncrementButton,{})]})}),(0,Z.jsx)(j,{className:`text-caption leading-5 text-muted`,children:i(`priorityHint`)})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(de,{className:`text-body font-medium text-muted`,children:i(`proxyUrl`)}),(0,Z.jsx)(M,{fullWidth:!0,value:se,onChange:e=>ce(e.target.value),placeholder:i(`proxyUrlPlaceholder`),"aria-label":i(`proxyUrl`),disabled:K}),(0,Z.jsx)(j,{className:`text-caption leading-5 text-muted`,children:i(`proxyUrlHint`)})]}),Qe?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(de,{className:`text-body font-medium text-muted`,children:i(`dropSystemPrompt`)}),(0,Z.jsx)(j,{className:`text-caption leading-5 text-muted`,children:i(V?.provider===`trae`?`dropSystemPromptTraeHint`:`dropSystemPromptCreateHint`)}),(0,Z.jsx)(xe,{isSelected:ae,isDisabled:K,ariaLabel:i(`dropSystemPrompt`),onChange:oe})]}):null]}):null]}),X?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`span`,{className:`text-body font-medium text-muted`,children:i(`zhipuAccountMode`)}),(0,Z.jsx)(Wn,{ariaLabel:i(`zhipuAccountMode`),columns:2,value:D,onChange:e=>{G||me(e)},options:[{value:`payg`,label:i(`zhipuModePayg`),hint:i(`zhipuModePaygHint`),disabled:G},{value:`coding`,label:i(`zhipuModeCoding`),hint:i(`zhipuModeCodingHint`),disabled:G}]})]}),(0,Z.jsx)(N,{label:i(`zhipuApiKey`),children:(0,Z.jsx)(M,{type:`password`,value:he,onChange:e=>ge(e.target.value),placeholder:i(`zhipuApiKeyPh`),"aria-label":i(`zhipuApiKey`),disabled:G})}),D===`coding`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{label:i(`zhipuOrganization`),children:(0,Z.jsx)(M,{value:O,onChange:e=>k(e.target.value),placeholder:i(`zhipuOrganizationPh`),"aria-label":i(`zhipuOrganization`),disabled:G})}),(0,Z.jsx)(N,{label:i(`zhipuProject`),children:(0,Z.jsx)(M,{value:_e,onChange:e=>ve(e.target.value),placeholder:i(`zhipuProjectPh`),"aria-label":i(`zhipuProject`),disabled:G})})]}):null,L?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[q?(0,Z.jsx)(H,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:q?`font-medium text-foreground`:`text-muted`,children:L})]}):null]}):null,yt?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,Z.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:i(`doubaoCookieLead`)}),(0,Z.jsx)(N,{label:i(`doubaoCookieLabel`),children:(0,Z.jsx)(s,{className:`min-h-28 font-mono text-caption leading-5`,value:ye,onChange:e=>be(e.target.value),placeholder:i(`doubaoCookiePh`),"aria-label":i(`doubaoCookieLabel`),disabled:G})}),L?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[q?(0,Z.jsx)(H,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:q?`font-medium text-foreground`:`text-muted`,children:L})]}):null]}):null,X||yt?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(et,{className:`mt-3`,value:p,onChange:e=>{!G&&e!==p&&(m(e),R(``),Te(``),De(!1))},ariaLabel:i(`authentication`),options:bt.map(e=>({id:e.value,label:e.label}))}),(0,Z.jsx)(`p`,{className:`mt-2 min-h-5 text-caption leading-5 text-muted`,children:xt}),(0,Z.jsx)(`div`,{className:`mt-3 flex flex-col gap-4`,children:p===`browser`?(0,Z.jsxs)(Z.Fragment,{children:[V?.provider===`codex`?(0,Z.jsx)(Wn,{ariaLabel:i(`codexLoginMethod`),columns:2,value:Me,onChange:e=>{G||Ne(e)},options:[{value:`cli`,label:i(`codexLoginCli`),hint:i(`codexLoginCliHint`),disabled:G||!!z.current},{value:`chatgpt`,label:i(`codexLoginChatGPT`),hint:i(`codexLoginChatGPTHint`),disabled:G||!!z.current}]}):null,V?.provider===`kiro`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Wn,{ariaLabel:i(`kiroLoginMethod`),columns:2,value:Pe,onChange:e=>{G||Ie(e)},options:[{value:`builder_id`,label:i(`kiroLoginBuilder`),hint:i(`kiroLoginBuilderHint`),disabled:G||!!z.current},{value:`idc`,label:i(`kiroLoginIDC`),hint:i(`kiroLoginIDCHint`),disabled:G||!!z.current},{value:`sso`,label:i(`kiroLoginSSO`),hint:i(`kiroLoginSSOHint`),disabled:G||!!z.current},{value:`microsoft`,label:i(`kiroLoginMicrosoft`),hint:i(`kiroLoginMicrosoftHint`),disabled:G||!!z.current}]}),Pe===`idc`?(0,Z.jsx)(N,{label:i(`kiroIDCStartURL`),children:(0,Z.jsx)(M,{value:Re,onChange:e=>ze(e.target.value),placeholder:i(`kiroIDCStartURLPh`),"aria-label":i(`kiroIDCStartURL`),disabled:G})}):null]}):null,we?(0,Z.jsxs)(`div`,{className:`card rounded-xl bg-surface px-3 py-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,Z.jsx)(Or,{phase:Se,busy:G,tab:p,forTab:`browser`}),(0,Z.jsx)(`span`,{className:`text-muted`,children:L||i(`loginOpenMsg`)})]}),(0,Z.jsx)(`code`,{className:`mono mt-2 block break-all text-caption leading-5 text-foreground`,children:we}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,onPress:()=>window.open(we,`_blank`,`noopener,noreferrer`),children:[(0,Z.jsx)(c,{size:14}),i(`openAuthUrl`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`ghost`,onPress:()=>{f(we).then(e=>{e&&(De(!0),window.setTimeout(()=>De(!1),1100))})},children:[(0,Z.jsx)(a,{copied:Ee}),i(Ee?`copied`:`copy`)]})]})]}):null,L&&!we?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[q?(0,Z.jsx)(H,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:q?`font-medium text-foreground`:`text-muted`,children:L})]}):null,$e?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:i(`wizardCallbackLead`)}),(0,Z.jsx)(s,{className:`h-28 w-full resize-none font-mono text-caption leading-5`,value:ke,onChange:e=>Ae(e.target.value),placeholder:i(`wizardCallbackPh`),"aria-label":i(`wizardCallbackPh`),disabled:q}),(0,Z.jsx)(x,{size:`sm`,variant:`secondary`,isPending:Se===`busy`&&!!ke.trim(),onPress:()=>void ft(),isDisabled:q,children:i(`wizardSubmitCallback`)})]}):null]}):p===`pat`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{label:i(`tabPat`),children:(0,Z.jsx)(M,{type:`password`,value:le,onChange:e=>ue(e.target.value),placeholder:i(`wizardPatPh`),"aria-label":i(`wizardPatPh`),disabled:G})}),L?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[q?(0,Z.jsx)(H,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:q?`font-medium text-foreground`:`text-muted`,children:L})]}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:`JSON`}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,onPress:gt,isDisabled:G,children:[(0,Z.jsx)(Lt,{size:13}),i(`wizardChooseFile`)]}),(0,Z.jsx)(`input`,{ref:qe,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:_t})]}),(0,Z.jsx)(s,{className:`min-h-32 font-mono text-caption`,value:fe,onChange:e=>pe(e.target.value),placeholder:i(`wizardImportPh`),"aria-label":i(`tabImport`),disabled:G}),L?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[q?(0,Z.jsx)(H,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:q?`font-medium text-foreground`:`text-muted`,children:L})]}):null]})})]})]})})}),(0,Z.jsxs)(P.Footer,{className:`justify-end gap-2 px-5 pb-5`,children:[(0,Z.jsx)(x,{variant:`ghost`,onPress:st,isDisabled:G,children:i(`cancel`)}),o===`login`&&X?(0,Z.jsx)(x,{isPending:Se===`busy`,onPress:()=>void pt(),isDisabled:q,children:q?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{size:15}),i(`wizardAccountReady`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Be,{size:15}),i(`zhipuCreate`)]})}):null,o===`login`&&yt?(0,Z.jsx)(x,{isPending:Se===`busy`,onPress:()=>void J(),isDisabled:q,children:q?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{size:15}),i(`wizardAccountReady`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Be,{size:15}),i(`doubaoImport`)]})}):null,o===`login`&&!X&&!yt&&p===`browser`?(0,Z.jsx)(x,{isPending:vt(`browser`),onPress:()=>void dt(),isDisabled:q,children:q?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{size:15}),i(`wizardAccountReady`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_,{size:15}),i(`wizardStartBrowser`)]})}):null,o===`login`&&!X&&!yt&&p===`pat`?(0,Z.jsx)(x,{isPending:vt(`pat`),onPress:()=>void mt(),isDisabled:q,children:q?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{size:15}),i(`patDone`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Be,{size:15}),i(`wizardCreateAndLogin`)]})}):null,o===`login`&&!X&&!yt&&p===`import`?(0,Z.jsx)(x,{isPending:vt(`import`),onPress:()=>void ht(),isDisabled:q,children:q?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{size:15}),i(`accountImported`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Lt,{size:15}),i(`importCredential`)]})}):null]})]})})})})}function Mr(e,t){return e===`region_mixed`?t(`batchImportRegionMixed`):e===`region_unknown`?t(`batchImportRegionUnknown`):e===`unknown_format`?t(`batchImportUnknownFormat`):``}function Nr({isOpen:e,detection:t,fileName:n,isPending:r,t:i,onClose:a,onConfirm:o}){let s=t?.provider===`kiro`?[`us-east-1`,`eu-central-1`]:[`cn`,`global`],[c,l]=(0,Y.useState)(t?.region&&s.includes(t.region)?t.region:s[0]);(0,Y.useEffect)(()=>{if(!t)return;let e=t.provider===`kiro`?[`us-east-1`,`eu-central-1`]:[`cn`,`global`];t.region&&e.includes(t.region)?l(t.region):l(e[0])},[t]);let u=!!t?.batchImportSupported,d=t?.provider,f=t?.format||i(`batchImportFormatUnknown`),p=d?at(d,i):i(`batchImportProviderUnknown`),m=(t?.warnings||[]).map(e=>Mr(e,i)).filter(Boolean);return(0,Z.jsx)(P.Root,{isOpen:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,Z.jsx)(P.Backdrop,{variant:`blur`,isDismissable:!r,children:(0,Z.jsx)(P.Container,{placement:`center`,size:`md`,scroll:`inside`,className:`mx-3 w-full max-w-[min(100%,32rem)] sm:mx-0`,children:(0,Z.jsxs)(P.Dialog,{children:[(0,Z.jsxs)(P.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(P.Heading,{className:`text-section font-semibold`,children:i(`batchImportConfirmTitle`)}),(0,Z.jsx)(`p`,{className:`mt-1 break-all text-caption leading-5 text-muted`,children:n?i(`batchImportConfirmHint`,{file:n}):i(`batchImportConfirmHintNoFile`)})]}),(0,Z.jsx)(P.CloseTrigger,{isDisabled:r,"aria-label":i(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ve,{size:16})})]}),(0,Z.jsxs)(P.Body,{className:`space-y-4 px-6 pb-2`,children:[(0,Z.jsx)(`div`,{className:`rounded-xl bg-surface-secondary px-3.5 py-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[d?(0,Z.jsx)(rt,{provider:d,size:18}):null,(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-body font-medium text-foreground`,children:p}),(0,Z.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:f})]})]})}),u?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`div`,{className:`text-body font-medium text-muted`,children:i(d===`kiro`?`batchImportKiroRegion`:`batchImportRegion`)}),(0,Z.jsx)(et,{value:c,onChange:e=>{s.includes(e)&&l(e)},ariaLabel:i(d===`kiro`?`batchImportKiroRegion`:`batchImportRegion`),options:d===`kiro`?[{id:`us-east-1`,label:i(`accountTypeKiroUS`)},{id:`eu-central-1`,label:i(`accountTypeKiroEU`)}]:[{id:`cn`,label:i(`accountTypeWorkBuddyCN`)},{id:`global`,label:i(`accountTypeWorkBuddyGlobal`)}]}),t?.regionAmbiguous?(0,Z.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:i(d===`kiro`?`batchImportKiroRegionPickHint`:`batchImportRegionPickHint`)}):null]}):(0,Z.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:i(`batchImportProviderUnsupported`)}),m.length?(0,Z.jsx)(`ul`,{className:`space-y-1 text-caption leading-5 text-muted`,children:m.map(e=>(0,Z.jsx)(`li`,{children:e},e))}):null]}),(0,Z.jsxs)(P.Footer,{className:`flex-col-reverse gap-2 px-6 pb-6 sm:flex-row sm:justify-end`,children:[(0,Z.jsx)(x,{size:`sm`,variant:`ghost`,className:`w-full sm:w-auto`,isDisabled:r,onPress:a,children:i(u?`cancel`:`close`)}),u?(0,Z.jsx)(x,{size:`sm`,className:`w-full sm:w-auto`,isPending:r,onPress:()=>o(c),children:i(`batchImportConfirmAction`)}):null]})]})})})})}function Pr(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.format==`string`&&t.format.trim().toLowerCase()===`cli2api-accounts`&&Array.isArray(t.accounts)}function Fr(e){let t;try{t=JSON.parse(e)}catch{throw Error(`bad_json`)}if(!Pr(t))throw Error(`bad_bundle`);return t}function Ir(e){let t=JSON.stringify(e,null,2),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=(e.exported_at||new Date().toISOString()).replace(/[:.]/g,`-`).slice(0,19),a=document.createElement(`a`);a.href=r,a.download=`cli2api-accounts-${i}.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(r)}function Lr({isOpen:e,bundle:t,fileName:n,isPending:r,t:i,onClose:a,onConfirm:o}){let s=t?.accounts?.length??0,c=t?.accounts?.filter(e=>!!e.credential).length??0;return(0,Z.jsx)(P.Root,{isOpen:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,Z.jsx)(P.Backdrop,{variant:`blur`,isDismissable:!r,children:(0,Z.jsx)(P.Container,{placement:`center`,size:`md`,scroll:`inside`,className:`mx-3 w-full max-w-[min(100%,32rem)] sm:mx-0`,children:(0,Z.jsxs)(P.Dialog,{children:[(0,Z.jsxs)(P.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(P.Heading,{className:`text-section font-semibold`,children:i(`bundleImportConfirmTitle`)}),(0,Z.jsx)(`p`,{className:`mt-1 break-all text-caption leading-5 text-muted`,children:n?i(`bundleImportConfirmHint`,{file:n}):i(`bundleImportConfirmHintNoFile`)})]}),(0,Z.jsx)(P.CloseTrigger,{isDisabled:r,"aria-label":i(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ve,{size:16})})]}),(0,Z.jsxs)(P.Body,{className:`space-y-3 px-6 pb-2`,children:[(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-secondary px-3.5 py-3 text-body leading-6 text-foreground`,children:[(0,Z.jsx)(`div`,{className:`mono text-lg font-semibold`,children:s}),(0,Z.jsx)(`div`,{className:`text-muted`,children:i(`bundleImportAccountCount`)})]}),(0,Z.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:i(`bundleImportCountDetail`,{credentials:c})}),(0,Z.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:i(`bundleImportAdditiveHint`)}),(0,Z.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:i(`bundleExportHint`)})]}),(0,Z.jsxs)(P.Footer,{className:`flex-col-reverse gap-2 px-6 pb-6 sm:flex-row sm:justify-end`,children:[(0,Z.jsx)(x,{size:`sm`,variant:`ghost`,className:`w-full sm:w-auto`,isDisabled:r,onPress:a,children:i(`cancel`)}),(0,Z.jsx)(x,{size:`sm`,className:`w-full sm:w-auto`,isPending:r,isDisabled:s===0,onPress:o,children:i(`bundleImportConfirmAction`)})]})]})})})})}function Rr(e){if(!Array.isArray(e.accounts))return[e];let t=e.accounts.filter(e=>!!e&&typeof e==`object`&&!Array.isArray(e)&&pr(e));return t.length>0?t:[e]}function zr(e,t){let n=Rr(e),r=n.find(e=>typeof e.nickname==`string`||typeof e.email==`string`),i=typeof r?.nickname==`string`?r.nickname.trim():``,a=typeof r?.email==`string`?r.email.trim():``;return{format:`kiro-oauth-v1`,provider:`kiro`,region:fr(n[0]||e)||t,enabled:!0,name:n.length===1&&(i||a)||void 0,accounts:n.map(e=>({...e,region:fr(e)||t}))}}var Br=`__all__`,Vr=[],Hr=2;function Ur(){let{t:e}=ie(),[t,n]=(0,Y.useState)([]),[r,i]=(0,Y.useState)(null),[a,s]=(0,Y.useState)(``),[c,u]=(0,Y.useState)([]),[d,_]=(0,Y.useState)(!0),v=c,te=v.length>0,[ne,re]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),[E,ae]=(0,Y.useState)(!1),[oe,se]=(0,Y.useState)(null),[ce,le]=(0,Y.useState)(``),[ue,fe]=(0,Y.useState)(!1),[D,ge]=(0,Y.useState)(null),[O,k]=(0,Y.useState)(null),[_e,A]=(0,Y.useState)(``),[j,M]=(0,Y.useState)(null),[N,P]=(0,Y.useState)({}),[ye,xe]=(0,Y.useState)({}),[Se,F]=(0,Y.useState)({}),[Te,Ee]=(0,Y.useState)({}),[De,Oe]=(0,Y.useState)({}),[Me,Le]=(0,Y.useState)(null),[Re,ze]=(0,Y.useState)(null),[Be,Ve]=(0,Y.useState)(null),[He,We]=(0,Y.useState)(null),[Ge,B]=(0,Y.useState)(null),[V,H]=(0,Y.useState)(``),[W,Ye]=(0,Y.useState)(`all`),[Xe,Qe]=(0,Y.useState)(``),[$e,G]=(0,Y.useState)(1),[K,q]=(0,Y.useState)(20),[tt,nt]=(0,Y.useState)({}),[it,ot]=(0,Y.useState)({}),[st,ct]=(0,Y.useState)({}),[lt,ut]=(0,Y.useState)({}),[dt,ft]=(0,Y.useState)(!1),[pt,mt]=(0,Y.useState)(!1),J=(0,Y.useCallback)(async(e=!1)=>{try{let t=(await we(e)).data||Vr;return u(t),t}finally{_(!1)}},[]),ht=(0,Y.useCallback)(async(e,t=!0)=>{let n=[...new Set(e)];if(!n.length)return{total:0,failed:0,errors:[]};let r=n.length,i=new Map;for(let e=0;e{try{let n=await R(e,{quota:t});u(t=>t.map(t=>t.id===e?n:t))}catch(t){let n=t instanceof Error?t.message:String(t);i.set(e,n),F(t=>({...t,[e]:n}))}}))}return{total:r,failed:i.size,errors:[...i.values()]}},[]);(0,Y.useEffect)(()=>{J(!1).catch(()=>void 0)},[J]),(0,Y.useEffect)(()=>{let e=!0;return Promise.all([Pe(),Ze()]).then(([t,r])=>{e&&(n(t.data||[]),i(r))}).catch(t=>{e&&s(t instanceof Error?t.message:String(t))}),()=>{e=!1}},[]),(0,Y.useEffect)(()=>{let e=!0;return J(!1).then(t=>{if(e)return ht((t||[]).map(e=>e.id))}).catch(()=>void 0),()=>{e=!1}},[J,ht]);function gt(e){return t.find(t=>t.id===e.provider)?.regions.find(t=>t.id===e.region)?.checkin}function vt(e){let t=gt(e)?.timezone,n=t===`Local`?r?.timezone:t;if(!(!n||n===`Local`))try{return Intl.DateTimeFormat(`en-CA`,{timeZone:n}),n}catch{return}}let X=(0,Y.useMemo)(()=>v.map(e=>{let t=tt[e.id],n=it[e.id],r=st[e.id],i=lt[e.id],a=e;return t!==void 0&&(a={...a,enabled:t}),n!==void 0&&(a={...a,name:n}),r!==void 0&&(a={...a,max_inflight:r}),i!==void 0&&(a={...a,priority:i}),a}),[tt,st,it,lt,v]),yt=(0,Y.useMemo)(()=>{let e={all:X.length,available:0,attention:0,disabled:0};for(let t of X){let n=_t(t);n===`hot`||n===`ready`?e.available+=1:n===`disabled`&&(e.disabled+=1),t.enabled&&n!==`hot`&&n!==`ready`&&(e.attention+=1)}return e},[X]),bt=(0,Y.useMemo)(()=>{let e=new Map;for(let t of X){let n=String(t.provider||`qoder`).toLowerCase();e.set(n,(e.get(n)||0)+1)}return[...e.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))},[X]),xt=X.find(e=>e.id===Me),St=X.find(e=>e.id===Re)||null,Ct=X.find(e=>e.id===Be)||null,wt=X.find(e=>e.id===He)||null,Tt=(0,Y.useMemo)(()=>{let e=V.trim().toLowerCase();return X.filter(t=>{let n=_t(t);return!(W===`all`||W===`available`&&(n===`hot`||n===`ready`)||W===`attention`&&t.enabled&&n!==`hot`&&n!==`ready`||W===`disabled`&&n===`disabled`)||Xe&&String(t.provider||`qoder`).toLowerCase()!==Xe?!1:!e||[t.name,t.id,t.remote_uid,t.provider,t.auth_type].some(t=>String(t||``).toLowerCase().includes(e))})},[X,W,Xe,V]),Et=[V,W,Xe,K].join(`\0`),[Dt,Ot]=(0,Y.useState)(Et);Dt!==Et&&(Ot(Et),G(1));let At=Math.max(1,Math.ceil(Tt.length/K)),jt=Math.min(Dt===Et?Math.max(1,$e):1,At);$e!==jt&&G(jt);let Mt=(0,Y.useMemo)(()=>{let e=(jt-1)*K;return Tt.slice(e,e+K)},[jt,Tt,K]);if(d&&!te)return(0,Z.jsx)(z,{});async function Nt(e,t,n){M({id:e,kind:t}),F(t=>({...t,[e]:``}));try{return await n(),!0}catch(t){return F(n=>({...n,[e]:t instanceof Error?t.message:String(t)})),!1}finally{M(null)}}async function Pt(t,n){B(t),await Nt(t,`device`,async()=>{F(n=>({...n,[t]:e(`wizardStartingSession`)}));let r=await Je(t,n);r.authUrl&&Oe(e=>({...e,[t]:r.authUrl||``}));for(let n=0;n<60;n++){await new Promise(e=>window.setTimeout(e,2e3));let n=(await je(t)).login||{};if(F(r=>({...r,[t]:n.message||e(`waitingQoderLogin`)})),n.status===`ok`||n.status===`error`)break}await J(!1),await ht([t])})}async function It(t){let n=(ye[t]||``).trim();if(!n){F(n=>({...n,[t]:e(`wizardCallbackPh`)}));return}await Nt(t,`callback`,async()=>{F(n=>({...n,[t]:e(`wizardStartingSession`)})),await Ke(t,n),xe(e=>({...e,[t]:``})),await J(!1),await ht([t])})&&(B(e=>e===t?null:e),F(e=>({...e,[t]:``})))}async function Lt(t){let n=(N[t]||``).trim();if(!n){F(n=>({...n,[t]:e(`pastePatFirst`)}));return}await Nt(t,`pat`,async()=>{F(n=>({...n,[t]:e(`wizardStartingSession`)})),await Fe(n,t),P(e=>({...e,[t]:``})),await J(!1),await ht([t])})}async function Rt(t){await Nt(t,`export`,async()=>{let n=await Ae(t);await f(JSON.stringify(n,null,2)),F(n=>({...n,[t]:e(`credentialCopied`)}))})}async function zt(){if(S)return;C(!0);let t=`accounts-export-all`;U({id:t,type:`loading`,title:e(`toastAccountsExporting`)});try{let n=await L();Ir(n),U({id:t,type:`success`,title:e(`toastAccountsExported`,{n:n.count??n.accounts.length}),description:e(`bundleExportHint`)})}catch(n){U({id:t,type:`error`,title:e(`toastFailed`),description:n instanceof Error?n.message:String(n)})}finally{C(!1)}}function Bt(){w||(ae(!1),se(null),le(``))}async function Vt(t){let n=t.target.files?.[0];if(t.target.value=``,n)try{let e=Fr(await n.text());se(e),le(n.name),ae(!0)}catch(t){let n=t instanceof Error?t.message:String(t);U({type:`error`,title:e(n===`bad_json`?`wizardBadJson`:`bundleImportUnrecognized`)})}}async function Ht(){if(!oe||w)return;T(!0);let t=`bundle-import-accounts`;U({id:t,type:`loading`,title:e(`bundleImportLoading`)});try{let n=await Ne(oe),r=n.succeeded??0,i=n.failed??0,a=(n.errors||[]).slice(0,3).map(e=>e.message||`index ${e.index}`).filter(Boolean).join(`; `);U({id:t,type:i>0&&r===0?`error`:i>0?`info`:`success`,title:i>0?e(`accountImportPartial`).replace(`{ok}`,String(r)).replace(`{fail}`,String(i)):e(`accountImportBatch`).replace(`{n}`,String(r)),description:a||void 0}),ae(!1),se(null),le(``),r>0&&await J(!1)}catch(n){U({id:t,type:`error`,title:e(`toastFailed`),description:n instanceof Error?n.message:String(n)})}finally{T(!1)}}async function Ut(e,t){nt(n=>({...n,[e]:t})),await Nt(e,`toggle`,async()=>{await Ie(e,{enabled:t}),await J(!1)}),nt(t=>{let n={...t};return delete n[e],n})}async function Wt(t){U({id:`refresh-${t}`,type:`loading`,title:e(`toastRefreshingAccount`)}),M({id:t,kind:`refresh`}),F(e=>{let n={...e};return delete n[t],n});try{let n=await ht([t]);if(n.failed>0){U({id:`refresh-${t}`,type:`error`,title:e(`toastFailed`),description:n.errors[0]||e(`toastFailed`)});return}U({id:`refresh-${t}`,type:`success`,title:e(`toastAccountRefreshed`)})}finally{M(null)}}async function Kt(){ft(!0),U({id:`refresh-credits`,type:`loading`,title:e(`toastRefreshingCredits`)});try{let t=await ht(c.map(e=>e.id));if(t.failed>0){let n=t.failed0&&r===0?`error`:i>0?`info`:`success`,title:a}),fe(!1),ge(null),k(null),A(``),r>0&&await J(!1)}catch(t){U({id:n,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{b(!1)}}async function Xt(e,t){await Nt(e,`toggle`,async()=>{await Ie(e,{auto_checkin:t}),await J(!1)})}async function Zt(){mt(!0),U({id:`checkin-all`,type:`loading`,title:e(`toastCheckingInAll`,{done:0,total:v.length})});try{let t=(await I()).data||[];if(t.length===0){U({id:`checkin-all`,type:`info`,title:e(`checkinAllEmpty`)});return}let n={checked:0,skipped:0,failed:0},r={};for(let i of t){let t=String(i.status||``).toLowerCase(),a=t===`already`||t===`skipped`||t===`error`?t:`success`;a===`error`?n.failed+=1:a===`skipped`||a===`already`?n.skipped+=1:n.checked+=1,r[i.account_id]={kind:a,message:a===`error`?i.message||e(`checkinRecordFailed`):i.message}}Ee(e=>({...e,...r}));let i={checked:n.checked,skipped:n.skipped,failed:n.failed};U({id:`checkin-all`,type:n.failed?`error`:`success`,title:e(n.failed?`toastCheckedInAllFailed`:`toastCheckedInAll`,i)})}catch(t){U({id:`checkin-all`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{mt(!1),await J(!1).catch(()=>void 0)}}async function Qt(t){await Nt(t,`checkin`,async()=>{let n;try{n=await qe(t)}catch(e){Ee(n=>({...n,[t]:{kind:`error`,message:e instanceof Error?e.message:String(e)}})),await J(!1).catch(()=>void 0),await ht([t]).catch(()=>void 0);return}let r=n?.last_checkin_status,i=n?.last_checkin_msg,a=r===`already`?`already`:r===`skipped`?`skipped`:r===`error`?`error`:`success`;Ee(n=>({...n,[t]:{kind:a,message:a===`error`?i||e(`checkinRecordFailed`):i}})),await J(!1).catch(()=>void 0),await ht([t]).catch(()=>void 0)})}async function $t(t,n){if(!t)throw Error(e(`accountNameRequired`));ot(e=>({...e,[t]:n.name})),ct(e=>({...e,[t]:n.max_inflight})),ut(e=>({...e,[t]:n.priority})),M({id:t,kind:`settings`});try{await Ie(t,n),await J(!1)}catch(e){throw e instanceof Error?e:Error(String(e))}finally{M(null),ot(e=>{let n={...e};return delete n[t],n}),ct(e=>{let n={...e};return delete n[t],n}),ut(e=>{let n={...e};return delete n[t],n})}}return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[a?(0,Z.jsx)(me,{title:a}):null,(0,Z.jsxs)(`section`,{"data-gsap-reveal":!0,className:`flex flex-wrap items-center gap-2`,children:[v.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(et,{value:W,onChange:e=>Ye(e),ariaLabel:e(`accountStatusFilter`),options:[{id:`all`,label:(0,Z.jsxs)(Z.Fragment,{children:[e(`filterAll`),(0,Z.jsx)(`span`,{className:`mono text-muted`,children:yt.all})]})},{id:`available`,label:(0,Z.jsxs)(Z.Fragment,{children:[e(`availableAccounts`),(0,Z.jsx)(`span`,{className:`mono text-muted`,children:yt.available})]})},{id:`attention`,label:(0,Z.jsxs)(Z.Fragment,{children:[e(`needsAttention`),(0,Z.jsx)(`span`,{className:`mono ${yt.attention?`text-danger`:`text-muted`}`,children:yt.attention})]})},{id:`disabled`,label:(0,Z.jsxs)(Z.Fragment,{children:[e(`disabled`),(0,Z.jsx)(`span`,{className:`mono text-muted`,children:yt.disabled})]})}]}),(0,Z.jsxs)(be,{className:`w-48`,"aria-label":e(`providerFilterAll`),value:Xe||Br,onChange:e=>{typeof e==`string`&&Qe(e===Br?``:e)},children:[(0,Z.jsxs)(be.Trigger,{className:`items-center`,children:[(0,Z.jsx)(be.Value,{className:`min-w-0 truncate`}),(0,Z.jsx)(be.Indicator,{})]}),(0,Z.jsx)(be.Popover,{children:(0,Z.jsxs)(pe,{children:[(0,Z.jsxs)(pe.Item,{id:Br,textValue:e(`providerFilterAll`),children:[(0,Z.jsxs)(de,{className:`flex items-center gap-2`,children:[e(`providerFilterAll`),(0,Z.jsx)(`span`,{className:`mono text-muted`,children:v.length})]}),(0,Z.jsx)(pe.ItemIndicator,{})]}),bt.map(([t,n])=>(0,Z.jsxs)(pe.Item,{id:t,textValue:at(t,e),children:[(0,Z.jsxs)(de,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(rt,{provider:t,size:13}),at(t,e),(0,Z.jsx)(`span`,{className:`mono text-muted`,children:n})]}),(0,Z.jsx)(pe.ItemIndicator,{})]},t))]})})]}),(0,Z.jsx)(h,{className:`w-full sm:w-60`,value:V,onChange:H,placeholder:e(`searchAccounts`),ariaLabel:e(`searchAccounts`)})]}):null,(0,Z.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:ml-auto sm:w-auto`,children:[(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:S,isDisabled:y||ue||w||E,onPress:()=>void zt(),children:[(0,Z.jsx)(Ft,{size:14}),e(`exportAll`)]}),(0,Z.jsxs)(`label`,{htmlFor:`accounts-bundle-import-file`,className:`button button--sm button--secondary inline-flex items-center gap-1.5 ${w||E||y||ue||S?`pointer-events-none opacity-60`:`cursor-pointer`}`,children:[w?(0,Z.jsx)(Ue,{size:14,loading:!0}):(0,Z.jsx)(Ft,{size:14}),e(`importAll`)]}),(0,Z.jsx)(`input`,{id:`accounts-bundle-import-file`,type:`file`,accept:`.json,application/json,text/json`,disabled:w||E||y||ue||S,className:`sr-only`,onChange:e=>void Vt(e)}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:pt,isDisabled:dt,onPress:()=>void Zt(),children:[(0,Z.jsx)(kt,{size:14}),e(`checkinAll`)]}),(0,Z.jsxs)(x,{size:`sm`,variant:`secondary`,isPending:dt,isDisabled:pt,onPress:()=>void Kt(),children:[(0,Z.jsx)(o,{size:14}),e(`refreshCredits`)]}),(0,Z.jsxs)(`label`,{htmlFor:`accounts-batch-import-file`,className:`button button--sm button--secondary inline-flex items-center gap-1.5 ${y||ue||w||E||S?`pointer-events-none opacity-60`:`cursor-pointer`}`,children:[y?(0,Z.jsx)(Ue,{size:14,loading:!0}):(0,Z.jsx)(Gt,{size:14}),e(`batchImport`)]}),(0,Z.jsx)(`input`,{id:`accounts-batch-import-file`,type:`file`,accept:`.json,application/json,text/json`,disabled:y||ue||w||E||S,className:`sr-only`,onChange:e=>void Jt(e)}),(0,Z.jsxs)(x,{size:`sm`,onPress:()=>re(!0),children:[(0,Z.jsx)(g,{size:14}),e(`addAccount`)]})]})]}),(0,Z.jsx)(jr,{isOpen:ne,onClose:()=>re(!1),onAdded:()=>{U({type:`success`,title:e(`toastAccountAdded`)}),J(!1)}}),(0,Z.jsx)(Lr,{isOpen:E,bundle:oe,fileName:ce,isPending:w,t:e,onClose:Bt,onConfirm:()=>{Ht()}}),(0,Z.jsx)(Nr,{isOpen:ue,detection:D,fileName:_e,isPending:y,t:e,onClose:qt,onConfirm:e=>{Yt(e)}}),(0,Z.jsx)(zn,{account:St,t:e,onClose:()=>ze(null)},Re??`closed`),(0,Z.jsx)(Ln,{account:Ct,t:e,onClose:()=>Ve(null)},Be??`closed`),(0,Z.jsx)(Hn,{account:wt,checkinDefaultTime:wt&>(wt)?r?.checkin_times[wt.provider||``]:void 0,checkinTimezone:wt?vt(wt):void 0,busy:!!(j&&j.id===He&&j.kind===`settings`),t:e,onClose:()=>We(null),onSave:e=>$t(He||``,e)},He??`closed`),(0,Z.jsx)(he,{isOpen:!!xt,title:e(`delete`),description:e(`deleteAccountConfirm`,{name:xt?.name||xt?.id||``}),confirmLabel:e(`delete`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:j?.id===Me&&j.kind===`delete`,onClose:()=>Le(null),onConfirm:()=>{if(!xt)return;let t=xt.id;Le(null),Nt(t,`delete`,async()=>{await ke(t),await J(!1)}).then(t=>{t&&U({type:`success`,title:e(`toastAccountDeleted`)})})}}),te?null:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(ve,{className:`rounded-3xl bg-surface-secondary`,icon:(0,Z.jsx)(Ue,{size:28}),title:e(`noAccounts`),hint:e(`accountEmptyHint`),action:(0,Z.jsxs)(x,{size:`sm`,onPress:()=>re(!0),children:[(0,Z.jsx)(g,{size:14}),e(`addAccount`)]})}),(0,Z.jsx)(`div`,{className:`text-center`,children:(0,Z.jsx)(l,{})})]}),te&&!Tt.length?(0,Z.jsx)(ve,{className:`rounded-3xl bg-surface-secondary`,icon:(0,Z.jsx)(p,{size:22}),title:e(`noAccountsMatch`),action:(0,Z.jsx)(x,{size:`sm`,variant:`ghost`,onPress:()=>{H(``),Ye(`all`),Qe(``)},children:e(`clearFilters`)})}):null,(0,Z.jsx)(`section`,{className:`grid auto-rows-[minmax(280px,auto)] gap-2.5 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4`,children:Mt.map(t=>(0,Z.jsx)(Pn,{account:t,busyKind:j?.id===t.id?j.kind:``,authPanelOpen:Ge===t.id,authUrl:De[t.id],note:Se[t.id],pat:N[t.id]||``,t:e,onPatChange:e=>P(n=>({...n,[t.id]:e})),callbackUrl:ye[t.id]||``,onCallbackChange:e=>xe(n=>({...n,[t.id]:e})),onSubmitCallback:()=>void It(t.id),onDeviceLogin:e=>void Pt(t.id,e),onPatLogin:()=>void Lt(t.id),onExport:()=>void Rt(t.id),onRefresh:()=>void Wt(t.id),onDelete:()=>Le(t.id),onToggle:e=>void Ut(t.id,e),checkinDefaultTime:r?.checkin_times[t.provider||``],checkinTimezone:vt(t),onToggleAutoCheckin:gt(t)?e=>void Xt(t.id,e):void 0,onCheckin:gt(t)?()=>void Qt(t.id):void 0,checkinFeedback:Te[t.id]??null,onViewCheckins:gt(t)?()=>Ve(t.id):void 0,onEdit:()=>We(t.id),onToggleAuthPanel:()=>B(e=>e===t.id?null:t.id),onViewModels:()=>ze(t.id)},t.id))}),Tt.length?(0,Z.jsx)(ee,{total:Tt.length,page:jt,pageCount:At,pageSize:K,pageSizes:m,loading:!1,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:jt,pages:At}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:G,onPageSize:q}):null]})}export{Ur as AccountsPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/CaiaiSoftLink-Cv7Cw6NC.js b/internal/webui/static/assets/CaiaiSoftLink-DUJ2V4Pr.js similarity index 97% rename from internal/webui/static/assets/CaiaiSoftLink-Cv7Cw6NC.js rename to internal/webui/static/assets/CaiaiSoftLink-DUJ2V4Pr.js index 5c7fbf38..96ae5914 100644 --- a/internal/webui/static/assets/CaiaiSoftLink-Cv7Cw6NC.js +++ b/internal/webui/static/assets/CaiaiSoftLink-DUJ2V4Pr.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./Check.es-BqA3iE7U.js";import{n as i}from"./clipboard-DfpIZ3R1.js";import{n as a,pt as o}from"./useI18n-B77RWTNi.js";import{c as s,z as c}from"./SharedElementTransition-BlCsXfb1.js";import{r as l,t as u}from"./textfield-BWaikvel.js";import{r as d}from"./gsap-C3sDxib7.js";import{_ as f,b as p,v as m}from"./index-CmGY2WQi.js";var h=t(e(),1),g=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z`}))]]),_=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),v=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M160,48V208L80,128Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61ZM152,188.69,91.31,128,152,67.31Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M168,48V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,168,48Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M164.24,203.76a6,6,0,1,1-8.48,8.48l-80-80a6,6,0,0,1,0-8.48l80-80a6,6,0,0,1,8.48,8.48L88.49,128Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M162.83,205.17a4,4,0,0,1-5.66,5.66l-80-80a4,4,0,0,1,0-5.66l80-80a4,4,0,1,1,5.66,5.66L85.66,128Z`}))]]),y=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M76,64A12,12,0,0,1,88,52H216a12,12,0,0,1,0,24H88A12,12,0,0,1,76,64Zm140,52H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Zm0,64H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,112a16,16,0,1,0,16,16A16,16,0,0,0,44,112Zm0-64A16,16,0,1,0,60,64,16,16,0,0,0,44,48Zm0,128a16,16,0,1,0,16,16A16,16,0,0,0,44,176Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M216,64V192H88V64Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM68,188a12,12,0,1,1,12-12A12,12,0,0,1,68,188Zm0-48a12,12,0,1,1,12-12A12,12,0,0,1,68,140Zm0-48A12,12,0,1,1,80,80,12,12,0,0,1,68,92Zm124,92H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M82,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H88A6,6,0,0,1,82,64Zm134,58H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Zm0,64H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12ZM44,54A10,10,0,1,0,54,64,10,10,0,0,0,44,54Zm0,128a10,10,0,1,0,10,10A10,10,0,0,0,44,182Zm0-64a10,10,0,1,0,10,10A10,10,0,0,0,44,118Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M84,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H88A4,4,0,0,1,84,64Zm132,60H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Zm0,64H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8ZM44,120a8,8,0,1,0,8,8A8,8,0,0,0,44,120Zm0-64a8,8,0,1,0,8,8A8,8,0,0,0,44,56Zm0,128a8,8,0,1,0,8,8A8,8,0,0,0,44,184Z`}))]]),b=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:g}));b.displayName=`ArrowSquareOutIcon`;var x=b,S=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:_}));S.displayName=`ArrowsClockwiseIcon`;var C=S,w=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:v}));w.displayName=`CaretLeftIcon`;var T=w,E=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:y}));E.displayName=`ListBulletsIcon`;var D=E,O=c({base:`textarea`,defaultVariants:{fullWidth:!1,variant:`primary`},variants:{fullWidth:{false:``,true:`textarea--full-width`},variant:{primary:`textarea--primary`,secondary:`textarea--secondary`}}}),k=n(),A=({className:e,fullWidth:t,variant:n,...r})=>{let i=(0,h.use)(u),a=n??i?.variant;return(0,k.jsx)(l,{"data-slot":`textarea`,className:s(e,O({fullWidth:t,variant:a})),...r})},j=Object.assign(A,{Root:A});function M({copied:e,size:t=14,className:n}){let a=(0,h.useRef)(null),o=(0,h.useRef)(null),s=(0,h.useRef)(!0);return(0,h.useLayoutEffect)(()=>{let t=e?o.current:a.current,n=e?a.current:o.current;if(!t||!n)return;let r={autoAlpha:1,scale:1,filter:`blur(0px)`},i={autoAlpha:0,scale:.5,filter:`blur(4px)`};if(s.current||p()){s.current=!1,d.set(t,r),d.set(n,i);return}d.to(n,{...i,duration:f.fast,ease:m.out,overwrite:!0}),d.fromTo(t,i,{...r,duration:f.base,ease:m.soft,delay:f.instant/2,overwrite:!0})},[e]),(0,k.jsxs)(`span`,{className:`relative inline-grid place-items-center ${n??``}`,style:{width:t,height:t},children:[(0,k.jsx)(`span`,{ref:a,className:`col-start-1 row-start-1 inline-flex`,children:(0,k.jsx)(i,{size:t})}),(0,k.jsx)(`span`,{ref:o,className:`col-start-1 row-start-1 inline-flex text-success`,children:(0,k.jsx)(r,{size:t})})]})}var N=`https://caiaiu.com`;function P({className:e=``}){let{t}=a();return(0,k.jsx)(`p`,{className:`text-caption leading-5 text-muted ${e}`.trim(),children:(0,k.jsx)(`a`,{href:N,target:`_blank`,rel:`noopener noreferrer`,className:`underline-offset-2 transition-colors hover:text-foreground hover:underline`,children:t(`caiaiSoftLink`)})})}export{T as a,D as i,M as n,C as o,j as r,x as s,P as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./Check.es-DrOC94kl.js";import{n as i}from"./clipboard-DG4c5Ihq.js";import{n as a,pt as o}from"./useI18n-DAGWWg9N.js";import{c as s,z as c}from"./SharedElementTransition-BlCsXfb1.js";import{r as l,t as u}from"./textfield-DbDjPadh.js";import{r as d}from"./gsap-C3sDxib7.js";import{v as f,x as p,y as m}from"./index-BYut8qRj.js";var h=t(e(),1),g=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z`}))]]),_=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),v=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M160,48V208L80,128Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61ZM152,188.69,91.31,128,152,67.31Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M168,48V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,168,48Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M164.24,203.76a6,6,0,1,1-8.48,8.48l-80-80a6,6,0,0,1,0-8.48l80-80a6,6,0,0,1,8.48,8.48L88.49,128Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M162.83,205.17a4,4,0,0,1-5.66,5.66l-80-80a4,4,0,0,1,0-5.66l80-80a4,4,0,1,1,5.66,5.66L85.66,128Z`}))]]),y=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M76,64A12,12,0,0,1,88,52H216a12,12,0,0,1,0,24H88A12,12,0,0,1,76,64Zm140,52H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Zm0,64H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,112a16,16,0,1,0,16,16A16,16,0,0,0,44,112Zm0-64A16,16,0,1,0,60,64,16,16,0,0,0,44,48Zm0,128a16,16,0,1,0,16,16A16,16,0,0,0,44,176Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M216,64V192H88V64Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM68,188a12,12,0,1,1,12-12A12,12,0,0,1,68,188Zm0-48a12,12,0,1,1,12-12A12,12,0,0,1,68,140Zm0-48A12,12,0,1,1,80,80,12,12,0,0,1,68,92Zm124,92H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M82,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H88A6,6,0,0,1,82,64Zm134,58H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Zm0,64H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12ZM44,54A10,10,0,1,0,54,64,10,10,0,0,0,44,54Zm0,128a10,10,0,1,0,10,10A10,10,0,0,0,44,182Zm0-64a10,10,0,1,0,10,10A10,10,0,0,0,44,118Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M84,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H88A4,4,0,0,1,84,64Zm132,60H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Zm0,64H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8ZM44,120a8,8,0,1,0,8,8A8,8,0,0,0,44,120Zm0-64a8,8,0,1,0,8,8A8,8,0,0,0,44,56Zm0,128a8,8,0,1,0,8,8A8,8,0,0,0,44,184Z`}))]]),b=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:g}));b.displayName=`ArrowSquareOutIcon`;var x=b,S=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:_}));S.displayName=`ArrowsClockwiseIcon`;var C=S,w=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:v}));w.displayName=`CaretLeftIcon`;var T=w,E=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:y}));E.displayName=`ListBulletsIcon`;var D=E,O=c({base:`textarea`,defaultVariants:{fullWidth:!1,variant:`primary`},variants:{fullWidth:{false:``,true:`textarea--full-width`},variant:{primary:`textarea--primary`,secondary:`textarea--secondary`}}}),k=n(),A=({className:e,fullWidth:t,variant:n,...r})=>{let i=(0,h.use)(u),a=n??i?.variant;return(0,k.jsx)(l,{"data-slot":`textarea`,className:s(e,O({fullWidth:t,variant:a})),...r})},j=Object.assign(A,{Root:A});function M({copied:e,size:t=14,className:n}){let a=(0,h.useRef)(null),o=(0,h.useRef)(null),s=(0,h.useRef)(!0);return(0,h.useLayoutEffect)(()=>{let t=e?o.current:a.current,n=e?a.current:o.current;if(!t||!n)return;let r={autoAlpha:1,scale:1,filter:`blur(0px)`},i={autoAlpha:0,scale:.5,filter:`blur(4px)`};if(s.current||p()){s.current=!1,d.set(t,r),d.set(n,i);return}d.to(n,{...i,duration:f.fast,ease:m.out,overwrite:!0}),d.fromTo(t,i,{...r,duration:f.base,ease:m.soft,delay:f.instant/2,overwrite:!0})},[e]),(0,k.jsxs)(`span`,{className:`relative inline-grid place-items-center ${n??``}`,style:{width:t,height:t},children:[(0,k.jsx)(`span`,{ref:a,className:`col-start-1 row-start-1 inline-flex`,children:(0,k.jsx)(i,{size:t})}),(0,k.jsx)(`span`,{ref:o,className:`col-start-1 row-start-1 inline-flex text-success`,children:(0,k.jsx)(r,{size:t})})]})}var N=`https://caiaiu.com`;function P({className:e=``}){let{t}=a();return(0,k.jsx)(`p`,{className:`text-caption leading-5 text-muted ${e}`.trim(),children:(0,k.jsx)(`a`,{href:N,target:`_blank`,rel:`noopener noreferrer`,className:`underline-offset-2 transition-colors hover:text-foreground hover:underline`,children:t(`caiaiSoftLink`)})})}export{T as a,D as i,M as n,C as o,j as r,x as s,P as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/Check.es-BqA3iE7U.js b/internal/webui/static/assets/Check.es-DrOC94kl.js similarity index 97% rename from internal/webui/static/assets/Check.es-BqA3iE7U.js rename to internal/webui/static/assets/Check.es-DrOC94kl.js index 2b6a6599..96ce99c4 100644 --- a/internal/webui/static/assets/Check.es-BqA3iE7U.js +++ b/internal/webui/static/assets/Check.es-DrOC94kl.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-B77RWTNi.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M176,128,96,208V48Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z`}))]]),a=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z`}))]]),o=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));o.displayName=`CaretRightIcon`;var s=o,c=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:a}));c.displayName=`CheckIcon`;var l=c;export{s as n,l as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-DAGWWg9N.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M176,128,96,208V48Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z`}))]]),a=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z`}))]]),o=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));o.displayName=`CaretRightIcon`;var s=o,c=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:a}));c.displayName=`CheckIcon`;var l=c;export{s as n,l as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/Checkbox-DB5s8nrk.js b/internal/webui/static/assets/Checkbox-q1M8UCZU.js similarity index 95% rename from internal/webui/static/assets/Checkbox-DB5s8nrk.js rename to internal/webui/static/assets/Checkbox-q1M8UCZU.js index 150eb8ff..2885f152 100644 --- a/internal/webui/static/assets/Checkbox-DB5s8nrk.js +++ b/internal/webui/static/assets/Checkbox-q1M8UCZU.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{E as n,a as r}from"./useI18n-B77RWTNi.js";import{A as i,F as a,G as o,I as s,J as c,L as l,M as u,Y as d,d as f,j as p,q as m,u as h}from"./SharedElementTransition-BlCsXfb1.js";import{c as g,f as _,i as v,m as y,p as b,u as x}from"./label-DLoR3Z-C.js";import{t as S}from"./useToggle-BRoRhkOA.js";var C=t(e(),1),w=new WeakMap;function T(e,t,n){let{labelProps:r,inputProps:i,descriptionProps:a,errorMessageProps:o,isSelected:s,isPressed:l,isDisabled:u,isReadOnly:d,isInvalid:f,validationErrors:p,validationDetails:m}=S(e,t,n),{isIndeterminate:h}=e;return(0,C.useEffect)(()=>{n.current&&(n.current.indeterminate=!!h)}),{labelProps:c(r,(0,C.useMemo)(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:i,descriptionProps:a,errorMessageProps:o,isSelected:s,isPressed:l,isDisabled:u,isReadOnly:d,isInvalid:f,validationErrors:p,validationDetails:m}}function E(e,t,n){let r=v({isReadOnly:e.isReadOnly||t.isReadOnly,isSelected:t.isSelected(e.value),defaultSelected:t.defaultValue.includes(e.value),onChange(n){n?t.addValue(e.value):t.removeValue(e.value),e.onChange&&e.onChange(n)}}),{name:i,form:a,descriptionId:o,errorMessageId:s,validationBehavior:c}=w.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=b({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=(0,C.useRef)(_),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};(0,C.useEffect)(d);let f=t.realtimeValidation.isInvalid?t.realtimeValidation:l,p=c===`native`?t.displayValidation:f,m=T({...e,isReadOnly:e.isReadOnly||t.isReadOnly,isDisabled:e.isDisabled||t.isDisabled,name:e.name||i,form:e.form||a,isRequired:e.isRequired??t.isRequired,validationBehavior:c,[x]:{realtimeValidation:f,displayValidation:p,resetValidation:t.resetValidation,commitValidation:t.commitValidation,updateValidation(e){u.current=e,d()}}},r,n);return{...m,inputProps:{...m.inputProps,"aria-describedby":[m.inputProps[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}var D=(0,C.createContext)(null),O=(0,C.createContext)(null),k=(0,C.createContext)(null),A=(0,C.createContext)(null),j=(0,C.forwardRef)(function(e,t){let{inputRef:n=null,...o}=e;[e,t]=p(o,t,O);let s=(0,C.useContext)(k),[l,d]=M(e,n),{descriptionProps:f,errorMessageProps:h,isSelected:g,isDisabled:_,isReadOnly:v,isInvalid:b,validationDetails:x,validationErrors:S}=l,w=u({...e,defaultClassName:`react-aria-CheckboxField`,values:{isSelected:g,isIndeterminate:e.isIndeterminate||!1,isDisabled:_,isReadOnly:v,isInvalid:b,isRequired:e.isRequired||!1}}),T=m(e,{global:!0});return delete T.id,delete T.onClick,C.createElement(a.div,{...c(T,w),ref:t,slot:e.slot||void 0,"data-selected":g||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-disabled":_||void 0,"data-readonly":v||void 0,"data-invalid":b||void 0,"data-required":e.isRequired||void 0},C.createElement(i,{values:[[A,{...l,inputRef:d,defaultClassName:`react-aria-CheckboxButton`,isIndeterminate:e.isIndeterminate,isRequired:e.isRequired}],[r,{slots:{description:f,errorMessage:h}}],[y,s?null:{isInvalid:b,validationDetails:x,validationErrors:S}]]},w.children))});function M(e,t){let{validationBehavior:n}=l(g)||{},r=e.validationBehavior??n??`native`,i=(0,C.useContext)(k),a=o((0,C.useMemo)(()=>d(t,e.inputRef===void 0?null:e.inputRef),[t,e.inputRef])),c={...s(e),children:typeof e.children==`function`||e.children,value:e.value,validationBehavior:r};return[i?E(c,i,a):T(c,v(e),a),a]}var N=(0,C.forwardRef)(function(e,t){let{labelProps:r,inputProps:i,isSelected:o,isDisabled:s,isReadOnly:l,isPressed:d,isInvalid:p,inputRef:g,defaultClassName:_,isIndeterminate:v,isRequired:y}=(0,C.useContext)(A),{isFocused:b,isFocusVisible:x,focusProps:S}=f(),w=s||l,{hoverProps:T,isHovered:E}=h({...e,isDisabled:w}),D=u({...e,defaultClassName:_,values:{isSelected:o,isIndeterminate:v||!1,isPressed:d,isHovered:E,isFocused:b,isFocusVisible:x,isDisabled:s,isReadOnly:l,isInvalid:p,isRequired:y||!1}}),O=m(e,{global:!0});return delete O.id,delete O.onClick,C.createElement(a.label,{...c(O,r,T,D),ref:t,slot:e.slot||void 0,"data-selected":o||void 0,"data-indeterminate":v||void 0,"data-pressed":d||void 0,"data-hovered":E||void 0,"data-focused":b||void 0,"data-focus-visible":x||void 0,"data-disabled":s||void 0,"data-readonly":l||void 0,"data-invalid":p||void 0,"data-required":y||void 0},C.createElement(n,{elementType:`span`},C.createElement(`input`,{...c(i,S),ref:g})),D.children)});export{O as i,j as n,D as r,N as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{E as n,a as r}from"./useI18n-DAGWWg9N.js";import{A as i,F as a,G as o,I as s,J as c,L as l,M as u,Y as d,d as f,j as p,q as m,u as h}from"./SharedElementTransition-BlCsXfb1.js";import{c as g,f as _,i as v,m as y,p as b,u as x}from"./label-j5K3TFm8.js";import{t as S}from"./useToggle-Zi1rbfHX.js";var C=t(e(),1),w=new WeakMap;function T(e,t,n){let{labelProps:r,inputProps:i,descriptionProps:a,errorMessageProps:o,isSelected:s,isPressed:l,isDisabled:u,isReadOnly:d,isInvalid:f,validationErrors:p,validationDetails:m}=S(e,t,n),{isIndeterminate:h}=e;return(0,C.useEffect)(()=>{n.current&&(n.current.indeterminate=!!h)}),{labelProps:c(r,(0,C.useMemo)(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:i,descriptionProps:a,errorMessageProps:o,isSelected:s,isPressed:l,isDisabled:u,isReadOnly:d,isInvalid:f,validationErrors:p,validationDetails:m}}function E(e,t,n){let r=v({isReadOnly:e.isReadOnly||t.isReadOnly,isSelected:t.isSelected(e.value),defaultSelected:t.defaultValue.includes(e.value),onChange(n){n?t.addValue(e.value):t.removeValue(e.value),e.onChange&&e.onChange(n)}}),{name:i,form:a,descriptionId:o,errorMessageId:s,validationBehavior:c}=w.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=b({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=(0,C.useRef)(_),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};(0,C.useEffect)(d);let f=t.realtimeValidation.isInvalid?t.realtimeValidation:l,p=c===`native`?t.displayValidation:f,m=T({...e,isReadOnly:e.isReadOnly||t.isReadOnly,isDisabled:e.isDisabled||t.isDisabled,name:e.name||i,form:e.form||a,isRequired:e.isRequired??t.isRequired,validationBehavior:c,[x]:{realtimeValidation:f,displayValidation:p,resetValidation:t.resetValidation,commitValidation:t.commitValidation,updateValidation(e){u.current=e,d()}}},r,n);return{...m,inputProps:{...m.inputProps,"aria-describedby":[m.inputProps[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}var D=(0,C.createContext)(null),O=(0,C.createContext)(null),k=(0,C.createContext)(null),A=(0,C.createContext)(null),j=(0,C.forwardRef)(function(e,t){let{inputRef:n=null,...o}=e;[e,t]=p(o,t,O);let s=(0,C.useContext)(k),[l,d]=M(e,n),{descriptionProps:f,errorMessageProps:h,isSelected:g,isDisabled:_,isReadOnly:v,isInvalid:b,validationDetails:x,validationErrors:S}=l,w=u({...e,defaultClassName:`react-aria-CheckboxField`,values:{isSelected:g,isIndeterminate:e.isIndeterminate||!1,isDisabled:_,isReadOnly:v,isInvalid:b,isRequired:e.isRequired||!1}}),T=m(e,{global:!0});return delete T.id,delete T.onClick,C.createElement(a.div,{...c(T,w),ref:t,slot:e.slot||void 0,"data-selected":g||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-disabled":_||void 0,"data-readonly":v||void 0,"data-invalid":b||void 0,"data-required":e.isRequired||void 0},C.createElement(i,{values:[[A,{...l,inputRef:d,defaultClassName:`react-aria-CheckboxButton`,isIndeterminate:e.isIndeterminate,isRequired:e.isRequired}],[r,{slots:{description:f,errorMessage:h}}],[y,s?null:{isInvalid:b,validationDetails:x,validationErrors:S}]]},w.children))});function M(e,t){let{validationBehavior:n}=l(g)||{},r=e.validationBehavior??n??`native`,i=(0,C.useContext)(k),a=o((0,C.useMemo)(()=>d(t,e.inputRef===void 0?null:e.inputRef),[t,e.inputRef])),c={...s(e),children:typeof e.children==`function`||e.children,value:e.value,validationBehavior:r};return[i?E(c,i,a):T(c,v(e),a),a]}var N=(0,C.forwardRef)(function(e,t){let{labelProps:r,inputProps:i,isSelected:o,isDisabled:s,isReadOnly:l,isPressed:d,isInvalid:p,inputRef:g,defaultClassName:_,isIndeterminate:v,isRequired:y}=(0,C.useContext)(A),{isFocused:b,isFocusVisible:x,focusProps:S}=f(),w=s||l,{hoverProps:T,isHovered:E}=h({...e,isDisabled:w}),D=u({...e,defaultClassName:_,values:{isSelected:o,isIndeterminate:v||!1,isPressed:d,isHovered:E,isFocused:b,isFocusVisible:x,isDisabled:s,isReadOnly:l,isInvalid:p,isRequired:y||!1}}),O=m(e,{global:!0});return delete O.id,delete O.onClick,C.createElement(a.label,{...c(O,r,T,D),ref:t,slot:e.slot||void 0,"data-selected":o||void 0,"data-indeterminate":v||void 0,"data-pressed":d||void 0,"data-hovered":E||void 0,"data-focused":b||void 0,"data-focus-visible":x||void 0,"data-disabled":s||void 0,"data-readonly":l||void 0,"data-invalid":p||void 0,"data-required":y||void 0},C.createElement(n,{elementType:`span`},C.createElement(`input`,{...c(i,S),ref:g})),D.children)});export{O as i,j as n,D as r,N as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/CompactSwitch-BinKb1rw.js b/internal/webui/static/assets/CompactSwitch-CzZldrIr.js similarity index 95% rename from internal/webui/static/assets/CompactSwitch-BinKb1rw.js rename to internal/webui/static/assets/CompactSwitch-CzZldrIr.js index 07e76c57..af00742c 100644 --- a/internal/webui/static/assets/CompactSwitch-BinKb1rw.js +++ b/internal/webui/static/assets/CompactSwitch-CzZldrIr.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{E as r,a as i}from"./useI18n-B77RWTNi.js";import{A as a,B as o,F as s,G as c,I as l,J as u,L as d,M as f,Y as p,c as m,d as h,j as g,q as _,s as v,u as y,z as b}from"./SharedElementTransition-BlCsXfb1.js";import{c as x,i as S,m as C,t as w}from"./label-DLoR3Z-C.js";import{t as T}from"./useToggle-BRoRhkOA.js";var E=b({defaultVariants:{size:`md`},slots:{base:`switch`,content:`switch__content`,control:`switch__control`,icon:`switch__icon`,thumb:`switch__thumb`},variants:{size:{lg:{base:`switch--lg`},md:{base:`switch--md`},sm:{base:`switch--sm`}}}});function D(e,t,n){let{labelProps:r,inputProps:i,isSelected:a,...o}=T(e,t,n);return{labelProps:r,inputProps:{...i,role:`switch`,checked:a},isSelected:a,...o}}var O=t(e(),1),k=(0,O.createContext)(null),A=(0,O.createContext)(null),j=(0,O.createContext)(null),M=(0,O.forwardRef)(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=g(r,t,k);let{validationBehavior:o}=d(x)||{},m=e.validationBehavior??o??`native`,h=c(p(n,e.inputRef===void 0?null:e.inputRef)),v=S(e),y=D({...l(e),children:typeof e.children==`function`||e.children,validationBehavior:m},v,h),{descriptionProps:b,errorMessageProps:w,isSelected:T,isDisabled:E,isReadOnly:M,isInvalid:N,validationDetails:P,validationErrors:F}=y,I=f({...e,defaultClassName:`react-aria-SwitchField`,values:{isSelected:T,isDisabled:E,isReadOnly:M,isInvalid:N,isRequired:e.isRequired||!1,state:v}}),L=_(e,{global:!0});return delete L.id,delete L.onClick,O.createElement(s.div,{...u(L,I),ref:t,slot:e.slot||void 0,"data-selected":T||void 0,"data-disabled":E||void 0,"data-readonly":M||void 0,"data-invalid":N||void 0,"data-required":e.isRequired||void 0},O.createElement(a,{values:[[A,v],[j,{...y,inputRef:h,defaultClassName:`react-aria-SwitchButton`,isRequired:e.isRequired}],[i,{slots:{description:b,errorMessage:w}}],[C,{isInvalid:N,validationDetails:P,validationErrors:F}]]},I.children))}),N=(0,O.forwardRef)(function(e,t){let{labelProps:n,inputProps:i,isSelected:a,isDisabled:o,isReadOnly:c,isPressed:l,isInvalid:d,inputRef:p,defaultClassName:m,isRequired:g}=(0,O.useContext)(j),{isFocused:v,isFocusVisible:b,focusProps:x}=h(),S=o||c,C=(0,O.useContext)(A),{hoverProps:w,isHovered:T}=y({...e,isDisabled:S}),E=f({...e,defaultClassName:m,values:{isSelected:a,isPressed:l,isHovered:T,isFocused:v,isFocusVisible:b,isDisabled:o,isReadOnly:c,isInvalid:d,isRequired:g||!1,state:C}}),D=_(e,{global:!0});return delete D.id,delete D.onClick,O.createElement(s.label,{...u(D,n,w,E),ref:t,slot:e.slot||void 0,"data-selected":a||void 0,"data-pressed":l||void 0,"data-hovered":T||void 0,"data-focused":v||void 0,"data-focus-visible":b||void 0,"data-disabled":o||void 0,"data-readonly":c||void 0,"data-invalid":d||void 0,"data-required":g||void 0},O.createElement(r,{elementType:`span`},O.createElement(`input`,{...u(i,x),ref:p})),E.children)}),P=n(),F=(0,O.createContext)({}),I=({children:e,className:t,size:n,...r})=>{let i=O.useMemo(()=>E({size:n}),[n]);return(0,P.jsx)(M,{"data-slot":`switch`,...r,className:m(t,i.base()),children:t=>(0,P.jsx)(F,{value:{slots:i,state:t},children:typeof e==`function`?e(t):e})})};I.displayName=`HeroUI.Switch`;var L=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(N,{"data-slot":`switch-content`,...n,className:m(t,r?.content()),children:e})};L.displayName=`HeroUI.Switch.Content`;var R=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(o.span,{className:v(r?.control,t),"data-slot":`switch-control`,...n,children:e})};R.displayName=`HeroUI.Switch.Control`;var z=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(o.span,{className:v(r?.thumb,t),"data-slot":`switch-thumb`,...n,children:e})};z.displayName=`HeroUI.Switch.Thumb`;var B=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(o.span,{className:v(r?.icon,t),"data-slot":`switch-icon`,...n,children:e})};B.displayName=`HeroUI.Switch.Icon`;var V=Object.assign(I,{Root:I,Content:L,Control:R,Thumb:z,Icon:B});function H({isSelected:e,isDisabled:t,ariaLabel:n,label:r,size:i=`sm`,onChange:a}){return(0,P.jsx)(V,{size:i,isSelected:e,isDisabled:t,onChange:a,children:(0,P.jsxs)(V.Content,{children:[(0,P.jsx)(V.Control,{children:(0,P.jsx)(V.Thumb,{})}),r?(0,P.jsx)(w,{children:r}):(0,P.jsx)(`span`,{className:`sr-only`,children:n})]})})}export{H as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{E as r,a as i}from"./useI18n-DAGWWg9N.js";import{A as a,B as o,F as s,G as c,I as l,J as u,L as d,M as f,Y as p,c as m,d as h,j as g,q as _,s as v,u as y,z as b}from"./SharedElementTransition-BlCsXfb1.js";import{c as x,i as S,m as C,t as w}from"./label-j5K3TFm8.js";import{t as T}from"./useToggle-Zi1rbfHX.js";var E=b({defaultVariants:{size:`md`},slots:{base:`switch`,content:`switch__content`,control:`switch__control`,icon:`switch__icon`,thumb:`switch__thumb`},variants:{size:{lg:{base:`switch--lg`},md:{base:`switch--md`},sm:{base:`switch--sm`}}}});function D(e,t,n){let{labelProps:r,inputProps:i,isSelected:a,...o}=T(e,t,n);return{labelProps:r,inputProps:{...i,role:`switch`,checked:a},isSelected:a,...o}}var O=t(e(),1),k=(0,O.createContext)(null),A=(0,O.createContext)(null),j=(0,O.createContext)(null),M=(0,O.forwardRef)(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=g(r,t,k);let{validationBehavior:o}=d(x)||{},m=e.validationBehavior??o??`native`,h=c(p(n,e.inputRef===void 0?null:e.inputRef)),v=S(e),y=D({...l(e),children:typeof e.children==`function`||e.children,validationBehavior:m},v,h),{descriptionProps:b,errorMessageProps:w,isSelected:T,isDisabled:E,isReadOnly:M,isInvalid:N,validationDetails:P,validationErrors:F}=y,I=f({...e,defaultClassName:`react-aria-SwitchField`,values:{isSelected:T,isDisabled:E,isReadOnly:M,isInvalid:N,isRequired:e.isRequired||!1,state:v}}),L=_(e,{global:!0});return delete L.id,delete L.onClick,O.createElement(s.div,{...u(L,I),ref:t,slot:e.slot||void 0,"data-selected":T||void 0,"data-disabled":E||void 0,"data-readonly":M||void 0,"data-invalid":N||void 0,"data-required":e.isRequired||void 0},O.createElement(a,{values:[[A,v],[j,{...y,inputRef:h,defaultClassName:`react-aria-SwitchButton`,isRequired:e.isRequired}],[i,{slots:{description:b,errorMessage:w}}],[C,{isInvalid:N,validationDetails:P,validationErrors:F}]]},I.children))}),N=(0,O.forwardRef)(function(e,t){let{labelProps:n,inputProps:i,isSelected:a,isDisabled:o,isReadOnly:c,isPressed:l,isInvalid:d,inputRef:p,defaultClassName:m,isRequired:g}=(0,O.useContext)(j),{isFocused:v,isFocusVisible:b,focusProps:x}=h(),S=o||c,C=(0,O.useContext)(A),{hoverProps:w,isHovered:T}=y({...e,isDisabled:S}),E=f({...e,defaultClassName:m,values:{isSelected:a,isPressed:l,isHovered:T,isFocused:v,isFocusVisible:b,isDisabled:o,isReadOnly:c,isInvalid:d,isRequired:g||!1,state:C}}),D=_(e,{global:!0});return delete D.id,delete D.onClick,O.createElement(s.label,{...u(D,n,w,E),ref:t,slot:e.slot||void 0,"data-selected":a||void 0,"data-pressed":l||void 0,"data-hovered":T||void 0,"data-focused":v||void 0,"data-focus-visible":b||void 0,"data-disabled":o||void 0,"data-readonly":c||void 0,"data-invalid":d||void 0,"data-required":g||void 0},O.createElement(r,{elementType:`span`},O.createElement(`input`,{...u(i,x),ref:p})),E.children)}),P=n(),F=(0,O.createContext)({}),I=({children:e,className:t,size:n,...r})=>{let i=O.useMemo(()=>E({size:n}),[n]);return(0,P.jsx)(M,{"data-slot":`switch`,...r,className:m(t,i.base()),children:t=>(0,P.jsx)(F,{value:{slots:i,state:t},children:typeof e==`function`?e(t):e})})};I.displayName=`HeroUI.Switch`;var L=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(N,{"data-slot":`switch-content`,...n,className:m(t,r?.content()),children:e})};L.displayName=`HeroUI.Switch.Content`;var R=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(o.span,{className:v(r?.control,t),"data-slot":`switch-control`,...n,children:e})};R.displayName=`HeroUI.Switch.Control`;var z=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(o.span,{className:v(r?.thumb,t),"data-slot":`switch-thumb`,...n,children:e})};z.displayName=`HeroUI.Switch.Thumb`;var B=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(o.span,{className:v(r?.icon,t),"data-slot":`switch-icon`,...n,children:e})};B.displayName=`HeroUI.Switch.Icon`;var V=Object.assign(I,{Root:I,Content:L,Control:R,Thumb:z,Icon:B});function H({isSelected:e,isDisabled:t,ariaLabel:n,label:r,size:i=`sm`,onChange:a}){return(0,P.jsx)(V,{size:i,isSelected:e,isDisabled:t,onChange:a,children:(0,P.jsxs)(V.Content,{children:[(0,P.jsx)(V.Control,{children:(0,P.jsx)(V.Thumb,{})}),r?(0,P.jsx)(w,{children:r}):(0,P.jsx)(`span`,{className:`sr-only`,children:n})]})})}export{H as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/ConfirmDialog-2wOP1m7E.js b/internal/webui/static/assets/ConfirmDialog-2wOP1m7E.js new file mode 100644 index 00000000..ee863832 --- /dev/null +++ b/internal/webui/static/assets/ConfirmDialog-2wOP1m7E.js @@ -0,0 +1 @@ +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{J as r,R as i,Y as a,q as o,r as s}from"./useI18n-DAGWWg9N.js";import{B as c,c as l,s as u,z as d}from"./SharedElementTransition-BlCsXfb1.js";import{n as f}from"./modal-BqXo29An.js";import{B as p,H as m,R as h,V as g,xt as _,z as v}from"./index-BYut8qRj.js";var y=d({defaultVariants:{size:`md`,status:`danger`,variant:`opaque`},slots:{backdrop:`alert-dialog__backdrop`,body:`alert-dialog__body`,closeTrigger:`alert-dialog__close-trigger`,container:`alert-dialog__container`,dialog:`alert-dialog__dialog`,footer:`alert-dialog__footer`,header:`alert-dialog__header`,heading:`alert-dialog__heading`,icon:`alert-dialog__icon`,trigger:`alert-dialog__trigger`},variants:{size:{cover:{dialog:`alert-dialog__dialog--cover`},lg:{dialog:`alert-dialog__dialog--lg`},md:{dialog:`alert-dialog__dialog--md`},sm:{dialog:`alert-dialog__dialog--sm`},xs:{dialog:`alert-dialog__dialog--xs`}},status:{accent:{icon:`alert-dialog__icon--accent`},danger:{icon:`alert-dialog__icon--danger`},default:{icon:`alert-dialog__icon--default`},success:{icon:`alert-dialog__icon--success`},warning:{icon:`alert-dialog__icon--warning`}},variant:{blur:{backdrop:`alert-dialog__backdrop--blur`},opaque:{backdrop:`alert-dialog__backdrop--opaque`},transparent:{backdrop:`alert-dialog__backdrop--transparent`}}}}),b=t(e(),1),x=n(),S=(0,b.createContext)({}),C=({children:e,...t})=>{let n=(0,b.useMemo)(()=>({slots:y(),placement:void 0}),[]);return(0,x.jsx)(S,{value:n,children:(0,x.jsx)(g,{"data-slot":`alert-dialog-root`,...t,children:e})})},w=Object.assign(C,{Root:C,Trigger:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(f,{children:(0,x.jsx)(`div`,{className:u(r?.trigger,t),"data-slot":`alert-dialog-trigger`,role:`button`,...n,children:e})})},Backdrop:({children:e,className:t,isDismissable:n=!1,isKeyboardDismissDisabled:r=!0,onClick:i,variant:a,...o})=>{let{slots:s}=(0,b.use)(S),c=(0,b.useMemo)(()=>y({variant:a}),[a]),u=(0,b.useMemo)(()=>({slots:{...s,...c}}),[s,c]);return(0,x.jsx)(p,{className:l(t,c?.backdrop()),"data-slot":`alert-dialog-backdrop`,isDismissable:n,isKeyboardDismissDisabled:r,onClick:e=>{e.stopPropagation(),i?.(e)},...o,children:t=>(0,x.jsxs)(S,{value:u,children:[typeof e==`function`?e(t):e,` `]})})},Container:({children:e,className:t,placement:n=`auto`,size:r,...i})=>{let{slots:a}=(0,b.use)(S),o=(0,b.useMemo)(()=>y({size:r}),[r]),s=(0,b.useMemo)(()=>({placement:n,slots:{...a,...o}}),[n,a,o]);return(0,x.jsx)(v,{className:l(t,o?.container()),"data-placement":n,"data-slot":`alert-dialog-container`,...i,children:t=>(0,x.jsx)(S,{value:s,children:typeof e==`function`?e(t):e})})},Dialog:({children:e,className:t,...n})=>{let{placement:r,slots:i}=(0,b.use)(S);return(0,x.jsx)(m,{className:u(i?.dialog,t),"data-placement":r,"data-slot":`alert-dialog-dialog`,role:`alertdialog`,...n,children:e})},Header:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(`div`,{className:u(r?.header,t),"data-slot":`alert-dialog-header`,...n,children:e})},Heading:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(_,{className:u(r?.heading,t),"data-slot":`alert-dialog-heading`,slot:`title`,...n,children:e})},Body:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(`div`,{className:u(r?.body,t),"data-slot":`alert-dialog-body`,...n,children:e})},Footer:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(`div`,{className:u(r?.footer,t),"data-slot":`alert-dialog-footer`,...n,children:e})},Icon:({children:e,className:t,status:n=`danger`,...s})=>{let l=(0,b.useMemo)(()=>y({status:n}),[n]),u=()=>{switch(n){case`default`:return(0,x.jsx)(o,{"data-slot":`alert-dialog-default-icon`});case`accent`:return(0,x.jsx)(o,{"data-slot":`alert-dialog-default-icon`});case`success`:return(0,x.jsx)(r,{"data-slot":`alert-dialog-default-icon`});case`warning`:return(0,x.jsx)(a,{"data-slot":`alert-dialog-default-icon`});case`danger`:return(0,x.jsx)(i,{"data-slot":`alert-dialog-default-icon`});default:return(0,x.jsx)(i,{"data-slot":`alert-dialog-default-icon`})}};return(0,x.jsx)(c.div,{className:l?.icon({className:t}),"data-slot":`alert-dialog-icon`,...s,children:e??u()})},CloseTrigger:({className:e,...t})=>{let{slots:n}=(0,b.use)(S);return(0,x.jsx)(h,{className:l(e,n?.closeTrigger()),"data-slot":`alert-dialog-close-trigger`,slot:`close`,...t})}});function T({isOpen:e,title:t,description:n,confirmLabel:r,cancelLabel:i,closeLabel:a,isPending:o,status:c=`danger`,confirmVariant:l=`danger`,onClose:u,onConfirm:d}){return(0,x.jsx)(w.Root,{isOpen:e,onOpenChange:e=>{!e&&!o&&u()},children:(0,x.jsx)(w.Backdrop,{variant:`blur`,isDismissable:!o,children:(0,x.jsx)(w.Container,{placement:`center`,size:`sm`,children:(0,x.jsxs)(w.Dialog,{children:[(0,x.jsxs)(w.Header,{className:`items-start justify-between gap-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,x.jsx)(w.Icon,{status:c}),(0,x.jsx)(`div`,{children:(0,x.jsx)(w.Heading,{children:t})})]}),(0,x.jsx)(w.CloseTrigger,{isDisabled:o,"aria-label":a})]}),(0,x.jsx)(w.Body,{children:(0,x.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:n})}),(0,x.jsxs)(w.Footer,{children:[(0,x.jsx)(s,{size:`sm`,variant:`ghost`,isDisabled:o,onPress:u,children:i}),(0,x.jsx)(s,{size:`sm`,variant:l,isPending:o,onPress:d,children:r})]})]})})})})}export{T as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/ConfirmDialog-CNztRgAW.js b/internal/webui/static/assets/ConfirmDialog-CNztRgAW.js deleted file mode 100644 index a1622447..00000000 --- a/internal/webui/static/assets/ConfirmDialog-CNztRgAW.js +++ /dev/null @@ -1 +0,0 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{J as r,R as i,Y as a,q as o,r as s}from"./useI18n-B77RWTNi.js";import{B as c,c as l,s as u,z as d}from"./SharedElementTransition-BlCsXfb1.js";import{n as f}from"./modal-q_Ums9Et.js";import{Jt as p,dt as m,ft as h,ht as g,mt as _,pt as v}from"./index-CmGY2WQi.js";var y=d({defaultVariants:{size:`md`,status:`danger`,variant:`opaque`},slots:{backdrop:`alert-dialog__backdrop`,body:`alert-dialog__body`,closeTrigger:`alert-dialog__close-trigger`,container:`alert-dialog__container`,dialog:`alert-dialog__dialog`,footer:`alert-dialog__footer`,header:`alert-dialog__header`,heading:`alert-dialog__heading`,icon:`alert-dialog__icon`,trigger:`alert-dialog__trigger`},variants:{size:{cover:{dialog:`alert-dialog__dialog--cover`},lg:{dialog:`alert-dialog__dialog--lg`},md:{dialog:`alert-dialog__dialog--md`},sm:{dialog:`alert-dialog__dialog--sm`},xs:{dialog:`alert-dialog__dialog--xs`}},status:{accent:{icon:`alert-dialog__icon--accent`},danger:{icon:`alert-dialog__icon--danger`},default:{icon:`alert-dialog__icon--default`},success:{icon:`alert-dialog__icon--success`},warning:{icon:`alert-dialog__icon--warning`}},variant:{blur:{backdrop:`alert-dialog__backdrop--blur`},opaque:{backdrop:`alert-dialog__backdrop--opaque`},transparent:{backdrop:`alert-dialog__backdrop--transparent`}}}}),b=t(e(),1),x=n(),S=(0,b.createContext)({}),C=({children:e,...t})=>{let n=(0,b.useMemo)(()=>({slots:y(),placement:void 0}),[]);return(0,x.jsx)(S,{value:n,children:(0,x.jsx)(_,{"data-slot":`alert-dialog-root`,...t,children:e})})},w=Object.assign(C,{Root:C,Trigger:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(f,{children:(0,x.jsx)(`div`,{className:u(r?.trigger,t),"data-slot":`alert-dialog-trigger`,role:`button`,...n,children:e})})},Backdrop:({children:e,className:t,isDismissable:n=!1,isKeyboardDismissDisabled:r=!0,onClick:i,variant:a,...o})=>{let{slots:s}=(0,b.use)(S),c=(0,b.useMemo)(()=>y({variant:a}),[a]),u=(0,b.useMemo)(()=>({slots:{...s,...c}}),[s,c]);return(0,x.jsx)(v,{className:l(t,c?.backdrop()),"data-slot":`alert-dialog-backdrop`,isDismissable:n,isKeyboardDismissDisabled:r,onClick:e=>{e.stopPropagation(),i?.(e)},...o,children:t=>(0,x.jsxs)(S,{value:u,children:[typeof e==`function`?e(t):e,` `]})})},Container:({children:e,className:t,placement:n=`auto`,size:r,...i})=>{let{slots:a}=(0,b.use)(S),o=(0,b.useMemo)(()=>y({size:r}),[r]),s=(0,b.useMemo)(()=>({placement:n,slots:{...a,...o}}),[n,a,o]);return(0,x.jsx)(h,{className:l(t,o?.container()),"data-placement":n,"data-slot":`alert-dialog-container`,...i,children:t=>(0,x.jsx)(S,{value:s,children:typeof e==`function`?e(t):e})})},Dialog:({children:e,className:t,...n})=>{let{placement:r,slots:i}=(0,b.use)(S);return(0,x.jsx)(g,{className:u(i?.dialog,t),"data-placement":r,"data-slot":`alert-dialog-dialog`,role:`alertdialog`,...n,children:e})},Header:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(`div`,{className:u(r?.header,t),"data-slot":`alert-dialog-header`,...n,children:e})},Heading:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(p,{className:u(r?.heading,t),"data-slot":`alert-dialog-heading`,slot:`title`,...n,children:e})},Body:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(`div`,{className:u(r?.body,t),"data-slot":`alert-dialog-body`,...n,children:e})},Footer:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(`div`,{className:u(r?.footer,t),"data-slot":`alert-dialog-footer`,...n,children:e})},Icon:({children:e,className:t,status:n=`danger`,...s})=>{let l=(0,b.useMemo)(()=>y({status:n}),[n]),u=()=>{switch(n){case`default`:return(0,x.jsx)(o,{"data-slot":`alert-dialog-default-icon`});case`accent`:return(0,x.jsx)(o,{"data-slot":`alert-dialog-default-icon`});case`success`:return(0,x.jsx)(r,{"data-slot":`alert-dialog-default-icon`});case`warning`:return(0,x.jsx)(a,{"data-slot":`alert-dialog-default-icon`});case`danger`:return(0,x.jsx)(i,{"data-slot":`alert-dialog-default-icon`});default:return(0,x.jsx)(i,{"data-slot":`alert-dialog-default-icon`})}};return(0,x.jsx)(c.div,{className:l?.icon({className:t}),"data-slot":`alert-dialog-icon`,...s,children:e??u()})},CloseTrigger:({className:e,...t})=>{let{slots:n}=(0,b.use)(S);return(0,x.jsx)(m,{className:l(e,n?.closeTrigger()),"data-slot":`alert-dialog-close-trigger`,slot:`close`,...t})}});function T({isOpen:e,title:t,description:n,confirmLabel:r,cancelLabel:i,closeLabel:a,isPending:o,status:c=`danger`,confirmVariant:l=`danger`,onClose:u,onConfirm:d}){return(0,x.jsx)(w.Root,{isOpen:e,onOpenChange:e=>{!e&&!o&&u()},children:(0,x.jsx)(w.Backdrop,{variant:`blur`,isDismissable:!o,children:(0,x.jsx)(w.Container,{placement:`center`,size:`sm`,children:(0,x.jsxs)(w.Dialog,{children:[(0,x.jsxs)(w.Header,{className:`items-start justify-between gap-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,x.jsx)(w.Icon,{status:c}),(0,x.jsx)(`div`,{children:(0,x.jsx)(w.Heading,{children:t})})]}),(0,x.jsx)(w.CloseTrigger,{isDisabled:o,"aria-label":a})]}),(0,x.jsx)(w.Body,{children:(0,x.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:n})}),(0,x.jsxs)(w.Footer,{children:[(0,x.jsx)(s,{size:`sm`,variant:`ghost`,isDisabled:o,onPress:u,children:i}),(0,x.jsx)(s,{size:`sm`,variant:l,isPending:o,onPress:d,children:r})]})]})})})})}export{T as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/FilterSelect-B8vbCqfN.js b/internal/webui/static/assets/FilterSelect-BkT3LDQz.js similarity index 80% rename from internal/webui/static/assets/FilterSelect-B8vbCqfN.js rename to internal/webui/static/assets/FilterSelect-BkT3LDQz.js index fd751583..1108c251 100644 --- a/internal/webui/static/assets/FilterSelect-B8vbCqfN.js +++ b/internal/webui/static/assets/FilterSelect-BkT3LDQz.js @@ -1 +1 @@ -import{n as e}from"./shim-mfK0Rmj6.js";import{t}from"./label-DLoR3Z-C.js";import{t as n}from"./list-box-rbke8Feh.js";import{t as r}from"./select-BRn66sMj.js";var i=e(),a=`__all__`;function o({value:e,onChange:o,ariaLabel:s,options:c,className:l}){let u=c.map(e=>({id:e.id||a,label:e.label})),d=e||a,f=u.find(e=>e.id===d);return(0,i.jsxs)(r,{className:l??`w-fit min-w-36`,"aria-label":s,value:d,onChange:e=>{typeof e==`string`&&o(e===a?``:e)},children:[(0,i.jsxs)(r.Trigger,{className:`min-w-0 w-full items-center`,children:[(0,i.jsx)(r.Value,{className:`min-w-0 truncate`,children:({defaultChildren:e,isPlaceholder:t})=>t||!f?e:(0,i.jsx)(`span`,{className:`truncate`,children:f.label})}),(0,i.jsx)(r.Indicator,{})]}),(0,i.jsx)(r.Popover,{className:`max-h-72 min-w-36`,children:(0,i.jsx)(n,{children:u.map(e=>(0,i.jsxs)(n.Item,{id:e.id,textValue:e.label,children:[(0,i.jsx)(t,{className:`block truncate`,children:e.label}),(0,i.jsx)(n.ItemIndicator,{})]},e.id))})})]})}export{o as t}; \ No newline at end of file +import{n as e}from"./shim-mfK0Rmj6.js";import{t}from"./label-j5K3TFm8.js";import{t as n}from"./list-box-CGt1vjr2.js";import{t as r}from"./select-6cCnF9ka.js";var i=e(),a=`__all__`;function o({value:e,onChange:o,ariaLabel:s,options:c,className:l}){let u=c.map(e=>({id:e.id||a,label:e.label})),d=e||a,f=u.find(e=>e.id===d);return(0,i.jsxs)(r,{className:l??`w-fit min-w-36`,"aria-label":s,value:d,onChange:e=>{typeof e==`string`&&o(e===a?``:e)},children:[(0,i.jsxs)(r.Trigger,{className:`min-w-0 w-full items-center`,children:[(0,i.jsx)(r.Value,{className:`min-w-0 truncate`,children:({defaultChildren:e,isPlaceholder:t})=>t||!f?e:(0,i.jsx)(`span`,{className:`truncate`,children:f.label})}),(0,i.jsx)(r.Indicator,{})]}),(0,i.jsx)(r.Popover,{className:`max-h-72 min-w-36`,children:(0,i.jsx)(n,{children:u.map(e=>(0,i.jsxs)(n.Item,{id:e.id,textValue:e.label,children:[(0,i.jsx)(t,{className:`block truncate`,children:e.label}),(0,i.jsx)(n.ItemIndicator,{})]},e.id))})})]})}export{o as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/FilterToggle-Bygki2HF.js b/internal/webui/static/assets/FilterToggle-nA-ZS4oO.js similarity index 79% rename from internal/webui/static/assets/FilterToggle-Bygki2HF.js rename to internal/webui/static/assets/FilterToggle-nA-ZS4oO.js index 3a26ff8d..dac34df2 100644 --- a/internal/webui/static/assets/FilterToggle-Bygki2HF.js +++ b/internal/webui/static/assets/FilterToggle-nA-ZS4oO.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./toggle-button-group-DR9Hhwb5.js";import{r as a}from"./gsap-C3sDxib7.js";import{_ as o,v as s,y as c}from"./index-CmGY2WQi.js";var l=t(e(),1),u=n(),d={"--toggle-button-bg-selected":`transparent`,"--toggle-button-bg-selected-hover":`transparent`,"--toggle-button-bg-selected-pressed":`transparent`};function f({value:e,onChange:t,options:n,ariaLabel:f,className:p}){let m=(0,l.useRef)(null),h=(0,l.useRef)(null),g=(0,l.useRef)(!1);return(0,l.useLayoutEffect)(()=>{let e=m.current,t=h.current;if(!e||!t)return;let n=n=>{let r=e.querySelector(`[data-selected="true"]`);if(!r){a.set(t,{autoAlpha:0});return}let i=e.getBoundingClientRect(),l=r.getBoundingClientRect();a.to(t,{x:l.left-i.left,y:l.top-i.top,width:l.width,height:l.height,autoAlpha:1,duration:n?c(o.base):0,ease:s.out,overwrite:!0})};n(g.current),g.current=!0;let r=new ResizeObserver(()=>n(!1));return r.observe(e),()=>{r.disconnect(),a.killTweensOf(t)}},[e,n]),(0,u.jsxs)(`div`,{ref:m,className:`filter-toggle relative inline-flex ${p??``}`,children:[(0,u.jsx)(`span`,{ref:h,"aria-hidden":!0,className:`filter-toggle__pill pointer-events-none absolute left-0 top-0 opacity-0`}),(0,u.jsx)(i,{"aria-label":f,size:`sm`,selectionMode:`single`,disallowEmptySelection:!0,selectedKeys:new Set([e]),onSelectionChange:n=>{let r=[...n][0];typeof r==`string`&&r!==e&&t(r)},children:n.map(e=>(0,u.jsxs)(r,{id:e.id,className:`relative z-[1]`,style:d,children:[e.icon,e.label]},e.id))})]})}export{f as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./toggle-button-group-C1kahmRj.js";import{r as a}from"./gsap-C3sDxib7.js";import{b as o,v as s,y as c}from"./index-BYut8qRj.js";var l=t(e(),1),u=n(),d={"--toggle-button-bg-selected":`transparent`,"--toggle-button-bg-selected-hover":`transparent`,"--toggle-button-bg-selected-pressed":`transparent`};function f({value:e,onChange:t,options:n,ariaLabel:f,className:p}){let m=(0,l.useRef)(null),h=(0,l.useRef)(null),g=(0,l.useRef)(!1);return(0,l.useLayoutEffect)(()=>{let e=m.current,t=h.current;if(!e||!t)return;let n=n=>{let r=e.querySelector(`[data-selected="true"]`);if(!r){a.set(t,{autoAlpha:0});return}let i=e.getBoundingClientRect(),l=r.getBoundingClientRect();a.to(t,{x:l.left-i.left,y:l.top-i.top,width:l.width,height:l.height,autoAlpha:1,duration:n?o(s.base):0,ease:c.out,overwrite:!0})};n(g.current),g.current=!0;let r=new ResizeObserver(()=>n(!1));return r.observe(e),()=>{r.disconnect(),a.killTweensOf(t)}},[e,n]),(0,u.jsxs)(`div`,{ref:m,className:`filter-toggle relative inline-flex ${p??``}`,children:[(0,u.jsx)(`span`,{ref:h,"aria-hidden":!0,className:`filter-toggle__pill pointer-events-none absolute left-0 top-0 opacity-0`}),(0,u.jsx)(i,{"aria-label":f,size:`sm`,selectionMode:`single`,disallowEmptySelection:!0,selectedKeys:new Set([e]),onSelectionChange:n=>{let r=[...n][0];typeof r==`string`&&r!==e&&t(r)},children:n.map(e=>(0,u.jsxs)(r,{id:e.id,className:`relative z-[1]`,style:d,children:[e.icon,e.label]},e.id))})]})}export{f as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/FormRow-DvxQavWE.js b/internal/webui/static/assets/FormRow-6b4yVFYc.js similarity index 84% rename from internal/webui/static/assets/FormRow-DvxQavWE.js rename to internal/webui/static/assets/FormRow-6b4yVFYc.js index 63488b05..5ad3162e 100644 --- a/internal/webui/static/assets/FormRow-DvxQavWE.js +++ b/internal/webui/static/assets/FormRow-6b4yVFYc.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{i as r}from"./useI18n-B77RWTNi.js";import{c as i,z as a}from"./SharedElementTransition-BlCsXfb1.js";import{r as o,t as s}from"./label-DLoR3Z-C.js";import{t as c}from"./textfield-BWaikvel.js";import{n as l}from"./use-has-text-slot-B-ilgVo6.js";import{t as u}from"./collection-prop-injection-UgIu0U6K.js";var d=a({base:`description`}),f=a({base:`input`,defaultVariants:{fullWidth:!1,variant:`primary`},variants:{fullWidth:{false:``,true:`input--full-width`},variant:{primary:`input--primary`,secondary:`input--secondary`}}}),p=t(e(),1),m=n(),h=(0,p.createContext)({});u(`combo-box.inputGroup`);var g=({className:e,fullWidth:t,variant:n,...r})=>{let a=(0,p.use)(c),s=(0,p.use)(h),l=n??a.variant??s.variant;return(0,m.jsx)(o,{className:i(e,f({fullWidth:t,variant:l})),"data-slot":`input`,...r})},_=Object.assign(g,{Root:g}),v=({children:e,className:t,...n})=>l(`description`)?(0,m.jsx)(r,{className:d({className:t}),"data-slot":`description`,slot:`description`,...n,children:e}):null,y=Object.assign(v,{Root:v}),b=`w-28`;function x({label:e,hint:t,labelWidthClass:n=b,htmlFor:r,align:i=`center`,children:a}){return(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`div`,{className:`flex gap-3 ${i===`start`?`items-start`:`items-center`}`,children:[(0,m.jsx)(s,{htmlFor:r,className:`${n} shrink-0 ${i===`start`?`pt-2`:``} text-body font-medium text-foreground`,children:e}),(0,m.jsx)(`div`,{className:`min-w-0 flex-1 [&_[data-slot=input]]:w-full [&_[data-slot=textarea]]:w-full`,children:a})]}),t?(0,m.jsx)(`p`,{className:`mt-1.5 pl-[7.75rem] text-caption leading-5 text-muted`,children:t}):null]})}export{y as n,_ as r,x as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{i as r}from"./useI18n-DAGWWg9N.js";import{c as i,z as a}from"./SharedElementTransition-BlCsXfb1.js";import{r as o,t as s}from"./label-j5K3TFm8.js";import{t as c}from"./textfield-DbDjPadh.js";import{n as l}from"./use-has-text-slot-C0lyJpv1.js";import{t as u}from"./collection-prop-injection-UgIu0U6K.js";var d=a({base:`description`}),f=a({base:`input`,defaultVariants:{fullWidth:!1,variant:`primary`},variants:{fullWidth:{false:``,true:`input--full-width`},variant:{primary:`input--primary`,secondary:`input--secondary`}}}),p=t(e(),1),m=n(),h=(0,p.createContext)({});u(`combo-box.inputGroup`);var g=({className:e,fullWidth:t,variant:n,...r})=>{let a=(0,p.use)(c),s=(0,p.use)(h),l=n??a.variant??s.variant;return(0,m.jsx)(o,{className:i(e,f({fullWidth:t,variant:l})),"data-slot":`input`,...r})},_=Object.assign(g,{Root:g}),v=({children:e,className:t,...n})=>l(`description`)?(0,m.jsx)(r,{className:d({className:t}),"data-slot":`description`,slot:`description`,...n,children:e}):null,y=Object.assign(v,{Root:v}),b=`w-28`;function x({label:e,hint:t,labelWidthClass:n=b,htmlFor:r,align:i=`center`,children:a}){return(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`div`,{className:`flex gap-3 ${i===`start`?`items-start`:`items-center`}`,children:[(0,m.jsx)(s,{htmlFor:r,className:`${n} shrink-0 ${i===`start`?`pt-2`:``} text-body font-medium text-foreground`,children:e}),(0,m.jsx)(`div`,{className:`min-w-0 flex-1 [&_[data-slot=input]]:w-full [&_[data-slot=textarea]]:w-full`,children:a})]}),t?(0,m.jsx)(`p`,{className:`mt-1.5 pl-[7.75rem] text-caption leading-5 text-muted`,children:t}):null]})}export{y as n,_ as r,x as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/InflightDepthChart-_zhkPXRC.js b/internal/webui/static/assets/InflightDepthChart-oFVQT4m1.js similarity index 95% rename from internal/webui/static/assets/InflightDepthChart-_zhkPXRC.js rename to internal/webui/static/assets/InflightDepthChart-oFVQT4m1.js index fd392323..310af49e 100644 --- a/internal/webui/static/assets/InflightDepthChart-_zhkPXRC.js +++ b/internal/webui/static/assets/InflightDepthChart-oFVQT4m1.js @@ -1 +1 @@ -import{a as e,c as t,n,r}from"./shim-mfK0Rmj6.js";import{b as i,y as a}from"./index-CmGY2WQi.js";import{At as o,Dn as s,Gt as c,Ht as l,Kt as u,L as d,Ln as f,Mt as p,R as m,Rn as h,Sn as g,U as _,_ as v,a as y,ct as b,dt as x,f as S,g as C,kt as w,m as T,pt as E,r as D,t as O,tt as k}from"./AreaChart-B0YOdVBx.js";import{t as A}from"./XAxis-DLQkFqxC.js";import{n as j,t as M}from"./ReferenceArea-CiIBWWEY.js";var N=t(e());function P(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 F(e){for(var t=1;t{var n;if(N.isValidElement(e))n=N.cloneElement(e,t);else if(typeof e==`function`)n=e(t);else{if(!l(t.x1)||!l(t.y1)||!l(t.x2)||!l(t.y2))return null;n=N.createElement(`line`,z({},t,{className:`recharts-reference-line-line`}))}return n},V=(e,t,n,r,i,a)=>{var o=a.x,s=a.width,c=i.map(e,{position:n});if(!l(c)||t===`discard`&&!i.isInRange(c))return null;var u=[{x:o+s,y:c},{x:o,y:c}];return r===`left`?u.reverse():u},H=(e,t,n,r,i,a)=>{var o=a.y,s=a.height,c=i.map(e,{position:n});if(!l(c)||t===`discard`&&!i.isInRange(c))return null;var u=[{x:c,y:o+s},{x:c,y:o}];return r===`top`?u.reverse():u},U=(e,t,n,r)=>{var i=[r.mapWithFallback(e[0],{position:n,fallback:`rangeMin`}),r.mapWithFallback(e[1],{position:n,fallback:`rangeMax`})];return t===`discard`&&i.some(e=>!r.isInRange(e))?null:i},W=(e,t,n,r,i,a,o)=>{var c=o.x,l=o.y,u=o.segment,d=o.ifOverflow,f=s(c);return s(l)?V(l,d,r,a,t,n):f?H(c,d,r,i,e,n):u!=null&&u.length===2?U(u,d,r,new j({x:e,y:t})):null};function G(e){var t=c();return(0,N.useEffect)(()=>(t(T(e)),()=>{t(C(e))})),null}function K(e){var t=e.xAxisId,n=e.yAxisId,i=e.shape,a=e.className,o=e.ifOverflow,s=p(),c=S(),l=u(e=>b(e,t)),g=u(e=>x(e,n)),y=u(e=>k(e,`xAxis`,t,s)),C=u(e=>k(e,`yAxis`,n,s)),T=w();if(!c||!T||l==null||g==null||y==null||C==null)return null;var E=W(y,C,T,e.position,l.orientation,g.orientation,e);if(!E)return null;var D=E[0],O=E[1];if(D==null||O==null)return null;var A=D.x,j=D.y,M=O.x,P=O.y,I=F(F({clipPath:o===`hidden`?`url(#${c})`:void 0},h(e)),{},{x1:A,y1:j,x2:M,y2:P}),L=v({x1:A,y1:j,x2:M,y2:P});return N.createElement(_,{zIndex:e.zIndex},N.createElement(f,{className:r(`recharts-reference-line`,a)},B(i,I),N.createElement(d,z({},L,{lowerWidth:L.width,upperWidth:L.width}),N.createElement(m,{label:e.label}),e.children)))}var q={ifOverflow:`discard`,xAxisId:0,yAxisId:0,fill:`none`,label:!1,stroke:`#ccc`,fillOpacity:1,strokeWidth:1,position:`middle`,zIndex:E.line};function J(e){var t=g(e,q);return N.createElement(N.Fragment,null,N.createElement(G,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x:t.x,y:t.y,segment:t.segment}),N.createElement(K,t))}J.displayName=`ReferenceLine`;var Y=n();function X({series:e,bands:t,backpressure:n,label:r}){let s=Math.max(n,...e,1),c=(0,N.useRef)(s),[l,u]=(0,N.useState)(s);(0,N.useEffect)(()=>{if(i()){c.current=s,u(s);return}let e=c.current,t=s;if(Math.abs(t-e)<.01)return;let n=0,r=performance.now(),o=a(.56)*1e3,l=i=>{let a=Math.min(1,(i-r)/o),s=1-(1-a)**3,d=e+(t-e)*s;c.current=d,u(d),a<1&&(n=requestAnimationFrame(l))};return n=requestAnimationFrame(l),()=>cancelAnimationFrame(n)},[s]);let d=(0,N.useMemo)(()=>e.map((e,t)=>({i:t,v:e,bp:n})),[e,n]),f=(0,N.useMemo)(()=>t.map((t,n)=>{let r=Math.max(1,e.length-1);return{key:n,x1:t.from*r,x2:Math.max(t.from*r+.35,t.until*r)}}),[t,e.length]),p=Math.max(l,n,1);return(0,Y.jsx)(`div`,{className:`h-11 w-full overflow-hidden`,role:`img`,"aria-label":r,"data-depth-chart":!0,children:(0,Y.jsx)(o,{width:`100%`,height:`100%`,children:(0,Y.jsxs)(O,{data:d,margin:{top:4,right:2,bottom:2,left:2},children:[(0,Y.jsx)(D,{hide:!0,domain:[0,p],allowDataOverflow:!0}),(0,Y.jsx)(A,{hide:!0,dataKey:`i`,type:`number`,domain:[0,Math.max(0,e.length-1)]}),f.map(e=>(0,Y.jsx)(M,{x1:e.x1,x2:e.x2,y1:0,y2:p,fill:`var(--il-warn, var(--warning))`,fillOpacity:.14,ifOverflow:`extendDomain`},e.key)),(0,Y.jsx)(J,{y:n,stroke:`var(--il-faint, var(--foreground))`,strokeOpacity:.35,strokeDasharray:`3 3`,ifOverflow:`extendDomain`}),(0,Y.jsx)(`defs`,{children:(0,Y.jsxs)(`linearGradient`,{id:`il-depth-fill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,Y.jsx)(`stop`,{offset:`0%`,stopColor:`var(--il-depth, var(--chart-1))`,stopOpacity:.28}),(0,Y.jsx)(`stop`,{offset:`100%`,stopColor:`var(--il-depth, var(--chart-1))`,stopOpacity:.04})]})}),(0,Y.jsx)(y,{type:`monotone`,dataKey:`v`,stroke:`var(--il-depth, var(--chart-1))`,strokeOpacity:.95,strokeWidth:1.85,fill:`url(#il-depth-fill)`,fillOpacity:1,isAnimationActive:!i(),animationDuration:Math.round(a(.56)*1e3),animationEasing:`linear`,dot:!1,activeDot:!1})]})})})}export{X as InflightDepthChart}; \ No newline at end of file +import{a as e,c as t,n,r}from"./shim-mfK0Rmj6.js";import{b as i,x as a}from"./index-BYut8qRj.js";import{At as o,Dn as s,Gt as c,Ht as l,Kt as u,L as d,Ln as f,Mt as p,R as m,Rn as h,Sn as g,U as _,_ as v,a as y,ct as b,dt as x,f as S,g as C,kt as w,m as T,pt as E,r as D,t as O,tt as k}from"./AreaChart-B0YOdVBx.js";import{t as A}from"./XAxis-DLQkFqxC.js";import{n as j,t as M}from"./ReferenceArea-CiIBWWEY.js";var N=t(e());function P(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 F(e){for(var t=1;t{var n;if(N.isValidElement(e))n=N.cloneElement(e,t);else if(typeof e==`function`)n=e(t);else{if(!l(t.x1)||!l(t.y1)||!l(t.x2)||!l(t.y2))return null;n=N.createElement(`line`,z({},t,{className:`recharts-reference-line-line`}))}return n},V=(e,t,n,r,i,a)=>{var o=a.x,s=a.width,c=i.map(e,{position:n});if(!l(c)||t===`discard`&&!i.isInRange(c))return null;var u=[{x:o+s,y:c},{x:o,y:c}];return r===`left`?u.reverse():u},H=(e,t,n,r,i,a)=>{var o=a.y,s=a.height,c=i.map(e,{position:n});if(!l(c)||t===`discard`&&!i.isInRange(c))return null;var u=[{x:c,y:o+s},{x:c,y:o}];return r===`top`?u.reverse():u},U=(e,t,n,r)=>{var i=[r.mapWithFallback(e[0],{position:n,fallback:`rangeMin`}),r.mapWithFallback(e[1],{position:n,fallback:`rangeMax`})];return t===`discard`&&i.some(e=>!r.isInRange(e))?null:i},W=(e,t,n,r,i,a,o)=>{var c=o.x,l=o.y,u=o.segment,d=o.ifOverflow,f=s(c);return s(l)?V(l,d,r,a,t,n):f?H(c,d,r,i,e,n):u!=null&&u.length===2?U(u,d,r,new j({x:e,y:t})):null};function G(e){var t=c();return(0,N.useEffect)(()=>(t(T(e)),()=>{t(C(e))})),null}function K(e){var t=e.xAxisId,n=e.yAxisId,i=e.shape,a=e.className,o=e.ifOverflow,s=p(),c=S(),l=u(e=>b(e,t)),g=u(e=>x(e,n)),y=u(e=>k(e,`xAxis`,t,s)),C=u(e=>k(e,`yAxis`,n,s)),T=w();if(!c||!T||l==null||g==null||y==null||C==null)return null;var E=W(y,C,T,e.position,l.orientation,g.orientation,e);if(!E)return null;var D=E[0],O=E[1];if(D==null||O==null)return null;var A=D.x,j=D.y,M=O.x,P=O.y,I=F(F({clipPath:o===`hidden`?`url(#${c})`:void 0},h(e)),{},{x1:A,y1:j,x2:M,y2:P}),L=v({x1:A,y1:j,x2:M,y2:P});return N.createElement(_,{zIndex:e.zIndex},N.createElement(f,{className:r(`recharts-reference-line`,a)},B(i,I),N.createElement(d,z({},L,{lowerWidth:L.width,upperWidth:L.width}),N.createElement(m,{label:e.label}),e.children)))}var q={ifOverflow:`discard`,xAxisId:0,yAxisId:0,fill:`none`,label:!1,stroke:`#ccc`,fillOpacity:1,strokeWidth:1,position:`middle`,zIndex:E.line};function J(e){var t=g(e,q);return N.createElement(N.Fragment,null,N.createElement(G,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x:t.x,y:t.y,segment:t.segment}),N.createElement(K,t))}J.displayName=`ReferenceLine`;var Y=n();function X({series:e,bands:t,backpressure:n,label:r}){let s=Math.max(n,...e,1),c=(0,N.useRef)(s),[l,u]=(0,N.useState)(s);(0,N.useEffect)(()=>{if(a()){c.current=s,u(s);return}let e=c.current,t=s;if(Math.abs(t-e)<.01)return;let n=0,r=performance.now(),o=i(.56)*1e3,l=i=>{let a=Math.min(1,(i-r)/o),s=1-(1-a)**3,d=e+(t-e)*s;c.current=d,u(d),a<1&&(n=requestAnimationFrame(l))};return n=requestAnimationFrame(l),()=>cancelAnimationFrame(n)},[s]);let d=(0,N.useMemo)(()=>e.map((e,t)=>({i:t,v:e,bp:n})),[e,n]),f=(0,N.useMemo)(()=>t.map((t,n)=>{let r=Math.max(1,e.length-1);return{key:n,x1:t.from*r,x2:Math.max(t.from*r+.35,t.until*r)}}),[t,e.length]),p=Math.max(l,n,1);return(0,Y.jsx)(`div`,{className:`h-11 w-full overflow-hidden`,role:`img`,"aria-label":r,"data-depth-chart":!0,children:(0,Y.jsx)(o,{width:`100%`,height:`100%`,children:(0,Y.jsxs)(O,{data:d,margin:{top:4,right:2,bottom:2,left:2},children:[(0,Y.jsx)(D,{hide:!0,domain:[0,p],allowDataOverflow:!0}),(0,Y.jsx)(A,{hide:!0,dataKey:`i`,type:`number`,domain:[0,Math.max(0,e.length-1)]}),f.map(e=>(0,Y.jsx)(M,{x1:e.x1,x2:e.x2,y1:0,y2:p,fill:`var(--il-warn, var(--warning))`,fillOpacity:.14,ifOverflow:`extendDomain`},e.key)),(0,Y.jsx)(J,{y:n,stroke:`var(--il-faint, var(--foreground))`,strokeOpacity:.35,strokeDasharray:`3 3`,ifOverflow:`extendDomain`}),(0,Y.jsx)(`defs`,{children:(0,Y.jsxs)(`linearGradient`,{id:`il-depth-fill`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,Y.jsx)(`stop`,{offset:`0%`,stopColor:`var(--il-depth, var(--chart-1))`,stopOpacity:.28}),(0,Y.jsx)(`stop`,{offset:`100%`,stopColor:`var(--il-depth, var(--chart-1))`,stopOpacity:.04})]})}),(0,Y.jsx)(y,{type:`monotone`,dataKey:`v`,stroke:`var(--il-depth, var(--chart-1))`,strokeOpacity:.95,strokeWidth:1.85,fill:`url(#il-depth-fill)`,fillOpacity:1,isAnimationActive:!a(),animationDuration:Math.round(i(.56)*1e3),animationEasing:`linear`,dot:!1,activeDot:!1})]})})})}export{X as InflightDepthChart}; \ No newline at end of file diff --git a/internal/webui/static/assets/InflightLiveCard-CQIDgYNq.js b/internal/webui/static/assets/InflightLiveCard-DWPcSiCz.js similarity index 60% rename from internal/webui/static/assets/InflightLiveCard-CQIDgYNq.js rename to internal/webui/static/assets/InflightLiveCard-DWPcSiCz.js index b7216327..36971245 100644 --- a/internal/webui/static/assets/InflightLiveCard-CQIDgYNq.js +++ b/internal/webui/static/assets/InflightLiveCard-DWPcSiCz.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/InflightDepthChart-_zhkPXRC.js","assets/shim-mfK0Rmj6.js","assets/index-CmGY2WQi.js","assets/useI18n-B77RWTNi.js","assets/SharedElementTransition-BlCsXfb1.js","assets/gsap-C3sDxib7.js","assets/index-CiXcUE0I.css","assets/AreaChart-B0YOdVBx.js","assets/XAxis-DLQkFqxC.js","assets/ReferenceArea-CiIBWWEY.js"])))=>i.map(i=>d[i]); -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./Check.es-BqA3iE7U.js";import{pt as a}from"./useI18n-B77RWTNi.js";import{n as o}from"./useToggle-BRoRhkOA.js";import{t as s}from"./CompactSwitch-BinKb1rw.js";import{n as c,r as l,t as u}from"./gsap-C3sDxib7.js";import{Sn as d,_n as f,b as p,en as m,fn as h,v as g,y as _}from"./index-CmGY2WQi.js";import{a as v}from"./format-B6SmebW-.js";import{t as y}from"./ProviderMark-IiAZTaQS.js";var b=t(e(),1),x=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M204,64V168a12,12,0,0,1-24,0V93L72.49,200.49a12,12,0,0,1-17-17L163,76H88a12,12,0,0,1,0-24H192A12,12,0,0,1,204,64Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M192,64V168L88,64Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M192,56H88a8,8,0,0,0-5.66,13.66L128.69,116,58.34,186.34a8,8,0,0,0,11.32,11.32L140,127.31l46.34,46.35A8,8,0,0,0,200,168V64A8,8,0,0,0,192,56Zm-8,92.69-38.34-38.34h0L107.31,72H184Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-13.66,5.66L140,127.31,69.66,197.66a8,8,0,0,1-11.32-11.32L128.69,116,82.34,69.66A8,8,0,0,1,88,56H192A8,8,0,0,1,200,64Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M198,64V168a6,6,0,0,1-12,0V78.48L68.24,196.24a6,6,0,0,1-8.48-8.48L177.52,70H88a6,6,0,0,1,0-12H192A6,6,0,0,1,198,64Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-16,0V83.31L69.66,197.66a8,8,0,0,1-11.32-11.32L172.69,72H88a8,8,0,0,1,0-16H192A8,8,0,0,1,200,64Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M196,64V168a4,4,0,0,1-8,0V73.66L66.83,194.83a4,4,0,0,1-5.66-5.66L182.34,68H88a4,4,0,0,1,0-8H192A4,4,0,0,1,196,64Z`}))]]),S=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M128,20A108,108,0,0,0,31.85,177.23L21,209.66A20,20,0,0,0,46.34,235l32.43-10.81A108,108,0,1,0,128,20Zm0,192a84,84,0,0,1-42.06-11.27,12,12,0,0,0-6-1.62,12.1,12.1,0,0,0-3.8.62l-29.79,9.93,9.93-29.79a12,12,0,0,0-1-9.81A84,84,0,1,1,128,212Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M232,128A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M128,26A102,102,0,0,0,38.35,176.69L26.73,211.56a14,14,0,0,0,17.71,17.71l34.87-11.62A102,102,0,1,0,128,26Zm0,192a90,90,0,0,1-45.06-12.08,6.09,6.09,0,0,0-3-.81,6.2,6.2,0,0,0-1.9.31L40.65,217.88a2,2,0,0,1-2.53-2.53L50.58,178a6,6,0,0,0-.5-4.91A90,90,0,1,1,128,218Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M128,28A100,100,0,0,0,40.53,176.5l-11.9,35.69a12,12,0,0,0,15.18,15.18l35.69-11.9A100,100,0,1,0,128,28Zm0,192a92,92,0,0,1-46.07-12.35,4.05,4.05,0,0,0-2-.54,3.93,3.93,0,0,0-1.27.21L41.28,219.78a4,4,0,0,1-5.06-5.06l12.46-37.38a4,4,0,0,0-.33-3.27A92,92,0,1,1,128,220Z`}))]]),C=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M230.47,67.5a12,12,0,0,0-19.26-4.32L172.43,99l-12.68-2.72L157,83.57l35.79-38.78a12,12,0,0,0-4.32-19.26A76.07,76.07,0,0,0,88.41,121.64L30.92,174.18a4.68,4.68,0,0,0-.39.38,36,36,0,0,0,50.91,50.91l.38-.39,52.54-57.49A76.05,76.05,0,0,0,230.47,67.5ZM160,148a51.5,51.5,0,0,1-23.35-5.52,12,12,0,0,0-14.26,2.62L64.31,208.66a12,12,0,0,1-17-17l63.55-58.07a12,12,0,0,0,2.62-14.26A51.5,51.5,0,0,1,108,96a52.06,52.06,0,0,1,52-52h.89L135.17,71.87a12,12,0,0,0-2.91,10.65l5.66,26.35a12,12,0,0,0,9.21,9.21l26.35,5.66a12,12,0,0,0,10.65-2.91L212,95.12c0,.3,0,.59,0,.89A52.06,52.06,0,0,1,160,148Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,96a64,64,0,0,1-94.94,56L73,217A24,24,0,0,1,39,183L104,126.94a64,64,0,0,1,80-90.29L144,80l5.66,26.34L176,112l43.35-40A63.8,63.8,0,0,1,224,96Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M232,96a72,72,0,0,1-100.94,66L79,222.22c-.12.14-.26.29-.39.42a32,32,0,0,1-45.26-45.26c.14-.13.28-.27.43-.39L94,124.94a72.07,72.07,0,0,1,83.54-98.78,8,8,0,0,1,3.93,13.19L144,80l5.66,26.35L176,112l40.65-37.52a8,8,0,0,1,13.19,3.93A72.6,72.6,0,0,1,232,96Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224.91,69.75a6,6,0,0,0-9.63-2.16l-41.07,37.9L154.7,101.3l-4.19-19.51,37.9-41.07a6,6,0,0,0-2.16-9.63,70,70,0,0,0-89.77,94.39l-61.39,53c-.11.09-.21.19-.32.3A30,30,0,0,0,77.2,221.23c.11-.11.21-.21.3-.32l53-61.39a70,70,0,0,0,94.39-89.77ZM160,154a58,58,0,0,1-28-7.22,6,6,0,0,0-7.45,1.33L68.57,212.88a18,18,0,0,1-25.45-25.45l64.76-55.94A6,6,0,0,0,109.2,124a58,58,0,0,1,64-84.53L139.58,75.93a6,6,0,0,0-1.45,5.33l5.65,26.35a6,6,0,0,0,4.61,4.61l26.35,5.65a6,6,0,0,0,5.33-1.45L216.49,82.8A58.06,58.06,0,0,1,160,154Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M223.05,70.5a4,4,0,0,0-6.42-1.44l-41.82,38.6L153,103l-4.68-21.79,38.6-41.82a4,4,0,0,0-1.44-6.43A68,68,0,0,0,98.94,126L36.4,180l-.21.2a28,28,0,0,0,39.6,39.6l.2-.21,54-62.54A68,68,0,0,0,228,96,67.51,67.51,0,0,0,223.05,70.5ZM160,156a60,60,0,0,1-29-7.47,4,4,0,0,0-5,.89L70,214.25A20,20,0,0,1,41.75,186l64.82-56a4,4,0,0,0,.89-5,60,60,0,0,1,69.46-86.59L141.05,77.29a4,4,0,0,0-1,3.55l5.66,26.35a4,4,0,0,0,3.07,3.07l26.35,5.66a4,4,0,0,0,3.55-1l38.87-35.87A60.05,60.05,0,0,1,160,156Z`}))]]),w=b.forwardRef((e,t)=>b.createElement(a,{ref:t,...e,weights:x}));w.displayName=`ArrowUpRightIcon`;var ee=w,T=b.forwardRef((e,t)=>b.createElement(a,{ref:t,...e,weights:S}));T.displayName=`ChatCircleIcon`;var te=T,E=b.forwardRef((e,t)=>b.createElement(a,{ref:t,...e,weights:C}));E.displayName=`WrenchIcon`;var D=E,O={generatedAt:0,backpressure:6,throughputPerMin:42,waitP95Ms:2800,totals:{done:186,failed:4},workers:[{id:`acc-wb-a1`,name:`WorkBuddy`,provider:`workbuddy`,busy:!0,progress:.72,jobId:`j1`,concurrency:4,inFlight:3,cells:[{id:`j1`,name:`glm-5.2`,startedAtMs:0,elapsedMs:11200},{id:`j1b`,name:`kimi-k2.7-code`,startedAtMs:0,elapsedMs:8400},{id:`j1c`,name:`qwen3-embedding`,startedAtMs:0,elapsedMs:4100}]},{id:`acc-wb-a2`,name:`Zhipu`,provider:`zhipu`,busy:!0,progress:.41,jobId:`j2`,rateLimited:!0,concurrency:2,inFlight:1,cells:[{id:`j2`,name:`deepseek-v4-pro`,startedAtMs:0,elapsedMs:9400}]},{id:`acc-qd-b1`,name:`Qoder`,provider:`qoder`,busy:!0,progress:.88,jobId:`j3`,concurrency:1,inFlight:1,cells:[{id:`j3`,name:`glm-5.3`,startedAtMs:0,elapsedMs:6200}]},{id:`acc-qd-b2`,name:`Kimi`,provider:`kimi`,busy:!1,progress:0,concurrency:4,inFlight:0,cells:[]},{id:`acc-trae-c1`,name:`Trae`,provider:`trae`,busy:!0,progress:.23,jobId:`j4`,concurrency:3,inFlight:2,cells:[{id:`j4`,name:`qwen3-coder`,startedAtMs:0,elapsedMs:3100},{id:`j4b`,name:`glm-5.3-flash`,startedAtMs:0,elapsedMs:1800}]},{id:`acc-codex-d1`,name:`Codex`,provider:`codex`,busy:!1,progress:0,rateLimited:!0,concurrency:2,inFlight:0,cells:[]}],jobs:[{id:`j1`,name:`glm-5.2`,kind:`chat`,status:`running`,accountId:`acc-wb-a1`,progress:.72,elapsedMs:11200,sticky:!0},{id:`j1b`,name:`kimi-k2.7-code`,kind:`chat`,status:`running`,accountId:`acc-wb-a1`,progress:.55,elapsedMs:8400},{id:`j1c`,name:`qwen3-embedding`,kind:`embed`,status:`running`,accountId:`acc-wb-a1`,progress:.3,elapsedMs:4100},{id:`j2`,name:`deepseek-v4-pro`,kind:`embed`,status:`running`,accountId:`acc-wb-a2`,progress:.41,elapsedMs:9400},{id:`j3`,name:`glm-5.3`,kind:`chat`,status:`running`,accountId:`acc-qd-b1`,progress:.88,elapsedMs:6200},{id:`j4`,name:`qwen3-coder`,kind:`tools`,status:`running`,accountId:`acc-trae-c1`,progress:.23,elapsedMs:3100},{id:`j4b`,name:`glm-5.3-flash`,kind:`chat`,status:`running`,accountId:`acc-trae-c1`,progress:.15,elapsedMs:1800},{id:`j5`,name:`deepseek-v4.1-flash`,kind:`chat`,status:`queued`,progress:0,elapsedMs:7200},{id:`j6`,name:`glm-5.2`,kind:`chat`,status:`queued`,progress:0,elapsedMs:5100},{id:`j7`,name:`kimi-k2.7-code`,kind:`chat`,status:`queued`,progress:0,elapsedMs:2800,sticky:!0,priority:`high`},{id:`j8`,name:`qwen3-embedding`,kind:`embed`,status:`queued`,progress:0,elapsedMs:1400},{id:`j9`,name:`qwen3-coder`,kind:`tools`,status:`queued`,progress:0,elapsedMs:900},{id:`j10`,name:`glm-5.3-flash`,kind:`chat`,status:`queued`,progress:0,elapsedMs:600},{id:`j11`,name:`deepseek-v4-pro`,kind:`embed`,status:`queued`,progress:0,elapsedMs:400},{id:`j12`,name:`glm-5.3`,kind:`chat`,status:`queued`,progress:0,elapsedMs:200,priority:`high`}],rateLimits:[{id:`rl1`,label:`Zhipu 限流`,remainingMs:97e3,from:.55,until:.72},{id:`rl2`,label:`Codex 冷却`,remainingMs:41e3,from:.82,until:1}],depthSeries:[1,1,2,2,3,4,5,6,7,6,5,4,3,4,5,6,5,4,3,3,2,3,4,3]},k=[{name:`glm-5.3`,kind:`chat`},{name:`qwen3-embedding`,kind:`embed`},{name:`qwen3-coder`,kind:`tools`},{name:`glm-5.3-flash`,kind:`chat`,sticky:!0},{name:`deepseek-v4.1-flash`,kind:`chat`},{name:`deepseek-v4-pro`,kind:`embed`},{name:`kimi-k2.7-code`,kind:`chat`}],A=100;function j(e=O){return{...e,workers:e.workers.map(e=>({...e,cells:e.cells?.map(e=>({...e}))})),jobs:e.jobs.map(e=>({...e})),rateLimits:e.rateLimits.map(e=>({...e})),depthSeries:[...e.depthSeries],totals:{...e.totals},completions:void 0}}function M(){return j()}function N(){let e=Math.max(1,O.depthSeries.length);return{generatedAt:Date.now(),backpressure:O.backpressure,throughputPerMin:0,waitP95Ms:0,totals:{done:0,failed:0},workers:[],jobs:[],rateLimits:[],depthSeries:Array.from({length:e},()=>0)}}function P(e){return e.jobs.length===0&&e.workers.length===0&&e.throughputPerMin===0&&(e.totals?.done??0)===0&&(e.totals?.failed??0)===0}function ne(e,t){let n=Math.max(16,Math.min(500,t)),r=j(e);r.generatedAt=(e.generatedAt||0)+n,r.rateLimits=r.rateLimits.map(e=>({...e,remainingMs:Math.max(0,e.remainingMs-n)})).filter(e=>e.remainingMs>0);for(let e of r.workers)e.id===`acc-wb-a2`?e.rateLimited=r.rateLimits.some(e=>e.label.includes(`Zhipu`)):e.id===`acc-codex-d1`&&(e.rateLimited=r.rateLimits.some(e=>e.label.includes(`Codex`)));let i=new Map(r.jobs.map(e=>[e.id,e]));for(let e of r.workers){if(e.cells?.length)for(let t of e.cells)t.elapsedMs+=n;if(e.rateLimited)continue;let t=0;for(let r of e.cells??[]){let e=i.get(r.id);if(!e||e.status!==`running`)continue;e.elapsedMs=r.elapsedMs;let a=.045+r.id.charCodeAt(r.id.length-1)%5*.008;e.progress=Math.min(1,e.progress+n/1e3*a),t=Math.max(t,e.progress)}(e.cells?.length??0)>0&&(e.progress=t,e.busy=!0,e.jobId=e.cells[0].id,e.inFlight=e.cells.length)}let a=[];for(let e of r.workers){if(e.rateLimited||!e.cells?.length)continue;let t=e.cells.find(e=>{let t=i.get(e.id);return!!(t&&t.status===`running`&&t.progress>=.995)});if(!t)continue;let n=(t.id.charCodeAt(1)+Math.floor(r.generatedAt/1e3))%9!=0;a.push({jobId:t.id,workerId:e.id,ok:n})}for(let e of a){let t=i.get(e.jobId),n=r.workers.find(t=>t.id===e.workerId);if(!t||!n)continue;if(n.cells=(n.cells??[]).filter(t=>t.id!==e.jobId),n.inFlight=n.cells.length,n.jobId=n.cells[0]?.id,n.busy=n.cells.length>0,n.progress=n.busy?Math.max(.04,...n.cells.map(e=>i.get(e.id)?.progress??.04)):0,t.accountId=void 0,e.ok){t.status=`done`,t.progress=1,r.totals.done+=1;continue}let a=(t.attempt??1)+1;if(a<=3&&(e.jobId.charCodeAt(0)+Math.floor(r.generatedAt/900))%2==0){t.status=`queued`,t.progress=0,t.elapsedMs=80,t.attempt=a,t.priority=`high`;continue}t.status=`failed`,t.progress=1,r.totals.failed+=1}let o=[];for(let e of a){let t=i.get(e.jobId);t&&(t.status===`done`||t.status===`failed`)&&o.push({id:t.id,name:t.name,kind:t.kind,ok:t.status===`done`})}r.completions=o.length>0?o:void 0,r.jobs=r.jobs.filter(e=>e.status===`queued`||e.status===`running`);for(let e of r.jobs)e.status===`queued`&&(e.elapsedMs+=n);let s=r.jobs.filter(e=>e.status===`queued`);for(let e of r.workers){if(e.rateLimited)continue;let t=F(e.concurrency??1);for(e.cells=e.cells??[];e.cells.lengthe.id!==n.id),r].slice(0,t),e.busy=!0,e.progress=Math.max(e.progress,.04),e.jobId=e.cells[0]?.id,e.inFlight=e.cells.length}}if(r.jobs.filter(e=>e.status===`queued`).length<10&&r.generatedAt%1600e.status===`running`),t=r.jobs.filter(e=>e.status===`queued`),n=t.filter(e=>e.priority===`high`&&e.elapsedMs>=400),i=t.filter(e=>!(e.priority===`high`&&e.elapsedMs>=400)),a=n;r.jobs=[...e,...a,...i]}let c=r.workers.filter(e=>e.busy).length,l=r.jobs.filter(e=>e.status===`queued`).length,u=Math.max(1,l+Math.max(0,c-2)),d=r.depthSeries.slice(1);return d.push(u),r.depthSeries=d,r.throughputPerMin=Math.max(28,Math.min(58,r.throughputPerMin+(A%3-1))),r.waitP95Ms=Math.max(900,Math.min(5200,r.waitP95Ms+(l>4?40:-20))),r}function F(e){return e==null||!Number.isFinite(e)?1:Math.max(1,Math.min(16,Math.floor(e)))}function I(e){let t=e.jobs.filter(e=>e.status===`running`).length,n=e.jobs.filter(e=>e.status===`queued`).length,r=e.workers.filter(e=>e.busy).length,i=0,a=0;for(let t of e.workers){let e=F(t.concurrency??1);i+=e;let n=t.inFlight==null?+!!t.busy:Math.max(0,Math.min(e,Math.floor(t.inFlight)));a+=n}let o=e.depthSeries[e.depthSeries.length-1]??n;return{running:t,waiting:n,busyWorkers:r,occupiedSlots:a,workerSlots:i,rateLimitActive:e.rateLimits.length,depthNow:o}}function re(e,t){let n=Date.now(),r=new Map(e.jobs.map(e=>[e.id,e])),i=Math.max(1,O.depthSeries.length),a=t.rate_limits.map((e,t)=>{let n=Math.min(.86,t*.22%.86);return{id:e.id,label:e.label,remainingMs:Math.max(0,e.remaining_ms),from:n,until:Math.min(1,n+.14)}}),o=(t.queue??[]).map(e=>{let t=(e.id||``).trim(),i=r.get(t),a,o=e.started_at?.trim();if(o){let e=Date.parse(o);Number.isNaN(e)||(a=e)}return a==null&&i?.startedAtMs!=null&&(a=i.startedAtMs),a??=n,{id:t,name:(e.name||``).trim()||t,kind:`chat`,status:`queued`,accountId:(e.account_id||``).trim()||void 0,progress:0,startedAtMs:a,elapsedMs:Math.max(0,n-a)}}),s=new Set(o.map(e=>e.id)),c=new Map;for(let e of o){let t=(e.accountId||``).trim();t&&e.name&&!c.has(t)&&c.set(t,e.name)}let l=new Map;for(let e of t.occupancy??[]){let t=(e.account_id||``).trim(),n=(e.id||``).trim();if(!t||!n)continue;let r=l.get(t)??[];r.push(e),l.set(t,r)}let u=new Map;for(let t of e.workers)t.cells?.length&&u.set(t.id,t.cells);let d=(e,t,n)=>{let r=e?.trim();if(r){let e=Date.parse(r);if(!Number.isNaN(e))return e}return t??n},f=t.workers.map(e=>{let i=F(e.max_inflight??4),a=e.in_flight!=null&&Number.isFinite(e.in_flight)?Math.max(0,Math.floor(e.in_flight)):+!!e.busy,o=Math.min(i,a),f=u.get(e.id)??[],p=new Map(f.map(e=>[e.id,e])),m=l.get(e.id)??[],h=[];for(let e of m){if(h.length>=o)break;let t=(e.id||``).trim();if(!t)continue;let i=p.get(t),a=r.get(t),c=d(e.started_at,i?.startedAtMs??a?.startedAtMs,n),l=(e.name||``).trim()||t;h.push({id:t,name:l,startedAtMs:c,elapsedMs:Math.max(0,n-c),pendingInbound:s.has(t)})}let g=t.workers.find(t=>t.id===e.id),_=d(g?.started_at,void 0,n);for(;h.length0;return{id:e.id,name:e.name,provider:e.provider,busy:v,progress:v?Math.max(.04,Math.min(1,e.progress||0)):0,rateLimited:e.rate_limited,jobId:h[0]?.id,concurrency:i,inFlight:o,cells:h}}),p=[];for(let e of f)for(let t of e.cells??[]){if(s.has(t.id))continue;let n=r.get(t.id);p.push({id:t.id,name:t.name,kind:n?.kind??`chat`,status:`running`,accountId:e.id,progress:e.progress,startedAtMs:t.startedAtMs,elapsedMs:t.elapsedMs})}let m=[...p,...o],h=e.waitP95Ms===0,g=h?e.depthSeries.slice(1):Array.from({length:Math.max(0,i-1)},()=>0);for(g.push(Math.max(0,t.in_flight));g.lengthe.id)),b=[];for(let n of e.jobs){if(n.status!==`running`||y.has(n.id))continue;let e=(n.accountId||n.id.replace(/^live-/,``)).trim(),r=!0;if(_.has(n.id))r=_.get(n.id),_.delete(n.id);else{let n=v.get(e);if(n&&n.length>0)r=n.shift();else{let n=t.workers.find(t=>t.id===e);n?.last_error_kind&&n.last_error_kind.trim()!==``&&(r=!1)}}b.push({id:n.id,name:n.name,kind:n.kind,ok:r})}let x=0,S=0;if(h){x=e.totals.done,S=e.totals.failed;let n=t.recent_completions??[];if(n.length>0)for(let e of n)(e.status||``).trim()===`ok`?x+=1:S+=1;else for(let e of b)e.ok?x+=1:S+=1}return{generatedAt:n,backpressure:e.backpressure,throughputPerMin:Math.max(0,t.rpm),waitP95Ms:0,totals:{done:x,failed:S},workers:f,rateLimits:a,jobs:m,depthSeries:g.slice(-i),completions:b.length>0?b:void 0}}var L=n();function R(e){let t=Array.from(e),n=[],r=0,i=0;for(let e=t.length-1;e>=0;e--){let a=t[e];a>=`0`&&a<=`9`?n.unshift({key:`d${r++}`,digit:a.charCodeAt(0)-48}):n.unshift({key:`s${i++}`,char:a})}return n}var z=e=>(e%10+10)%10,B=e=>1-(1-e)**4,V=(e,t)=>{e.style.transform=`translateY(${-z(t)/11*100}%)`};function H({value:e,kind:t=`int`,duration:n=900,className:r}){let i=(0,b.useMemo)(()=>v(e,t),[e,t]),a=(0,b.useMemo)(()=>R(i),[i]),o=(0,b.useRef)(null),s=(0,b.useRef)(new Map),c=(0,b.useRef)(new Map),l=(0,b.useRef)(0),u=(0,b.useRef)(!0),d=(0,b.useRef)(!1),f=(0,b.useRef)(new Set),p=(0,b.useRef)(new Set),m=new Set(a.filter(e=>`digit`in e).map(e=>e.key));for(let e of m)d.current&&!p.current.has(e)&&f.current.add(e);for(let e of f.current)m.has(e)||f.current.delete(e);return p.current=m,(0,b.useEffect)(()=>{d.current=!0},[]),(0,b.useEffect)(()=>{e!==l.current&&(u.current=e>l.current),l.current=e;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=new Set;for(let e of a){if(!(`digit`in e))continue;r.add(e.key);let n=s.current.get(e.key)??{pos:0,from:0,to:0},i=u.current?z(e.digit-n.pos):-z(n.pos-e.digit);n.from=n.pos,n.to=n.pos+i,t&&(n.pos=n.from=n.to),s.current.set(e.key,n)}for(let e of s.current.keys())r.has(e)||s.current.delete(e);let i=()=>{for(let[e,t]of s.current){let n=c.current.get(e);n&&V(n,t.pos)}};if(t)return i();let o=0,d=performance.now(),f=e=>{let t=Math.min(1,(e-d)/n),r=B(t);for(let e of s.current.values())e.pos=e.from+(e.to-e.from)*r;i(),t<1&&(o=requestAnimationFrame(f))};return o=requestAnimationFrame(f),()=>cancelAnimationFrame(o)},[a,e,n]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`style`,{href:`ui-number-ticker`,precedence:`default`,children:U}),(0,L.jsxs)(`span`,{ref:o,className:[`ui-nt`,r].filter(Boolean).join(` `),"aria-live":`polite`,children:[(0,L.jsx)(`span`,{className:`ui-nt__sr`,children:i}),(0,L.jsx)(`span`,{className:`ui-nt__track`,"aria-hidden":`true`,children:a.map(e=>`digit`in e?(0,L.jsx)(`span`,{className:`ui-nt__col`,"data-enter":f.current.has(e.key)||void 0,children:(0,L.jsx)(`span`,{className:`ui-nt__stack`,ref:t=>{if(t)return c.current.set(e.key,t),V(t,s.current.get(e.key)?.pos??0),()=>{c.current.get(e.key)===t&&c.current.delete(e.key)}},children:[0,1,2,3,4,5,6,7,8,9,0].map((e,t)=>(0,L.jsx)(`span`,{className:`ui-nt__cell`,children:e},t))})},e.key):(0,L.jsx)(`span`,{className:`ui-nt__static`,children:e.char},e.key))})]})]})}var U=` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/InflightDepthChart-oFVQT4m1.js","assets/shim-mfK0Rmj6.js","assets/index-BYut8qRj.js","assets/useI18n-DAGWWg9N.js","assets/SharedElementTransition-BlCsXfb1.js","assets/overview-DcWoRgOQ.js","assets/gsap-C3sDxib7.js","assets/index-Dr_4VBy4.css","assets/AreaChart-B0YOdVBx.js","assets/XAxis-DLQkFqxC.js","assets/ReferenceArea-CiIBWWEY.js"])))=>i.map(i=>d[i]); +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./Check.es-DrOC94kl.js";import{pt as a}from"./useI18n-DAGWWg9N.js";import{n as o}from"./useToggle-Zi1rbfHX.js";import{t as s}from"./CompactSwitch-CzZldrIr.js";import{n as c,r as l,t as u}from"./gsap-C3sDxib7.js";import{Bt as d,Dt as f,Kt as p,Zt as m,b as h,x as g,y as _}from"./index-BYut8qRj.js";import{a as v}from"./format-B6SmebW-.js";import{t as y}from"./ProviderMark-IiAZTaQS.js";var b=t(e(),1),x=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M204,64V168a12,12,0,0,1-24,0V93L72.49,200.49a12,12,0,0,1-17-17L163,76H88a12,12,0,0,1,0-24H192A12,12,0,0,1,204,64Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M192,64V168L88,64Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M192,56H88a8,8,0,0,0-5.66,13.66L128.69,116,58.34,186.34a8,8,0,0,0,11.32,11.32L140,127.31l46.34,46.35A8,8,0,0,0,200,168V64A8,8,0,0,0,192,56Zm-8,92.69-38.34-38.34h0L107.31,72H184Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-13.66,5.66L140,127.31,69.66,197.66a8,8,0,0,1-11.32-11.32L128.69,116,82.34,69.66A8,8,0,0,1,88,56H192A8,8,0,0,1,200,64Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M198,64V168a6,6,0,0,1-12,0V78.48L68.24,196.24a6,6,0,0,1-8.48-8.48L177.52,70H88a6,6,0,0,1,0-12H192A6,6,0,0,1,198,64Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-16,0V83.31L69.66,197.66a8,8,0,0,1-11.32-11.32L172.69,72H88a8,8,0,0,1,0-16H192A8,8,0,0,1,200,64Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M196,64V168a4,4,0,0,1-8,0V73.66L66.83,194.83a4,4,0,0,1-5.66-5.66L182.34,68H88a4,4,0,0,1,0-8H192A4,4,0,0,1,196,64Z`}))]]),S=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M128,20A108,108,0,0,0,31.85,177.23L21,209.66A20,20,0,0,0,46.34,235l32.43-10.81A108,108,0,1,0,128,20Zm0,192a84,84,0,0,1-42.06-11.27,12,12,0,0,0-6-1.62,12.1,12.1,0,0,0-3.8.62l-29.79,9.93,9.93-29.79a12,12,0,0,0-1-9.81A84,84,0,1,1,128,212Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M232,128A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M128,26A102,102,0,0,0,38.35,176.69L26.73,211.56a14,14,0,0,0,17.71,17.71l34.87-11.62A102,102,0,1,0,128,26Zm0,192a90,90,0,0,1-45.06-12.08,6.09,6.09,0,0,0-3-.81,6.2,6.2,0,0,0-1.9.31L40.65,217.88a2,2,0,0,1-2.53-2.53L50.58,178a6,6,0,0,0-.5-4.91A90,90,0,1,1,128,218Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M128,28A100,100,0,0,0,40.53,176.5l-11.9,35.69a12,12,0,0,0,15.18,15.18l35.69-11.9A100,100,0,1,0,128,28Zm0,192a92,92,0,0,1-46.07-12.35,4.05,4.05,0,0,0-2-.54,3.93,3.93,0,0,0-1.27.21L41.28,219.78a4,4,0,0,1-5.06-5.06l12.46-37.38a4,4,0,0,0-.33-3.27A92,92,0,1,1,128,220Z`}))]]),C=new Map([[`bold`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M230.47,67.5a12,12,0,0,0-19.26-4.32L172.43,99l-12.68-2.72L157,83.57l35.79-38.78a12,12,0,0,0-4.32-19.26A76.07,76.07,0,0,0,88.41,121.64L30.92,174.18a4.68,4.68,0,0,0-.39.38,36,36,0,0,0,50.91,50.91l.38-.39,52.54-57.49A76.05,76.05,0,0,0,230.47,67.5ZM160,148a51.5,51.5,0,0,1-23.35-5.52,12,12,0,0,0-14.26,2.62L64.31,208.66a12,12,0,0,1-17-17l63.55-58.07a12,12,0,0,0,2.62-14.26A51.5,51.5,0,0,1,108,96a52.06,52.06,0,0,1,52-52h.89L135.17,71.87a12,12,0,0,0-2.91,10.65l5.66,26.35a12,12,0,0,0,9.21,9.21l26.35,5.66a12,12,0,0,0,10.65-2.91L212,95.12c0,.3,0,.59,0,.89A52.06,52.06,0,0,1,160,148Z`}))],[`duotone`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224,96a64,64,0,0,1-94.94,56L73,217A24,24,0,0,1,39,183L104,126.94a64,64,0,0,1,80-90.29L144,80l5.66,26.34L176,112l43.35-40A63.8,63.8,0,0,1,224,96Z`,opacity:`0.2`}),b.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`fill`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M232,96a72,72,0,0,1-100.94,66L79,222.22c-.12.14-.26.29-.39.42a32,32,0,0,1-45.26-45.26c.14-.13.28-.27.43-.39L94,124.94a72.07,72.07,0,0,1,83.54-98.78,8,8,0,0,1,3.93,13.19L144,80l5.66,26.35L176,112l40.65-37.52a8,8,0,0,1,13.19,3.93A72.6,72.6,0,0,1,232,96Z`}))],[`light`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M224.91,69.75a6,6,0,0,0-9.63-2.16l-41.07,37.9L154.7,101.3l-4.19-19.51,37.9-41.07a6,6,0,0,0-2.16-9.63,70,70,0,0,0-89.77,94.39l-61.39,53c-.11.09-.21.19-.32.3A30,30,0,0,0,77.2,221.23c.11-.11.21-.21.3-.32l53-61.39a70,70,0,0,0,94.39-89.77ZM160,154a58,58,0,0,1-28-7.22,6,6,0,0,0-7.45,1.33L68.57,212.88a18,18,0,0,1-25.45-25.45l64.76-55.94A6,6,0,0,0,109.2,124a58,58,0,0,1,64-84.53L139.58,75.93a6,6,0,0,0-1.45,5.33l5.65,26.35a6,6,0,0,0,4.61,4.61l26.35,5.65a6,6,0,0,0,5.33-1.45L216.49,82.8A58.06,58.06,0,0,1,160,154Z`}))],[`regular`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`thin`,b.createElement(b.Fragment,null,b.createElement(`path`,{d:`M223.05,70.5a4,4,0,0,0-6.42-1.44l-41.82,38.6L153,103l-4.68-21.79,38.6-41.82a4,4,0,0,0-1.44-6.43A68,68,0,0,0,98.94,126L36.4,180l-.21.2a28,28,0,0,0,39.6,39.6l.2-.21,54-62.54A68,68,0,0,0,228,96,67.51,67.51,0,0,0,223.05,70.5ZM160,156a60,60,0,0,1-29-7.47,4,4,0,0,0-5,.89L70,214.25A20,20,0,0,1,41.75,186l64.82-56a4,4,0,0,0,.89-5,60,60,0,0,1,69.46-86.59L141.05,77.29a4,4,0,0,0-1,3.55l5.66,26.35a4,4,0,0,0,3.07,3.07l26.35,5.66a4,4,0,0,0,3.55-1l38.87-35.87A60.05,60.05,0,0,1,160,156Z`}))]]),w=b.forwardRef((e,t)=>b.createElement(a,{ref:t,...e,weights:x}));w.displayName=`ArrowUpRightIcon`;var ee=w,T=b.forwardRef((e,t)=>b.createElement(a,{ref:t,...e,weights:S}));T.displayName=`ChatCircleIcon`;var te=T,E=b.forwardRef((e,t)=>b.createElement(a,{ref:t,...e,weights:C}));E.displayName=`WrenchIcon`;var D=E,O={generatedAt:0,backpressure:6,throughputPerMin:42,waitP95Ms:2800,totals:{done:186,failed:4},workers:[{id:`acc-wb-a1`,name:`WorkBuddy`,provider:`workbuddy`,busy:!0,progress:.72,jobId:`j1`,concurrency:4,inFlight:3,cells:[{id:`j1`,name:`glm-5.2`,startedAtMs:0,elapsedMs:11200},{id:`j1b`,name:`kimi-k2.7-code`,startedAtMs:0,elapsedMs:8400},{id:`j1c`,name:`qwen3-embedding`,startedAtMs:0,elapsedMs:4100}]},{id:`acc-wb-a2`,name:`Zhipu`,provider:`zhipu`,busy:!0,progress:.41,jobId:`j2`,rateLimited:!0,concurrency:2,inFlight:1,cells:[{id:`j2`,name:`deepseek-v4-pro`,startedAtMs:0,elapsedMs:9400}]},{id:`acc-qd-b1`,name:`Qoder`,provider:`qoder`,busy:!0,progress:.88,jobId:`j3`,concurrency:1,inFlight:1,cells:[{id:`j3`,name:`glm-5.3`,startedAtMs:0,elapsedMs:6200}]},{id:`acc-qd-b2`,name:`Kimi`,provider:`kimi`,busy:!1,progress:0,concurrency:4,inFlight:0,cells:[]},{id:`acc-trae-c1`,name:`Trae`,provider:`trae`,busy:!0,progress:.23,jobId:`j4`,concurrency:3,inFlight:2,cells:[{id:`j4`,name:`qwen3-coder`,startedAtMs:0,elapsedMs:3100},{id:`j4b`,name:`glm-5.3-flash`,startedAtMs:0,elapsedMs:1800}]},{id:`acc-codex-d1`,name:`Codex`,provider:`codex`,busy:!1,progress:0,rateLimited:!0,concurrency:2,inFlight:0,cells:[]}],jobs:[{id:`j1`,name:`glm-5.2`,kind:`chat`,status:`running`,accountId:`acc-wb-a1`,progress:.72,elapsedMs:11200,sticky:!0},{id:`j1b`,name:`kimi-k2.7-code`,kind:`chat`,status:`running`,accountId:`acc-wb-a1`,progress:.55,elapsedMs:8400},{id:`j1c`,name:`qwen3-embedding`,kind:`embed`,status:`running`,accountId:`acc-wb-a1`,progress:.3,elapsedMs:4100},{id:`j2`,name:`deepseek-v4-pro`,kind:`embed`,status:`running`,accountId:`acc-wb-a2`,progress:.41,elapsedMs:9400},{id:`j3`,name:`glm-5.3`,kind:`chat`,status:`running`,accountId:`acc-qd-b1`,progress:.88,elapsedMs:6200},{id:`j4`,name:`qwen3-coder`,kind:`tools`,status:`running`,accountId:`acc-trae-c1`,progress:.23,elapsedMs:3100},{id:`j4b`,name:`glm-5.3-flash`,kind:`chat`,status:`running`,accountId:`acc-trae-c1`,progress:.15,elapsedMs:1800},{id:`j5`,name:`deepseek-v4.1-flash`,kind:`chat`,status:`queued`,progress:0,elapsedMs:7200},{id:`j6`,name:`glm-5.2`,kind:`chat`,status:`queued`,progress:0,elapsedMs:5100},{id:`j7`,name:`kimi-k2.7-code`,kind:`chat`,status:`queued`,progress:0,elapsedMs:2800,sticky:!0,priority:`high`},{id:`j8`,name:`qwen3-embedding`,kind:`embed`,status:`queued`,progress:0,elapsedMs:1400},{id:`j9`,name:`qwen3-coder`,kind:`tools`,status:`queued`,progress:0,elapsedMs:900},{id:`j10`,name:`glm-5.3-flash`,kind:`chat`,status:`queued`,progress:0,elapsedMs:600},{id:`j11`,name:`deepseek-v4-pro`,kind:`embed`,status:`queued`,progress:0,elapsedMs:400},{id:`j12`,name:`glm-5.3`,kind:`chat`,status:`queued`,progress:0,elapsedMs:200,priority:`high`}],rateLimits:[{id:`rl1`,label:`Zhipu 限流`,remainingMs:97e3,from:.55,until:.72},{id:`rl2`,label:`Codex 冷却`,remainingMs:41e3,from:.82,until:1}],depthSeries:[1,1,2,2,3,4,5,6,7,6,5,4,3,4,5,6,5,4,3,3,2,3,4,3]},k=[{name:`glm-5.3`,kind:`chat`},{name:`qwen3-embedding`,kind:`embed`},{name:`qwen3-coder`,kind:`tools`},{name:`glm-5.3-flash`,kind:`chat`,sticky:!0},{name:`deepseek-v4.1-flash`,kind:`chat`},{name:`deepseek-v4-pro`,kind:`embed`},{name:`kimi-k2.7-code`,kind:`chat`}],A=100;function j(e=O){return{...e,workers:e.workers.map(e=>({...e,cells:e.cells?.map(e=>({...e}))})),jobs:e.jobs.map(e=>({...e})),rateLimits:e.rateLimits.map(e=>({...e})),depthSeries:[...e.depthSeries],totals:{...e.totals},completions:void 0}}function M(){return j()}function N(){let e=Math.max(1,O.depthSeries.length);return{generatedAt:Date.now(),backpressure:O.backpressure,throughputPerMin:0,waitP95Ms:0,totals:{done:0,failed:0},workers:[],jobs:[],rateLimits:[],depthSeries:Array.from({length:e},()=>0)}}function P(e){return e.jobs.length===0&&e.workers.length===0&&e.throughputPerMin===0&&(e.totals?.done??0)===0&&(e.totals?.failed??0)===0}function ne(e,t){let n=Math.max(16,Math.min(500,t)),r=j(e);r.generatedAt=(e.generatedAt||0)+n,r.rateLimits=r.rateLimits.map(e=>({...e,remainingMs:Math.max(0,e.remainingMs-n)})).filter(e=>e.remainingMs>0);for(let e of r.workers)e.id===`acc-wb-a2`?e.rateLimited=r.rateLimits.some(e=>e.label.includes(`Zhipu`)):e.id===`acc-codex-d1`&&(e.rateLimited=r.rateLimits.some(e=>e.label.includes(`Codex`)));let i=new Map(r.jobs.map(e=>[e.id,e]));for(let e of r.workers){if(e.cells?.length)for(let t of e.cells)t.elapsedMs+=n;if(e.rateLimited)continue;let t=0;for(let r of e.cells??[]){let e=i.get(r.id);if(!e||e.status!==`running`)continue;e.elapsedMs=r.elapsedMs;let a=.045+r.id.charCodeAt(r.id.length-1)%5*.008;e.progress=Math.min(1,e.progress+n/1e3*a),t=Math.max(t,e.progress)}(e.cells?.length??0)>0&&(e.progress=t,e.busy=!0,e.jobId=e.cells[0].id,e.inFlight=e.cells.length)}let a=[];for(let e of r.workers){if(e.rateLimited||!e.cells?.length)continue;let t=e.cells.find(e=>{let t=i.get(e.id);return!!(t&&t.status===`running`&&t.progress>=.995)});if(!t)continue;let n=(t.id.charCodeAt(1)+Math.floor(r.generatedAt/1e3))%9!=0;a.push({jobId:t.id,workerId:e.id,ok:n})}for(let e of a){let t=i.get(e.jobId),n=r.workers.find(t=>t.id===e.workerId);if(!t||!n)continue;if(n.cells=(n.cells??[]).filter(t=>t.id!==e.jobId),n.inFlight=n.cells.length,n.jobId=n.cells[0]?.id,n.busy=n.cells.length>0,n.progress=n.busy?Math.max(.04,...n.cells.map(e=>i.get(e.id)?.progress??.04)):0,t.accountId=void 0,e.ok){t.status=`done`,t.progress=1,r.totals.done+=1;continue}let a=(t.attempt??1)+1;if(a<=3&&(e.jobId.charCodeAt(0)+Math.floor(r.generatedAt/900))%2==0){t.status=`queued`,t.progress=0,t.elapsedMs=80,t.attempt=a,t.priority=`high`;continue}t.status=`failed`,t.progress=1,r.totals.failed+=1}let o=[];for(let e of a){let t=i.get(e.jobId);t&&(t.status===`done`||t.status===`failed`)&&o.push({id:t.id,name:t.name,kind:t.kind,ok:t.status===`done`})}r.completions=o.length>0?o:void 0,r.jobs=r.jobs.filter(e=>e.status===`queued`||e.status===`running`);for(let e of r.jobs)e.status===`queued`&&(e.elapsedMs+=n);let s=r.jobs.filter(e=>e.status===`queued`);for(let e of r.workers){if(e.rateLimited)continue;let t=F(e.concurrency??1);for(e.cells=e.cells??[];e.cells.lengthe.id!==n.id),r].slice(0,t),e.busy=!0,e.progress=Math.max(e.progress,.04),e.jobId=e.cells[0]?.id,e.inFlight=e.cells.length}}if(r.jobs.filter(e=>e.status===`queued`).length<10&&r.generatedAt%1600e.status===`running`),t=r.jobs.filter(e=>e.status===`queued`),n=t.filter(e=>e.priority===`high`&&e.elapsedMs>=400),i=t.filter(e=>!(e.priority===`high`&&e.elapsedMs>=400)),a=n;r.jobs=[...e,...a,...i]}let c=r.workers.filter(e=>e.busy).length,l=r.jobs.filter(e=>e.status===`queued`).length,u=Math.max(1,l+Math.max(0,c-2)),d=r.depthSeries.slice(1);return d.push(u),r.depthSeries=d,r.throughputPerMin=Math.max(28,Math.min(58,r.throughputPerMin+(A%3-1))),r.waitP95Ms=Math.max(900,Math.min(5200,r.waitP95Ms+(l>4?40:-20))),r}function F(e){return e==null||!Number.isFinite(e)?1:Math.max(1,Math.min(16,Math.floor(e)))}function I(e){let t=e.jobs.filter(e=>e.status===`running`).length,n=e.jobs.filter(e=>e.status===`queued`).length,r=e.workers.filter(e=>e.busy).length,i=0,a=0;for(let t of e.workers){let e=F(t.concurrency??1);i+=e;let n=t.inFlight==null?+!!t.busy:Math.max(0,Math.min(e,Math.floor(t.inFlight)));a+=n}let o=e.depthSeries[e.depthSeries.length-1]??n;return{running:t,waiting:n,busyWorkers:r,occupiedSlots:a,workerSlots:i,rateLimitActive:e.rateLimits.length,depthNow:o}}function re(e,t){let n=Date.now(),r=new Map(e.jobs.map(e=>[e.id,e])),i=Math.max(1,O.depthSeries.length),a=t.rate_limits.map((e,t)=>{let n=Math.min(.86,t*.22%.86);return{id:e.id,label:e.label,remainingMs:Math.max(0,e.remaining_ms),from:n,until:Math.min(1,n+.14)}}),o=(t.queue??[]).map(e=>{let t=(e.id||``).trim(),i=r.get(t),a,o=e.started_at?.trim();if(o){let e=Date.parse(o);Number.isNaN(e)||(a=e)}return a==null&&i?.startedAtMs!=null&&(a=i.startedAtMs),a??=n,{id:t,name:(e.name||``).trim()||t,kind:`chat`,status:`queued`,accountId:(e.account_id||``).trim()||void 0,progress:0,startedAtMs:a,elapsedMs:Math.max(0,n-a)}}),s=new Set(o.map(e=>e.id)),c=new Map;for(let e of o){let t=(e.accountId||``).trim();t&&e.name&&!c.has(t)&&c.set(t,e.name)}let l=new Map;for(let e of t.occupancy??[]){let t=(e.account_id||``).trim(),n=(e.id||``).trim();if(!t||!n)continue;let r=l.get(t)??[];r.push(e),l.set(t,r)}let u=new Map;for(let t of e.workers)t.cells?.length&&u.set(t.id,t.cells);let d=(e,t,n)=>{let r=e?.trim();if(r){let e=Date.parse(r);if(!Number.isNaN(e))return e}return t??n},f=t.workers.map(e=>{let i=F(e.max_inflight??4),a=e.in_flight!=null&&Number.isFinite(e.in_flight)?Math.max(0,Math.floor(e.in_flight)):+!!e.busy,o=Math.min(i,a),f=u.get(e.id)??[],p=new Map(f.map(e=>[e.id,e])),m=l.get(e.id)??[],h=[];for(let e of m){if(h.length>=o)break;let t=(e.id||``).trim();if(!t)continue;let i=p.get(t),a=r.get(t),c=d(e.started_at,i?.startedAtMs??a?.startedAtMs,n),l=(e.name||``).trim()||t;h.push({id:t,name:l,startedAtMs:c,elapsedMs:Math.max(0,n-c),pendingInbound:s.has(t)})}let g=t.workers.find(t=>t.id===e.id),_=d(g?.started_at,void 0,n);for(;h.length0;return{id:e.id,name:e.name,provider:e.provider,busy:v,progress:v?Math.max(.04,Math.min(1,e.progress||0)):0,rateLimited:e.rate_limited,jobId:h[0]?.id,concurrency:i,inFlight:o,cells:h}}),p=[];for(let e of f)for(let t of e.cells??[]){if(s.has(t.id))continue;let n=r.get(t.id);p.push({id:t.id,name:t.name,kind:n?.kind??`chat`,status:`running`,accountId:e.id,progress:e.progress,startedAtMs:t.startedAtMs,elapsedMs:t.elapsedMs})}let m=[...p,...o],h=e.waitP95Ms===0,g=h?e.depthSeries.slice(1):Array.from({length:Math.max(0,i-1)},()=>0);for(g.push(Math.max(0,t.in_flight));g.lengthe.id)),b=[];for(let n of e.jobs){if(n.status!==`running`||y.has(n.id))continue;let e=(n.accountId||n.id.replace(/^live-/,``)).trim(),r=!0;if(_.has(n.id))r=_.get(n.id),_.delete(n.id);else{let n=v.get(e);if(n&&n.length>0)r=n.shift();else{let n=t.workers.find(t=>t.id===e);n?.last_error_kind&&n.last_error_kind.trim()!==``&&(r=!1)}}b.push({id:n.id,name:n.name,kind:n.kind,ok:r})}let x=0,S=0;if(h){x=e.totals.done,S=e.totals.failed;let n=t.recent_completions??[];if(n.length>0)for(let e of n)(e.status||``).trim()===`ok`?x+=1:S+=1;else for(let e of b)e.ok?x+=1:S+=1}return{generatedAt:n,backpressure:e.backpressure,throughputPerMin:Math.max(0,t.rpm),waitP95Ms:0,totals:{done:x,failed:S},workers:f,rateLimits:a,jobs:m,depthSeries:g.slice(-i),completions:b.length>0?b:void 0}}var L=n();function R(e){let t=Array.from(e),n=[],r=0,i=0;for(let e=t.length-1;e>=0;e--){let a=t[e];a>=`0`&&a<=`9`?n.unshift({key:`d${r++}`,digit:a.charCodeAt(0)-48}):n.unshift({key:`s${i++}`,char:a})}return n}var z=e=>(e%10+10)%10,B=e=>1-(1-e)**4,V=(e,t)=>{e.style.transform=`translateY(${-z(t)/11*100}%)`};function H({value:e,kind:t=`int`,duration:n=900,className:r}){let i=(0,b.useMemo)(()=>v(e,t),[e,t]),a=(0,b.useMemo)(()=>R(i),[i]),o=(0,b.useRef)(null),s=(0,b.useRef)(new Map),c=(0,b.useRef)(new Map),l=(0,b.useRef)(0),u=(0,b.useRef)(!0),d=(0,b.useRef)(!1),f=(0,b.useRef)(new Set),p=(0,b.useRef)(new Set),m=new Set(a.filter(e=>`digit`in e).map(e=>e.key));for(let e of m)d.current&&!p.current.has(e)&&f.current.add(e);for(let e of f.current)m.has(e)||f.current.delete(e);return p.current=m,(0,b.useEffect)(()=>{d.current=!0},[]),(0,b.useEffect)(()=>{e!==l.current&&(u.current=e>l.current),l.current=e;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=new Set;for(let e of a){if(!(`digit`in e))continue;r.add(e.key);let n=s.current.get(e.key)??{pos:0,from:0,to:0},i=u.current?z(e.digit-n.pos):-z(n.pos-e.digit);n.from=n.pos,n.to=n.pos+i,t&&(n.pos=n.from=n.to),s.current.set(e.key,n)}for(let e of s.current.keys())r.has(e)||s.current.delete(e);let i=()=>{for(let[e,t]of s.current){let n=c.current.get(e);n&&V(n,t.pos)}};if(t)return i();let o=0,d=performance.now(),f=e=>{let t=Math.min(1,(e-d)/n),r=B(t);for(let e of s.current.values())e.pos=e.from+(e.to-e.from)*r;i(),t<1&&(o=requestAnimationFrame(f))};return o=requestAnimationFrame(f),()=>cancelAnimationFrame(o)},[a,e,n]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`style`,{href:`ui-number-ticker`,precedence:`default`,children:U}),(0,L.jsxs)(`span`,{ref:o,className:[`ui-nt`,r].filter(Boolean).join(` `),"aria-live":`polite`,children:[(0,L.jsx)(`span`,{className:`ui-nt__sr`,children:i}),(0,L.jsx)(`span`,{className:`ui-nt__track`,"aria-hidden":`true`,children:a.map(e=>`digit`in e?(0,L.jsx)(`span`,{className:`ui-nt__col`,"data-enter":f.current.has(e.key)||void 0,children:(0,L.jsx)(`span`,{className:`ui-nt__stack`,ref:t=>{if(t)return c.current.set(e.key,t),V(t,s.current.get(e.key)?.pos??0),()=>{c.current.get(e.key)===t&&c.current.delete(e.key)}},children:[0,1,2,3,4,5,6,7,8,9,0].map((e,t)=>(0,L.jsx)(`span`,{className:`ui-nt__cell`,children:e},t))})},e.key):(0,L.jsx)(`span`,{className:`ui-nt__static`,children:e.char},e.key))})]})]})}var U=` .ui-nt { --ui-nt-lh: 1.15em; --ui-nt-ease: cubic-bezier(0.22, 1, 0.36, 1); @@ -60,7 +60,7 @@ import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./Chec :where(.dark, [data-theme="dark"]) .ui-nt { --ui-nt-lh: 1.15em; } -`,ie=(0,b.lazy)(()=>d(()=>import(`./InflightDepthChart-_zhkPXRC.js`).then(e=>({default:e.InflightDepthChart})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),W=`cli2api_inflight_mock_demo`;function ae(){try{return localStorage.getItem(W)===`1`}catch{return!1}}function oe(e){try{localStorage.setItem(W,e?`1`:`0`)}catch{}}l.registerPlugin(c,u);var G=c.get(`inflightQueue`)||c.create(`inflightQueue`,`0.22, 1, 0.36, 1`),K=c.get(`inflightSlide`)||c.create(`inflightSlide`,`0.16, 1, 0.3, 1`),q=6,se=4,ce=.88,le=.56,ue=140;function de(e){let t=Math.max(0,e/1e3);if(t>=60){let e=Math.floor(t/60),n=Math.floor(t%60);return`${e}m ${String(n).padStart(2,`0`)}s`}return t>=10?`${t.toFixed(0)}s`:`${t.toFixed(1)}s`}function fe(e,t){return e?e.startedAtMs==null?Math.max(0,e.elapsedMs):Math.max(0,t-e.startedAtMs):0}function pe(e){switch(e){case`chat`:return`bg-[color-mix(in_oklab,var(--chart-1)_55%,var(--surface))]`;case`embed`:return`bg-[color-mix(in_oklab,var(--chart-6)_55%,var(--surface))]`;case`tools`:return`bg-[color-mix(in_oklab,var(--chart-5)_50%,var(--surface))]`;default:return`bg-foreground/25`}}function me(e){return(0,L.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg ${e===`embed`?`bg-[color-mix(in_oklab,var(--chart-6)_16%,var(--surface))] text-[color-mix(in_oklab,var(--chart-6)_70%,var(--foreground))]`:e===`tools`?`bg-[color-mix(in_oklab,var(--chart-5)_14%,var(--surface))] text-[color-mix(in_oklab,var(--chart-5)_68%,var(--foreground))]`:e===`chat`?`bg-[color-mix(in_oklab,var(--chart-1)_16%,var(--surface))] text-[color-mix(in_oklab,var(--chart-1)_70%,var(--foreground))]`:`bg-surface-secondary text-muted`}`,"aria-hidden":!0,children:e===`embed`?(0,L.jsx)(h,{size:15}):e===`tools`?(0,L.jsx)(D,{size:15}):(0,L.jsx)(te,{size:15})})}function he(e){switch(e){case`chat`:return`border border-[color-mix(in_oklab,var(--chart-1)_16%,transparent)] bg-[color-mix(in_oklab,var(--chart-1)_8%,var(--surface))] text-foreground/75`;case`embed`:return`border border-[color-mix(in_oklab,var(--chart-6)_16%,transparent)] bg-[color-mix(in_oklab,var(--chart-6)_8%,var(--surface))] text-foreground/75`;case`tools`:return`border border-[color-mix(in_oklab,var(--chart-5)_14%,transparent)] bg-[color-mix(in_oklab,var(--chart-5)_7%,var(--surface))] text-foreground/72`;default:return`border border-foreground/8 bg-[color-mix(in_oklab,var(--foreground)_3%,var(--surface))] text-foreground/68`}}function ge({slot:e,jobById:t,clockMs:n,idleLabel:r,landedCellIds:i}){let a=F(e.concurrency??1),o=e.inFlight==null?+!!e.busy:Math.max(0,Math.floor(e.inFlight)),s=Math.min(a,o),c=s>0,l=(e.cells??[]).slice(0,s),u=l.filter(e=>!e.pendingInbound&&i.has(e.id)).map(e=>`${e.name} ${de(Math.max(0,n-e.startedAtMs))}`),d=`${e.name} · ${s}/${a}${u.length?` · ${u.join(`, `)}`:``}`;return(0,L.jsxs)(`div`,{"data-slot":!0,"data-slot-id":e.id,"data-slot-job":e.jobId??``,"data-slot-busy":c?``:void 0,"data-slot-concurrency":a,"data-slot-inflight":s,className:`relative flex min-w-0 items-center gap-2 overflow-hidden rounded-xl px-2.5 py-2 ${c?`border border-foreground/12 bg-[var(--il-busy-bg)]`:`border border-foreground/8 bg-[var(--il-item-bg)]`}`,title:d,children:[(0,L.jsxs)(`span`,{className:`relative z-[1] flex min-w-0 w-[5.5rem] shrink-0 items-center gap-1.5 ${c?`text-foreground/85`:`text-muted opacity-55`}`,title:`${e.name} · ${e.provider}`,children:[(0,L.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center ${c?``:`opacity-70`}`,"aria-hidden":!0,children:(0,L.jsx)(y,{provider:e.provider,size:18})}),(0,L.jsx)(`span`,{className:`mono min-w-0 truncate text-caption leading-none ${c?`font-medium`:``}`,children:e.name})]}),(0,L.jsx)(`div`,{className:`relative z-[1] flex min-h-[2rem] min-w-0 flex-1 gap-0.5`,role:`img`,"aria-label":`${s}/${a}`,children:Array.from({length:a},(e,a)=>{let o=l[a],s=!!o,c=s&&!o.pendingInbound&&i.has(o.id),u=c?t.get(o.id):void 0,d=c?Math.max(0,n-o.startedAtMs):0,f=o?.name||r;return(0,L.jsx)(`div`,{"data-slot-cell":``,"data-slot-fill":s?``:void 0,"data-cell-id":o?.id??``,"data-cell-index":a,"data-cell-pending":s&&!c?``:void 0,className:`relative flex min-w-0 flex-1 flex-col justify-center overflow-hidden rounded-[2px] px-1 ${c?`border border-foreground/14 bg-[var(--il-busy-fill)] text-foreground/85`:`bg-[var(--il-track)] opacity-55`}`,children:c?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 w-[62%] bg-gradient-to-r from-transparent via-[color-mix(in_oklab,var(--foreground)_9%,transparent)] to-transparent motion-safe:animate-[inflight-shimmer_1.35s_linear_infinite]`}),(0,L.jsxs)(`span`,{className:`relative z-[1] flex min-w-0 items-center gap-1 truncate text-caption font-medium leading-tight`,children:[u?(0,L.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-[2px] ${pe(u.kind)}`,"aria-hidden":!0}):null,(0,L.jsx)(`span`,{className:`truncate`,"data-slot-job-pill":``,children:f})]}),(0,L.jsx)(`span`,{className:`relative z-[1] mono truncate text-[9px] leading-tight tabular text-foreground/70`,children:de(d)})]}):(0,L.jsx)(`span`,{className:`relative z-[1] mono text-center text-[9px] text-muted/50`,children:`—`})},o?.id??`empty-${a}`)})})]})}function _e({t:e,snapshot:t,live:n=null,expanded:a,onExpandedChange:c,defaultExpanded:u=!1,forceMockDemo:d=!1,mockPace:h=1,bare:v=!1}){let y=t!==void 0,[x,S]=(0,b.useState)(u),C=a??x,w=e=>{c?.(e),a===void 0&&S(e)},[T,te]=(0,b.useState)(()=>d||ae()),E=e=>{te(e),d||oe(e)},[D,O]=(0,b.useState)(()=>j(t??N())),[k,A]=(0,b.useState)(!1),[F,R]=(0,b.useState)(null),[z,B]=(0,b.useState)(()=>Date.now()),[V,H]=(0,b.useState)(()=>new Set),U=(0,b.useRef)(new Map),W=e=>{let t=(e||``).trim();if(!t)return;let n=U.current.get(t);n&&(clearTimeout(n),U.current.delete(t)),H(e=>{if(e.has(t))return e;let n=new Set(e);return n.add(t),n})},_e=e=>{let t=(e||``).trim();if(!t)return;let n=U.current.get(t);n&&clearTimeout(n),U.current.set(t,setTimeout(()=>{U.current.delete(t),W(t)},ue))},Y=y?t:D,X=(0,b.useMemo)(()=>I(Y),[Y]),ye=(0,b.useRef)(null),Z=(0,b.useRef)(!1),be=(0,b.useRef)(Y),Q=(0,b.useRef)({wait:{},slot:{},outcome:{}}),xe=(0,b.useMemo)(()=>new Map(Y.jobs.map(e=>[e.id,e])),[Y.jobs]),Se=Y.jobs.filter(e=>e.status===`queued`),Ce=Se.slice(0,q),we=Se.slice(q),Te=(0,b.useMemo)(()=>{let e=Y.workers.filter(e=>e.busy),t=Y.workers.filter(e=>!e.busy),n=[],r=new Set;for(let i of[...e,...t])if(!r.has(i.id)&&(r.add(i.id),n.push(i),n.length>=se))break;return n},[Y.workers]),Ee=X.waiting>=Y.backpressure,$=(0,b.useRef)(!1);(0,b.useLayoutEffect)(()=>{if(y){O(j(t)),A(!1),R(null),$.current=!1;return}if(!C){A(!1),$.current=!1;return}if(n!==null){A(!1),R(n.sticky),B(Date.now()),$.current||(Z.current=!1),O(e=>{let t=$.current?e:{...j(e),waitP95Ms:1,totals:{done:0,failed:0}};return $.current=!0,re(t,n)});return}R(null),$.current=!1,Z.current=!1,T?(A(!0),O(e=>P(e)?j(M()):e)):(A(!1),O(j(N())))},[y,t,C,n,T]),(0,b.useEffect)(()=>{if(y||!C||!k||!T||n!==null||p())return;let e=0,t=performance.now(),r=!0,i=n=>{if(!r)return;let a=n-t;if(!document.hidden&&a>=260){t=n;let e=Number.isFinite(h)?Math.min(1,Math.max(.2,h??1)):1;O(t=>ne(t,a*e))}e=requestAnimationFrame(i)};return e=requestAnimationFrame(i),()=>{r=!1,cancelAnimationFrame(e)}},[y,C,k,T,n,h]),(0,b.useEffect)(()=>{if(!C)return;if(p()){B(Date.now());return}let e=0,t=0,n=!0,r=i=>{n&&(!document.hidden&&i-t>=150&&(t=i,B(Date.now())),e=requestAnimationFrame(r))};return B(Date.now()),e=requestAnimationFrame(r),()=>{n=!1,cancelAnimationFrame(e)}},[C]),(0,b.useEffect)(()=>{C||(Z.current=!1)},[C]),(0,b.useEffect)(()=>{if(!C){for(let e of U.current.values())clearTimeout(e);U.current.clear(),H(new Set)}},[C]),(0,b.useEffect)(()=>()=>{for(let e of U.current.values())clearTimeout(e);U.current.clear()},[]),(0,b.useLayoutEffect)(()=>{let e=ye.current,t=be.current;be.current=Y;let r=()=>{if(!e)return;let t={};e.querySelectorAll(`[data-wait-id]`).forEach(e=>{let n=e.getAttribute(`data-wait-id`);n&&(t[n]=e.getBoundingClientRect())});let n={};e.querySelectorAll(`[data-slot-id]`).forEach(e=>{let t=e.getAttribute(`data-slot-id`);t&&(n[t]=e.getBoundingClientRect())}),e.querySelectorAll(`[data-cell-id]`).forEach(e=>{let t=e.getAttribute(`data-cell-id`);t&&(n[`cell:${t}`]=e.getBoundingClientRect())}),Q.current={wait:t,slot:n,outcome:{ok:e.querySelector(`[data-outcome="ok"]`)?.getBoundingClientRect(),danger:e.querySelector(`[data-outcome="danger"]`)?.getBoundingClientRect()}}},i=e=>{let n=new Set(t.jobs.filter(e=>e.status===`queued`).map(e=>e.id));H(t=>{let r=new Set,i=new Set;for(let a of Y.workers)for(let o of a.cells??[]){let a=o.id;if(r.add(a),!o.pendingInbound){if(t.has(a)){i.add(a);continue}if(e===`all`){i.add(a);continue}Y.jobs.some(e=>e.id===a&&e.status===`queued`)||n.has(a)||i.add(a)}}let a=i.size===t.size;if(a){for(let e of i)if(!t.has(e)){a=!1;break}}if(a){for(let e of t)if(!r.has(e)){a=!1;break}}return a?t:i})};if(!e||p()||!Z.current){r(),i(`all`),C&&e&&!Z.current&&!p()&&(y||$.current||n===null&&T&&k||n===null&&!T&&P(Y)?(Z.current=!0,l.killTweensOf(e),l.fromTo(e,{opacity:0,y:6},{opacity:1,y:0,duration:_(.22),ease:g.out,clearProps:`opacity,transform`,force3D:!0})):l.set(e,{opacity:0}));return}if(t===Y){r(),i(`stable`);return}i(`stable`);let a=new Map(t.jobs.map(e=>[e.id,e])),o=new Map(Y.jobs.map(e=>[e.id,e])),s=new Map;for(let e of t.workers){e.jobId&&s.set(e.jobId,e.id);for(let t of e.cells??[])s.set(t.id,e.id)}let c=new Map;for(let e of Y.workers){e.jobId&&c.set(e.jobId,e.id);for(let t of e.cells??[])c.set(t.id,e.id)}let u=(e,t,n,r,i,a,o,s=0)=>{let c=e instanceof HTMLElement?e.getBoundingClientRect():e,u=t instanceof HTMLElement?t.getBoundingClientRect():t;if(!c||!u||c.width<2||u.width<2){o?.();return}let d=r===`chat`?`var(--chart-1)`:r===`embed`?`var(--chart-6)`:r===`tools`?`var(--chart-5)`:`var(--foreground)`,f=i===`ok`?`color-mix(in oklab, var(--success) 24%, var(--surface))`:i===`danger`?`color-mix(in oklab, var(--danger) 22%, var(--surface))`:i===`retry`?`color-mix(in oklab, var(--warning) 16%, var(--surface))`:r===`chat`?`color-mix(in oklab, var(--chart-1) 32%, var(--surface))`:r===`embed`?`color-mix(in oklab, var(--chart-6) 32%, var(--surface))`:r===`tools`?`color-mix(in oklab, var(--chart-5) 26%, var(--surface))`:`var(--surface)`,p=i===`ok`?`var(--success)`:i===`danger`?`var(--danger)`:i===`retry`?`var(--warning)`:`var(--foreground)`,m=i===`ok`?`var(--success)`:i===`danger`?`var(--danger)`:i===`retry`?`var(--warning)`:d,h=d,g=`inset 0 1px 0 var(--surface-rim), inset 0 0 0 1px var(--surface-edge), var(--surface-contact), 0 0 0 1px color-mix(in oklab, ${m} 28%, transparent), 0 6px 18px color-mix(in oklab, ${m} 36%, transparent), 0 12px 32px color-mix(in oklab, var(--foreground) 16%, transparent)`,v=`inset 0 1px 0 var(--surface-rim), 0 0 14px color-mix(in oklab, ${m} 48%, transparent), 0 0 28px color-mix(in oklab, ${m} 28%, transparent)`,y=i===`run`,b=y?Math.max(c.width,72):Math.max(c.width,88),x=y?Math.max(c.height,22):Math.max(c.height,26),S=y?Math.max(u.width,40):void 0,C=y?Math.max(u.height,22):void 0,w=S??b*.92,ee=C??x,T=u.left+Math.max(0,(u.width-w)/2),te=u.top+Math.max(0,(u.height-ee)/2),E=i===`ok`||i===`danger`?.86:1,D=c.left+(T-c.left)*E,O=c.top+(te-c.top)*E,k=_(y?ce:.72),A=_(y?.12:.16),j=_(y?.18:.14),M=_(Math.max(0,s)),N=e=>{let t=document.createElement(`div`);t.setAttribute(`aria-hidden`,`true`),Object.assign(t.style,{position:`fixed`,left:`${c.left}px`,top:`${c.top}px`,width:`${b}px`,height:`${x}px`,zIndex:e.asTrail?`78`:`80`,pointerEvents:`none`,display:`flex`,alignItems:`center`,gap:`6px`,padding:`0 8px`,borderRadius:`8px`,fontSize:`11px`,fontWeight:`500`,lineHeight:`1`,color:p,background:f,boxShadow:e.asTrail?v:g,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,opacity:String(e.opacity),willChange:`transform, left, top, opacity, filter`,transform:e.asTrail?`scaleX(1.12)`:`none`,filter:e.asTrail?`blur(0.9px) brightness(1.18) saturate(1.25)`:`none`});let r=document.createElement(`span`);Object.assign(r.style,{width:`6px`,height:`6px`,borderRadius:`2px`,flexShrink:`0`,background:h});let i=document.createElement(`span`);return i.textContent=n,Object.assign(i.style,{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:`0`,flex:`1`}),t.append(r,i),document.body.appendChild(t),t},P=i===`ok`||i===`danger`,ne=P?b*.55:b*.92,F=y?S:ne,I=y?1:i===`retry`?.96:.42,re=y?.82:i===`retry`?.9:.28,L=N({opacity:1});l.set(L,{transformOrigin:`center center`,x:0,y:0});let R=D-c.left,z=O-c.top,B=y?-Math.min(42,14+Math.abs(R)*.1):0;[.72,.46,.26].map((e,t)=>{let n=N({opacity:e,asTrail:!0});return l.set(n,{transformOrigin:`center center`,x:0,y:0}),y?l.to(n,{motionPath:{path:[{x:0,y:0},{x:R*.45,y:z*.35+B},{x:R,y:z}],curviness:1.35,autoRotate:!1},width:F,height:C,scaleX:1.18+t*.08,opacity:0,duration:k,delay:M+_(.05+t*.05),ease:K,force3D:!0,onComplete:()=>n.remove()}):l.to(n,{left:D,top:O,width:F,...P?{scale:I*(.92-t*.08)}:{scaleX:1.28+t*.1},opacity:0,duration:k,delay:M+_(.04+t*.045),ease:G,force3D:!0,onComplete:()=>n.remove()}),n});let V=y?{motionPath:{path:[{x:0,y:0},{x:R*.45,y:z*.35+B},{x:R,y:z}],curviness:1.35,autoRotate:!1},width:F,height:C,scale:I,opacity:1,duration:k,delay:M,ease:K,force3D:!0}:{left:D,top:O,width:F,scale:I,opacity:1,duration:k,delay:M,ease:G,force3D:!0};l.to(L,{...V,onComplete:()=>{let e=a;if(e&&(i===`ok`||i===`danger`)){let t=i===`ok`?`inset 0 0 0 1px color-mix(in oklab, var(--success) 28%, transparent)`:`inset 0 0 0 1px color-mix(in oklab, var(--danger) 28%, transparent)`,n=i===`ok`?`inset 0 0 0 1.5px color-mix(in oklab, var(--success) 52%, transparent), 0 0 10px color-mix(in oklab, var(--success) 20%, transparent)`:`inset 0 0 0 1.5px color-mix(in oklab, var(--danger) 52%, transparent), 0 0 10px color-mix(in oklab, var(--danger) 20%, transparent)`;l.set(e,{transformOrigin:`center center`});let r=l.timeline({onComplete:()=>{l.set(e,{clearProps:`boxShadow,transform,x,scale`})}});r.fromTo(e,{boxShadow:t},{boxShadow:n,duration:_(.16),ease:`power1.inOut`,yoyo:!0,repeat:1}),r.to(e,{keyframes:[{x:2.8,scale:1.07,duration:_(.07)},{x:-3.2,scale:.93,duration:_(.09)},{x:2.2,scale:1.05,duration:_(.08)},{x:-1.2,scale:.98,duration:_(.07)},{x:0,scale:1,duration:_(.1)}],ease:`power1.inOut`})}o?.(),l.to(L,{opacity:0,scale:re,duration:j,delay:A,ease:`power1.out`,onComplete:()=>L.remove()})}})},d=Q.current,f=new Set,m=(t,n,r,i)=>{if(!i||f.has(t))return;f.add(t);let a=d.wait[t],o=e.querySelector(`[data-slot-id="${CSS.escape(i)}"]`),s=o?.querySelector(`[data-cell-id="${CSS.escape(t)}"]`)??o?.querySelector(`[data-slot-fill]:last-of-type`)??null,c=s?.getBoundingClientRect()??o?.getBoundingClientRect()??d.slot[i],p=s;if(!(a&&c&&a.width>=2&&c.width>=2)){_e(t);return}u(a,c,n,r,`run`,null,()=>{W(t),o&&(l.fromTo(o,{filter:`brightness(1.28)`},{filter:`brightness(1)`,duration:_(.48),ease:g.soft}),p&&l.fromTo(p,{scale:.92,transformOrigin:`left center`},{scale:1,duration:_(.48),ease:K}))})};for(let[e,t]of o){let n=a.get(e);if(!n||n.status!==`queued`||t.status!==`running`)continue;let r=c.get(e)||t.accountId||n.accountId;r&&m(e,t.name,t.kind,r)}let h=Y.workers.filter(e=>e.busy&&!t.workers.some(t=>t.id===e.id&&t.busy));for(let[e,t]of a){if(t.status!==`queued`||o.has(e))continue;let n=(t.accountId||``).trim();if(!n&&h.length===1&&(n=h[0].id),!n)continue;let r=Y.workers.find(e=>e.id===n);r&&!r.busy&&h.every(e=>e.id!==n)||m(e,t.name,t.kind,n)}for(let[e,t]of a)t.status===`queued`&&(o.has(e)||f.has(e)||Y.workers.some(t=>(t.cells??[]).some(t=>t.id===e))&&_e(e));{let t=new Set;for(let[e,n]of a){if(n.status!==`queued`)continue;let r=o.get(e);r&&r.status===`queued`||t.add(e)}if(t.size){let n=_(le),r=e=>{let t=e.dataset.waitId;t&&(Q.current.wait[t]=e.getBoundingClientRect())},i=(e,i)=>{let a=e.dataset.waitId;if(!a||t.has(a))return;let o=e.getBoundingClientRect();l.killTweensOf(e),l.set(e,{x:0,y:0,scale:1});let s=e.getBoundingClientRect(),c=o.left-s.left,u=o.top-s.top;if(Math.abs(c)<.5&&Math.abs(u)<.5){r(e);return}l.fromTo(e,{x:c,y:u,...i?.promote?{scale:1.15}:{}},{x:0,y:0,scale:1,duration:n,ease:G,force3D:!0,onUpdate:()=>r(e),onComplete:()=>{l.set(e,{clearProps:`transform`}),r(e)}})};e.querySelectorAll(`[data-wait-pill][data-wait-id]`).forEach(e=>i(e)),e.querySelectorAll(`[data-wait-token][data-wait-id]`).forEach(e=>i(e,{promote:!0}))}}{let n=new Set;for(let e of Y.workers)for(let t of e.cells??[])n.add(t.id);let r=[],i=new Set;for(let e of t.workers)(e.cells??[]).forEach((t,s)=>{if(n.has(t.id)||i.has(t.id))return;let c=o.get(t.id);if(c?.status===`queued`||c?.status===`running`)return;i.add(t.id);let l=a.get(t.id);r.push({id:t.id,name:t.name||l?.name||e.name,kind:l?.kind??`chat`,workerId:e.id,cellIndex:s})});for(let[e,t]of a){if(t.status!==`running`||i.has(e)||n.has(e))continue;let a=o.get(e);a?.status!==`queued`&&a?.status!==`running`&&(i.add(e),r.push({id:e,name:t.name,kind:t.kind,workerId:s.get(e)??``,cellIndex:0}))}let c=new Map;for(let e of r){let t=c.get(e.workerId)??[];t.push(e),c.set(e.workerId,t)}for(let n of c.values())n.sort((e,t)=>e.cellIndex-t.cellIndex),n.forEach((n,r)=>{let i=d.slot[`cell:${n.id}`]??(n.workerId?d.slot[n.workerId]:void 0),a=o.get(n.id),s=Y.completions?.find(e=>e.id===n.id),c;if(s)c=s.ok?`ok`:`danger`;else if(a?.status===`failed`)c=`danger`;else if(a?.status===`done`)c=`ok`;else{let e=Y.totals.done>t.totals.done;c=Y.totals.failed>t.totals.failed&&!e?`danger`:`ok`}let l=e.querySelector(c===`ok`?`[data-outcome="ok"]`:`[data-outcome="danger"]`),f=l?.getBoundingClientRect()??d.outcome[c];u(i,f,n.name,n.kind,c,l,void 0,r*.1)})}for(let[t,n]of a){if(n.status!==`running`)continue;let r=o.get(t);if(!r||r.status!==`queued`)continue;let i=s.get(t),a=d.slot[`cell:${t}`]??(i?d.slot[i]:void 0),c=(e.querySelector(`[data-wait-id="${CSS.escape(t)}"]`)??e.querySelector(`[data-queue-col]`))?.getBoundingClientRect();u(a,c,n.name,n.kind,`retry`,null,()=>{let n=e.querySelector(`[data-wait-id="${CSS.escape(t)}"]`);n&&l.fromTo(n,{opacity:.4,scale:.85},{opacity:1,scale:1,duration:_(.42),ease:G})})}for(let[t,n]of o){if(n.status!==`queued`||a.has(t))continue;let r=e.querySelector(`[data-wait-id="${CSS.escape(t)}"]`);r&&l.fromTo(r,{opacity:0,y:-10,scale:.6},{opacity:1,y:0,scale:1,duration:_(.52),ease:G})}{let n=t.jobs.filter(e=>e.status===`queued`).map(e=>e.id),r=Y.jobs.filter(e=>e.status===`queued`).map(e=>e.id);if(n.length===r.length&&n.some((e,t)=>e!==r[t])){let t=_(le);for(let n of r){let r=e.querySelector(`[data-wait-id="${CSS.escape(n)}"]`);if(!r)continue;let i=r.getBoundingClientRect();l.killTweensOf(r),l.set(r,{x:0,y:0});let a=r.getBoundingClientRect(),o=i.left-a.left,s=i.top-a.top;if(Math.abs(o)<.5&&Math.abs(s)<.5){Q.current.wait[n]=a;continue}l.fromTo(r,{x:o,y:s},{x:0,y:0,duration:t,ease:G,force3D:!0,onUpdate:()=>{Q.current.wait[n]=r.getBoundingClientRect()},onComplete:()=>{l.set(r,{clearProps:`transform`}),Q.current.wait[n]=r.getBoundingClientRect()}})}}}{let n=t.jobs.filter(e=>e.status===`queued`).map(e=>e.id),r=Y.jobs.filter(e=>e.status===`queued`).map(e=>e.id);for(let t=0;t{let t=e.filter(e=>e.busy),n=e.filter(e=>!e.busy),r=[],i=new Set;for(let e of[...t,...n])if(!i.has(e.id)&&(i.add(e.id),r.push(e.id),r.length>=se))break;return r},r=n(t.workers),i=n(Y.workers);if(r.length!==i.length||r.some((e,t)=>e!==i[t])){let t=new Map(r.map((e,t)=>[e,t]));for(let n=0;nf,h=_(p?0:m?.07:.04),g=_(p?.72:.64);l.killTweensOf(a),l.fromTo(a,{x:c,y:u,scale:p?1.035:1,zIndex:p?6:m?2:3},{x:0,y:0,scale:1,zIndex:1,duration:g,delay:h,ease:G,force3D:!0,onComplete:()=>{l.set(a,{clearProps:`transform,zIndex`})}})}for(let n of i){if(t.has(n))continue;let r=e.querySelector(`[data-slot-id="${CSS.escape(n)}"]`);r&&(l.killTweensOf(r),l.fromTo(r,{opacity:.35,y:14,scale:.96},{opacity:1,y:0,scale:1,duration:_(.56),delay:_(.08),ease:G,onComplete:()=>l.set(r,{clearProps:`transform`})}))}}}r()},[Y,C,y,k,T,n]);let De=e(`inflightDepthHint`,{n:X.depthNow}),Oe=!k&&!!n,ke=k&&T&&!n,Ae=F?.bindings??0;return(0,L.jsxs)(o,{"data-testid":`inflight-live-card`,"data-expanded":C?`true`:`false`,"data-gsap-reveal":!0,variant:v?`transparent`:void 0,className:`group overflow-hidden p-0 ${v?`bg-transparent shadow-none`:`transition-[box-shadow] duration-200`}`,children:[(0,L.jsx)(`style`,{children:` +`,ie=(0,b.lazy)(()=>m(()=>import(`./InflightDepthChart-oFVQT4m1.js`).then(e=>({default:e.InflightDepthChart})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))),W=`cli2api_inflight_mock_demo`;function ae(){try{return localStorage.getItem(W)===`1`}catch{return!1}}function oe(e){try{localStorage.setItem(W,e?`1`:`0`)}catch{}}l.registerPlugin(c,u);var G=c.get(`inflightQueue`)||c.create(`inflightQueue`,`0.22, 1, 0.36, 1`),K=c.get(`inflightSlide`)||c.create(`inflightSlide`,`0.16, 1, 0.3, 1`),q=6,se=4,ce=.88,le=.56,ue=140;function de(e){let t=Math.max(0,e/1e3);if(t>=60){let e=Math.floor(t/60),n=Math.floor(t%60);return`${e}m ${String(n).padStart(2,`0`)}s`}return t>=10?`${t.toFixed(0)}s`:`${t.toFixed(1)}s`}function fe(e,t){return e?e.startedAtMs==null?Math.max(0,e.elapsedMs):Math.max(0,t-e.startedAtMs):0}function pe(e){switch(e){case`chat`:return`bg-[color-mix(in_oklab,var(--chart-1)_55%,var(--surface))]`;case`embed`:return`bg-[color-mix(in_oklab,var(--chart-6)_55%,var(--surface))]`;case`tools`:return`bg-[color-mix(in_oklab,var(--chart-5)_50%,var(--surface))]`;default:return`bg-foreground/25`}}function me(e){return(0,L.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg ${e===`embed`?`bg-[color-mix(in_oklab,var(--chart-6)_16%,var(--surface))] text-[color-mix(in_oklab,var(--chart-6)_70%,var(--foreground))]`:e===`tools`?`bg-[color-mix(in_oklab,var(--chart-5)_14%,var(--surface))] text-[color-mix(in_oklab,var(--chart-5)_68%,var(--foreground))]`:e===`chat`?`bg-[color-mix(in_oklab,var(--chart-1)_16%,var(--surface))] text-[color-mix(in_oklab,var(--chart-1)_70%,var(--foreground))]`:`bg-surface-secondary text-muted`}`,"aria-hidden":!0,children:e===`embed`?(0,L.jsx)(d,{size:15}):e===`tools`?(0,L.jsx)(D,{size:15}):(0,L.jsx)(te,{size:15})})}function he(e){switch(e){case`chat`:return`border border-[color-mix(in_oklab,var(--chart-1)_16%,transparent)] bg-[color-mix(in_oklab,var(--chart-1)_8%,var(--surface))] text-foreground/75`;case`embed`:return`border border-[color-mix(in_oklab,var(--chart-6)_16%,transparent)] bg-[color-mix(in_oklab,var(--chart-6)_8%,var(--surface))] text-foreground/75`;case`tools`:return`border border-[color-mix(in_oklab,var(--chart-5)_14%,transparent)] bg-[color-mix(in_oklab,var(--chart-5)_7%,var(--surface))] text-foreground/72`;default:return`border border-foreground/8 bg-[color-mix(in_oklab,var(--foreground)_3%,var(--surface))] text-foreground/68`}}function ge({slot:e,jobById:t,clockMs:n,idleLabel:r,landedCellIds:i}){let a=F(e.concurrency??1),o=e.inFlight==null?+!!e.busy:Math.max(0,Math.floor(e.inFlight)),s=Math.min(a,o),c=s>0,l=(e.cells??[]).slice(0,s),u=l.filter(e=>!e.pendingInbound&&i.has(e.id)).map(e=>`${e.name} ${de(Math.max(0,n-e.startedAtMs))}`),d=`${e.name} · ${s}/${a}${u.length?` · ${u.join(`, `)}`:``}`;return(0,L.jsxs)(`div`,{"data-slot":!0,"data-slot-id":e.id,"data-slot-job":e.jobId??``,"data-slot-busy":c?``:void 0,"data-slot-concurrency":a,"data-slot-inflight":s,className:`relative flex min-w-0 items-center gap-2 overflow-hidden rounded-xl px-2.5 py-2 ${c?`border border-foreground/12 bg-[var(--il-busy-bg)]`:`border border-foreground/8 bg-[var(--il-item-bg)]`}`,title:d,children:[(0,L.jsxs)(`span`,{className:`relative z-[1] flex min-w-0 w-[5.5rem] shrink-0 items-center gap-1.5 ${c?`text-foreground/85`:`text-muted opacity-55`}`,title:`${e.name} · ${e.provider}`,children:[(0,L.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center ${c?``:`opacity-70`}`,"aria-hidden":!0,children:(0,L.jsx)(y,{provider:e.provider,size:18})}),(0,L.jsx)(`span`,{className:`mono min-w-0 truncate text-caption leading-none ${c?`font-medium`:``}`,children:e.name})]}),(0,L.jsx)(`div`,{className:`relative z-[1] flex min-h-[2rem] min-w-0 flex-1 gap-0.5`,role:`img`,"aria-label":`${s}/${a}`,children:Array.from({length:a},(e,a)=>{let o=l[a],s=!!o,c=s&&!o.pendingInbound&&i.has(o.id),u=c?t.get(o.id):void 0,d=c?Math.max(0,n-o.startedAtMs):0,f=o?.name||r;return(0,L.jsx)(`div`,{"data-slot-cell":``,"data-slot-fill":s?``:void 0,"data-cell-id":o?.id??``,"data-cell-index":a,"data-cell-pending":s&&!c?``:void 0,className:`relative flex min-w-0 flex-1 flex-col justify-center overflow-hidden rounded-[2px] px-1 ${c?`border border-foreground/14 bg-[var(--il-busy-fill)] text-foreground/85`:`bg-[var(--il-track)] opacity-55`}`,children:c?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 w-[62%] bg-gradient-to-r from-transparent via-[color-mix(in_oklab,var(--foreground)_9%,transparent)] to-transparent motion-safe:animate-[inflight-shimmer_1.35s_linear_infinite]`}),(0,L.jsxs)(`span`,{className:`relative z-[1] flex min-w-0 items-center gap-1 truncate text-caption font-medium leading-tight`,children:[u?(0,L.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-[2px] ${pe(u.kind)}`,"aria-hidden":!0}):null,(0,L.jsx)(`span`,{className:`truncate`,"data-slot-job-pill":``,children:f})]}),(0,L.jsx)(`span`,{className:`relative z-[1] mono truncate text-[9px] leading-tight tabular text-foreground/70`,children:de(d)})]}):(0,L.jsx)(`span`,{className:`relative z-[1] mono text-center text-[9px] text-muted/50`,children:`—`})},o?.id??`empty-${a}`)})})]})}function _e({t:e,snapshot:t,live:n=null,expanded:a,onExpandedChange:c,defaultExpanded:u=!1,forceMockDemo:d=!1,mockPace:m=1,bare:v=!1}){let y=t!==void 0,[x,S]=(0,b.useState)(u),C=a??x,w=e=>{c?.(e),a===void 0&&S(e)},[T,te]=(0,b.useState)(()=>d||ae()),E=e=>{te(e),d||oe(e)},[D,O]=(0,b.useState)(()=>j(t??N())),[k,A]=(0,b.useState)(!1),[F,R]=(0,b.useState)(null),[z,B]=(0,b.useState)(()=>Date.now()),[V,H]=(0,b.useState)(()=>new Set),U=(0,b.useRef)(new Map),W=e=>{let t=(e||``).trim();if(!t)return;let n=U.current.get(t);n&&(clearTimeout(n),U.current.delete(t)),H(e=>{if(e.has(t))return e;let n=new Set(e);return n.add(t),n})},_e=e=>{let t=(e||``).trim();if(!t)return;let n=U.current.get(t);n&&clearTimeout(n),U.current.set(t,setTimeout(()=>{U.current.delete(t),W(t)},ue))},Y=y?t:D,X=(0,b.useMemo)(()=>I(Y),[Y]),ye=(0,b.useRef)(null),Z=(0,b.useRef)(!1),be=(0,b.useRef)(Y),Q=(0,b.useRef)({wait:{},slot:{},outcome:{}}),xe=(0,b.useMemo)(()=>new Map(Y.jobs.map(e=>[e.id,e])),[Y.jobs]),Se=Y.jobs.filter(e=>e.status===`queued`),Ce=Se.slice(0,q),we=Se.slice(q),Te=(0,b.useMemo)(()=>{let e=Y.workers.filter(e=>e.busy),t=Y.workers.filter(e=>!e.busy),n=[],r=new Set;for(let i of[...e,...t])if(!r.has(i.id)&&(r.add(i.id),n.push(i),n.length>=se))break;return n},[Y.workers]),Ee=X.waiting>=Y.backpressure,$=(0,b.useRef)(!1);(0,b.useLayoutEffect)(()=>{if(y){O(j(t)),A(!1),R(null),$.current=!1;return}if(!C){A(!1),$.current=!1;return}if(n!==null){A(!1),R(n.sticky),B(Date.now()),$.current||(Z.current=!1),O(e=>{let t=$.current?e:{...j(e),waitP95Ms:1,totals:{done:0,failed:0}};return $.current=!0,re(t,n)});return}R(null),$.current=!1,Z.current=!1,T?(A(!0),O(e=>P(e)?j(M()):e)):(A(!1),O(j(N())))},[y,t,C,n,T]),(0,b.useEffect)(()=>{if(y||!C||!k||!T||n!==null||g())return;let e=0,t=performance.now(),r=!0,i=n=>{if(!r)return;let a=n-t;if(!document.hidden&&a>=260){t=n;let e=Number.isFinite(m)?Math.min(1,Math.max(.2,m??1)):1;O(t=>ne(t,a*e))}e=requestAnimationFrame(i)};return e=requestAnimationFrame(i),()=>{r=!1,cancelAnimationFrame(e)}},[y,C,k,T,n,m]),(0,b.useEffect)(()=>{if(!C)return;if(g()){B(Date.now());return}let e=0,t=0,n=!0,r=i=>{n&&(!document.hidden&&i-t>=150&&(t=i,B(Date.now())),e=requestAnimationFrame(r))};return B(Date.now()),e=requestAnimationFrame(r),()=>{n=!1,cancelAnimationFrame(e)}},[C]),(0,b.useEffect)(()=>{C||(Z.current=!1)},[C]),(0,b.useEffect)(()=>{if(!C){for(let e of U.current.values())clearTimeout(e);U.current.clear(),H(new Set)}},[C]),(0,b.useEffect)(()=>()=>{for(let e of U.current.values())clearTimeout(e);U.current.clear()},[]),(0,b.useLayoutEffect)(()=>{let e=ye.current,t=be.current;be.current=Y;let r=()=>{if(!e)return;let t={};e.querySelectorAll(`[data-wait-id]`).forEach(e=>{let n=e.getAttribute(`data-wait-id`);n&&(t[n]=e.getBoundingClientRect())});let n={};e.querySelectorAll(`[data-slot-id]`).forEach(e=>{let t=e.getAttribute(`data-slot-id`);t&&(n[t]=e.getBoundingClientRect())}),e.querySelectorAll(`[data-cell-id]`).forEach(e=>{let t=e.getAttribute(`data-cell-id`);t&&(n[`cell:${t}`]=e.getBoundingClientRect())}),Q.current={wait:t,slot:n,outcome:{ok:e.querySelector(`[data-outcome="ok"]`)?.getBoundingClientRect(),danger:e.querySelector(`[data-outcome="danger"]`)?.getBoundingClientRect()}}},i=e=>{let n=new Set(t.jobs.filter(e=>e.status===`queued`).map(e=>e.id));H(t=>{let r=new Set,i=new Set;for(let a of Y.workers)for(let o of a.cells??[]){let a=o.id;if(r.add(a),!o.pendingInbound){if(t.has(a)){i.add(a);continue}if(e===`all`){i.add(a);continue}Y.jobs.some(e=>e.id===a&&e.status===`queued`)||n.has(a)||i.add(a)}}let a=i.size===t.size;if(a){for(let e of i)if(!t.has(e)){a=!1;break}}if(a){for(let e of t)if(!r.has(e)){a=!1;break}}return a?t:i})};if(!e||g()||!Z.current){r(),i(`all`),C&&e&&!Z.current&&!g()&&(y||$.current||n===null&&T&&k||n===null&&!T&&P(Y)?(Z.current=!0,l.killTweensOf(e),l.fromTo(e,{opacity:0,y:6},{opacity:1,y:0,duration:h(.22),ease:_.out,clearProps:`opacity,transform`,force3D:!0})):l.set(e,{opacity:0}));return}if(t===Y){r(),i(`stable`);return}i(`stable`);let a=new Map(t.jobs.map(e=>[e.id,e])),o=new Map(Y.jobs.map(e=>[e.id,e])),s=new Map;for(let e of t.workers){e.jobId&&s.set(e.jobId,e.id);for(let t of e.cells??[])s.set(t.id,e.id)}let c=new Map;for(let e of Y.workers){e.jobId&&c.set(e.jobId,e.id);for(let t of e.cells??[])c.set(t.id,e.id)}let u=(e,t,n,r,i,a,o,s=0)=>{let c=e instanceof HTMLElement?e.getBoundingClientRect():e,u=t instanceof HTMLElement?t.getBoundingClientRect():t;if(!c||!u||c.width<2||u.width<2){o?.();return}let d=r===`chat`?`var(--chart-1)`:r===`embed`?`var(--chart-6)`:r===`tools`?`var(--chart-5)`:`var(--foreground)`,f=i===`ok`?`color-mix(in oklab, var(--success) 24%, var(--surface))`:i===`danger`?`color-mix(in oklab, var(--danger) 22%, var(--surface))`:i===`retry`?`color-mix(in oklab, var(--warning) 16%, var(--surface))`:r===`chat`?`color-mix(in oklab, var(--chart-1) 32%, var(--surface))`:r===`embed`?`color-mix(in oklab, var(--chart-6) 32%, var(--surface))`:r===`tools`?`color-mix(in oklab, var(--chart-5) 26%, var(--surface))`:`var(--surface)`,p=i===`ok`?`var(--success)`:i===`danger`?`var(--danger)`:i===`retry`?`var(--warning)`:`var(--foreground)`,m=i===`ok`?`var(--success)`:i===`danger`?`var(--danger)`:i===`retry`?`var(--warning)`:d,g=d,_=`inset 0 1px 0 var(--surface-rim), inset 0 0 0 1px var(--surface-edge), var(--surface-contact), 0 0 0 1px color-mix(in oklab, ${m} 28%, transparent), 0 6px 18px color-mix(in oklab, ${m} 36%, transparent), 0 12px 32px color-mix(in oklab, var(--foreground) 16%, transparent)`,v=`inset 0 1px 0 var(--surface-rim), 0 0 14px color-mix(in oklab, ${m} 48%, transparent), 0 0 28px color-mix(in oklab, ${m} 28%, transparent)`,y=i===`run`,b=y?Math.max(c.width,72):Math.max(c.width,88),x=y?Math.max(c.height,22):Math.max(c.height,26),S=y?Math.max(u.width,40):void 0,C=y?Math.max(u.height,22):void 0,w=S??b*.92,ee=C??x,T=u.left+Math.max(0,(u.width-w)/2),te=u.top+Math.max(0,(u.height-ee)/2),E=i===`ok`||i===`danger`?.86:1,D=c.left+(T-c.left)*E,O=c.top+(te-c.top)*E,k=h(y?ce:.72),A=h(y?.12:.16),j=h(y?.18:.14),M=h(Math.max(0,s)),N=e=>{let t=document.createElement(`div`);t.setAttribute(`aria-hidden`,`true`),Object.assign(t.style,{position:`fixed`,left:`${c.left}px`,top:`${c.top}px`,width:`${b}px`,height:`${x}px`,zIndex:e.asTrail?`78`:`80`,pointerEvents:`none`,display:`flex`,alignItems:`center`,gap:`6px`,padding:`0 8px`,borderRadius:`8px`,fontSize:`11px`,fontWeight:`500`,lineHeight:`1`,color:p,background:f,boxShadow:e.asTrail?v:_,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,opacity:String(e.opacity),willChange:`transform, left, top, opacity, filter`,transform:e.asTrail?`scaleX(1.12)`:`none`,filter:e.asTrail?`blur(0.9px) brightness(1.18) saturate(1.25)`:`none`});let r=document.createElement(`span`);Object.assign(r.style,{width:`6px`,height:`6px`,borderRadius:`2px`,flexShrink:`0`,background:g});let i=document.createElement(`span`);return i.textContent=n,Object.assign(i.style,{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,minWidth:`0`,flex:`1`}),t.append(r,i),document.body.appendChild(t),t},P=i===`ok`||i===`danger`,ne=P?b*.55:b*.92,F=y?S:ne,I=y?1:i===`retry`?.96:.42,re=y?.82:i===`retry`?.9:.28,L=N({opacity:1});l.set(L,{transformOrigin:`center center`,x:0,y:0});let R=D-c.left,z=O-c.top,B=y?-Math.min(42,14+Math.abs(R)*.1):0;[.72,.46,.26].map((e,t)=>{let n=N({opacity:e,asTrail:!0});return l.set(n,{transformOrigin:`center center`,x:0,y:0}),y?l.to(n,{motionPath:{path:[{x:0,y:0},{x:R*.45,y:z*.35+B},{x:R,y:z}],curviness:1.35,autoRotate:!1},width:F,height:C,scaleX:1.18+t*.08,opacity:0,duration:k,delay:M+h(.05+t*.05),ease:K,force3D:!0,onComplete:()=>n.remove()}):l.to(n,{left:D,top:O,width:F,...P?{scale:I*(.92-t*.08)}:{scaleX:1.28+t*.1},opacity:0,duration:k,delay:M+h(.04+t*.045),ease:G,force3D:!0,onComplete:()=>n.remove()}),n});let V=y?{motionPath:{path:[{x:0,y:0},{x:R*.45,y:z*.35+B},{x:R,y:z}],curviness:1.35,autoRotate:!1},width:F,height:C,scale:I,opacity:1,duration:k,delay:M,ease:K,force3D:!0}:{left:D,top:O,width:F,scale:I,opacity:1,duration:k,delay:M,ease:G,force3D:!0};l.to(L,{...V,onComplete:()=>{let e=a;if(e&&(i===`ok`||i===`danger`)){let t=i===`ok`?`inset 0 0 0 1px color-mix(in oklab, var(--success) 28%, transparent)`:`inset 0 0 0 1px color-mix(in oklab, var(--danger) 28%, transparent)`,n=i===`ok`?`inset 0 0 0 1.5px color-mix(in oklab, var(--success) 52%, transparent), 0 0 10px color-mix(in oklab, var(--success) 20%, transparent)`:`inset 0 0 0 1.5px color-mix(in oklab, var(--danger) 52%, transparent), 0 0 10px color-mix(in oklab, var(--danger) 20%, transparent)`;l.set(e,{transformOrigin:`center center`});let r=l.timeline({onComplete:()=>{l.set(e,{clearProps:`boxShadow,transform,x,scale`})}});r.fromTo(e,{boxShadow:t},{boxShadow:n,duration:h(.16),ease:`power1.inOut`,yoyo:!0,repeat:1}),r.to(e,{keyframes:[{x:2.8,scale:1.07,duration:h(.07)},{x:-3.2,scale:.93,duration:h(.09)},{x:2.2,scale:1.05,duration:h(.08)},{x:-1.2,scale:.98,duration:h(.07)},{x:0,scale:1,duration:h(.1)}],ease:`power1.inOut`})}o?.(),l.to(L,{opacity:0,scale:re,duration:j,delay:A,ease:`power1.out`,onComplete:()=>L.remove()})}})},d=Q.current,f=new Set,p=(t,n,r,i)=>{if(!i||f.has(t))return;f.add(t);let a=d.wait[t],o=e.querySelector(`[data-slot-id="${CSS.escape(i)}"]`),s=o?.querySelector(`[data-cell-id="${CSS.escape(t)}"]`)??o?.querySelector(`[data-slot-fill]:last-of-type`)??null,c=s?.getBoundingClientRect()??o?.getBoundingClientRect()??d.slot[i],p=s;if(!(a&&c&&a.width>=2&&c.width>=2)){_e(t);return}u(a,c,n,r,`run`,null,()=>{W(t),o&&(l.fromTo(o,{filter:`brightness(1.28)`},{filter:`brightness(1)`,duration:h(.48),ease:_.soft}),p&&l.fromTo(p,{scale:.92,transformOrigin:`left center`},{scale:1,duration:h(.48),ease:K}))})};for(let[e,t]of o){let n=a.get(e);if(!n||n.status!==`queued`||t.status!==`running`)continue;let r=c.get(e)||t.accountId||n.accountId;r&&p(e,t.name,t.kind,r)}let m=Y.workers.filter(e=>e.busy&&!t.workers.some(t=>t.id===e.id&&t.busy));for(let[e,t]of a){if(t.status!==`queued`||o.has(e))continue;let n=(t.accountId||``).trim();if(!n&&m.length===1&&(n=m[0].id),!n)continue;let r=Y.workers.find(e=>e.id===n);r&&!r.busy&&m.every(e=>e.id!==n)||p(e,t.name,t.kind,n)}for(let[e,t]of a)t.status===`queued`&&(o.has(e)||f.has(e)||Y.workers.some(t=>(t.cells??[]).some(t=>t.id===e))&&_e(e));{let t=new Set;for(let[e,n]of a){if(n.status!==`queued`)continue;let r=o.get(e);r&&r.status===`queued`||t.add(e)}if(t.size){let n=h(le),r=e=>{let t=e.dataset.waitId;t&&(Q.current.wait[t]=e.getBoundingClientRect())},i=(e,i)=>{let a=e.dataset.waitId;if(!a||t.has(a))return;let o=e.getBoundingClientRect();l.killTweensOf(e),l.set(e,{x:0,y:0,scale:1});let s=e.getBoundingClientRect(),c=o.left-s.left,u=o.top-s.top;if(Math.abs(c)<.5&&Math.abs(u)<.5){r(e);return}l.fromTo(e,{x:c,y:u,...i?.promote?{scale:1.15}:{}},{x:0,y:0,scale:1,duration:n,ease:G,force3D:!0,onUpdate:()=>r(e),onComplete:()=>{l.set(e,{clearProps:`transform`}),r(e)}})};e.querySelectorAll(`[data-wait-pill][data-wait-id]`).forEach(e=>i(e)),e.querySelectorAll(`[data-wait-token][data-wait-id]`).forEach(e=>i(e,{promote:!0}))}}{let n=new Set;for(let e of Y.workers)for(let t of e.cells??[])n.add(t.id);let r=[],i=new Set;for(let e of t.workers)(e.cells??[]).forEach((t,s)=>{if(n.has(t.id)||i.has(t.id))return;let c=o.get(t.id);if(c?.status===`queued`||c?.status===`running`)return;i.add(t.id);let l=a.get(t.id);r.push({id:t.id,name:t.name||l?.name||e.name,kind:l?.kind??`chat`,workerId:e.id,cellIndex:s})});for(let[e,t]of a){if(t.status!==`running`||i.has(e)||n.has(e))continue;let a=o.get(e);a?.status!==`queued`&&a?.status!==`running`&&(i.add(e),r.push({id:e,name:t.name,kind:t.kind,workerId:s.get(e)??``,cellIndex:0}))}let c=new Map;for(let e of r){let t=c.get(e.workerId)??[];t.push(e),c.set(e.workerId,t)}for(let n of c.values())n.sort((e,t)=>e.cellIndex-t.cellIndex),n.forEach((n,r)=>{let i=d.slot[`cell:${n.id}`]??(n.workerId?d.slot[n.workerId]:void 0),a=o.get(n.id),s=Y.completions?.find(e=>e.id===n.id),c;if(s)c=s.ok?`ok`:`danger`;else if(a?.status===`failed`)c=`danger`;else if(a?.status===`done`)c=`ok`;else{let e=Y.totals.done>t.totals.done;c=Y.totals.failed>t.totals.failed&&!e?`danger`:`ok`}let l=e.querySelector(c===`ok`?`[data-outcome="ok"]`:`[data-outcome="danger"]`),f=l?.getBoundingClientRect()??d.outcome[c];u(i,f,n.name,n.kind,c,l,void 0,r*.1)})}for(let[t,n]of a){if(n.status!==`running`)continue;let r=o.get(t);if(!r||r.status!==`queued`)continue;let i=s.get(t),a=d.slot[`cell:${t}`]??(i?d.slot[i]:void 0),c=(e.querySelector(`[data-wait-id="${CSS.escape(t)}"]`)??e.querySelector(`[data-queue-col]`))?.getBoundingClientRect();u(a,c,n.name,n.kind,`retry`,null,()=>{let n=e.querySelector(`[data-wait-id="${CSS.escape(t)}"]`);n&&l.fromTo(n,{opacity:.4,scale:.85},{opacity:1,scale:1,duration:h(.42),ease:G})})}for(let[t,n]of o){if(n.status!==`queued`||a.has(t))continue;let r=e.querySelector(`[data-wait-id="${CSS.escape(t)}"]`);r&&l.fromTo(r,{opacity:0,y:-10,scale:.6},{opacity:1,y:0,scale:1,duration:h(.52),ease:G})}{let n=t.jobs.filter(e=>e.status===`queued`).map(e=>e.id),r=Y.jobs.filter(e=>e.status===`queued`).map(e=>e.id);if(n.length===r.length&&n.some((e,t)=>e!==r[t])){let t=h(le);for(let n of r){let r=e.querySelector(`[data-wait-id="${CSS.escape(n)}"]`);if(!r)continue;let i=r.getBoundingClientRect();l.killTweensOf(r),l.set(r,{x:0,y:0});let a=r.getBoundingClientRect(),o=i.left-a.left,s=i.top-a.top;if(Math.abs(o)<.5&&Math.abs(s)<.5){Q.current.wait[n]=a;continue}l.fromTo(r,{x:o,y:s},{x:0,y:0,duration:t,ease:G,force3D:!0,onUpdate:()=>{Q.current.wait[n]=r.getBoundingClientRect()},onComplete:()=>{l.set(r,{clearProps:`transform`}),Q.current.wait[n]=r.getBoundingClientRect()}})}}}{let n=t.jobs.filter(e=>e.status===`queued`).map(e=>e.id),r=Y.jobs.filter(e=>e.status===`queued`).map(e=>e.id);for(let t=0;t{let t=e.filter(e=>e.busy),n=e.filter(e=>!e.busy),r=[],i=new Set;for(let e of[...t,...n])if(!i.has(e.id)&&(i.add(e.id),r.push(e.id),r.length>=se))break;return r},r=n(t.workers),i=n(Y.workers);if(r.length!==i.length||r.some((e,t)=>e!==i[t])){let t=new Map(r.map((e,t)=>[e,t]));for(let n=0;nf,g=h(p?0:m?.07:.04),_=h(p?.72:.64);l.killTweensOf(a),l.fromTo(a,{x:c,y:u,scale:p?1.035:1,zIndex:p?6:m?2:3},{x:0,y:0,scale:1,zIndex:1,duration:_,delay:g,ease:G,force3D:!0,onComplete:()=>{l.set(a,{clearProps:`transform,zIndex`})}})}for(let n of i){if(t.has(n))continue;let r=e.querySelector(`[data-slot-id="${CSS.escape(n)}"]`);r&&(l.killTweensOf(r),l.fromTo(r,{opacity:.35,y:14,scale:.96},{opacity:1,y:0,scale:1,duration:h(.56),delay:h(.08),ease:G,onComplete:()=>l.set(r,{clearProps:`transform`})}))}}}r()},[Y,C,y,k,T,n]);let De=e(`inflightDepthHint`,{n:X.depthNow}),Oe=!k&&!!n,ke=k&&T&&!n,Ae=F?.bindings??0;return(0,L.jsxs)(o,{"data-testid":`inflight-live-card`,"data-expanded":C?`true`:`false`,"data-gsap-reveal":!0,variant:v?`transparent`:void 0,className:`group overflow-hidden p-0 ${v?`bg-transparent shadow-none`:`transition-[box-shadow] duration-200`}`,children:[(0,L.jsx)(`style`,{children:` [data-testid="inflight-live-card"]{ /* Public AffectUI hierarchy → project tokens. Outer Card keeps solid-glass; nested queue/slots/outcomes use @@ -101,4 +101,4 @@ import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./Chec [class*="animate-[inflight-queue-shimmer_"], [class*="animate-[inflight-glow_"]{animation:none!important} } - `}),v?null:(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3 px-4 py-3`,children:[(0,L.jsxs)(`button`,{type:`button`,"data-testid":`inflight-live-toggle`,"aria-expanded":C,"aria-controls":`inflight-live-body`,onClick:()=>w(!C),className:`flex min-w-0 flex-1 items-start gap-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2 focus-visible:ring-offset-background`,children:[(0,L.jsx)(r,{size:14,"aria-hidden":!0,className:`mt-1 shrink-0 text-muted transition-transform duration-200 ${C?`rotate-90`:``}`}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`h3`,{className:`font-semibold`,children:e(`inflightTitle`)}),(0,L.jsxs)(`span`,{className:`mono inline-flex items-center gap-1 rounded-[3px] px-1.5 py-0.5 text-caption text-muted`,children:[(0,L.jsx)(`span`,{className:`status-dot`,"data-state":Oe?`ok`:``}),e(Oe?`inflightLiveBadge`:ke?`inflightMockBadge`:`inflightIdleBadge`)]}),C&&Ae>0?(0,L.jsx)(`span`,{className:`mono text-caption text-muted`,children:e(`inflightStickyBindings`,{n:Ae})}):null]}),(0,L.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:e(`inflightHint`)})]})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[C?(0,L.jsxs)(f,{to:`/live`,className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,"aria-label":e(`inflightCardAria`),onClick:e=>e.stopPropagation(),children:[e(`inflightOpen`),(0,L.jsx)(ee,{size:14,"aria-hidden":!0})]}):(0,L.jsxs)(`button`,{type:`button`,className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted transition-colors hover:text-foreground`,onClick:()=>w(!0),children:[e(`inflightExpand`),(0,L.jsx)(r,{size:14,"aria-hidden":!0})]}),C&&!y?(0,L.jsx)(`div`,{className:`flex items-center gap-1.5`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,L.jsx)(s,{size:`sm`,isSelected:T,ariaLabel:e(`inflightMockToggleAria`),label:e(`inflightMockToggle`),onChange:E})}):null]})]}),C?(0,L.jsxs)(`div`,{id:`inflight-live-body`,ref:ye,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 px-4 pb-1 pt-0 sm:grid-cols-4`,children:[(0,L.jsx)(J,{label:e(`inflightWaiting`),value:X.waiting,warn:Ee}),(0,L.jsx)(J,{label:e(`inflightRunning`),value:X.occupiedSlots,suffix:`/${X.workerSlots}`}),(0,L.jsx)(J,{label:e(`inflightThroughput`),value:Y.throughputPerMin,suffix:`/min`}),(0,L.jsx)(J,{label:e(`inflightWaitP95`),value:Y.waitP95Ms,kind:`ms`})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 px-4 py-3 lg:grid-cols-[minmax(11rem,0.7fr)_minmax(0,2.1fr)_auto]`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,"data-queue-col":!0,children:[(0,L.jsxs)(`div`,{className:`mb-1.5 flex items-baseline justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightQueue`)}),(0,L.jsx)(`span`,{className:`mono text-[10px] tabular ${Ee?`text-[var(--il-warn-fg)]`:`text-muted`}`,children:X.waiting})]}),(0,L.jsxs)(`div`,{className:`space-y-1.5`,children:[Ce.map(t=>(0,L.jsxs)(`div`,{"data-wait-pill":!0,"data-wait-id":t.id,"data-priority":t.priority??`normal`,className:`relative flex items-center justify-between gap-2 overflow-hidden rounded-xl px-2.5 py-2 ${he(t.kind)}`,children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 w-2/5 bg-gradient-to-r from-transparent via-[color-mix(in_oklab,var(--foreground)_8%,transparent)] to-transparent motion-safe:animate-[inflight-queue-shimmer_2.8s_linear_infinite]`}),(0,L.jsxs)(`span`,{className:`relative z-[1] flex min-w-0 items-center gap-2.5 truncate text-caption font-medium text-foreground/78`,children:[me(t.kind),(0,L.jsxs)(`span`,{className:`truncate`,children:[t.name,t.priority===`high`?(0,L.jsx)(`span`,{className:`mono ml-1 text-[10px] text-muted`,children:`↑`}):null,t.sticky?(0,L.jsx)(`span`,{className:`mono ml-1 text-[10px] text-muted`,children:e(`inflightSticky`)}):null]})]}),(0,L.jsx)(`span`,{className:`relative z-[1] mono shrink-0 text-caption text-muted`,children:de(fe(t,z))})]},t.id)),we.length?(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 pt-1`,"data-queue-overflow":!0,children:[we.map(e=>(0,L.jsx)(`span`,{"data-wait-token":!0,"data-wait-id":e.id,"data-priority":e.priority??`normal`,className:`size-2 rounded-[2px] ${pe(e.kind)} ${e.priority===`high`?`ring-1 ring-foreground/20`:``}`,title:e.name},e.id)),(0,L.jsxs)(`span`,{className:`mono text-[10px] text-muted`,children:[`+`,we.length]})]}):Ce.length===0?(0,L.jsx)(`div`,{className:`text-caption text-muted`,children:e(`inflightQueueEmpty`)}):null]})]}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`mb-1.5 flex items-baseline justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightSlots`)}),(0,L.jsxs)(`span`,{className:`mono text-[10px] tabular text-muted`,children:[X.occupiedSlots,`/`,X.workerSlots]})]}),(0,L.jsx)(`div`,{className:`flex flex-col gap-2`,"data-worker-rail":!0,children:Te.map(t=>(0,L.jsx)(ge,{slot:t,jobById:xe,clockMs:z,idleLabel:e(`inflightSlotIdle`),landedCellIds:V},t.id))})]}),(0,L.jsxs)(`div`,{className:`flex gap-2 sm:gap-2.5 lg:w-[6.75rem] lg:flex-col lg:gap-2.5`,children:[(0,L.jsx)(ve,{label:e(`inflightDone`),value:Y.totals.done,tone:`ok`,icon:(0,L.jsx)(i,{size:22,"aria-hidden":!0})}),(0,L.jsx)(ve,{label:e(`inflightFailed`),value:Y.totals.failed,tone:`danger`,icon:(0,L.jsx)(m,{size:22,"aria-hidden":!0})})]})]}),(0,L.jsxs)(`div`,{"data-depth":!0,className:`px-4 py-3`,children:[(0,L.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightDepth`)}),(0,L.jsx)(`span`,{className:`mono text-caption tabular text-muted`,children:De})]}),(0,L.jsx)(`div`,{className:`rounded-lg bg-[var(--il-item-bg)] px-1.5 pt-1.5 pb-1`,children:(0,L.jsx)(b.Suspense,{fallback:(0,L.jsx)(`div`,{className:`h-11 w-full`,"aria-hidden":!0}),children:(0,L.jsx)(ie,{series:Y.depthSeries,bands:[],backpressure:Y.backpressure,label:De})})})]})]}):null]})}function J({label:e,value:t,suffix:n,kind:r=`int`,warn:i}){return(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`text-caption uppercase tracking-wide text-muted`,children:e}),(0,L.jsxs)(`div`,{className:`mono mt-1 flex items-baseline gap-0.5 text-section font-semibold tabular ${i?`text-[var(--il-warn-fg)]`:`text-foreground`}`,children:[(0,L.jsx)(H,{value:t,kind:r,duration:560}),n?(0,L.jsx)(`span`,{className:`text-[0.92em] opacity-80`,children:n}):null]})]})}function ve({label:e,value:t,tone:n,icon:r}){let i=n===`ok`;return(0,L.jsxs)(`div`,{"data-outcome":n,role:`group`,"aria-label":`${e}: ${t}`,title:`${e}: ${t}`,className:`flex min-h-28 min-w-[3.6rem] flex-1 flex-col items-center justify-center gap-2 rounded-2xl border px-3 py-4 ${i?`border-[color-mix(in_oklab,var(--success)_14%,transparent)] bg-[var(--il-ok-bg)]`:`border-[color-mix(in_oklab,var(--danger)_12%,transparent)] bg-[var(--il-err-bg)]`}`,children:[(0,L.jsx)(`span`,{className:`inline-flex size-12 items-center justify-center rounded-2xl ${i?`bg-[color-mix(in_oklab,var(--success)_14%,var(--surface))] text-[var(--il-ok-fg)]`:`bg-[color-mix(in_oklab,var(--danger)_12%,var(--surface))] text-[var(--il-err-fg)]`}`,"aria-hidden":!0,children:r}),(0,L.jsx)(`div`,{className:`mono text-[1.7rem] font-semibold tabular leading-none tracking-tight ${i?`text-[var(--il-ok-fg)]`:`text-[var(--il-err-fg)]`}`,children:(0,L.jsx)(H,{value:t,kind:`int`,duration:560})}),(0,L.jsx)(`span`,{className:`text-caption font-medium ${i?`text-[color-mix(in_oklab,var(--success)_55%,var(--muted))]`:`text-[color-mix(in_oklab,var(--danger)_55%,var(--muted))]`}`,children:e})]})}export{H as n,ee as r,_e as t}; \ No newline at end of file + `}),v?null:(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3 px-4 py-3`,children:[(0,L.jsxs)(`button`,{type:`button`,"data-testid":`inflight-live-toggle`,"aria-expanded":C,"aria-controls":`inflight-live-body`,onClick:()=>w(!C),className:`flex min-w-0 flex-1 items-start gap-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2 focus-visible:ring-offset-background`,children:[(0,L.jsx)(r,{size:14,"aria-hidden":!0,className:`mt-1 shrink-0 text-muted transition-transform duration-200 ${C?`rotate-90`:``}`}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`h3`,{className:`font-semibold`,children:e(`inflightTitle`)}),(0,L.jsxs)(`span`,{className:`mono inline-flex items-center gap-1 rounded-[3px] px-1.5 py-0.5 text-caption text-muted`,children:[(0,L.jsx)(`span`,{className:`status-dot`,"data-state":Oe?`ok`:``}),e(Oe?`inflightLiveBadge`:ke?`inflightMockBadge`:`inflightIdleBadge`)]}),C&&Ae>0?(0,L.jsx)(`span`,{className:`mono text-caption text-muted`,children:e(`inflightStickyBindings`,{n:Ae})}):null]}),(0,L.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:e(`inflightHint`)})]})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[C?(0,L.jsxs)(p,{to:`/live`,className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,"aria-label":e(`inflightCardAria`),onClick:e=>e.stopPropagation(),children:[e(`inflightOpen`),(0,L.jsx)(ee,{size:14,"aria-hidden":!0})]}):(0,L.jsxs)(`button`,{type:`button`,className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted transition-colors hover:text-foreground`,onClick:()=>w(!0),children:[e(`inflightExpand`),(0,L.jsx)(r,{size:14,"aria-hidden":!0})]}),C&&!y?(0,L.jsx)(`div`,{className:`flex items-center gap-1.5`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,L.jsx)(s,{size:`sm`,isSelected:T,ariaLabel:e(`inflightMockToggleAria`),label:e(`inflightMockToggle`),onChange:E})}):null]})]}),C?(0,L.jsxs)(`div`,{id:`inflight-live-body`,ref:ye,children:[(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 px-4 pb-1 pt-0 sm:grid-cols-4`,children:[(0,L.jsx)(J,{label:e(`inflightWaiting`),value:X.waiting,warn:Ee}),(0,L.jsx)(J,{label:e(`inflightRunning`),value:X.occupiedSlots,suffix:`/${X.workerSlots}`}),(0,L.jsx)(J,{label:e(`inflightThroughput`),value:Y.throughputPerMin,suffix:`/min`}),(0,L.jsx)(J,{label:e(`inflightWaitP95`),value:Y.waitP95Ms,kind:`ms`})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 px-4 py-3 lg:grid-cols-[minmax(11rem,0.7fr)_minmax(0,2.1fr)_auto]`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,"data-queue-col":!0,children:[(0,L.jsxs)(`div`,{className:`mb-1.5 flex items-baseline justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightQueue`)}),(0,L.jsx)(`span`,{className:`mono text-[10px] tabular ${Ee?`text-[var(--il-warn-fg)]`:`text-muted`}`,children:X.waiting})]}),(0,L.jsxs)(`div`,{className:`space-y-1.5`,children:[Ce.map(t=>(0,L.jsxs)(`div`,{"data-wait-pill":!0,"data-wait-id":t.id,"data-priority":t.priority??`normal`,className:`relative flex items-center justify-between gap-2 overflow-hidden rounded-xl px-2.5 py-2 ${he(t.kind)}`,children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 w-2/5 bg-gradient-to-r from-transparent via-[color-mix(in_oklab,var(--foreground)_8%,transparent)] to-transparent motion-safe:animate-[inflight-queue-shimmer_2.8s_linear_infinite]`}),(0,L.jsxs)(`span`,{className:`relative z-[1] flex min-w-0 items-center gap-2.5 truncate text-caption font-medium text-foreground/78`,children:[me(t.kind),(0,L.jsxs)(`span`,{className:`truncate`,children:[t.name,t.priority===`high`?(0,L.jsx)(`span`,{className:`mono ml-1 text-[10px] text-muted`,children:`↑`}):null,t.sticky?(0,L.jsx)(`span`,{className:`mono ml-1 text-[10px] text-muted`,children:e(`inflightSticky`)}):null]})]}),(0,L.jsx)(`span`,{className:`relative z-[1] mono shrink-0 text-caption text-muted`,children:de(fe(t,z))})]},t.id)),we.length?(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 pt-1`,"data-queue-overflow":!0,children:[we.map(e=>(0,L.jsx)(`span`,{"data-wait-token":!0,"data-wait-id":e.id,"data-priority":e.priority??`normal`,className:`size-2 rounded-[2px] ${pe(e.kind)} ${e.priority===`high`?`ring-1 ring-foreground/20`:``}`,title:e.name},e.id)),(0,L.jsxs)(`span`,{className:`mono text-[10px] text-muted`,children:[`+`,we.length]})]}):Ce.length===0?(0,L.jsx)(`div`,{className:`text-caption text-muted`,children:e(`inflightQueueEmpty`)}):null]})]}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`mb-1.5 flex items-baseline justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightSlots`)}),(0,L.jsxs)(`span`,{className:`mono text-[10px] tabular text-muted`,children:[X.occupiedSlots,`/`,X.workerSlots]})]}),(0,L.jsx)(`div`,{className:`flex flex-col gap-2`,"data-worker-rail":!0,children:Te.map(t=>(0,L.jsx)(ge,{slot:t,jobById:xe,clockMs:z,idleLabel:e(`inflightSlotIdle`),landedCellIds:V},t.id))})]}),(0,L.jsxs)(`div`,{className:`flex gap-2 sm:gap-2.5 lg:w-[6.75rem] lg:flex-col lg:gap-2.5`,children:[(0,L.jsx)(ve,{label:e(`inflightDone`),value:Y.totals.done,tone:`ok`,icon:(0,L.jsx)(i,{size:22,"aria-hidden":!0})}),(0,L.jsx)(ve,{label:e(`inflightFailed`),value:Y.totals.failed,tone:`danger`,icon:(0,L.jsx)(f,{size:22,"aria-hidden":!0})})]})]}),(0,L.jsxs)(`div`,{"data-depth":!0,className:`px-4 py-3`,children:[(0,L.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`text-caption uppercase tracking-wide text-muted`,children:e(`inflightDepth`)}),(0,L.jsx)(`span`,{className:`mono text-caption tabular text-muted`,children:De})]}),(0,L.jsx)(`div`,{className:`rounded-lg bg-[var(--il-item-bg)] px-1.5 pt-1.5 pb-1`,children:(0,L.jsx)(b.Suspense,{fallback:(0,L.jsx)(`div`,{className:`h-11 w-full`,"aria-hidden":!0}),children:(0,L.jsx)(ie,{series:Y.depthSeries,bands:[],backpressure:Y.backpressure,label:De})})})]})]}):null]})}function J({label:e,value:t,suffix:n,kind:r=`int`,warn:i}){return(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`text-caption uppercase tracking-wide text-muted`,children:e}),(0,L.jsxs)(`div`,{className:`mono mt-1 flex items-baseline gap-0.5 text-section font-semibold tabular ${i?`text-[var(--il-warn-fg)]`:`text-foreground`}`,children:[(0,L.jsx)(H,{value:t,kind:r,duration:560}),n?(0,L.jsx)(`span`,{className:`text-[0.92em] opacity-80`,children:n}):null]})]})}function ve({label:e,value:t,tone:n,icon:r}){let i=n===`ok`;return(0,L.jsxs)(`div`,{"data-outcome":n,role:`group`,"aria-label":`${e}: ${t}`,title:`${e}: ${t}`,className:`flex min-h-28 min-w-[3.6rem] flex-1 flex-col items-center justify-center gap-2 rounded-2xl border px-3 py-4 ${i?`border-[color-mix(in_oklab,var(--success)_14%,transparent)] bg-[var(--il-ok-bg)]`:`border-[color-mix(in_oklab,var(--danger)_12%,transparent)] bg-[var(--il-err-bg)]`}`,children:[(0,L.jsx)(`span`,{className:`inline-flex size-12 items-center justify-center rounded-2xl ${i?`bg-[color-mix(in_oklab,var(--success)_14%,var(--surface))] text-[var(--il-ok-fg)]`:`bg-[color-mix(in_oklab,var(--danger)_12%,var(--surface))] text-[var(--il-err-fg)]`}`,"aria-hidden":!0,children:r}),(0,L.jsx)(`div`,{className:`mono text-[1.7rem] font-semibold tabular leading-none tracking-tight ${i?`text-[var(--il-ok-fg)]`:`text-[var(--il-err-fg)]`}`,children:(0,L.jsx)(H,{value:t,kind:`int`,duration:560})}),(0,L.jsx)(`span`,{className:`text-caption font-medium ${i?`text-[color-mix(in_oklab,var(--success)_55%,var(--muted))]`:`text-[color-mix(in_oklab,var(--danger)_55%,var(--muted))]`}`,children:e})]})}export{H as n,ee as r,_e as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/KeysPage-DE4rMPv6.js b/internal/webui/static/assets/KeysPage-DE4rMPv6.js new file mode 100644 index 00000000..25f90a71 --- /dev/null +++ b/internal/webui/static/assets/KeysPage-DE4rMPv6.js @@ -0,0 +1 @@ +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./clipboard-DG4c5Ihq.js";import{t as a}from"./Plus.es-BKtgxOxU.js";import{t as o}from"./TrashSimple.es-a96yoz9-.js";import{n as s,r as c}from"./useI18n-DAGWWg9N.js";import{t as l}from"./label-j5K3TFm8.js";import{n as u,t as d}from"./PageAlert-BTp9jdUz.js";import{n as f}from"./useToggle-Zi1rbfHX.js";import{t as p}from"./checkbox-CVxi8har.js";import{n as m,r as h,t as g}from"./FormRow-6b4yVFYc.js";import{t as _}from"./EmptyPanel-Bs-jQMvG.js";import{t as v}from"./modal-BqXo29An.js";import{n as y,t as b}from"./number-field-CyPgNRvS.js";import{t as x}from"./CompactSwitch-CzZldrIr.js";import{g as S}from"./overview-DcWoRgOQ.js";import{r as C}from"./gsap-C3sDxib7.js";import{Dt as w,It as T,M as E,_ as D,k as O,m as k,o as A,t as j,v as M,x as N,y as P}from"./index-BYut8qRj.js";import{t as F}from"./ProviderMark-IiAZTaQS.js";import{n as I,t as L}from"./provider-gHnttGKq.js";import{n as R,o as z,r as ee,t as B}from"./keys-mrKPFyc7.js";var V=t(e(),1),H=n(),U=1.1;function W({label:e,onConfirm:t,isPending:n,children:r}){let i=(0,V.useRef)(null),a=(0,V.useRef)(null);return(0,V.useEffect)(()=>()=>{a.current?.kill()},[]),(0,H.jsxs)(O,{delay:300,children:[(0,H.jsx)(O.Trigger,{children:(0,H.jsxs)(c,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":e,isPending:n,className:`relative overflow-hidden`,onPressStart:()=>{let e=i.current;!e||n||(a.current?.kill(),a.current=C.to(e,{scaleX:1,duration:U*(1-Number(C.getProperty(e,`scaleX`))),ease:P.linear,onComplete:()=>{a.current=null,C.to(e,{scaleX:0,duration:N()?0:M.base,ease:P.out,delay:M.fast}),t()}}))},onPressEnd:()=>{let e=i.current;!e||!a.current||(a.current.kill(),a.current=null,C.to(e,{scaleX:0,duration:N()?0:M.base,ease:P.soft}))},children:[(0,H.jsx)(`span`,{ref:i,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 origin-left scale-x-0 bg-danger/20`}),(0,H.jsx)(`span`,{className:`relative inline-flex`,children:r})]})}),(0,H.jsx)(O.Content,{children:e})]})}function G(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id});return t}function K(e,t){let n=e.indexOf(`:`),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n+1);return i?I(r,i,t):L(r,t)}function q(e){let t=e.indexOf(`:`);return t===-1?e:e.slice(0,t)}function J(e,t){let n=[],r=new Set(e.filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));for(let t of e)t.includes(`:`)&&n.push(t);for(let e of t)r.has(e.provider)&&!n.includes(e.value)&&n.push(e.value);return n}function Y(e,t){return e.length?e.map(e=>K(e,t)).join(` · `):t(`keysAllProviders`)}function te(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function X(){let{t:e}=s(),[t,n]=(0,V.useState)([]),[l,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(``),[g,y]=(0,V.useState)([]),[b,C]=(0,V.useState)(!0),[O,M]=(0,V.useState)(``),[N,P]=(0,V.useState)(``),[I,L]=(0,V.useState)(!1),[U,J]=(0,V.useState)(null),[Y,X]=(0,V.useState)(null),[ne,Q]=(0,V.useState)(!1);(0,V.useEffect)(()=>{S().then(e=>{let t=G(e.data||[]);n(t),p(t.length>0),h(``)}).catch(e=>{h(e instanceof Error?e.message:String(e))})},[]);async function $(){C(!0);try{let e=await ee();y(e.data||[]),P(``)}catch(e){P(e instanceof Error?e.message:String(e))}finally{C(!1)}}(0,V.useEffect)(()=>{let e=window.setTimeout(()=>void $(),0);return()=>window.clearTimeout(e)},[]);async function re(e){await i(e),Q(!0),window.setTimeout(()=>Q(!1),1200)}async function ie(e,t){M(e.id),y(n=>n.map(n=>n.id===e.id?{...n,enabled:t}:n));try{let n=await z(e.id,{enabled:t});y(t=>t.map(t=>t.id===e.id?{...t,...n,secret:void 0}:t))}catch(e){P(e instanceof Error?e.message:String(e)),await $()}finally{M(``)}}async function ae(t){M(t.id);try{await R(t.id),y(e=>e.filter(e=>e.id!==t.id)),j({type:`success`,title:e(`toastKeyDeleted`)})}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(``)}}return b&&!g.length?(0,H.jsx)(A,{}):(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:e(`navKeys`)}),(0,H.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`keysLead`)})]}),(0,H.jsxs)(c,{size:`sm`,isDisabled:!l,onPress:()=>L(!0),children:[(0,H.jsx)(a,{size:14}),e(`keysCreate`)]})]}),N?(0,H.jsx)(d,{title:N}):null,m?(0,H.jsx)(d,{title:e(`keysProvidersLoadFailed`,{message:m})}):null,b?(0,H.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:Math.max(3,g.length)},(e,t)=>(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-3`,children:[(0,H.jsx)(k,{className:`h-4 w-28`}),(0,H.jsx)(k,{className:`mt-2 h-3 w-40`}),(0,H.jsx)(k,{className:`mt-4 h-6 w-24`}),(0,H.jsx)(k,{className:`mt-6 h-8 w-full`})]},t))}):g.length?(0,H.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,children:g.map(t=>(0,H.jsxs)(f,{className:`overflow-hidden p-0`,children:[(0,H.jsxs)(f.Header,{className:`flex-row items-start justify-between gap-3 px-3 pt-3 pb-2.5`,children:[(0,H.jsx)(`div`,{className:`min-w-0`,children:(0,H.jsx)(f.Title,{className:`truncate text-body`,children:t.name})}),(0,H.jsx)(E,{size:`sm`,variant:`soft`,color:t.enabled?`success`:`default`,children:t.enabled?e(`enabled`):e(`disabled`)})]}),(0,H.jsxs)(f.Content,{className:`space-y-2.5 px-3 pb-2.5`,children:[(0,H.jsx)(`div`,{className:`mono w-full rounded-lg bg-surface-secondary px-3 py-2 text-body text-foreground`,title:t.prefix,children:t.prefix}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(t.providers.length?t.providers:[`all`]).map(t=>(0,H.jsx)(E,{size:`sm`,variant:`soft`,children:(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t===`all`?(0,H.jsx)(T,{size:12}):(0,H.jsx)(F,{provider:q(t),size:12}),(0,H.jsx)(`span`,{children:t===`all`?e(`keysAllProviders`):K(t,e)})]})},t)),t.model_aggregation?(0,H.jsx)(E,{size:`sm`,variant:`soft`,children:e(`keysModelAggregationBadge`)}):null]}),(0,H.jsxs)(`p`,{className:`text-caption leading-5 text-muted`,children:[t.max_inflight>0?e(`keysMaxInflightValue`,{count:t.max_inflight}):e(`keysMaxInflightUnlimited`),` · `,t.last_used_at?e(`keysLastUsed`,{time:te(t.last_used_at)}):e(`keysNeverUsed`)]})]}),(0,H.jsxs)(f.Footer,{className:`gap-1.5 bg-surface-secondary px-3 py-2`,children:[(0,H.jsx)(c,{size:`sm`,variant:`ghost`,isDisabled:!l,onPress:()=>J(t),children:e(`edit`)}),(0,H.jsx)(W,{label:e(`holdToDelete`),isPending:O===t.id,onConfirm:()=>void ae(t),children:(0,H.jsx)(o,{size:14})}),(0,H.jsx)(`div`,{className:`ml-auto`,children:(0,H.jsx)(x,{isSelected:t.enabled,isDisabled:O===t.id,ariaLabel:e(`enable`),onChange:e=>void ie(t,e)})})]})]},t.id))}):(0,H.jsx)(_,{className:`rounded-3xl bg-surface-secondary`,icon:(0,H.jsx)(D,{size:28}),title:e(`keysEmpty`),hint:e(`keysEmptyHint`),action:(0,H.jsxs)(c,{size:`sm`,isDisabled:!l,onPress:()=>L(!0),children:[(0,H.jsx)(a,{size:14}),e(`keysCreate`)]})}),(0,H.jsx)(Z,{isOpen:I,title:e(`keysCreateTitle`),hint:e(`keysCreateHint`),options:t,t:e,onClose:()=>L(!1),onSave:async e=>{let t=await B(e);y(e=>[t,...e.map(e=>({...e,secret:void 0}))]),L(!1),X(t)}}),(0,H.jsx)(Z,{isOpen:!!U,title:e(`keysEditTitle`),hint:e(`keysEditHint`),initial:U,options:t,t:e,onClose:()=>J(null),onSave:async e=>{if(!U)return;let t=await z(U.id,e);y(e=>e.map(e=>e.id===U.id?{...e,...t,secret:void 0}:e)),J(null)}}),(0,H.jsx)(v.Root,{isOpen:!!Y?.secret,onOpenChange:e=>{e||X(null)},children:(0,H.jsx)(v.Backdrop,{variant:`blur`,children:(0,H.jsx)(v.Container,{placement:`center`,size:`lg`,children:(0,H.jsxs)(v.Dialog,{children:[(0,H.jsxs)(v.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(v.Heading,{className:`text-section font-semibold`,children:e(`keysSecretTitle`)}),(0,H.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`keysSecretHint`)})]}),(0,H.jsx)(v.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,H.jsx)(w,{size:18})})]}),(0,H.jsxs)(v.Body,{className:`px-6 pb-2`,children:[(0,H.jsxs)(u,{status:`warning`,className:`mb-4`,children:[(0,H.jsx)(u.Indicator,{}),(0,H.jsx)(u.Content,{children:(0,H.jsx)(u.Title,{children:e(`keysSecretOnce`)})})]}),(0,H.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:Y?.secret})]}),(0,H.jsxs)(v.Footer,{className:`justify-end`,children:[(0,H.jsx)(c,{variant:`ghost`,onPress:()=>X(null),children:e(`close`)}),(0,H.jsxs)(c,{onPress:()=>{Y?.secret&&re(Y.secret)},children:[(0,H.jsx)(r,{size:14}),e(ne?`copied`:`copy`)]})]})]})})})})]})}function Z({isOpen:e,title:t,hint:n,initial:r,options:i,t:a,onClose:o,onSave:s}){let[d,f]=(0,V.useState)(r?.name||``),[_,S]=(0,V.useState)(r?.max_inflight||0),[C,T]=(0,V.useState)(r?.model_aggregation||!1),[E,D]=(0,V.useState)([]),[O,k]=(0,V.useState)(new Set),[A,j]=(0,V.useState)(!0),[M,N]=(0,V.useState)(``),[P,L]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(!e)return;f(r?.name||``),S(r?.max_inflight||0),T(!!r?.model_aggregation),D(J(r?.providers||[],i));let t=new Set((r?.providers||[]).filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));k(t),j(!0),N(``)},[r,e,i]);function R(e){let t=i.find(t=>t.value===e);j(!1),D(n=>n.includes(e)?(t&&k(e=>{let n=new Set(e);return n.delete(t.provider),n}),n.filter(t=>t!==e)):[...n,e])}async function z(e){e?.preventDefault();let t=d.trim();if(!t){N(a(`keysNameRequired`));return}if(!Number.isInteger(_)||_<0||_>256){N(a(`keysMaxInflightInvalid`));return}if(!i.length){N(a(`keysProvidersNotLoaded`));return}L(!0),N(``);try{await s({name:t,providers:A?r?.providers||[]:E,max_inflight:_,model_aggregation:C})}catch(e){N(e instanceof Error?e.message:String(e))}finally{L(!1)}}return(0,H.jsx)(v.Root,{isOpen:e,onOpenChange:e=>{!e&&!P&&o()},children:(0,H.jsx)(v.Backdrop,{variant:`blur`,children:(0,H.jsx)(v.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,H.jsx)(v.Dialog,{className:`sm:min-w-[32rem]`,children:(0,H.jsxs)(y,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:z,children:[(0,H.jsxs)(v.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(v.Heading,{className:`text-section font-semibold`,children:t}),(0,H.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:n})]}),(0,H.jsx)(v.CloseTrigger,{isDisabled:P,"aria-label":a(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,H.jsx)(w,{size:18})})]}),(0,H.jsxs)(v.Body,{className:`space-y-5 px-6 pb-2 pt-1`,children:[M?(0,H.jsxs)(u,{status:`danger`,children:[(0,H.jsx)(u.Indicator,{}),(0,H.jsx)(u.Content,{children:(0,H.jsx)(u.Title,{children:M})})]}):null,(0,H.jsx)(g,{label:a(`keysName`),children:(0,H.jsx)(h,{value:d,onChange:e=>f(e.target.value),placeholder:a(`keysNamePh`),"aria-label":a(`keysName`)})}),(0,H.jsx)(g,{label:a(`keysMaxInflight`),hint:a(`keysMaxInflightHint`),children:(0,H.jsx)(b,{value:_,onChange:e=>S(e??0),minValue:0,maxValue:256,isDisabled:P,children:(0,H.jsxs)(b.Group,{children:[(0,H.jsx)(b.DecrementButton,{}),(0,H.jsx)(b.Input,{"aria-label":a(`keysMaxInflight`)}),(0,H.jsx)(b.IncrementButton,{})]})})}),(0,H.jsx)(g,{label:a(`keysModelAggregation`),hint:a(`keysModelAggregationHint`),children:(0,H.jsx)(x,{isSelected:C,isDisabled:P,ariaLabel:a(`keysModelAggregation`),onChange:T})}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(l,{className:`text-body font-medium text-muted`,children:a(`keysProviders`)}),(0,H.jsx)(m,{className:`text-caption leading-5 text-muted`,children:a(`keysProvidersHint`)}),i.length?(0,H.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:i.map(e=>{let t=E.includes(e.value),n=O.has(e.provider);return(0,H.jsx)(p,{isSelected:t,onChange:()=>R(e.value),className:`rounded-xl bg-surface-secondary px-3 py-2.5 data-selected:border-accent data-selected:bg-accent-soft`,children:(0,H.jsxs)(p.Content,{className:`flex items-center gap-2.5`,children:[(0,H.jsx)(p.Control,{children:(0,H.jsx)(p.Indicator,{})}),(0,H.jsx)(F,{provider:e.provider,size:16}),(0,H.jsx)(`span`,{className:`text-body font-medium`,children:I(e.provider,e.region,a)}),n?(0,H.jsx)(`span`,{className:`rounded-lg bg-surface-secondary px-1.5 py-0.5 text-caption font-medium text-muted`,children:a(`keysAllRegions`)}):null]})},e.value)})}):(0,H.jsx)(`p`,{className:`rounded-lg bg-surface-secondary px-3 py-2.5 text-caption leading-5 text-muted`,children:a(`keysProvidersNotLoaded`)}),(0,H.jsx)(`p`,{className:`text-caption text-muted`,children:Y(E,a)})]})]}),(0,H.jsxs)(v.Footer,{className:`justify-end`,children:[(0,H.jsx)(c,{variant:`ghost`,isDisabled:P,onPress:o,children:a(`cancel`)}),(0,H.jsx)(c,{type:`submit`,isPending:P,isDisabled:!i.length,children:a(r?`save`:`create`)})]})]})})})})})}export{X as KeysPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/KeysPage-DUl3Zy2G.js b/internal/webui/static/assets/KeysPage-DUl3Zy2G.js deleted file mode 100644 index 3eacd39a..00000000 --- a/internal/webui/static/assets/KeysPage-DUl3Zy2G.js +++ /dev/null @@ -1 +0,0 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./clipboard-DfpIZ3R1.js";import{t as a}from"./Plus.es-Cg0e8UP-.js";import{t as o}from"./TrashSimple.es-1c4RHqtF.js";import{n as s,r as c}from"./useI18n-B77RWTNi.js";import{t as l}from"./label-DLoR3Z-C.js";import{n as u,t as d}from"./PageAlert-r7ZVsH9h.js";import{n as f}from"./useToggle-BRoRhkOA.js";import{n as p,r as m,t as h}from"./number-field-DwLKuqPI.js";import{n as g,r as _,t as v}from"./FormRow-DvxQavWE.js";import{t as y}from"./EmptyPanel-Bs-jQMvG.js";import{t as b}from"./modal-q_Ums9Et.js";import{t as x}from"./CompactSwitch-BinKb1rw.js";import{r as S}from"./gsap-C3sDxib7.js";import{V as C,_ as w,a as T,at as E,b as D,cn as O,en as k,g as A,nt as j,p as M,t as N,v as P}from"./index-CmGY2WQi.js";import{t as F}from"./ProviderMark-IiAZTaQS.js";import{n as I,t as L}from"./provider-gHnttGKq.js";import{n as R,o as z,r as B,t as V}from"./keys-C0KNDmKA.js";var H=t(e(),1),U=n(),W=1.1;function G({label:e,onConfirm:t,isPending:n,children:r}){let i=(0,H.useRef)(null),a=(0,H.useRef)(null);return(0,H.useEffect)(()=>()=>{a.current?.kill()},[]),(0,U.jsxs)(j,{delay:300,children:[(0,U.jsx)(j.Trigger,{children:(0,U.jsxs)(c,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":e,isPending:n,className:`relative overflow-hidden`,onPressStart:()=>{let e=i.current;!e||n||(a.current?.kill(),a.current=S.to(e,{scaleX:1,duration:W*(1-Number(S.getProperty(e,`scaleX`))),ease:P.linear,onComplete:()=>{a.current=null,S.to(e,{scaleX:0,duration:D()?0:w.base,ease:P.out,delay:w.fast}),t()}}))},onPressEnd:()=>{let e=i.current;!e||!a.current||(a.current.kill(),a.current=null,S.to(e,{scaleX:0,duration:D()?0:w.base,ease:P.soft}))},children:[(0,U.jsx)(`span`,{ref:i,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 origin-left scale-x-0 bg-danger/20`}),(0,U.jsx)(`span`,{className:`relative inline-flex`,children:r})]})}),(0,U.jsx)(j.Content,{children:e})]})}function K(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id});return t}function q(e,t){let n=e.indexOf(`:`),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n+1);return i?I(r,i,t):L(r,t)}function ee(e){let t=e.indexOf(`:`);return t===-1?e:e.slice(0,t)}function J(e,t){let n=[],r=new Set(e.filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));for(let t of e)t.includes(`:`)&&n.push(t);for(let e of t)r.has(e.provider)&&!n.includes(e.value)&&n.push(e.value);return n}function Y(e,t){return e.length?e.map(e=>q(e,t)).join(` · `):t(`keysAllProviders`)}function te(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function X(){let{t:e}=s(),[t,n]=(0,H.useState)([]),[l,p]=(0,H.useState)(!1),[m,h]=(0,H.useState)(``),[g,_]=(0,H.useState)([]),[v,S]=(0,H.useState)(!0),[w,D]=(0,H.useState)(``),[j,P]=(0,H.useState)(``),[I,L]=(0,H.useState)(!1),[W,J]=(0,H.useState)(null),[Y,X]=(0,H.useState)(null),[ne,Q]=(0,H.useState)(!1);(0,H.useEffect)(()=>{C().then(e=>{let t=K(e.data||[]);n(t),p(t.length>0),h(``)}).catch(e=>{h(e instanceof Error?e.message:String(e))})},[]);async function $(){S(!0);try{let e=await B();_(e.data||[]),P(``)}catch(e){P(e instanceof Error?e.message:String(e))}finally{S(!1)}}(0,H.useEffect)(()=>{let e=window.setTimeout(()=>void $(),0);return()=>window.clearTimeout(e)},[]);async function re(e){await i(e),Q(!0),window.setTimeout(()=>Q(!1),1200)}async function ie(e,t){D(e.id),_(n=>n.map(n=>n.id===e.id?{...n,enabled:t}:n));try{let n=await z(e.id,{enabled:t});_(t=>t.map(t=>t.id===e.id?{...t,...n,secret:void 0}:t))}catch(e){P(e instanceof Error?e.message:String(e)),await $()}finally{D(``)}}async function ae(t){D(t.id);try{await R(t.id),_(e=>e.filter(e=>e.id!==t.id)),N({type:`success`,title:e(`toastKeyDeleted`)})}catch(e){P(e instanceof Error?e.message:String(e))}finally{D(``)}}return v&&!g.length?(0,U.jsx)(T,{}):(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:e(`navKeys`)}),(0,U.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`keysLead`)})]}),(0,U.jsxs)(c,{size:`sm`,isDisabled:!l,onPress:()=>L(!0),children:[(0,U.jsx)(a,{size:14}),e(`keysCreate`)]})]}),j?(0,U.jsx)(d,{title:j}):null,m?(0,U.jsx)(d,{title:e(`keysProvidersLoadFailed`,{message:m})}):null,v?(0,U.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:Math.max(3,g.length)},(e,t)=>(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-3`,children:[(0,U.jsx)(M,{className:`h-4 w-28`}),(0,U.jsx)(M,{className:`mt-2 h-3 w-40`}),(0,U.jsx)(M,{className:`mt-4 h-6 w-24`}),(0,U.jsx)(M,{className:`mt-6 h-8 w-full`})]},t))}):g.length?(0,U.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,children:g.map(t=>(0,U.jsxs)(f,{className:`overflow-hidden p-0`,children:[(0,U.jsxs)(f.Header,{className:`flex-row items-start justify-between gap-3 px-3 pt-3 pb-2.5`,children:[(0,U.jsx)(`div`,{className:`min-w-0`,children:(0,U.jsx)(f.Title,{className:`truncate text-body`,children:t.name})}),(0,U.jsx)(E,{size:`sm`,variant:`soft`,color:t.enabled?`success`:`default`,children:t.enabled?e(`enabled`):e(`disabled`)})]}),(0,U.jsxs)(f.Content,{className:`space-y-2.5 px-3 pb-2.5`,children:[(0,U.jsx)(`div`,{className:`mono w-full rounded-lg bg-surface-secondary px-3 py-2 text-body text-foreground`,title:t.prefix,children:t.prefix}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(t.providers.length?t.providers:[`all`]).map(t=>(0,U.jsx)(E,{size:`sm`,variant:`soft`,children:(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t===`all`?(0,U.jsx)(O,{size:12}):(0,U.jsx)(F,{provider:ee(t),size:12}),(0,U.jsx)(`span`,{children:t===`all`?e(`keysAllProviders`):q(t,e)})]})},t)),t.model_aggregation?(0,U.jsx)(E,{size:`sm`,variant:`soft`,children:e(`keysModelAggregationBadge`)}):null]}),(0,U.jsxs)(`p`,{className:`text-caption leading-5 text-muted`,children:[t.max_inflight>0?e(`keysMaxInflightValue`,{count:t.max_inflight}):e(`keysMaxInflightUnlimited`),` · `,t.last_used_at?e(`keysLastUsed`,{time:te(t.last_used_at)}):e(`keysNeverUsed`)]})]}),(0,U.jsxs)(f.Footer,{className:`gap-1.5 bg-surface-secondary px-3 py-2`,children:[(0,U.jsx)(c,{size:`sm`,variant:`ghost`,isDisabled:!l,onPress:()=>J(t),children:e(`edit`)}),(0,U.jsx)(G,{label:e(`holdToDelete`),isPending:w===t.id,onConfirm:()=>void ae(t),children:(0,U.jsx)(o,{size:14})}),(0,U.jsx)(`div`,{className:`ml-auto`,children:(0,U.jsx)(x,{isSelected:t.enabled,isDisabled:w===t.id,ariaLabel:e(`enable`),onChange:e=>void ie(t,e)})})]})]},t.id))}):(0,U.jsx)(y,{className:`rounded-3xl bg-surface-secondary`,icon:(0,U.jsx)(A,{size:28}),title:e(`keysEmpty`),hint:e(`keysEmptyHint`),action:(0,U.jsxs)(c,{size:`sm`,isDisabled:!l,onPress:()=>L(!0),children:[(0,U.jsx)(a,{size:14}),e(`keysCreate`)]})}),(0,U.jsx)(Z,{isOpen:I,title:e(`keysCreateTitle`),hint:e(`keysCreateHint`),options:t,t:e,onClose:()=>L(!1),onSave:async e=>{let t=await V(e);_(e=>[t,...e.map(e=>({...e,secret:void 0}))]),L(!1),X(t)}}),(0,U.jsx)(Z,{isOpen:!!W,title:e(`keysEditTitle`),hint:e(`keysEditHint`),initial:W,options:t,t:e,onClose:()=>J(null),onSave:async e=>{if(!W)return;let t=await z(W.id,e);_(e=>e.map(e=>e.id===W.id?{...e,...t,secret:void 0}:e)),J(null)}}),(0,U.jsx)(b.Root,{isOpen:!!Y?.secret,onOpenChange:e=>{e||X(null)},children:(0,U.jsx)(b.Backdrop,{variant:`blur`,children:(0,U.jsx)(b.Container,{placement:`center`,size:`lg`,children:(0,U.jsxs)(b.Dialog,{children:[(0,U.jsxs)(b.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(b.Heading,{className:`text-section font-semibold`,children:e(`keysSecretTitle`)}),(0,U.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`keysSecretHint`)})]}),(0,U.jsx)(b.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,U.jsx)(k,{size:18})})]}),(0,U.jsxs)(b.Body,{className:`px-6 pb-2`,children:[(0,U.jsxs)(u,{status:`warning`,className:`mb-4`,children:[(0,U.jsx)(u.Indicator,{}),(0,U.jsx)(u.Content,{children:(0,U.jsx)(u.Title,{children:e(`keysSecretOnce`)})})]}),(0,U.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:Y?.secret})]}),(0,U.jsxs)(b.Footer,{className:`justify-end`,children:[(0,U.jsx)(c,{variant:`ghost`,onPress:()=>X(null),children:e(`close`)}),(0,U.jsxs)(c,{onPress:()=>{Y?.secret&&re(Y.secret)},children:[(0,U.jsx)(r,{size:14}),e(ne?`copied`:`copy`)]})]})]})})})})]})}function Z({isOpen:e,title:t,hint:n,initial:r,options:i,t:a,onClose:o,onSave:s}){let[d,f]=(0,H.useState)(r?.name||``),[y,S]=(0,H.useState)(r?.max_inflight||0),[C,w]=(0,H.useState)(r?.model_aggregation||!1),[T,E]=(0,H.useState)([]),[D,O]=(0,H.useState)(new Set),[A,j]=(0,H.useState)(!0),[M,N]=(0,H.useState)(``),[P,L]=(0,H.useState)(!1);(0,H.useEffect)(()=>{if(!e)return;f(r?.name||``),S(r?.max_inflight||0),w(!!r?.model_aggregation),E(J(r?.providers||[],i));let t=new Set((r?.providers||[]).filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));O(t),j(!0),N(``)},[r,e,i]);function R(e){let t=i.find(t=>t.value===e);j(!1),E(n=>n.includes(e)?(t&&O(e=>{let n=new Set(e);return n.delete(t.provider),n}),n.filter(t=>t!==e)):[...n,e])}async function z(e){e?.preventDefault();let t=d.trim();if(!t){N(a(`keysNameRequired`));return}if(!Number.isInteger(y)||y<0||y>256){N(a(`keysMaxInflightInvalid`));return}if(!i.length){N(a(`keysProvidersNotLoaded`));return}L(!0),N(``);try{await s({name:t,providers:A?r?.providers||[]:T,max_inflight:y,model_aggregation:C})}catch(e){N(e instanceof Error?e.message:String(e))}finally{L(!1)}}return(0,U.jsx)(b.Root,{isOpen:e,onOpenChange:e=>{!e&&!P&&o()},children:(0,U.jsx)(b.Backdrop,{variant:`blur`,children:(0,U.jsx)(b.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,U.jsx)(b.Dialog,{className:`sm:min-w-[32rem]`,children:(0,U.jsxs)(p,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:z,children:[(0,U.jsxs)(b.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(b.Heading,{className:`text-section font-semibold`,children:t}),(0,U.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:n})]}),(0,U.jsx)(b.CloseTrigger,{isDisabled:P,"aria-label":a(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,U.jsx)(k,{size:18})})]}),(0,U.jsxs)(b.Body,{className:`space-y-5 px-6 pb-2 pt-1`,children:[M?(0,U.jsxs)(u,{status:`danger`,children:[(0,U.jsx)(u.Indicator,{}),(0,U.jsx)(u.Content,{children:(0,U.jsx)(u.Title,{children:M})})]}):null,(0,U.jsx)(v,{label:a(`keysName`),children:(0,U.jsx)(_,{value:d,onChange:e=>f(e.target.value),placeholder:a(`keysNamePh`),"aria-label":a(`keysName`)})}),(0,U.jsx)(v,{label:a(`keysMaxInflight`),hint:a(`keysMaxInflightHint`),children:(0,U.jsx)(h,{value:y,onChange:e=>S(e??0),minValue:0,maxValue:256,isDisabled:P,children:(0,U.jsxs)(h.Group,{children:[(0,U.jsx)(h.DecrementButton,{}),(0,U.jsx)(h.Input,{"aria-label":a(`keysMaxInflight`)}),(0,U.jsx)(h.IncrementButton,{})]})})}),(0,U.jsx)(v,{label:a(`keysModelAggregation`),hint:a(`keysModelAggregationHint`),children:(0,U.jsx)(x,{isSelected:C,isDisabled:P,ariaLabel:a(`keysModelAggregation`),onChange:w})}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(l,{className:`text-body font-medium text-muted`,children:a(`keysProviders`)}),(0,U.jsx)(g,{className:`text-caption leading-5 text-muted`,children:a(`keysProvidersHint`)}),i.length?(0,U.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:i.map(e=>{let t=T.includes(e.value),n=D.has(e.provider);return(0,U.jsx)(m,{isSelected:t,onChange:()=>R(e.value),className:`rounded-xl bg-surface-secondary px-3 py-2.5 data-selected:border-accent data-selected:bg-accent-soft`,children:(0,U.jsxs)(m.Content,{className:`flex items-center gap-2.5`,children:[(0,U.jsx)(m.Control,{children:(0,U.jsx)(m.Indicator,{})}),(0,U.jsx)(F,{provider:e.provider,size:16}),(0,U.jsx)(`span`,{className:`text-body font-medium`,children:I(e.provider,e.region,a)}),n?(0,U.jsx)(`span`,{className:`rounded-lg bg-surface-secondary px-1.5 py-0.5 text-caption font-medium text-muted`,children:a(`keysAllRegions`)}):null]})},e.value)})}):(0,U.jsx)(`p`,{className:`rounded-lg bg-surface-secondary px-3 py-2.5 text-caption leading-5 text-muted`,children:a(`keysProvidersNotLoaded`)}),(0,U.jsx)(`p`,{className:`text-caption text-muted`,children:Y(T,a)})]})]}),(0,U.jsxs)(b.Footer,{className:`justify-end`,children:[(0,U.jsx)(c,{variant:`ghost`,isDisabled:P,onPress:o,children:a(`cancel`)}),(0,U.jsx)(c,{type:`submit`,isPending:P,isDisabled:!i.length,children:a(r?`save`:`create`)})]})]})})})})})}export{X as KeysPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/LoginPage-Co8UBzg7.js b/internal/webui/static/assets/LoginPage-Co8UBzg7.js new file mode 100644 index 00000000..a8f411fd --- /dev/null +++ b/internal/webui/static/assets/LoginPage-Co8UBzg7.js @@ -0,0 +1 @@ +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./InflightLiveCard-DWPcSiCz.js";import{n as i,pt as a,r as o}from"./useI18n-DAGWWg9N.js";import{c as s,s as c,z as l}from"./SharedElementTransition-BlCsXfb1.js";import{h as u,r as d,t as f}from"./label-j5K3TFm8.js";import{t as p}from"./PageAlert-BTp9jdUz.js";import{n as m}from"./useToggle-Zi1rbfHX.js";import{r as h,t as g}from"./textfield-DbDjPadh.js";import{A as _,O as v}from"./overview-DcWoRgOQ.js";import{t as y}from"./textfield-BfjC-Swp.js";import{A as b,At as x,D as S,Jt as C,O as w,Pt as T,Rt as E,Yt as D,_ as O,k,qt as A,r as j}from"./index-BYut8qRj.js";var M=t(e(),1),N=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z`}))]]),P=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M251,123.13c-.37-.81-9.13-20.26-28.48-39.61C196.63,57.67,164,44,128,44S59.37,57.67,33.51,83.52C14.16,102.87,5.4,122.32,5,123.13a12.08,12.08,0,0,0,0,9.75c.37.82,9.13,20.26,28.49,39.61C59.37,198.34,92,212,128,212s68.63-13.66,94.48-39.51c19.36-19.35,28.12-38.79,28.49-39.61A12.08,12.08,0,0,0,251,123.13Zm-46.06,33C183.47,177.27,157.59,188,128,188s-55.47-10.73-76.91-31.88A130.36,130.36,0,0,1,29.52,128,130.45,130.45,0,0,1,51.09,99.89C72.54,78.73,98.41,68,128,68s55.46,10.73,76.91,31.89A130.36,130.36,0,0,1,226.48,128,130.45,130.45,0,0,1,204.91,156.12ZM128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,64a20,20,0,1,1,20-20A20,20,0,0,1,128,148Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Zm0,112a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M245.48,125.57c-.34-.78-8.66-19.23-27.24-37.81C201,70.54,171.38,50,128,50S55,70.54,37.76,87.76c-18.58,18.58-26.9,37-27.24,37.81a6,6,0,0,0,0,4.88c.34.77,8.66,19.22,27.24,37.8C55,185.47,84.62,206,128,206s73-20.53,90.24-37.75c18.58-18.58,26.9-37,27.24-37.8A6,6,0,0,0,245.48,125.57ZM128,194c-31.38,0-58.78-11.42-81.45-33.93A134.77,134.77,0,0,1,22.69,128,134.56,134.56,0,0,1,46.55,95.94C69.22,73.42,96.62,62,128,62s58.78,11.42,81.45,33.94A134.56,134.56,0,0,1,233.31,128C226.94,140.21,195,194,128,194Zm0-112a46,46,0,1,0,46,46A46.06,46.06,0,0,0,128,82Zm0,80a34,34,0,1,1,34-34A34,34,0,0,1,128,162Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M243.66,126.38c-.34-.76-8.52-18.89-26.83-37.2C199.87,72.22,170.7,52,128,52S56.13,72.22,39.17,89.18c-18.31,18.31-26.49,36.44-26.83,37.2a4.08,4.08,0,0,0,0,3.25c.34.77,8.52,18.89,26.83,37.2,17,17,46.14,37.17,88.83,37.17s71.87-20.21,88.83-37.17c18.31-18.31,26.49-36.43,26.83-37.2A4.08,4.08,0,0,0,243.66,126.38Zm-32.7,35c-23.07,23-51,34.62-83,34.62s-59.89-11.65-83-34.62A135.71,135.71,0,0,1,20.44,128,135.69,135.69,0,0,1,45,94.62C68.11,71.65,96,60,128,60s59.89,11.65,83,34.62A135.79,135.79,0,0,1,235.56,128,135.71,135.71,0,0,1,211,161.38ZM128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,80a36,36,0,1,1,36-36A36,36,0,0,1,128,164Z`}))]]),F=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M56.88,31.93A12,12,0,1,0,39.12,48.07l16,17.65C20.67,88.66,5.72,121.58,5,123.13a12.08,12.08,0,0,0,0,9.75c.37.82,9.13,20.26,28.49,39.61C59.37,198.34,92,212,128,212a131.34,131.34,0,0,0,51-10l20.09,22.1a12,12,0,0,0,17.76-16.14ZM128,188c-29.59,0-55.47-10.73-76.91-31.88A130.69,130.69,0,0,1,29.52,128c5.27-9.31,18.79-29.9,42-44.29l90.09,99.11A109.33,109.33,0,0,1,128,188Zm123-55.12c-.36.81-9,20-28,39.16a12,12,0,1,1-17-16.9A130.48,130.48,0,0,0,226.48,128a130.36,130.36,0,0,0-21.57-28.12C183.46,78.73,157.59,68,128,68c-3.35,0-6.7.14-10,.42a12,12,0,1,1-2-23.91c3.93-.34,8-.51,12-.51,36,0,68.63,13.67,94.49,39.52,19.35,19.35,28.11,38.8,28.48,39.61A12.08,12.08,0,0,1,251,132.88Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Zm0,112a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M53.92,34.62A8,8,0,1,0,42.08,45.38L61.32,66.55C25,88.84,9.38,123.2,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208a127.11,127.11,0,0,0,52.07-10.83l22,24.21a8,8,0,1,0,11.84-10.76Zm47.33,75.84,41.67,45.85a32,32,0,0,1-41.67-45.85ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.16,133.16,0,0,1,25,128c4.69-8.79,19.66-33.39,47.35-49.38l18,19.75a48,48,0,0,0,63.66,70l14.73,16.2A112,112,0,0,1,128,192Zm6-95.43a8,8,0,0,1,3-15.72,48.16,48.16,0,0,1,38.77,42.64,8,8,0,0,1-7.22,8.71,6.39,6.39,0,0,1-.75,0,8,8,0,0,1-8-7.26A32.09,32.09,0,0,0,134,96.57Zm113.28,34.69c-.42.94-10.55,23.37-33.36,43.8a8,8,0,1,1-10.67-11.92A132.77,132.77,0,0,0,231.05,128a133.15,133.15,0,0,0-23.12-30.77C185.67,75.19,158.78,64,128,64a118.37,118.37,0,0,0-19.36,1.57A8,8,0,1,1,106,49.79,134,134,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41A8,8,0,0,1,247.31,131.26Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M96.68,57.87a4,4,0,0,1,2.08-6.6A130.13,130.13,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41a8,8,0,0,1,0,6.5c-.35.79-8.82,19.57-27.65,38.4q-4.28,4.26-8.79,8.07a4,4,0,0,1-5.55-.36ZM213.92,210.62a8,8,0,1,1-11.84,10.76L180,197.13A127.21,127.21,0,0,1,128,208c-34.88,0-66.57-13.26-91.66-38.34C17.51,150.83,9,132.05,8.69,131.26a8,8,0,0,1,0-6.5C9,124,17.51,105.18,36.34,86.35a135,135,0,0,1,25-19.78L42.08,45.38A8,8,0,1,1,53.92,34.62Zm-65.49-48.25-52.69-58a40,40,0,0,0,52.69,58Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M52.44,36A6,6,0,0,0,43.56,44L64.44,67c-37.28,21.9-53.23,57-53.92,58.57a6,6,0,0,0,0,4.88c.34.77,8.66,19.22,27.24,37.8C55,185.47,84.62,206,128,206a124.91,124.91,0,0,0,52.57-11.25l23,25.29a6,6,0,0,0,8.88-8.08Zm48.62,71.32,45,49.52a34,34,0,0,1-45-49.52ZM128,194c-31.38,0-58.78-11.42-81.45-33.93A134.57,134.57,0,0,1,22.69,128c4.29-8.2,20.1-35.18,50-51.91L92.89,98.3a46,46,0,0,0,61.35,67.48l17.81,19.6A113.47,113.47,0,0,1,128,194Zm6.4-99.4a6,6,0,0,1,2.25-11.79,46.17,46.17,0,0,1,37.15,40.87,6,6,0,0,1-5.42,6.53l-.56,0a6,6,0,0,1-6-5.45A34.1,34.1,0,0,0,134.4,94.6Zm111.08,35.85c-.41.92-10.37,23-32.86,43.12a6,6,0,1,1-8-8.94A134.07,134.07,0,0,0,233.31,128a134.67,134.67,0,0,0-23.86-32.07C186.78,73.42,159.38,62,128,62a120.19,120.19,0,0,0-19.69,1.6,6,6,0,1,1-2-11.83A131.12,131.12,0,0,1,128,50c43.38,0,73,20.54,90.24,37.76,18.58,18.58,26.9,37,27.24,37.81A6,6,0,0,1,245.48,130.45Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M53.92,34.62A8,8,0,1,0,42.08,45.38L61.32,66.55C25,88.84,9.38,123.2,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208a127.11,127.11,0,0,0,52.07-10.83l22,24.21a8,8,0,1,0,11.84-10.76Zm47.33,75.84,41.67,45.85a32,32,0,0,1-41.67-45.85ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.16,133.16,0,0,1,25,128c4.69-8.79,19.66-33.39,47.35-49.38l18,19.75a48,48,0,0,0,63.66,70l14.73,16.2A112,112,0,0,1,128,192Zm6-95.43a8,8,0,0,1,3-15.72,48.16,48.16,0,0,1,38.77,42.64,8,8,0,0,1-7.22,8.71,6.39,6.39,0,0,1-.75,0,8,8,0,0,1-8-7.26A32.09,32.09,0,0,0,134,96.57Zm113.28,34.69c-.42.94-10.55,23.37-33.36,43.8a8,8,0,1,1-10.67-11.92A132.77,132.77,0,0,0,231.05,128a133.15,133.15,0,0,0-23.12-30.77C185.67,75.19,158.78,64,128,64a118.37,118.37,0,0,0-19.36,1.57A8,8,0,1,1,106,49.79,134,134,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41A8,8,0,0,1,247.31,131.26Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M51,37.31A4,4,0,0,0,45,42.69L67.59,67.5C29.34,89,13,124.81,12.34,126.38a4.08,4.08,0,0,0,0,3.25c.34.77,8.52,18.89,26.83,37.2,17,17,46.14,37.17,88.83,37.17a122.59,122.59,0,0,0,53.06-11.69l24,26.38a4,4,0,1,0,5.92-5.38ZM149.1,157.16A36,36,0,0,1,101,104.22ZM128,196c-32,0-59.89-11.65-83-34.62A135.81,135.81,0,0,1,20.44,128c3.65-7.23,20.09-36.81,52.68-54.43l22.45,24.7a44,44,0,0,0,59,64.83l20.89,23A114.94,114.94,0,0,1,128,196Zm6.78-103.36a4,4,0,0,1,1.49-7.86,44.15,44.15,0,0,1,35.54,39.09,4,4,0,0,1-3.61,4.35l-.38,0a4,4,0,0,1-4-3.63A36.1,36.1,0,0,0,134.78,92.64Zm108.88,37c-.41.91-10.2,22.58-32.38,42.45a4,4,0,0,1-2.67,1,4,4,0,0,1-2.67-7A136.71,136.71,0,0,0,235.56,128,136.07,136.07,0,0,0,211,94.62C187.89,71.65,160,60,128,60a122,122,0,0,0-20,1.63,4,4,0,0,1-1.32-7.89A129.3,129.3,0,0,1,128,52c42.7,0,71.87,20.22,88.83,37.18,18.31,18.31,26.49,36.44,26.83,37.2A4.08,4.08,0,0,1,243.66,129.63Z`}))]]),I=M.forwardRef((e,t)=>M.createElement(a,{ref:t,...e,weights:N}));I.displayName=`ArrowRightIcon`;var L=I,R=M.forwardRef((e,t)=>M.createElement(a,{ref:t,...e,weights:P}));R.displayName=`EyeIcon`;var z=R,B=M.forwardRef((e,t)=>M.createElement(a,{ref:t,...e,weights:F}));B.displayName=`EyeSlashIcon`;var V=B,H=l({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`input-group`,input:`input-group__input`,prefix:`input-group__prefix`,suffix:`input-group__suffix`},variants:{fullWidth:{false:{},true:{base:`input-group--full-width`}},variant:{primary:{base:`input-group--primary`},secondary:{base:`input-group--secondary`}}}}),U=n(),W=(0,M.createContext)({}),G=({children:e,className:t,fullWidth:n,onClick:r,variant:i,...a})=>{let o=(0,M.use)(g),c=i??o?.variant,l=M.useRef(null),d=M.useMemo(()=>H({fullWidth:n,variant:c}),[n,c]),f=e=>{let t=e.target,n=l.current?.querySelector(`input`);n&&t!==n&&!n.contains(t)&&n.focus(),r?.(e)};return(0,U.jsx)(W,{value:{slots:d},children:(0,U.jsx)(u,{...a,ref:l,className:s(t,d?.base()),"data-slot":`input-group`,onClick:f,children:t=>typeof e==`function`?e(t):e})})},K=Object.assign(G,{Root:G,Input:({className:e,...t})=>{let{slots:n}=(0,M.use)(W);return(0,U.jsx)(d,{className:s(e,n?.input()),"data-slot":`input-group-input`,...t})},TextArea:({className:e,...t})=>{let{slots:n}=(0,M.use)(W);return(0,U.jsx)(h,{className:s(e,n?.input()),"data-slot":`input-group-textarea`,...t})},Prefix:({children:e,className:t,...n})=>{let{slots:r}=(0,M.use)(W);return(0,U.jsx)(`div`,{className:c(r?.prefix,t),"data-slot":`input-group-prefix`,...n,children:e})},Suffix:({children:e,className:t,...n})=>{let{slots:r}=(0,M.use)(W);return(0,U.jsx)(`div`,{className:c(r?.suffix,t),"data-slot":`input-group-suffix`,...n,children:e})}});function q(){let{t:e,lang:t,setLang:n}=i(),{setApiKey:a}=_(),{overview:s,refresh:c}=w(),{theme:l,toggleTheme:u}=S(),[d,h]=(0,M.useState)(``),[g,N]=(0,M.useState)(!1),[P,F]=(0,M.useState)(!1),[I,R]=(0,M.useState)(``),B=D(),H=C().state?.from||`/`,W=(0,M.useRef)(null);if(j(W,`login`),s)return(0,U.jsx)(A,{to:H===`/login`?`/`:H,replace:!0});async function G(t){t.preventDefault();let n=d.trim();if(!n){R(e(`loginNeedKey`));return}F(!0),R(``);try{a(n),await c(n),B(H===`/login`?`/`:H,{replace:!0})}catch(t){R(v(t)?e(`loginBadKey`):t instanceof Error?t.message:String(t))}finally{F(!1)}}return(0,U.jsxs)(`div`,{className:`relative min-h-dvh overflow-hidden bg-background text-foreground`,children:[(0,U.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-border`}),(0,U.jsxs)(`main`,{ref:W,className:`relative z-10 mx-auto grid min-h-dvh w-full max-w-[1480px] lg:grid-cols-[minmax(0,1fr)_minmax(380px,30rem)]`,children:[(0,U.jsxs)(`section`,{className:`flex min-h-[52vh] flex-col px-5 py-6 sm:px-8 sm:py-8 lg:min-h-dvh lg:px-8 lg:py-10 xl:px-10`,children:[(0,U.jsxs)(`header`,{className:`flex items-center justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(O,{size:36}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`font-semibold`,children:`CLI2API`}),(0,U.jsx)(`div`,{className:`text-caption text-muted`,children:e(`controlPlane`)})]})]}),(0,U.jsxs)(b,{isAttached:!0,children:[(0,U.jsxs)(k,{children:[(0,U.jsx)(k.Trigger,{children:(0,U.jsx)(o,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:()=>n(t===`zh`?`en`:`zh`),"aria-label":t===`zh`?`English`:`中文`,children:(0,U.jsx)(E,{size:15})})}),(0,U.jsx)(k.Content,{children:t===`zh`?`English`:`中文`})]}),(0,U.jsxs)(k,{children:[(0,U.jsx)(k.Trigger,{children:(0,U.jsx)(o,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:u,"aria-label":l===`dark`?`Light mode`:`Dark mode`,children:l===`dark`?(0,U.jsx)(x,{size:15}):(0,U.jsx)(T,{size:15})})}),(0,U.jsx)(k.Content,{children:l===`dark`?`Light mode`:`Dark mode`})]})]})]}),(0,U.jsx)(`div`,{className:`my-auto w-full py-8 lg:py-10`,children:(0,U.jsx)(r,{t:e,defaultExpanded:!0,forceMockDemo:!0,bare:!0,live:null,mockPace:.45})}),(0,U.jsxs)(`footer`,{className:`hidden items-center justify-between text-caption text-muted lg:flex`,children:[(0,U.jsx)(`span`,{children:e(`loginHint`)}),(0,U.jsx)(`span`,{children:e(`routesHint`)})]})]}),(0,U.jsx)(`section`,{className:`flex items-center px-5 py-10 sm:px-8 lg:px-8 xl:px-10`,children:(0,U.jsx)(m,{"data-gsap-reveal":!0,variant:`transparent`,className:`w-full bg-transparent p-0 shadow-none`,children:(0,U.jsxs)(`form`,{onSubmit:e=>void G(e),children:[(0,U.jsx)(m.Header,{className:`px-2 py-6 sm:px-4`,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,U.jsx)(O,{size:28,loading:P}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(m.Title,{className:`text-title`,children:e(`loginFormTitle`)}),(0,U.jsx)(m.Description,{className:`mt-1`,children:e(`loginDesc`)})]})]})}),(0,U.jsxs)(m.Content,{className:`space-y-5 px-6 py-7 sm:px-8 sm:py-8`,children:[(0,U.jsxs)(y,{name:`console-password`,className:`w-full`,isInvalid:!!I,children:[(0,U.jsx)(f,{children:e(`loginPassword`)}),(0,U.jsxs)(K,{children:[(0,U.jsx)(K.Input,{id:`console-password`,type:g?`text`:`password`,value:d,onChange:e=>h(e.target.value),placeholder:e(`loginPasswordPh`),autoComplete:`current-password`,autoFocus:!0,"aria-label":e(`loginPassword`),spellCheck:!1}),(0,U.jsx)(K.Suffix,{children:(0,U.jsx)(o,{isIconOnly:!0,size:`sm`,variant:`ghost`,type:`button`,"aria-label":e(g?`hidePassword`:`showPassword`),onPress:()=>N(e=>!e),children:g?(0,U.jsx)(V,{size:16}):(0,U.jsx)(z,{size:16})})})]})]}),I?(0,U.jsx)(p,{title:I}):(0,U.jsx)(`p`,{className:`text-caption text-muted`,children:e(`loginHint`)}),(0,U.jsxs)(o,{type:`submit`,fullWidth:!0,size:`lg`,isPending:P,children:[e(P?`loggingInConsole`:`loginSubmit`),P?null:(0,U.jsx)(L,{size:17})]})]})]})})})]})]})}export{q as LoginPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/LoginPage-KdNdPS36.js b/internal/webui/static/assets/LoginPage-KdNdPS36.js deleted file mode 100644 index 5d81cd14..00000000 --- a/internal/webui/static/assets/LoginPage-KdNdPS36.js +++ /dev/null @@ -1 +0,0 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./InflightLiveCard-CQIDgYNq.js";import{n as i,pt as a,r as o}from"./useI18n-B77RWTNi.js";import{c as s,s as c,z as l}from"./SharedElementTransition-BlCsXfb1.js";import{h as u,r as d,t as f}from"./label-DLoR3Z-C.js";import{t as p}from"./PageAlert-r7ZVsH9h.js";import{n as m}from"./useToggle-BRoRhkOA.js";import{r as h,t as g}from"./textfield-BWaikvel.js";import{t as _}from"./textfield-OcaUopTb.js";import{D as v,E as y,bn as b,et as x,g as S,n as C,nt as w,rn as T,rt as E,sn as D,tt as O,un as k,vn as A,yn as j}from"./index-CmGY2WQi.js";var M=t(e(),1),N=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z`}))]]),P=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M251,123.13c-.37-.81-9.13-20.26-28.48-39.61C196.63,57.67,164,44,128,44S59.37,57.67,33.51,83.52C14.16,102.87,5.4,122.32,5,123.13a12.08,12.08,0,0,0,0,9.75c.37.82,9.13,20.26,28.49,39.61C59.37,198.34,92,212,128,212s68.63-13.66,94.48-39.51c19.36-19.35,28.12-38.79,28.49-39.61A12.08,12.08,0,0,0,251,123.13Zm-46.06,33C183.47,177.27,157.59,188,128,188s-55.47-10.73-76.91-31.88A130.36,130.36,0,0,1,29.52,128,130.45,130.45,0,0,1,51.09,99.89C72.54,78.73,98.41,68,128,68s55.46,10.73,76.91,31.89A130.36,130.36,0,0,1,226.48,128,130.45,130.45,0,0,1,204.91,156.12ZM128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,64a20,20,0,1,1,20-20A20,20,0,0,1,128,148Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Zm0,112a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M245.48,125.57c-.34-.78-8.66-19.23-27.24-37.81C201,70.54,171.38,50,128,50S55,70.54,37.76,87.76c-18.58,18.58-26.9,37-27.24,37.81a6,6,0,0,0,0,4.88c.34.77,8.66,19.22,27.24,37.8C55,185.47,84.62,206,128,206s73-20.53,90.24-37.75c18.58-18.58,26.9-37,27.24-37.8A6,6,0,0,0,245.48,125.57ZM128,194c-31.38,0-58.78-11.42-81.45-33.93A134.77,134.77,0,0,1,22.69,128,134.56,134.56,0,0,1,46.55,95.94C69.22,73.42,96.62,62,128,62s58.78,11.42,81.45,33.94A134.56,134.56,0,0,1,233.31,128C226.94,140.21,195,194,128,194Zm0-112a46,46,0,1,0,46,46A46.06,46.06,0,0,0,128,82Zm0,80a34,34,0,1,1,34-34A34,34,0,0,1,128,162Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M243.66,126.38c-.34-.76-8.52-18.89-26.83-37.2C199.87,72.22,170.7,52,128,52S56.13,72.22,39.17,89.18c-18.31,18.31-26.49,36.44-26.83,37.2a4.08,4.08,0,0,0,0,3.25c.34.77,8.52,18.89,26.83,37.2,17,17,46.14,37.17,88.83,37.17s71.87-20.21,88.83-37.17c18.31-18.31,26.49-36.43,26.83-37.2A4.08,4.08,0,0,0,243.66,126.38Zm-32.7,35c-23.07,23-51,34.62-83,34.62s-59.89-11.65-83-34.62A135.71,135.71,0,0,1,20.44,128,135.69,135.69,0,0,1,45,94.62C68.11,71.65,96,60,128,60s59.89,11.65,83,34.62A135.79,135.79,0,0,1,235.56,128,135.71,135.71,0,0,1,211,161.38ZM128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,80a36,36,0,1,1,36-36A36,36,0,0,1,128,164Z`}))]]),F=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M56.88,31.93A12,12,0,1,0,39.12,48.07l16,17.65C20.67,88.66,5.72,121.58,5,123.13a12.08,12.08,0,0,0,0,9.75c.37.82,9.13,20.26,28.49,39.61C59.37,198.34,92,212,128,212a131.34,131.34,0,0,0,51-10l20.09,22.1a12,12,0,0,0,17.76-16.14ZM128,188c-29.59,0-55.47-10.73-76.91-31.88A130.69,130.69,0,0,1,29.52,128c5.27-9.31,18.79-29.9,42-44.29l90.09,99.11A109.33,109.33,0,0,1,128,188Zm123-55.12c-.36.81-9,20-28,39.16a12,12,0,1,1-17-16.9A130.48,130.48,0,0,0,226.48,128a130.36,130.36,0,0,0-21.57-28.12C183.46,78.73,157.59,68,128,68c-3.35,0-6.7.14-10,.42a12,12,0,1,1-2-23.91c3.93-.34,8-.51,12-.51,36,0,68.63,13.67,94.49,39.52,19.35,19.35,28.11,38.8,28.48,39.61A12.08,12.08,0,0,1,251,132.88Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Zm0,112a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M53.92,34.62A8,8,0,1,0,42.08,45.38L61.32,66.55C25,88.84,9.38,123.2,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208a127.11,127.11,0,0,0,52.07-10.83l22,24.21a8,8,0,1,0,11.84-10.76Zm47.33,75.84,41.67,45.85a32,32,0,0,1-41.67-45.85ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.16,133.16,0,0,1,25,128c4.69-8.79,19.66-33.39,47.35-49.38l18,19.75a48,48,0,0,0,63.66,70l14.73,16.2A112,112,0,0,1,128,192Zm6-95.43a8,8,0,0,1,3-15.72,48.16,48.16,0,0,1,38.77,42.64,8,8,0,0,1-7.22,8.71,6.39,6.39,0,0,1-.75,0,8,8,0,0,1-8-7.26A32.09,32.09,0,0,0,134,96.57Zm113.28,34.69c-.42.94-10.55,23.37-33.36,43.8a8,8,0,1,1-10.67-11.92A132.77,132.77,0,0,0,231.05,128a133.15,133.15,0,0,0-23.12-30.77C185.67,75.19,158.78,64,128,64a118.37,118.37,0,0,0-19.36,1.57A8,8,0,1,1,106,49.79,134,134,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41A8,8,0,0,1,247.31,131.26Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M96.68,57.87a4,4,0,0,1,2.08-6.6A130.13,130.13,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41a8,8,0,0,1,0,6.5c-.35.79-8.82,19.57-27.65,38.4q-4.28,4.26-8.79,8.07a4,4,0,0,1-5.55-.36ZM213.92,210.62a8,8,0,1,1-11.84,10.76L180,197.13A127.21,127.21,0,0,1,128,208c-34.88,0-66.57-13.26-91.66-38.34C17.51,150.83,9,132.05,8.69,131.26a8,8,0,0,1,0-6.5C9,124,17.51,105.18,36.34,86.35a135,135,0,0,1,25-19.78L42.08,45.38A8,8,0,1,1,53.92,34.62Zm-65.49-48.25-52.69-58a40,40,0,0,0,52.69,58Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M52.44,36A6,6,0,0,0,43.56,44L64.44,67c-37.28,21.9-53.23,57-53.92,58.57a6,6,0,0,0,0,4.88c.34.77,8.66,19.22,27.24,37.8C55,185.47,84.62,206,128,206a124.91,124.91,0,0,0,52.57-11.25l23,25.29a6,6,0,0,0,8.88-8.08Zm48.62,71.32,45,49.52a34,34,0,0,1-45-49.52ZM128,194c-31.38,0-58.78-11.42-81.45-33.93A134.57,134.57,0,0,1,22.69,128c4.29-8.2,20.1-35.18,50-51.91L92.89,98.3a46,46,0,0,0,61.35,67.48l17.81,19.6A113.47,113.47,0,0,1,128,194Zm6.4-99.4a6,6,0,0,1,2.25-11.79,46.17,46.17,0,0,1,37.15,40.87,6,6,0,0,1-5.42,6.53l-.56,0a6,6,0,0,1-6-5.45A34.1,34.1,0,0,0,134.4,94.6Zm111.08,35.85c-.41.92-10.37,23-32.86,43.12a6,6,0,1,1-8-8.94A134.07,134.07,0,0,0,233.31,128a134.67,134.67,0,0,0-23.86-32.07C186.78,73.42,159.38,62,128,62a120.19,120.19,0,0,0-19.69,1.6,6,6,0,1,1-2-11.83A131.12,131.12,0,0,1,128,50c43.38,0,73,20.54,90.24,37.76,18.58,18.58,26.9,37,27.24,37.81A6,6,0,0,1,245.48,130.45Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M53.92,34.62A8,8,0,1,0,42.08,45.38L61.32,66.55C25,88.84,9.38,123.2,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208a127.11,127.11,0,0,0,52.07-10.83l22,24.21a8,8,0,1,0,11.84-10.76Zm47.33,75.84,41.67,45.85a32,32,0,0,1-41.67-45.85ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.16,133.16,0,0,1,25,128c4.69-8.79,19.66-33.39,47.35-49.38l18,19.75a48,48,0,0,0,63.66,70l14.73,16.2A112,112,0,0,1,128,192Zm6-95.43a8,8,0,0,1,3-15.72,48.16,48.16,0,0,1,38.77,42.64,8,8,0,0,1-7.22,8.71,6.39,6.39,0,0,1-.75,0,8,8,0,0,1-8-7.26A32.09,32.09,0,0,0,134,96.57Zm113.28,34.69c-.42.94-10.55,23.37-33.36,43.8a8,8,0,1,1-10.67-11.92A132.77,132.77,0,0,0,231.05,128a133.15,133.15,0,0,0-23.12-30.77C185.67,75.19,158.78,64,128,64a118.37,118.37,0,0,0-19.36,1.57A8,8,0,1,1,106,49.79,134,134,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41A8,8,0,0,1,247.31,131.26Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M51,37.31A4,4,0,0,0,45,42.69L67.59,67.5C29.34,89,13,124.81,12.34,126.38a4.08,4.08,0,0,0,0,3.25c.34.77,8.52,18.89,26.83,37.2,17,17,46.14,37.17,88.83,37.17a122.59,122.59,0,0,0,53.06-11.69l24,26.38a4,4,0,1,0,5.92-5.38ZM149.1,157.16A36,36,0,0,1,101,104.22ZM128,196c-32,0-59.89-11.65-83-34.62A135.81,135.81,0,0,1,20.44,128c3.65-7.23,20.09-36.81,52.68-54.43l22.45,24.7a44,44,0,0,0,59,64.83l20.89,23A114.94,114.94,0,0,1,128,196Zm6.78-103.36a4,4,0,0,1,1.49-7.86,44.15,44.15,0,0,1,35.54,39.09,4,4,0,0,1-3.61,4.35l-.38,0a4,4,0,0,1-4-3.63A36.1,36.1,0,0,0,134.78,92.64Zm108.88,37c-.41.91-10.2,22.58-32.38,42.45a4,4,0,0,1-2.67,1,4,4,0,0,1-2.67-7A136.71,136.71,0,0,0,235.56,128,136.07,136.07,0,0,0,211,94.62C187.89,71.65,160,60,128,60a122,122,0,0,0-20,1.63,4,4,0,0,1-1.32-7.89A129.3,129.3,0,0,1,128,52c42.7,0,71.87,20.22,88.83,37.18,18.31,18.31,26.49,36.44,26.83,37.2A4.08,4.08,0,0,1,243.66,129.63Z`}))]]),I=M.forwardRef((e,t)=>M.createElement(a,{ref:t,...e,weights:N}));I.displayName=`ArrowRightIcon`;var L=I,R=M.forwardRef((e,t)=>M.createElement(a,{ref:t,...e,weights:P}));R.displayName=`EyeIcon`;var z=R,B=M.forwardRef((e,t)=>M.createElement(a,{ref:t,...e,weights:F}));B.displayName=`EyeSlashIcon`;var V=B,H=l({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`input-group`,input:`input-group__input`,prefix:`input-group__prefix`,suffix:`input-group__suffix`},variants:{fullWidth:{false:{},true:{base:`input-group--full-width`}},variant:{primary:{base:`input-group--primary`},secondary:{base:`input-group--secondary`}}}}),U=n(),W=(0,M.createContext)({}),G=({children:e,className:t,fullWidth:n,onClick:r,variant:i,...a})=>{let o=(0,M.use)(g),c=i??o?.variant,l=M.useRef(null),d=M.useMemo(()=>H({fullWidth:n,variant:c}),[n,c]),f=e=>{let t=e.target,n=l.current?.querySelector(`input`);n&&t!==n&&!n.contains(t)&&n.focus(),r?.(e)};return(0,U.jsx)(W,{value:{slots:d},children:(0,U.jsx)(u,{...a,ref:l,className:s(t,d?.base()),"data-slot":`input-group`,onClick:f,children:t=>typeof e==`function`?e(t):e})})},K=Object.assign(G,{Root:G,Input:({className:e,...t})=>{let{slots:n}=(0,M.use)(W);return(0,U.jsx)(d,{className:s(e,n?.input()),"data-slot":`input-group-input`,...t})},TextArea:({className:e,...t})=>{let{slots:n}=(0,M.use)(W);return(0,U.jsx)(h,{className:s(e,n?.input()),"data-slot":`input-group-textarea`,...t})},Prefix:({children:e,className:t,...n})=>{let{slots:r}=(0,M.use)(W);return(0,U.jsx)(`div`,{className:c(r?.prefix,t),"data-slot":`input-group-prefix`,...n,children:e})},Suffix:({children:e,className:t,...n})=>{let{slots:r}=(0,M.use)(W);return(0,U.jsx)(`div`,{className:c(r?.suffix,t),"data-slot":`input-group-suffix`,...n,children:e})}});function q(){let{t:e,lang:t,setLang:n}=i(),{setApiKey:a}=O(),{overview:s,refresh:c}=v(),{theme:l,toggleTheme:u}=y(),[d,h]=(0,M.useState)(``),[g,N]=(0,M.useState)(!1),[P,F]=(0,M.useState)(!1),[I,R]=(0,M.useState)(``),B=b(),H=j().state?.from||`/`,W=(0,M.useRef)(null);if(C(W,`login`),s)return(0,U.jsx)(A,{to:H===`/login`?`/`:H,replace:!0});async function G(t){t.preventDefault();let n=d.trim();if(!n){R(e(`loginNeedKey`));return}F(!0),R(``);try{a(n),await c(n),B(H===`/login`?`/`:H,{replace:!0})}catch(t){R(x(t)?e(`loginBadKey`):t instanceof Error?t.message:String(t))}finally{F(!1)}}return(0,U.jsxs)(`div`,{className:`relative min-h-dvh overflow-hidden bg-background text-foreground`,children:[(0,U.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-border`}),(0,U.jsxs)(`main`,{ref:W,className:`relative z-10 mx-auto grid min-h-dvh w-full max-w-[1480px] lg:grid-cols-[minmax(0,1fr)_minmax(380px,30rem)]`,children:[(0,U.jsxs)(`section`,{className:`flex min-h-[52vh] flex-col px-5 py-6 sm:px-8 sm:py-8 lg:min-h-dvh lg:px-8 lg:py-10 xl:px-10`,children:[(0,U.jsxs)(`header`,{className:`flex items-center justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(S,{size:36}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`font-semibold`,children:`CLI2API`}),(0,U.jsx)(`div`,{className:`text-caption text-muted`,children:e(`controlPlane`)})]})]}),(0,U.jsxs)(E,{isAttached:!0,children:[(0,U.jsxs)(w,{children:[(0,U.jsx)(w.Trigger,{children:(0,U.jsx)(o,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:()=>n(t===`zh`?`en`:`zh`),"aria-label":t===`zh`?`English`:`中文`,children:(0,U.jsx)(k,{size:15})})}),(0,U.jsx)(w.Content,{children:t===`zh`?`English`:`中文`})]}),(0,U.jsxs)(w,{children:[(0,U.jsx)(w.Trigger,{children:(0,U.jsx)(o,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:u,"aria-label":l===`dark`?`Light mode`:`Dark mode`,children:l===`dark`?(0,U.jsx)(T,{size:15}):(0,U.jsx)(D,{size:15})})}),(0,U.jsx)(w.Content,{children:l===`dark`?`Light mode`:`Dark mode`})]})]})]}),(0,U.jsx)(`div`,{className:`my-auto w-full py-8 lg:py-10`,children:(0,U.jsx)(r,{t:e,defaultExpanded:!0,forceMockDemo:!0,bare:!0,live:null,mockPace:.45})}),(0,U.jsxs)(`footer`,{className:`hidden items-center justify-between text-caption text-muted lg:flex`,children:[(0,U.jsx)(`span`,{children:e(`loginHint`)}),(0,U.jsx)(`span`,{children:e(`routesHint`)})]})]}),(0,U.jsx)(`section`,{className:`flex items-center px-5 py-10 sm:px-8 lg:px-8 xl:px-10`,children:(0,U.jsx)(m,{"data-gsap-reveal":!0,variant:`transparent`,className:`w-full bg-transparent p-0 shadow-none`,children:(0,U.jsxs)(`form`,{onSubmit:e=>void G(e),children:[(0,U.jsx)(m.Header,{className:`px-2 py-6 sm:px-4`,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,U.jsx)(S,{size:28,loading:P}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(m.Title,{className:`text-title`,children:e(`loginFormTitle`)}),(0,U.jsx)(m.Description,{className:`mt-1`,children:e(`loginDesc`)})]})]})}),(0,U.jsxs)(m.Content,{className:`space-y-5 px-6 py-7 sm:px-8 sm:py-8`,children:[(0,U.jsxs)(_,{name:`console-password`,className:`w-full`,isInvalid:!!I,children:[(0,U.jsx)(f,{children:e(`loginPassword`)}),(0,U.jsxs)(K,{children:[(0,U.jsx)(K.Input,{id:`console-password`,type:g?`text`:`password`,value:d,onChange:e=>h(e.target.value),placeholder:e(`loginPasswordPh`),autoComplete:`current-password`,autoFocus:!0,"aria-label":e(`loginPassword`),spellCheck:!1}),(0,U.jsx)(K.Suffix,{children:(0,U.jsx)(o,{isIconOnly:!0,size:`sm`,variant:`ghost`,type:`button`,"aria-label":e(g?`hidePassword`:`showPassword`),onPress:()=>N(e=>!e),children:g?(0,U.jsx)(V,{size:16}):(0,U.jsx)(z,{size:16})})})]})]}),I?(0,U.jsx)(p,{title:I}):(0,U.jsx)(`p`,{className:`text-caption text-muted`,children:e(`loginHint`)}),(0,U.jsxs)(o,{type:`submit`,fullWidth:!0,size:`lg`,isPending:P,children:[e(P?`loggingInConsole`:`loginSubmit`),P?null:(0,U.jsx)(L,{size:17})]})]})]})})})]})]})}export{q as LoginPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/LogsPage-CSlXNIqi.js b/internal/webui/static/assets/LogsPage-CSlXNIqi.js deleted file mode 100644 index 04fd123c..00000000 --- a/internal/webui/static/assets/LogsPage-CSlXNIqi.js +++ /dev/null @@ -1 +0,0 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{i as r,r as i,t as a}from"./SearchBar-DwSqSsBT.js";import{t as o}from"./TrashSimple.es-1c4RHqtF.js";import{n as s,pt as ee,r as te}from"./useI18n-B77RWTNi.js";import{a as ne,c as re,i as ie,n as c,o as ae,r as l,t as oe}from"./TimeRangePicker-KlLSf1l-.js";import{t as se}from"./PageAlert-r7ZVsH9h.js";import{t as ce}from"./ConfirmDialog-CNztRgAW.js";import{n as u,t as le}from"./useApiKeyOptions-3wTJgKia.js";import{n as ue}from"./useToggle-BRoRhkOA.js";import{t as de}from"./EmptyPanel-Bs-jQMvG.js";import{t as d}from"./modal-q_Ums9Et.js";import{n as fe,t as f}from"./tabs-BShFVox8.js";import{t as p}from"./table-CRVB37zZ.js";import{I as pe,at as me,c as he,en as ge,hn as _e,o as ve,on as ye,p as m,s as be,t as xe,xn as Se,z as Ce}from"./index-CmGY2WQi.js";import{t as h}from"./FilterToggle-Bygki2HF.js";import{l as we,n as Te,s as Ee,t as De}from"./format-B6SmebW-.js";import{n as Oe,t as ke}from"./provider-gHnttGKq.js";import{t as Ae}from"./LatencyStats-DmxRwO-O.js";import{t as je}from"./FilterSelect-B8vbCqfN.js";var g=t(e(),1),Me=new Map([[`bold`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M72.5,150.63,100.79,128,72.5,105.37a12,12,0,1,1,15-18.74l40,32a12,12,0,0,1,0,18.74l-40,32a12,12,0,0,1-15-18.74ZM144,172h32a12,12,0,0,0,0-24H144a12,12,0,0,0,0,24ZM236,56V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56Zm-24,4H44V196H212Z`}))],[`duotone`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M224,56V200a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z`,opacity:`0.2`}),g.createElement(`path`,{d:`M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z`}))],[`fill`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm-91,94.25-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32a8,8,0,0,1,0,12.5ZM176,168H136a8,8,0,0,1,0-16h40a8,8,0,0,1,0,16Z`}))],[`light`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M126,128a6,6,0,0,1-2.25,4.69l-40,32a6,6,0,0,1-7.5-9.38L110.4,128,76.25,100.69a6,6,0,1,1,7.5-9.38l40,32A6,6,0,0,1,126,128Zm50,26H136a6,6,0,0,0,0,12h40a6,6,0,0,0,0-12Zm54-98V200a14,14,0,0,1-14,14H40a14,14,0,0,1-14-14V56A14,14,0,0,1,40,42H216A14,14,0,0,1,230,56Zm-12,0a2,2,0,0,0-2-2H40a2,2,0,0,0-2,2V200a2,2,0,0,0,2,2H216a2,2,0,0,0,2-2Z`}))],[`regular`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z`}))],[`thin`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M122.5,124.88a4,4,0,0,1,0,6.24l-40,32a4,4,0,0,1-5-6.24L113.6,128,77.5,99.12a4,4,0,0,1,5-6.24ZM176,156H136a4,4,0,0,0,0,8h40a4,4,0,0,0,0-8ZM228,56V200a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V56A12,12,0,0,1,40,44H216A12,12,0,0,1,228,56Zm-8,0a4,4,0,0,0-4-4H40a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H216a4,4,0,0,0,4-4Z`}))]]),_=g.forwardRef((e,t)=>g.createElement(ee,{ref:t,...e,weights:Me}));_.displayName=`TerminalWindowIcon`;var Ne=_,v=n();function Pe(e){return e===`ok`?`success`:e===`streaming`||e===`started`||e===`incomplete`?`warning`:e===`error`||e===`canceled`?`danger`:`default`}function Fe(e){if(e===`error`)return`danger`;if(e!==`warn`)return`ok`}function Ie(e){return e===`error`?`danger`:e===`warn`?`warning`:e===`info`?`success`:`default`}function y(e,t=`zh`){if(!e)return`—`;let n=new Date(e);return Number.isFinite(n.getTime())?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(n):e}function Le(e){let t=e.requested_reasoning?.trim()||``,n=e.resolved_reasoning?.trim()||``;return!t&&!n?``:t&&n&&t!==n?`${t} → ${n}`:n||t}function Re({log:e,inLabel:t,outLabel:n,pointsLabel:r}){let i=e.prompt_tokens,a=e.completion_tokens,o=e.credits??e.usage_detail?.credit,s=o!=null&&Number.isFinite(o)?Ve(o):null;return i==null&&a==null&&s==null?(0,v.jsx)(`span`,{className:`mono text-xs text-muted`,children:`—`}):(0,v.jsxs)(`div`,{className:`leading-4`,children:[i!=null||a!=null?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`mono text-xs`,children:[i??0,` / `,a??0]}),(0,v.jsxs)(`div`,{className:`mt-0.5 text-caption text-muted`,children:[t,` / `,n]})]}):null,s==null?null:(0,v.jsx)(`div`,{className:`mono text-caption text-success ${i!=null||a!=null?`mt-0.5`:``}`,children:r?r(s):s})]})}function ze(){return(0,v.jsxs)(`div`,{className:`space-y-5`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,v.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-secondary px-4 py-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(m,{className:`h-5 w-14`}),(0,v.jsx)(m,{className:`h-5 w-48 max-w-full`})]}),(0,v.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(m,{className:`h-3 w-16`}),(0,v.jsx)(m,{className:`h-4 w-20`})]},t))})]}),(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(m,{className:`h-3 w-20`}),(0,v.jsx)(`div`,{className:`grid gap-x-4 gap-y-3 sm:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(m,{className:`h-3 w-16`}),(0,v.jsx)(m,{className:`h-4 w-28 max-w-full`})]},t))})]}),(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(m,{className:`h-3 w-20`}),(0,v.jsx)(m,{className:`h-14 w-full`})]})]})}function Be({title:e,aside:t,children:n}){return(0,v.jsxs)(`section`,{className:`space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,v.jsx)(`h3`,{className:`text-xs font-medium text-muted`,children:e}),t]}),n]})}function b({label:e,value:t,mono:n=!1,wide:r=!1}){return(0,v.jsxs)(`div`,{className:`min-w-0 ${r?`col-span-full`:``}`,children:[(0,v.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,v.jsx)(`dd`,{className:`mt-0.5 break-all text-body ${n?`mono`:`font-medium`}`,children:t})]})}function Ve(e){return e==null||!Number.isFinite(e)?`—`:String(Math.round(e*1e4)/1e4)}var He=[`all`,`ok`,`incomplete`,`error`,`canceled`],x=[`all`,`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`],Ue=[`all`,`1h`,`24h`,`7d`,`custom`];function We(e){let t=(e,t,n)=>t.includes(e??``)?e:n,n=l(e.get(`from`)),r=l(e.get(`to`)),i=n&&r?{start:n,end:r}:null,a=e.get(`stream`);return{requestFilter:t(e.get(`status`),He,`all`),requestId:e.get(`id`)??``,accountFilter:e.get(`account`)??``,apiKeyFilter:e.get(`api_key`)??``,modelFilter:e.get(`model`)??``,providerFilter:e.get(`provider`)??``,streamFilter:a===`stream`||a===`true`?`stream`:a===`sync`||a===`false`?`sync`:`all`,errorKind:t(e.get(`error_kind`),x,`all`),timeRange:i?`custom`:t(e.get(`range`),Ue,`1h`),customRange:i}}function Ge(e){let t=new URLSearchParams;e.requestFilter!==`all`&&t.set(`status`,e.requestFilter),e.requestId&&t.set(`id`,e.requestId),e.accountFilter&&t.set(`account`,e.accountFilter),e.apiKeyFilter&&t.set(`api_key`,e.apiKeyFilter),e.modelFilter&&t.set(`model`,e.modelFilter),e.providerFilter&&t.set(`provider`,e.providerFilter),e.streamFilter!==`all`&&t.set(`stream`,e.streamFilter),e.errorKind!==`all`&&t.set(`error_kind`,e.errorKind);let n=e.timeRange===`custom`?c(e.customRange?.start):void 0,r=e.timeRange===`custom`?c(e.customRange?.end,!0):void 0;return n&&r?(t.set(`from`,n),t.set(`to`,r)):e.timeRange!==`1h`&&t.set(`range`,e.timeRange),t.toString()}function Ke(e){if(e===`all`||e===`custom`)return{from:void 0,to:void 0};let t=new Date,n=new Date(t);return e===`1h`&&n.setHours(n.getHours()-1),e===`24h`&&n.setHours(n.getHours()-24),e===`7d`&&n.setDate(n.getDate()-7),{from:n.toISOString(),to:t.toISOString()}}function S(){let{t:e,lang:t}=s(),[n,ee]=Se(),[l]=(0,g.useState)(()=>We(new URLSearchParams(window.location.search))),[m,Me]=(0,g.useState)([]),[_,He]=(0,g.useState)([]),[x,Ue]=(0,g.useState)(`requests`),[S,C]=(0,g.useState)(!0),[qe,Je]=(0,g.useState)(!1),[Ye,w]=(0,g.useState)(``),[T,Xe]=(0,g.useState)(l.requestFilter),[E,Ze]=(0,g.useState)(`all`),[D,Qe]=(0,g.useState)(l.requestId),[O,$e]=(0,g.useState)(``),[k,et]=(0,g.useState)(l.accountFilter),[A,tt]=(0,g.useState)(l.apiKeyFilter),[j,nt]=(0,g.useState)(``),[M,rt]=(0,g.useState)(l.modelFilter),[N,it]=(0,g.useState)(l.providerFilter),[P,at]=(0,g.useState)(l.streamFilter),[F,ot]=(0,g.useState)(l.errorKind),[I,st]=(0,g.useState)(l.timeRange),[L,ct]=(0,g.useState)(l.customRange),[lt,R]=(0,g.useState)(1),[z,ut]=(0,g.useState)(50),[dt,ft]=(0,g.useState)(1),[B,pt]=(0,g.useState)(50),[V,mt]=(0,g.useState)([]),[H,ht]=(0,g.useState)(0),[U,gt]=(0,g.useState)([]),[W,_t]=(0,g.useState)(0),[G,vt]=(0,g.useState)(null),[yt,bt]=(0,g.useState)(!1),[K,xt]=(0,g.useState)(null),[St,Ct]=(0,g.useState)(!1),[wt,Tt]=(0,g.useState)(!1),[Et,Dt]=(0,g.useState)(``),q=(0,g.useRef)(0),[Ot,kt]=(0,g.useState)(!1),[At,jt]=(0,g.useState)(!1),J=n.toString(),Y=Ge({requestFilter:T,requestId:D,accountFilter:k,apiKeyFilter:A,modelFilter:M,providerFilter:N,streamFilter:P,errorKind:F,timeRange:I,customRange:L}),X=(0,g.useRef)(J);(0,g.useEffect)(()=>{if(J===X.current)return;X.current=J;let e=We(new URLSearchParams(J));Xe(e.requestFilter),Qe(e.requestId),et(e.accountFilter),tt(e.apiKeyFilter),rt(e.modelFilter),it(e.providerFilter),at(e.streamFilter),ot(e.errorKind),st(e.timeRange),ct(e.customRange)},[J]),(0,g.useEffect)(()=>{Y!==X.current&&(X.current=Y,ee(Y,{replace:!0}))},[Y,ee]),(0,g.useEffect)(()=>{let e=!1;return Promise.allSettled([pe(!1),Ce()]).then(([t,n])=>{e||(t.status===`fulfilled`&&Me(t.value.data||[]),n.status===`fulfilled`&&He(n.value.data||[]))}),()=>{e=!0}},[]);let Z=(0,g.useMemo)(()=>{let e=new Map;for(let t of m||[])e.set(t.id,t.name||t.id);return e},[m]),Mt=(0,g.useMemo)(()=>{let e=new Map;for(let t of m||[])e.set(t.id,{provider:t.provider,region:t.region});return e},[m]);function Nt(t){let n=t.account_id?Mt.get(t.account_id):void 0,r=t.provider||n?.provider;return r?Oe(r,n?.region,e):`—`}function Pt(t){switch(t){case`pin`:return e(`logsRouting_pin`);case`sticky`:return e(`logsRouting_sticky`);case`sticky_escape`:return e(`logsRouting_sticky_escape`);default:return e(`logsRouting_pool`)}}let Ft=(0,g.useMemo)(()=>(m||[]).map(e=>({id:e.id,label:e.name||e.id})),[m]),{nameById:It,options:Lt}=le();function Rt(e){let t=e.api_key_id?.trim();return t?It.get(t)||t:`—`}let zt=(0,g.useMemo)(()=>{let t=new Set;for(let e of m||[])e.provider&&t.add(e.provider);return N&&t.add(N),[{id:``,label:e(`logsFilterProviderAll`)},...[...t].sort().map(t=>({id:t,label:ke(t,e)}))]},[m,N,e]),Bt=(0,g.useMemo)(()=>{let e=new Map;for(let t of _||[])e.has(t.id)||e.set(t.id,{id:t.id,label:t.display_name||t.id});return[...e.values()]},[_]),Vt=(0,g.useCallback)(async e=>((await ae({q:e||void 0,limit:20,offset:0})).items||[]).map(e=>({id:e.id,label:e.id})),[]),Ht=!!(D||T!==`all`||k||A||M||N||P!==`all`||F!==`all`||I!==`1h`),Ut=[T,D,k,A,M,N,P,F,I,L?.start?.toString()??``,L?.end?.toString()??``,z].join(`\0`),Wt=[E,O,j,B].join(`\0`),[Gt,Kt]=(0,g.useState)(Ut),[qt,Jt]=(0,g.useState)(Wt);Gt!==Ut&&(Kt(Ut),R(1)),qt!==Wt&&(Jt(Wt),ft(1));let Yt=Math.max(1,Math.ceil(H/z)),Q=Math.min(Gt===Ut?Math.max(1,lt):1,Yt);lt!==Q&&R(Q);let Xt=Math.max(1,Math.ceil(W/B)),$=Math.min(qt===Wt?Math.max(1,dt):1,Xt);dt!==$&&ft($);let Zt=(0,g.useCallback)(async(e=!1)=>{e||C(!0);try{let e=D?{from:void 0,to:void 0}:I===`custom`?{from:c(L?.start),to:c(L?.end,!0)}:Ke(I),t=await ae({status:T===`all`?void 0:T,id:D||void 0,account:k||void 0,api_key:A||void 0,model:M||void 0,provider:N||void 0,stream:P===`all`?void 0:P===`stream`,error_kind:F===`all`?void 0:F,from:e.from,to:e.to,limit:z,offset:(Q-1)*z});mt(t.items||[]),ht(t.total||0),w(``)}catch(t){e||w(t instanceof Error?t.message:String(t))}finally{e||(C(!1),Je(!0))}},[T,D,k,A,M,N,P,F,I,L,Q,z]),Qt=(0,g.useCallback)(async(e=!1)=>{e||C(!0);try{let e=await re({level:E===`all`?void 0:E,q:O.trim()||void 0,account:j||void 0,limit:B,offset:($-1)*B});gt(e.items||[]),_t(e.total??0),w(``)}catch(t){e||w(t instanceof Error?t.message:String(t))}finally{e||(C(!1),Je(!0))}},[E,O,j,$,B]),$t=(0,g.useCallback)(async(e=!1)=>{x===`requests`?await Zt(e):await Qt(e)},[x,Zt,Qt]);(0,g.useEffect)(()=>{C(!0);let e=x===`runtime`&&O.trim()?280:0,t=window.setTimeout(()=>void $t(!1),e);return()=>window.clearTimeout(t)},[$t,x,O]),(0,g.useEffect)(()=>{if(x!==`runtime`||$!==1)return;let e=window.setInterval(()=>{document.hidden||Qt(!0)},3e3);return()=>window.clearInterval(e)},[x,$,Qt]);let en=H===0?0:(Q-1)*z+1,tn=Math.min(H,Q*z),nn=W===0?0:($-1)*B+1,rn=Math.min(W,$*B),an=(0,g.useMemo)(()=>x===`requests`?e(`logsShownTotal`,{shown:V.length?`${en}–${tn}`:0,total:H}):e(`logsShownTotal`,{shown:U.length?`${nn}–${rn}`:0,total:W}),[x,V.length,U.length,en,tn,H,nn,rn,W,e]);function on(){Qe(``),Xe(`all`),et(``),tt(``),rt(``),it(``),at(`all`),ot(`all`),st(`1h`),ct(null),R(1)}async function sn(e){let t=++q.current;xt(e),Dt(``),Tt(!0),Ct(!0);try{let n=await ne(e.id);if(q.current!==t)return;xt(n)}catch(e){if(q.current!==t)return;Dt(e instanceof Error?e.message:String(e))}finally{q.current===t&&Tt(!1)}}function cn(e){vt(e),bt(!0)}async function ln(){jt(!0),xe({id:`logs-clear`,type:`loading`,title:e(`toastClearingLogs`)});try{await ie(),kt(!1),await Zt(!1),xe({id:`logs-clear`,type:`success`,title:e(`toastLogsCleared`)})}catch(t){w(t instanceof Error?t.message:String(t)),xe({id:`logs-clear`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{jt(!1)}}let un=S&&(x===`requests`?V.length===0:U.length===0);return S&&!qe?(0,v.jsx)(ve,{}):(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`navLogs`)}),(0,v.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`logsLead`)})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[x===`requests`?(0,v.jsxs)(te,{size:`sm`,variant:`ghost`,onPress:()=>kt(!0),isDisabled:At||H===0,children:[(0,v.jsx)(o,{size:14}),e(`logsClear`)]}):null,(0,v.jsxs)(te,{size:`sm`,variant:`secondary`,isPending:S,onPress:()=>void $t(!1),children:[(0,v.jsx)(_e,{size:15}),e(`refresh`)]})]})]}),Ye?(0,v.jsx)(se,{title:e(`failedLogs`,{msg:Ye})}):null,(0,v.jsxs)(f,{selectedKey:x,onSelectionChange:e=>Ue(String(e)),children:[(0,v.jsx)(f.ListContainer,{className:`w-fit`,children:(0,v.jsxs)(f.List,{children:[(0,v.jsxs)(fe,{id:`requests`,className:`gap-1.5`,children:[(0,v.jsx)(f.Indicator,{className:`transition-none`}),(0,v.jsx)(ye,{size:13}),e(`logsRequests`)]}),(0,v.jsxs)(fe,{id:`runtime`,className:`gap-1.5`,children:[(0,v.jsx)(f.Indicator,{className:`transition-none`}),(0,v.jsx)(Ne,{size:13}),e(`logsRuntime`)]})]})}),(0,v.jsxs)(f.Panel,{id:`requests`,"data-tab-panel":`requests`,className:`space-y-4 pt-5`,children:[(0,v.jsxs)(`div`,{className:`data-toolbar flex flex-col gap-2`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,v.jsx)(h,{value:T,onChange:e=>Xe(e),ariaLabel:e(`logsFilterAll`),options:[{id:`all`,label:e(`logsFilterAll`)},{id:`ok`,label:e(`logsFilterOk`)},{id:`incomplete`,label:e(`logsFilterIncomplete`)},{id:`error`,label:e(`logsFilterError`)},{id:`canceled`,label:e(`logsFilterCanceled`)}]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Ht?(0,v.jsx)(te,{size:`sm`,variant:`ghost`,onPress:on,children:e(`clearFilters`)}):null,(0,v.jsx)(`div`,{className:`mono text-caption text-muted`,children:an})]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(u,{ariaLabel:e(`logsColAccount`),value:k,onChange:et,options:Ft,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(u,{ariaLabel:e(`logsColApiKey`),value:A,onChange:tt,options:Lt,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(u,{ariaLabel:e(`logsColModel`),value:M,onChange:rt,options:Bt,allLabel:e(`logsFilterModelAll`),searchPlaceholder:e(`logsSearchModel`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(je,{ariaLabel:e(`logsColProvider`),value:N,onChange:it,options:zt}),(0,v.jsx)(u,{ariaLabel:e(`logsSearchRequestId`),value:D,onChange:Qe,options:D?[{id:D,label:D}]:[],allLabel:e(`logsFilterIdAll`),searchPlaceholder:e(`logsSearchRequestId`),emptyLabel:e(`logsNoFilterOptions`),loadOptions:Vt,className:`min-w-56`}),(0,v.jsx)(h,{value:P,onChange:e=>at(e),ariaLabel:e(`logsFilterStreamAll`),options:[{id:`all`,label:e(`logsFilterStreamAll`)},{id:`stream`,label:e(`logsStreamYes`)},{id:`sync`,label:e(`logsStreamNo`)}]}),(0,v.jsx)(je,{ariaLabel:e(`errorKind`),value:F===`all`?``:F,onChange:e=>ot(e||`all`),options:[{id:``,label:e(`logsFilterKindAll`)},{id:`quota`,label:e(`logsKindQuota`)},{id:`rate_limit`,label:e(`logsKindRateLimit`)},{id:`auth`,label:e(`logsKindAuth`)},{id:`not_ready`,label:e(`logsKindNotReady`)},{id:`unavailable`,label:e(`logsKindUnavailable`)},{id:`invalid_request`,label:e(`logsKindInvalidRequest`)},{id:`model_not_available`,label:e(`logsKindModelNotAvailable`)}]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e(`logsTimeRange`)}),(0,v.jsx)(h,{value:I,onChange:e=>st(e),ariaLabel:e(`logsTimeRange`),options:[{id:`all`,label:e(`logsTimeAll`)},{id:`1h`,label:e(`logsTime1h`)},{id:`24h`,label:e(`logsTime24h`)},{id:`7d`,label:e(`logsTime7d`)},{id:`custom`,label:e(`logsTimeCustom`)}]}),I===`custom`?(0,v.jsx)(oe,{className:`w-[min(100%,42rem)]`,value:L,onChange:ct,ariaLabel:e(`logsTimeRange`),fromLabel:e(`logsTimeFrom`),toLabel:e(`logsTimeTo`)}):null]})]}),(0,v.jsx)(ue,{className:`overflow-hidden p-0`,"aria-busy":S,children:un?(0,v.jsx)(be,{}):V.length===0?(0,v.jsx)(de,{icon:(0,v.jsx)(r,{size:22}),title:e(Ht?`logsNoMatch`:`logsEmptyRequests`),action:Ht?(0,v.jsx)(te,{size:`sm`,variant:`ghost`,onPress:on,children:e(`clearFilters`)}):null}):(0,v.jsx)(p,{children:(0,v.jsx)(p.ScrollContainer,{children:(0,v.jsxs)(p.Content,{"aria-label":e(`logsRequests`),children:[(0,v.jsxs)(p.Header,{children:[(0,v.jsx)(p.Column,{isRowHeader:!0,children:e(`logsColTime`)}),(0,v.jsx)(p.Column,{children:e(`logsColModel`)}),(0,v.jsx)(p.Column,{children:e(`logsColReasoning`)}),(0,v.jsx)(p.Column,{children:e(`logsColProvider`)}),(0,v.jsx)(p.Column,{children:e(`logsColAccount`)}),(0,v.jsx)(p.Column,{children:e(`logsColApiKey`)}),(0,v.jsx)(p.Column,{children:e(`logsColStatus`)}),(0,v.jsx)(p.Column,{children:e(`logsColStream`)}),(0,v.jsx)(p.Column,{children:e(`logsColLatency`)}),(0,v.jsx)(p.Column,{children:e(`logsColTokens`)})]}),(0,v.jsx)(p.Body,{children:V.map(n=>(0,v.jsxs)(p.Row,{className:`cursor-pointer`,onAction:()=>void sn(n),children:[(0,v.jsx)(p.Cell,{children:(0,v.jsxs)(`div`,{className:`py-1`,children:[(0,v.jsx)(`div`,{className:`mono text-xs`,children:y(n.created_at,t)}),(0,v.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.id})]})}),(0,v.jsxs)(p.Cell,{children:[(0,v.jsx)(`div`,{className:`text-body font-medium`,children:n.requested_model||`—`}),n.mapped_model&&n.mapped_model!==n.requested_model?(0,v.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.mapped_model}):null]}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`mono text-xs`,children:Le(n)||`—`})}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`text-xs`,children:Nt(n)})}),(0,v.jsxs)(p.Cell,{children:[(0,v.jsx)(`span`,{className:`text-xs`,children:n.account_id?Z.get(n.account_id)||n.account_id:`—`}),n.account_id&&Z.get(n.account_id)&&Z.get(n.account_id)!==n.account_id?(0,v.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.account_id}):null]}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`text-xs`,children:Rt(n)})}),(0,v.jsxs)(p.Cell,{children:[(0,v.jsx)(me,{size:`sm`,variant:`soft`,color:Pe(n.status),children:n.status}),n.error_kind?(0,v.jsx)(`div`,{className:`mono mt-1 text-caption text-muted`,children:n.error_kind}):null]}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`text-xs text-muted`,children:n.stream?e(`logsStreamYes`):e(`logsStreamNo`)})}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(Ae,{latencyMs:n.latency_ms,ttfbMs:n.ttfb_ms,completionTokens:n.completion_tokens,stream:n.stream,labels:{ttft:e(`logsColTTFT`),total:e(`logsLatencyTotal`),tps:e(`logsOutputTPS`)}})}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(Re,{log:n,inLabel:e(`logsTokensIn`),outLabel:e(`logsTokensOut`),pointsLabel:t=>e(`logsTokensPoints`,{value:t})})})]},n.id))})]})})})}),(0,v.jsx)(i,{total:H,page:Q,pageCount:Yt,pageSize:z,loading:S,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:Q,pages:Yt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:R,onPageSize:ut})]}),(0,v.jsxs)(f.Panel,{id:`runtime`,"data-tab-panel":`runtime`,className:`space-y-4 pt-5`,children:[(0,v.jsxs)(`div`,{className:`data-toolbar flex flex-wrap items-center justify-between gap-2`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(a,{className:`sm:w-72`,value:O,onChange:$e,placeholder:e(`logsSearchRuntime`),ariaLabel:e(`logsSearchRuntime`)}),(0,v.jsx)(u,{ariaLabel:e(`logsColAccount`),value:j,onChange:nt,options:Ft,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(h,{value:E,onChange:e=>Ze(e),ariaLabel:e(`logsLevelAll`),options:[{id:`all`,label:e(`logsLevelAll`)},{id:`info`,label:e(`logsLevelInfo`)},{id:`warn`,label:e(`logsLevelWarn`)},{id:`error`,label:e(`logsLevelError`)}]})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted`,children:[$===1?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`status-dot`,"data-state":`ok`}),e(`logsAutoRefresh`)]}):null,(0,v.jsx)(`span`,{className:`mono`,children:an})]})]}),(0,v.jsx)(ue,{className:`overflow-hidden p-0`,"aria-busy":S,children:un?(0,v.jsx)(he,{}):U.length===0?(0,v.jsx)(de,{icon:(0,v.jsx)(Ne,{size:22}),title:e(`logsEmptyRuntime`)}):(0,v.jsx)(`div`,{className:`divide-y divide-separator`,children:U.map(e=>(0,v.jsxs)(`div`,{className:`grid cursor-pointer gap-2 px-5 py-3 transition-colors hover:bg-surface-secondary/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:grid-cols-[150px_72px_minmax(0,1fr)] sm:items-start`,role:`button`,tabIndex:0,onClick:()=>cn(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),cn(e))},children:[(0,v.jsx)(`div`,{className:`mono text-caption text-muted`,children:y(e.time,t)}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`status-dot`,"data-state":Fe(e.level)}),(0,v.jsx)(`span`,{className:`font-medium text-muted`,children:e.level})]}),(0,v.jsxs)(`div`,{className:`min-w-0`,children:[e.account_id?(0,v.jsx)(`div`,{className:`mono mb-1 text-caption text-muted`,children:e.account_id}):null,(0,v.jsx)(`div`,{className:`mono break-all text-xs leading-5 text-foreground`,children:e.message})]})]},e.id))})}),(0,v.jsx)(i,{total:W,page:$,pageCount:Xt,pageSize:B,loading:S,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:$,pages:Xt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:ft,onPageSize:pt})]})]}),(0,v.jsx)(d.Root,{isOpen:yt,onOpenChange:e=>{bt(e),e||vt(null)},children:(0,v.jsx)(d.Backdrop,{variant:`blur`,children:(0,v.jsx)(d.Container,{size:`lg`,scroll:`inside`,children:(0,v.jsxs)(d.Dialog,{className:`w-full max-w-4xl`,children:[(0,v.jsxs)(d.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(d.Heading,{className:`text-section font-semibold`,children:e(`logsRuntimeDetailTitle`)}),(0,v.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:G?`#${G.id}`:`—`})]}),(0,v.jsx)(d.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,v.jsx)(ge,{size:16})})]}),(0,v.jsxs)(d.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,v.jsx)(`dl`,{className:`grid gap-3 sm:grid-cols-2`,children:[[e(`logsColTime`),G?y(G.time,t):`—`],[e(`logsRuntimeLevel`),G?.level||`—`],[e(`logsRuntimeSource`),G?.source||`—`],[e(`logsColAccount`),G?.account_id||`—`]].map(([t,n])=>(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`dt`,{className:`text-caption text-muted`,children:t}),(0,v.jsx)(`dd`,{className:`mt-1 break-all text-body font-medium`,children:t===e(`logsRuntimeLevel`)&&G?(0,v.jsx)(me,{size:`sm`,variant:`soft`,color:Ie(G.level),children:G.level}):n})]},String(t)))}),(0,v.jsxs)(`section`,{className:`space-y-2`,children:[(0,v.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:e(`logsRuntimeMessage`)}),(0,v.jsx)(`pre`,{className:`mono max-h-[min(38rem,60vh)] overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary px-4 py-3 text-xs leading-6 text-foreground`,children:G?.message||`—`})]})]})]})})})}),(0,v.jsx)(d.Root,{isOpen:St,onOpenChange:e=>{Ct(e),e||(q.current+=1,Tt(!1),Dt(``),xt(null))},children:(0,v.jsx)(d.Backdrop,{variant:`blur`,children:(0,v.jsx)(d.Container,{size:`lg`,scroll:`inside`,children:(0,v.jsxs)(d.Dialog,{className:`w-full max-w-4xl`,children:[(0,v.jsxs)(d.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(d.Heading,{className:`text-section font-semibold`,children:e(`logsDetailTitle`)}),(0,v.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:K?.id})]}),(0,v.jsx)(d.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,v.jsx)(ge,{size:16})})]}),(0,v.jsx)(d.Body,{className:`space-y-5 px-5 pb-5`,children:wt?(0,v.jsx)(ze,{}):Et?(0,v.jsx)(se,{title:e(`requestFailed`),description:Et}):K?(0,v.jsxs)(v.Fragment,{children:[K.error_message?(0,v.jsx)(se,{title:K.error_kind||e(`requestFailed`),description:K.error_message}):null,(0,v.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-secondary px-4 py-4`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,v.jsx)(me,{size:`sm`,variant:`soft`,color:Pe(K.status),children:K.status||`—`}),(0,v.jsx)(`span`,{className:`mono min-w-0 break-all text-body font-medium`,children:K.requested_model||`—`}),K.mapped_model&&K.mapped_model!==K.requested_model?(0,v.jsxs)(`span`,{className:`mono break-all text-caption text-muted`,children:[`→ `,K.mapped_model]}):null,Le(K)?(0,v.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`· `,Le(K)]}):null,(0,v.jsx)(`span`,{className:`mono ml-auto text-caption text-muted`,children:y(K.created_at,t)})]}),(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{mono:!0,label:`${e(`logsColTokens`)} · ${e(`logsTokensIn`)} / ${e(`logsTokensOut`)}`,value:K.prompt_tokens==null&&K.completion_tokens==null?`—`:`${K.prompt_tokens??0} / ${K.completion_tokens??0}`}),(K.credits??K.usage_detail?.credit)==null?null:(0,v.jsx)(b,{mono:!0,label:e(`logsCreditConsumed`),value:`${Ve(K.credits??K.usage_detail?.credit)}${K.usage_detail?.unit?` ${K.usage_detail.unit}`:``}`}),(0,v.jsx)(b,{mono:!0,label:e(`logsColTTFT`),value:Ee(K.ttfb_ms)}),(0,v.jsx)(b,{mono:!0,label:e(`logsLatencyTotal`),value:Ee(K.latency_ms)}),(0,v.jsx)(b,{mono:!0,label:e(`logsOutputTPS`),value:we(De({completionTokens:K.completion_tokens,latencyMs:K.latency_ms,ttfbMs:K.ttfb_ms,stream:K.stream}))})]})]}),(0,v.jsx)(Be,{title:e(`logsSectionCall`),children:(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{label:e(`logsColProvider`),value:Nt(K)}),(0,v.jsx)(b,{label:e(`logsColAccount`),value:K.account_id?Z.get(K.account_id)||K.account_id:`—`}),(0,v.jsx)(b,{label:e(`logsColApiKey`),value:Rt(K)}),(0,v.jsx)(b,{label:e(`logsColStream`),value:K.stream?e(`logsStreamYes`):e(`logsStreamNo`)}),(0,v.jsx)(b,{label:e(`logsRouting`),value:Pt(K.routing)})]})}),(0,v.jsx)(Be,{title:e(`logsAttempts`),aside:K.attempts?.length?(0,v.jsx)(`span`,{className:`mono text-caption text-muted`,children:K.attempts.length}):null,children:K.attempts?.length?(0,v.jsx)(`div`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:K.attempts.map(e=>(0,v.jsxs)(`div`,{className:`grid grid-cols-[32px_minmax(0,1fr)_auto] items-start gap-x-3 px-3 py-2.5`,children:[(0,v.jsxs)(`div`,{className:`mono pt-0.5 text-caption text-muted`,children:[`#`,e.attempt_index]}),(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.account_id?Z.get(e.account_id)||e.account_id:`—`}),e.error_message?(0,v.jsxs)(`div`,{className:`mt-0.5 break-all text-caption text-muted`,children:[e.error_kind?(0,v.jsx)(`span`,{className:`mono mr-1.5`,children:e.error_kind}):null,e.error_message]}):null]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.latency_ms==null?null:(0,v.jsx)(`span`,{className:`mono text-caption text-muted`,children:Ee(e.latency_ms)}),(0,v.jsx)(me,{size:`sm`,variant:`soft`,color:Pe(e.status===`failover`?`canceled`:e.status),children:e.status})]})]},e.id))}):(0,v.jsx)(`p`,{className:`text-caption text-muted`,children:e(`logsNoAttempts`)})}),K.message_count||K.stream_diagnostic?(0,v.jsx)(Be,{title:e(`logsSectionDiagnostics`),children:(0,v.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-secondary px-4 py-3`,children:[K.message_count?(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:e(`logsMessageShape`)}),(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{mono:!0,label:e(`logsMessageCount`),value:K.message_count}),(0,v.jsx)(b,{mono:!0,label:e(`logsEmptyMessageIndexes`),value:K.empty_message_indexes?.length?K.empty_message_indexes.join(`, `):`—`}),(0,v.jsx)(b,{mono:!0,wide:!0,label:e(`logsMessageRoles`),value:K.message_roles?.join(` → `)||`—`})]})]}):null,K.message_count&&K.stream_diagnostic?(0,v.jsx)(`div`,{className:`border-t border-separator`}):null,K.stream_diagnostic?(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:e(`logsStreamDiagnostics`)}),(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{mono:!0,label:e(`logsUpstreamStatus`),value:K.stream_diagnostic.upstream_status??`—`}),(0,v.jsx)(b,{mono:!0,label:e(`logsStreamComplete`),value:K.stream_diagnostic.saw_done?e(`yes`):e(`no`)}),(0,v.jsx)(b,{mono:!0,label:e(`logsCancellationSource`),value:K.stream_diagnostic.cancellation_source||`—`}),(0,v.jsx)(b,{mono:!0,label:e(`logsSSEEvents`),value:K.stream_diagnostic.sse_event_count}),(0,v.jsx)(b,{mono:!0,label:e(`logsBytesRead`),value:Te(K.stream_diagnostic.bytes_read)}),(0,v.jsx)(b,{mono:!0,label:e(`logsLastEvent`),value:K.stream_diagnostic.last_event||`—`}),K.stream_diagnostic.context_err?(0,v.jsx)(b,{mono:!0,wide:!0,label:`context`,value:K.stream_diagnostic.context_err}):null,K.stream_diagnostic.relay_error?(0,v.jsx)(b,{mono:!0,wide:!0,label:`relay`,value:K.stream_diagnostic.relay_error}):null]})]}):null]})}):null]}):null})]})})})}),(0,v.jsx)(ce,{isOpen:Ot,title:e(`logsClear`),description:e(`logsClearConfirm`),confirmLabel:e(`logsClear`),cancelLabel:e(`close`),closeLabel:e(`close`),isPending:At,onClose:()=>kt(!1),onConfirm:()=>void ln()})]})}export{S as LogsPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/LogsPage-CTGAkC1v.js b/internal/webui/static/assets/LogsPage-CTGAkC1v.js new file mode 100644 index 00000000..311ca68f --- /dev/null +++ b/internal/webui/static/assets/LogsPage-CTGAkC1v.js @@ -0,0 +1 @@ +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{i as r,r as i,t as a}from"./SearchBar-UDaAllIT.js";import{t as o}from"./TrashSimple.es-a96yoz9-.js";import{n as s,pt as ee,r as te}from"./useI18n-DAGWWg9N.js";import{a as ne,c as re,i as ie,n as c,o as ae,r as l,t as oe}from"./TimeRangePicker-BqBfH6td.js";import{t as se}from"./PageAlert-BTp9jdUz.js";import{t as ce}from"./ConfirmDialog-2wOP1m7E.js";import{n as u,t as le}from"./useApiKeyOptions-mwmshhJ6.js";import{n as ue}from"./useToggle-Zi1rbfHX.js";import{t as de}from"./EmptyPanel-Bs-jQMvG.js";import{t as d}from"./modal-BqXo29An.js";import{n as fe,t as f}from"./tabs-CvBWSueW.js";import{t as p}from"./table-CocoYVkm.js";import{p as pe,u as me}from"./overview-DcWoRgOQ.js";import{Dt as he,M as ge,Nt as _e,Wt as ve,Xt as ye,c as be,l as xe,m,s as Se,t as Ce}from"./index-BYut8qRj.js";import{t as h}from"./FilterToggle-nA-ZS4oO.js";import{l as we,n as Te,s as Ee,t as De}from"./format-B6SmebW-.js";import{n as Oe,t as ke}from"./provider-gHnttGKq.js";import{t as Ae}from"./LatencyStats-DmxRwO-O.js";import{t as je}from"./FilterSelect-BkT3LDQz.js";var g=t(e(),1),Me=new Map([[`bold`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M72.5,150.63,100.79,128,72.5,105.37a12,12,0,1,1,15-18.74l40,32a12,12,0,0,1,0,18.74l-40,32a12,12,0,0,1-15-18.74ZM144,172h32a12,12,0,0,0,0-24H144a12,12,0,0,0,0,24ZM236,56V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56Zm-24,4H44V196H212Z`}))],[`duotone`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M224,56V200a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z`,opacity:`0.2`}),g.createElement(`path`,{d:`M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z`}))],[`fill`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm-91,94.25-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32a8,8,0,0,1,0,12.5ZM176,168H136a8,8,0,0,1,0-16h40a8,8,0,0,1,0,16Z`}))],[`light`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M126,128a6,6,0,0,1-2.25,4.69l-40,32a6,6,0,0,1-7.5-9.38L110.4,128,76.25,100.69a6,6,0,1,1,7.5-9.38l40,32A6,6,0,0,1,126,128Zm50,26H136a6,6,0,0,0,0,12h40a6,6,0,0,0,0-12Zm54-98V200a14,14,0,0,1-14,14H40a14,14,0,0,1-14-14V56A14,14,0,0,1,40,42H216A14,14,0,0,1,230,56Zm-12,0a2,2,0,0,0-2-2H40a2,2,0,0,0-2,2V200a2,2,0,0,0,2,2H216a2,2,0,0,0,2-2Z`}))],[`regular`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z`}))],[`thin`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M122.5,124.88a4,4,0,0,1,0,6.24l-40,32a4,4,0,0,1-5-6.24L113.6,128,77.5,99.12a4,4,0,0,1,5-6.24ZM176,156H136a4,4,0,0,0,0,8h40a4,4,0,0,0,0-8ZM228,56V200a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V56A12,12,0,0,1,40,44H216A12,12,0,0,1,228,56Zm-8,0a4,4,0,0,0-4-4H40a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H216a4,4,0,0,0,4-4Z`}))]]),_=g.forwardRef((e,t)=>g.createElement(ee,{ref:t,...e,weights:Me}));_.displayName=`TerminalWindowIcon`;var Ne=_,v=n();function Pe(e){return e===`ok`?`success`:e===`streaming`||e===`started`||e===`incomplete`?`warning`:e===`error`||e===`canceled`?`danger`:`default`}function Fe(e){if(e===`error`)return`danger`;if(e!==`warn`)return`ok`}function Ie(e){return e===`error`?`danger`:e===`warn`?`warning`:e===`info`?`success`:`default`}function y(e,t=`zh`){if(!e)return`—`;let n=new Date(e);return Number.isFinite(n.getTime())?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(n):e}function Le(e){let t=e.requested_reasoning?.trim()||``,n=e.resolved_reasoning?.trim()||``;return!t&&!n?``:t&&n&&t!==n?`${t} → ${n}`:n||t}function Re({log:e,inLabel:t,outLabel:n,pointsLabel:r}){let i=e.prompt_tokens,a=e.completion_tokens,o=e.credits??e.usage_detail?.credit,s=o!=null&&Number.isFinite(o)?Ve(o):null;return i==null&&a==null&&s==null?(0,v.jsx)(`span`,{className:`mono text-xs text-muted`,children:`—`}):(0,v.jsxs)(`div`,{className:`leading-4`,children:[i!=null||a!=null?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`mono text-xs`,children:[i??0,` / `,a??0]}),(0,v.jsxs)(`div`,{className:`mt-0.5 text-caption text-muted`,children:[t,` / `,n]})]}):null,s==null?null:(0,v.jsx)(`div`,{className:`mono text-caption text-success ${i!=null||a!=null?`mt-0.5`:``}`,children:r?r(s):s})]})}function ze(){return(0,v.jsxs)(`div`,{className:`space-y-5`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,v.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-secondary px-4 py-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(m,{className:`h-5 w-14`}),(0,v.jsx)(m,{className:`h-5 w-48 max-w-full`})]}),(0,v.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(m,{className:`h-3 w-16`}),(0,v.jsx)(m,{className:`h-4 w-20`})]},t))})]}),(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(m,{className:`h-3 w-20`}),(0,v.jsx)(`div`,{className:`grid gap-x-4 gap-y-3 sm:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(m,{className:`h-3 w-16`}),(0,v.jsx)(m,{className:`h-4 w-28 max-w-full`})]},t))})]}),(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(m,{className:`h-3 w-20`}),(0,v.jsx)(m,{className:`h-14 w-full`})]})]})}function Be({title:e,aside:t,children:n}){return(0,v.jsxs)(`section`,{className:`space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,v.jsx)(`h3`,{className:`text-xs font-medium text-muted`,children:e}),t]}),n]})}function b({label:e,value:t,mono:n=!1,wide:r=!1}){return(0,v.jsxs)(`div`,{className:`min-w-0 ${r?`col-span-full`:``}`,children:[(0,v.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,v.jsx)(`dd`,{className:`mt-0.5 break-all text-body ${n?`mono`:`font-medium`}`,children:t})]})}function Ve(e){return e==null||!Number.isFinite(e)?`—`:String(Math.round(e*1e4)/1e4)}var He=[`all`,`ok`,`incomplete`,`error`,`canceled`],x=[`all`,`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`],Ue=[`all`,`1h`,`24h`,`7d`,`custom`];function We(e){let t=(e,t,n)=>t.includes(e??``)?e:n,n=l(e.get(`from`)),r=l(e.get(`to`)),i=n&&r?{start:n,end:r}:null,a=e.get(`stream`);return{requestFilter:t(e.get(`status`),He,`all`),requestId:e.get(`id`)??``,accountFilter:e.get(`account`)??``,apiKeyFilter:e.get(`api_key`)??``,modelFilter:e.get(`model`)??``,providerFilter:e.get(`provider`)??``,streamFilter:a===`stream`||a===`true`?`stream`:a===`sync`||a===`false`?`sync`:`all`,errorKind:t(e.get(`error_kind`),x,`all`),timeRange:i?`custom`:t(e.get(`range`),Ue,`1h`),customRange:i}}function Ge(e){let t=new URLSearchParams;e.requestFilter!==`all`&&t.set(`status`,e.requestFilter),e.requestId&&t.set(`id`,e.requestId),e.accountFilter&&t.set(`account`,e.accountFilter),e.apiKeyFilter&&t.set(`api_key`,e.apiKeyFilter),e.modelFilter&&t.set(`model`,e.modelFilter),e.providerFilter&&t.set(`provider`,e.providerFilter),e.streamFilter!==`all`&&t.set(`stream`,e.streamFilter),e.errorKind!==`all`&&t.set(`error_kind`,e.errorKind);let n=e.timeRange===`custom`?c(e.customRange?.start):void 0,r=e.timeRange===`custom`?c(e.customRange?.end,!0):void 0;return n&&r?(t.set(`from`,n),t.set(`to`,r)):e.timeRange!==`1h`&&t.set(`range`,e.timeRange),t.toString()}function Ke(e){if(e===`all`||e===`custom`)return{from:void 0,to:void 0};let t=new Date,n=new Date(t);return e===`1h`&&n.setHours(n.getHours()-1),e===`24h`&&n.setHours(n.getHours()-24),e===`7d`&&n.setDate(n.getDate()-7),{from:n.toISOString(),to:t.toISOString()}}function S(){let{t:e,lang:t}=s(),[n,ee]=ye(),[l]=(0,g.useState)(()=>We(new URLSearchParams(window.location.search))),[m,Me]=(0,g.useState)([]),[_,He]=(0,g.useState)([]),[x,Ue]=(0,g.useState)(`requests`),[S,C]=(0,g.useState)(!0),[qe,Je]=(0,g.useState)(!1),[Ye,w]=(0,g.useState)(``),[T,Xe]=(0,g.useState)(l.requestFilter),[E,Ze]=(0,g.useState)(`all`),[D,Qe]=(0,g.useState)(l.requestId),[O,$e]=(0,g.useState)(``),[k,et]=(0,g.useState)(l.accountFilter),[A,tt]=(0,g.useState)(l.apiKeyFilter),[j,nt]=(0,g.useState)(``),[M,rt]=(0,g.useState)(l.modelFilter),[N,it]=(0,g.useState)(l.providerFilter),[P,at]=(0,g.useState)(l.streamFilter),[F,ot]=(0,g.useState)(l.errorKind),[I,st]=(0,g.useState)(l.timeRange),[L,ct]=(0,g.useState)(l.customRange),[lt,R]=(0,g.useState)(1),[z,ut]=(0,g.useState)(50),[dt,ft]=(0,g.useState)(1),[B,pt]=(0,g.useState)(50),[V,mt]=(0,g.useState)([]),[H,ht]=(0,g.useState)(0),[U,gt]=(0,g.useState)([]),[W,_t]=(0,g.useState)(0),[G,vt]=(0,g.useState)(null),[yt,bt]=(0,g.useState)(!1),[K,xt]=(0,g.useState)(null),[St,Ct]=(0,g.useState)(!1),[wt,Tt]=(0,g.useState)(!1),[Et,Dt]=(0,g.useState)(``),q=(0,g.useRef)(0),[Ot,kt]=(0,g.useState)(!1),[At,jt]=(0,g.useState)(!1),J=n.toString(),Y=Ge({requestFilter:T,requestId:D,accountFilter:k,apiKeyFilter:A,modelFilter:M,providerFilter:N,streamFilter:P,errorKind:F,timeRange:I,customRange:L}),X=(0,g.useRef)(J);(0,g.useEffect)(()=>{if(J===X.current)return;X.current=J;let e=We(new URLSearchParams(J));Xe(e.requestFilter),Qe(e.requestId),et(e.accountFilter),tt(e.apiKeyFilter),rt(e.modelFilter),it(e.providerFilter),at(e.streamFilter),ot(e.errorKind),st(e.timeRange),ct(e.customRange)},[J]),(0,g.useEffect)(()=>{Y!==X.current&&(X.current=Y,ee(Y,{replace:!0}))},[Y,ee]),(0,g.useEffect)(()=>{let e=!1;return Promise.allSettled([me(!1),pe()]).then(([t,n])=>{e||(t.status===`fulfilled`&&Me(t.value.data||[]),n.status===`fulfilled`&&He(n.value.data||[]))}),()=>{e=!0}},[]);let Z=(0,g.useMemo)(()=>{let e=new Map;for(let t of m||[])e.set(t.id,t.name||t.id);return e},[m]),Mt=(0,g.useMemo)(()=>{let e=new Map;for(let t of m||[])e.set(t.id,{provider:t.provider,region:t.region});return e},[m]);function Nt(t){let n=t.account_id?Mt.get(t.account_id):void 0,r=t.provider||n?.provider;return r?Oe(r,n?.region,e):`—`}function Pt(t){switch(t){case`pin`:return e(`logsRouting_pin`);case`sticky`:return e(`logsRouting_sticky`);case`sticky_escape`:return e(`logsRouting_sticky_escape`);default:return e(`logsRouting_pool`)}}let Ft=(0,g.useMemo)(()=>(m||[]).map(e=>({id:e.id,label:e.name||e.id})),[m]),{nameById:It,options:Lt}=le();function Rt(e){let t=e.api_key_id?.trim();return t?It.get(t)||t:`—`}let zt=(0,g.useMemo)(()=>{let t=new Set;for(let e of m||[])e.provider&&t.add(e.provider);return N&&t.add(N),[{id:``,label:e(`logsFilterProviderAll`)},...[...t].sort().map(t=>({id:t,label:ke(t,e)}))]},[m,N,e]),Bt=(0,g.useMemo)(()=>{let e=new Map;for(let t of _||[])e.has(t.id)||e.set(t.id,{id:t.id,label:t.display_name||t.id});return[...e.values()]},[_]),Vt=(0,g.useCallback)(async e=>((await ae({q:e||void 0,limit:20,offset:0})).items||[]).map(e=>({id:e.id,label:e.id})),[]),Ht=!!(D||T!==`all`||k||A||M||N||P!==`all`||F!==`all`||I!==`1h`),Ut=[T,D,k,A,M,N,P,F,I,L?.start?.toString()??``,L?.end?.toString()??``,z].join(`\0`),Wt=[E,O,j,B].join(`\0`),[Gt,Kt]=(0,g.useState)(Ut),[qt,Jt]=(0,g.useState)(Wt);Gt!==Ut&&(Kt(Ut),R(1)),qt!==Wt&&(Jt(Wt),ft(1));let Yt=Math.max(1,Math.ceil(H/z)),Q=Math.min(Gt===Ut?Math.max(1,lt):1,Yt);lt!==Q&&R(Q);let Xt=Math.max(1,Math.ceil(W/B)),$=Math.min(qt===Wt?Math.max(1,dt):1,Xt);dt!==$&&ft($);let Zt=(0,g.useCallback)(async(e=!1)=>{e||C(!0);try{let e=D?{from:void 0,to:void 0}:I===`custom`?{from:c(L?.start),to:c(L?.end,!0)}:Ke(I),t=await ae({status:T===`all`?void 0:T,id:D||void 0,account:k||void 0,api_key:A||void 0,model:M||void 0,provider:N||void 0,stream:P===`all`?void 0:P===`stream`,error_kind:F===`all`?void 0:F,from:e.from,to:e.to,limit:z,offset:(Q-1)*z});mt(t.items||[]),ht(t.total||0),w(``)}catch(t){e||w(t instanceof Error?t.message:String(t))}finally{e||(C(!1),Je(!0))}},[T,D,k,A,M,N,P,F,I,L,Q,z]),Qt=(0,g.useCallback)(async(e=!1)=>{e||C(!0);try{let e=await re({level:E===`all`?void 0:E,q:O.trim()||void 0,account:j||void 0,limit:B,offset:($-1)*B});gt(e.items||[]),_t(e.total??0),w(``)}catch(t){e||w(t instanceof Error?t.message:String(t))}finally{e||(C(!1),Je(!0))}},[E,O,j,$,B]),$t=(0,g.useCallback)(async(e=!1)=>{x===`requests`?await Zt(e):await Qt(e)},[x,Zt,Qt]);(0,g.useEffect)(()=>{C(!0);let e=x===`runtime`&&O.trim()?280:0,t=window.setTimeout(()=>void $t(!1),e);return()=>window.clearTimeout(t)},[$t,x,O]),(0,g.useEffect)(()=>{if(x!==`runtime`||$!==1)return;let e=window.setInterval(()=>{document.hidden||Qt(!0)},3e3);return()=>window.clearInterval(e)},[x,$,Qt]);let en=H===0?0:(Q-1)*z+1,tn=Math.min(H,Q*z),nn=W===0?0:($-1)*B+1,rn=Math.min(W,$*B),an=(0,g.useMemo)(()=>x===`requests`?e(`logsShownTotal`,{shown:V.length?`${en}–${tn}`:0,total:H}):e(`logsShownTotal`,{shown:U.length?`${nn}–${rn}`:0,total:W}),[x,V.length,U.length,en,tn,H,nn,rn,W,e]);function on(){Qe(``),Xe(`all`),et(``),tt(``),rt(``),it(``),at(`all`),ot(`all`),st(`1h`),ct(null),R(1)}async function sn(e){let t=++q.current;xt(e),Dt(``),Tt(!0),Ct(!0);try{let n=await ne(e.id);if(q.current!==t)return;xt(n)}catch(e){if(q.current!==t)return;Dt(e instanceof Error?e.message:String(e))}finally{q.current===t&&Tt(!1)}}function cn(e){vt(e),bt(!0)}async function ln(){jt(!0),Ce({id:`logs-clear`,type:`loading`,title:e(`toastClearingLogs`)});try{await ie(),kt(!1),await Zt(!1),Ce({id:`logs-clear`,type:`success`,title:e(`toastLogsCleared`)})}catch(t){w(t instanceof Error?t.message:String(t)),Ce({id:`logs-clear`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{jt(!1)}}let un=S&&(x===`requests`?V.length===0:U.length===0);return S&&!qe?(0,v.jsx)(Se,{}):(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`navLogs`)}),(0,v.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`logsLead`)})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[x===`requests`?(0,v.jsxs)(te,{size:`sm`,variant:`ghost`,onPress:()=>kt(!0),isDisabled:At||H===0,children:[(0,v.jsx)(o,{size:14}),e(`logsClear`)]}):null,(0,v.jsxs)(te,{size:`sm`,variant:`secondary`,isPending:S,onPress:()=>void $t(!1),children:[(0,v.jsx)(ve,{size:15}),e(`refresh`)]})]})]}),Ye?(0,v.jsx)(se,{title:e(`failedLogs`,{msg:Ye})}):null,(0,v.jsxs)(f,{selectedKey:x,onSelectionChange:e=>Ue(String(e)),children:[(0,v.jsx)(f.ListContainer,{className:`w-fit`,children:(0,v.jsxs)(f.List,{children:[(0,v.jsxs)(fe,{id:`requests`,className:`gap-1.5`,children:[(0,v.jsx)(f.Indicator,{className:`transition-none`}),(0,v.jsx)(_e,{size:13}),e(`logsRequests`)]}),(0,v.jsxs)(fe,{id:`runtime`,className:`gap-1.5`,children:[(0,v.jsx)(f.Indicator,{className:`transition-none`}),(0,v.jsx)(Ne,{size:13}),e(`logsRuntime`)]})]})}),(0,v.jsxs)(f.Panel,{id:`requests`,"data-tab-panel":`requests`,className:`space-y-4 pt-5`,children:[(0,v.jsxs)(`div`,{className:`data-toolbar flex flex-col gap-2`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,v.jsx)(h,{value:T,onChange:e=>Xe(e),ariaLabel:e(`logsFilterAll`),options:[{id:`all`,label:e(`logsFilterAll`)},{id:`ok`,label:e(`logsFilterOk`)},{id:`incomplete`,label:e(`logsFilterIncomplete`)},{id:`error`,label:e(`logsFilterError`)},{id:`canceled`,label:e(`logsFilterCanceled`)}]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Ht?(0,v.jsx)(te,{size:`sm`,variant:`ghost`,onPress:on,children:e(`clearFilters`)}):null,(0,v.jsx)(`div`,{className:`mono text-caption text-muted`,children:an})]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(u,{ariaLabel:e(`logsColAccount`),value:k,onChange:et,options:Ft,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(u,{ariaLabel:e(`logsColApiKey`),value:A,onChange:tt,options:Lt,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(u,{ariaLabel:e(`logsColModel`),value:M,onChange:rt,options:Bt,allLabel:e(`logsFilterModelAll`),searchPlaceholder:e(`logsSearchModel`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(je,{ariaLabel:e(`logsColProvider`),value:N,onChange:it,options:zt}),(0,v.jsx)(u,{ariaLabel:e(`logsSearchRequestId`),value:D,onChange:Qe,options:D?[{id:D,label:D}]:[],allLabel:e(`logsFilterIdAll`),searchPlaceholder:e(`logsSearchRequestId`),emptyLabel:e(`logsNoFilterOptions`),loadOptions:Vt,className:`min-w-56`}),(0,v.jsx)(h,{value:P,onChange:e=>at(e),ariaLabel:e(`logsFilterStreamAll`),options:[{id:`all`,label:e(`logsFilterStreamAll`)},{id:`stream`,label:e(`logsStreamYes`)},{id:`sync`,label:e(`logsStreamNo`)}]}),(0,v.jsx)(je,{ariaLabel:e(`errorKind`),value:F===`all`?``:F,onChange:e=>ot(e||`all`),options:[{id:``,label:e(`logsFilterKindAll`)},{id:`quota`,label:e(`logsKindQuota`)},{id:`rate_limit`,label:e(`logsKindRateLimit`)},{id:`auth`,label:e(`logsKindAuth`)},{id:`not_ready`,label:e(`logsKindNotReady`)},{id:`unavailable`,label:e(`logsKindUnavailable`)},{id:`invalid_request`,label:e(`logsKindInvalidRequest`)},{id:`model_not_available`,label:e(`logsKindModelNotAvailable`)}]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e(`logsTimeRange`)}),(0,v.jsx)(h,{value:I,onChange:e=>st(e),ariaLabel:e(`logsTimeRange`),options:[{id:`all`,label:e(`logsTimeAll`)},{id:`1h`,label:e(`logsTime1h`)},{id:`24h`,label:e(`logsTime24h`)},{id:`7d`,label:e(`logsTime7d`)},{id:`custom`,label:e(`logsTimeCustom`)}]}),I===`custom`?(0,v.jsx)(oe,{className:`w-[min(100%,42rem)]`,value:L,onChange:ct,ariaLabel:e(`logsTimeRange`),fromLabel:e(`logsTimeFrom`),toLabel:e(`logsTimeTo`)}):null]})]}),(0,v.jsx)(ue,{className:`overflow-hidden p-0`,"aria-busy":S,children:un?(0,v.jsx)(be,{}):V.length===0?(0,v.jsx)(de,{icon:(0,v.jsx)(r,{size:22}),title:e(Ht?`logsNoMatch`:`logsEmptyRequests`),action:Ht?(0,v.jsx)(te,{size:`sm`,variant:`ghost`,onPress:on,children:e(`clearFilters`)}):null}):(0,v.jsx)(p,{children:(0,v.jsx)(p.ScrollContainer,{children:(0,v.jsxs)(p.Content,{"aria-label":e(`logsRequests`),children:[(0,v.jsxs)(p.Header,{children:[(0,v.jsx)(p.Column,{isRowHeader:!0,children:e(`logsColTime`)}),(0,v.jsx)(p.Column,{children:e(`logsColModel`)}),(0,v.jsx)(p.Column,{children:e(`logsColReasoning`)}),(0,v.jsx)(p.Column,{children:e(`logsColProvider`)}),(0,v.jsx)(p.Column,{children:e(`logsColAccount`)}),(0,v.jsx)(p.Column,{children:e(`logsColApiKey`)}),(0,v.jsx)(p.Column,{children:e(`logsColStatus`)}),(0,v.jsx)(p.Column,{children:e(`logsColStream`)}),(0,v.jsx)(p.Column,{children:e(`logsColLatency`)}),(0,v.jsx)(p.Column,{children:e(`logsColTokens`)})]}),(0,v.jsx)(p.Body,{children:V.map(n=>(0,v.jsxs)(p.Row,{className:`cursor-pointer`,onAction:()=>void sn(n),children:[(0,v.jsx)(p.Cell,{children:(0,v.jsxs)(`div`,{className:`py-1`,children:[(0,v.jsx)(`div`,{className:`mono text-xs`,children:y(n.created_at,t)}),(0,v.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.id})]})}),(0,v.jsxs)(p.Cell,{children:[(0,v.jsx)(`div`,{className:`text-body font-medium`,children:n.requested_model||`—`}),n.mapped_model&&n.mapped_model!==n.requested_model?(0,v.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.mapped_model}):null]}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`mono text-xs`,children:Le(n)||`—`})}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`text-xs`,children:Nt(n)})}),(0,v.jsxs)(p.Cell,{children:[(0,v.jsx)(`span`,{className:`text-xs`,children:n.account_id?Z.get(n.account_id)||n.account_id:`—`}),n.account_id&&Z.get(n.account_id)&&Z.get(n.account_id)!==n.account_id?(0,v.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.account_id}):null]}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`text-xs`,children:Rt(n)})}),(0,v.jsxs)(p.Cell,{children:[(0,v.jsx)(ge,{size:`sm`,variant:`soft`,color:Pe(n.status),children:n.status}),n.error_kind?(0,v.jsx)(`div`,{className:`mono mt-1 text-caption text-muted`,children:n.error_kind}):null]}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`text-xs text-muted`,children:n.stream?e(`logsStreamYes`):e(`logsStreamNo`)})}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(Ae,{latencyMs:n.latency_ms,ttfbMs:n.ttfb_ms,completionTokens:n.completion_tokens,stream:n.stream,labels:{ttft:e(`logsColTTFT`),total:e(`logsLatencyTotal`),tps:e(`logsOutputTPS`)}})}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(Re,{log:n,inLabel:e(`logsTokensIn`),outLabel:e(`logsTokensOut`),pointsLabel:t=>e(`logsTokensPoints`,{value:t})})})]},n.id))})]})})})}),(0,v.jsx)(i,{total:H,page:Q,pageCount:Yt,pageSize:z,loading:S,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:Q,pages:Yt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:R,onPageSize:ut})]}),(0,v.jsxs)(f.Panel,{id:`runtime`,"data-tab-panel":`runtime`,className:`space-y-4 pt-5`,children:[(0,v.jsxs)(`div`,{className:`data-toolbar flex flex-wrap items-center justify-between gap-2`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(a,{className:`sm:w-72`,value:O,onChange:$e,placeholder:e(`logsSearchRuntime`),ariaLabel:e(`logsSearchRuntime`)}),(0,v.jsx)(u,{ariaLabel:e(`logsColAccount`),value:j,onChange:nt,options:Ft,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(h,{value:E,onChange:e=>Ze(e),ariaLabel:e(`logsLevelAll`),options:[{id:`all`,label:e(`logsLevelAll`)},{id:`info`,label:e(`logsLevelInfo`)},{id:`warn`,label:e(`logsLevelWarn`)},{id:`error`,label:e(`logsLevelError`)}]})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted`,children:[$===1?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`status-dot`,"data-state":`ok`}),e(`logsAutoRefresh`)]}):null,(0,v.jsx)(`span`,{className:`mono`,children:an})]})]}),(0,v.jsx)(ue,{className:`overflow-hidden p-0`,"aria-busy":S,children:un?(0,v.jsx)(xe,{}):U.length===0?(0,v.jsx)(de,{icon:(0,v.jsx)(Ne,{size:22}),title:e(`logsEmptyRuntime`)}):(0,v.jsx)(`div`,{className:`divide-y divide-separator`,children:U.map(e=>(0,v.jsxs)(`div`,{className:`grid cursor-pointer gap-2 px-5 py-3 transition-colors hover:bg-surface-secondary/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:grid-cols-[150px_72px_minmax(0,1fr)] sm:items-start`,role:`button`,tabIndex:0,onClick:()=>cn(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),cn(e))},children:[(0,v.jsx)(`div`,{className:`mono text-caption text-muted`,children:y(e.time,t)}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`status-dot`,"data-state":Fe(e.level)}),(0,v.jsx)(`span`,{className:`font-medium text-muted`,children:e.level})]}),(0,v.jsxs)(`div`,{className:`min-w-0`,children:[e.account_id?(0,v.jsx)(`div`,{className:`mono mb-1 text-caption text-muted`,children:e.account_id}):null,(0,v.jsx)(`div`,{className:`mono break-all text-xs leading-5 text-foreground`,children:e.message})]})]},e.id))})}),(0,v.jsx)(i,{total:W,page:$,pageCount:Xt,pageSize:B,loading:S,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:$,pages:Xt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:ft,onPageSize:pt})]})]}),(0,v.jsx)(d.Root,{isOpen:yt,onOpenChange:e=>{bt(e),e||vt(null)},children:(0,v.jsx)(d.Backdrop,{variant:`blur`,children:(0,v.jsx)(d.Container,{size:`lg`,scroll:`inside`,children:(0,v.jsxs)(d.Dialog,{className:`w-full max-w-4xl`,children:[(0,v.jsxs)(d.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(d.Heading,{className:`text-section font-semibold`,children:e(`logsRuntimeDetailTitle`)}),(0,v.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:G?`#${G.id}`:`—`})]}),(0,v.jsx)(d.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,v.jsx)(he,{size:16})})]}),(0,v.jsxs)(d.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,v.jsx)(`dl`,{className:`grid gap-3 sm:grid-cols-2`,children:[[e(`logsColTime`),G?y(G.time,t):`—`],[e(`logsRuntimeLevel`),G?.level||`—`],[e(`logsRuntimeSource`),G?.source||`—`],[e(`logsColAccount`),G?.account_id||`—`]].map(([t,n])=>(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`dt`,{className:`text-caption text-muted`,children:t}),(0,v.jsx)(`dd`,{className:`mt-1 break-all text-body font-medium`,children:t===e(`logsRuntimeLevel`)&&G?(0,v.jsx)(ge,{size:`sm`,variant:`soft`,color:Ie(G.level),children:G.level}):n})]},String(t)))}),(0,v.jsxs)(`section`,{className:`space-y-2`,children:[(0,v.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:e(`logsRuntimeMessage`)}),(0,v.jsx)(`pre`,{className:`mono max-h-[min(38rem,60vh)] overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary px-4 py-3 text-xs leading-6 text-foreground`,children:G?.message||`—`})]})]})]})})})}),(0,v.jsx)(d.Root,{isOpen:St,onOpenChange:e=>{Ct(e),e||(q.current+=1,Tt(!1),Dt(``),xt(null))},children:(0,v.jsx)(d.Backdrop,{variant:`blur`,children:(0,v.jsx)(d.Container,{size:`lg`,scroll:`inside`,children:(0,v.jsxs)(d.Dialog,{className:`w-full max-w-4xl`,children:[(0,v.jsxs)(d.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(d.Heading,{className:`text-section font-semibold`,children:e(`logsDetailTitle`)}),(0,v.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:K?.id})]}),(0,v.jsx)(d.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,v.jsx)(he,{size:16})})]}),(0,v.jsx)(d.Body,{className:`space-y-5 px-5 pb-5`,children:wt?(0,v.jsx)(ze,{}):Et?(0,v.jsx)(se,{title:e(`requestFailed`),description:Et}):K?(0,v.jsxs)(v.Fragment,{children:[K.error_message?(0,v.jsx)(se,{title:K.error_kind||e(`requestFailed`),description:K.error_message}):null,(0,v.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-secondary px-4 py-4`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,v.jsx)(ge,{size:`sm`,variant:`soft`,color:Pe(K.status),children:K.status||`—`}),(0,v.jsx)(`span`,{className:`mono min-w-0 break-all text-body font-medium`,children:K.requested_model||`—`}),K.mapped_model&&K.mapped_model!==K.requested_model?(0,v.jsxs)(`span`,{className:`mono break-all text-caption text-muted`,children:[`→ `,K.mapped_model]}):null,Le(K)?(0,v.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`· `,Le(K)]}):null,(0,v.jsx)(`span`,{className:`mono ml-auto text-caption text-muted`,children:y(K.created_at,t)})]}),(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{mono:!0,label:`${e(`logsColTokens`)} · ${e(`logsTokensIn`)} / ${e(`logsTokensOut`)}`,value:K.prompt_tokens==null&&K.completion_tokens==null?`—`:`${K.prompt_tokens??0} / ${K.completion_tokens??0}`}),(K.credits??K.usage_detail?.credit)==null?null:(0,v.jsx)(b,{mono:!0,label:e(`logsCreditConsumed`),value:`${Ve(K.credits??K.usage_detail?.credit)}${K.usage_detail?.unit?` ${K.usage_detail.unit}`:``}`}),(0,v.jsx)(b,{mono:!0,label:e(`logsColTTFT`),value:Ee(K.ttfb_ms)}),(0,v.jsx)(b,{mono:!0,label:e(`logsLatencyTotal`),value:Ee(K.latency_ms)}),(0,v.jsx)(b,{mono:!0,label:e(`logsOutputTPS`),value:we(De({completionTokens:K.completion_tokens,latencyMs:K.latency_ms,ttfbMs:K.ttfb_ms,stream:K.stream}))})]})]}),(0,v.jsx)(Be,{title:e(`logsSectionCall`),children:(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{label:e(`logsColProvider`),value:Nt(K)}),(0,v.jsx)(b,{label:e(`logsColAccount`),value:K.account_id?Z.get(K.account_id)||K.account_id:`—`}),(0,v.jsx)(b,{label:e(`logsColApiKey`),value:Rt(K)}),(0,v.jsx)(b,{label:e(`logsColStream`),value:K.stream?e(`logsStreamYes`):e(`logsStreamNo`)}),(0,v.jsx)(b,{label:e(`logsRouting`),value:Pt(K.routing)})]})}),(0,v.jsx)(Be,{title:e(`logsAttempts`),aside:K.attempts?.length?(0,v.jsx)(`span`,{className:`mono text-caption text-muted`,children:K.attempts.length}):null,children:K.attempts?.length?(0,v.jsx)(`div`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:K.attempts.map(e=>(0,v.jsxs)(`div`,{className:`grid grid-cols-[32px_minmax(0,1fr)_auto] items-start gap-x-3 px-3 py-2.5`,children:[(0,v.jsxs)(`div`,{className:`mono pt-0.5 text-caption text-muted`,children:[`#`,e.attempt_index]}),(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.account_id?Z.get(e.account_id)||e.account_id:`—`}),e.error_message?(0,v.jsxs)(`div`,{className:`mt-0.5 break-all text-caption text-muted`,children:[e.error_kind?(0,v.jsx)(`span`,{className:`mono mr-1.5`,children:e.error_kind}):null,e.error_message]}):null]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.latency_ms==null?null:(0,v.jsx)(`span`,{className:`mono text-caption text-muted`,children:Ee(e.latency_ms)}),(0,v.jsx)(ge,{size:`sm`,variant:`soft`,color:Pe(e.status===`failover`?`canceled`:e.status),children:e.status})]})]},e.id))}):(0,v.jsx)(`p`,{className:`text-caption text-muted`,children:e(`logsNoAttempts`)})}),K.message_count||K.stream_diagnostic?(0,v.jsx)(Be,{title:e(`logsSectionDiagnostics`),children:(0,v.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-secondary px-4 py-3`,children:[K.message_count?(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:e(`logsMessageShape`)}),(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{mono:!0,label:e(`logsMessageCount`),value:K.message_count}),(0,v.jsx)(b,{mono:!0,label:e(`logsEmptyMessageIndexes`),value:K.empty_message_indexes?.length?K.empty_message_indexes.join(`, `):`—`}),(0,v.jsx)(b,{mono:!0,wide:!0,label:e(`logsMessageRoles`),value:K.message_roles?.join(` → `)||`—`})]})]}):null,K.message_count&&K.stream_diagnostic?(0,v.jsx)(`div`,{className:`border-t border-separator`}):null,K.stream_diagnostic?(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:e(`logsStreamDiagnostics`)}),(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{mono:!0,label:e(`logsUpstreamStatus`),value:K.stream_diagnostic.upstream_status??`—`}),(0,v.jsx)(b,{mono:!0,label:e(`logsStreamComplete`),value:K.stream_diagnostic.saw_done?e(`yes`):e(`no`)}),(0,v.jsx)(b,{mono:!0,label:e(`logsCancellationSource`),value:K.stream_diagnostic.cancellation_source||`—`}),(0,v.jsx)(b,{mono:!0,label:e(`logsSSEEvents`),value:K.stream_diagnostic.sse_event_count}),(0,v.jsx)(b,{mono:!0,label:e(`logsBytesRead`),value:Te(K.stream_diagnostic.bytes_read)}),(0,v.jsx)(b,{mono:!0,label:e(`logsLastEvent`),value:K.stream_diagnostic.last_event||`—`}),K.stream_diagnostic.context_err?(0,v.jsx)(b,{mono:!0,wide:!0,label:`context`,value:K.stream_diagnostic.context_err}):null,K.stream_diagnostic.relay_error?(0,v.jsx)(b,{mono:!0,wide:!0,label:`relay`,value:K.stream_diagnostic.relay_error}):null]})]}):null]})}):null]}):null})]})})})}),(0,v.jsx)(ce,{isOpen:Ot,title:e(`logsClear`),description:e(`logsClearConfirm`),confirmLabel:e(`logsClear`),cancelLabel:e(`close`),closeLabel:e(`close`),isPending:At,onClose:()=>kt(!1),onConfirm:()=>void ln()})]})}export{S as LogsPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/ModelPoolPage-BtpF1cru.js b/internal/webui/static/assets/ModelPoolPage-BtpF1cru.js new file mode 100644 index 00000000..bbca0504 --- /dev/null +++ b/internal/webui/static/assets/ModelPoolPage-BtpF1cru.js @@ -0,0 +1 @@ +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./Plus.es-BKtgxOxU.js";import{t as i}from"./TrashSimple.es-a96yoz9-.js";import{n as a,pt as o,r as s}from"./useI18n-DAGWWg9N.js";import{t as c}from"./label-j5K3TFm8.js";import{n as l,t as u}from"./PageAlert-BTp9jdUz.js";import{t as d}from"./ConfirmDialog-2wOP1m7E.js";import{n as f}from"./useToggle-Zi1rbfHX.js";import{n as p,r as m,t as h}from"./FormRow-6b4yVFYc.js";import{t as g}from"./EmptyPanel-Bs-jQMvG.js";import{t as _}from"./modal-BqXo29An.js";import{n as v,t as y}from"./number-field-CyPgNRvS.js";import{t as b}from"./CompactSwitch-CzZldrIr.js";import{t as x}from"./table-CocoYVkm.js";import{D as S,g as C,p as w,u as T}from"./overview-DcWoRgOQ.js";import{Dt as E,M as D,m as O,n as k,qt as A,t as j}from"./index-BYut8qRj.js";import{t as M}from"./ProviderMark-IiAZTaQS.js";import{n as N}from"./provider-gHnttGKq.js";import{t as P}from"./FilterSelect-BkT3LDQz.js";var F=t(e(),1),I=new Map([[`bold`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M208.49,152.49l-72,72a12,12,0,0,1-17,0l-72-72a12,12,0,0,1,17-17L116,187V40a12,12,0,0,1,24,0V187l51.51-51.52a12,12,0,0,1,17,17Z`}))],[`duotone`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M200,144l-72,72L56,144Z`,opacity:`0.2`}),F.createElement(`path`,{d:`M207.39,140.94A8,8,0,0,0,200,136H136V40a8,8,0,0,0-16,0v96H56a8,8,0,0,0-5.66,13.66l72,72a8,8,0,0,0,11.32,0l72-72A8,8,0,0,0,207.39,140.94ZM128,204.69,75.31,152H180.69Z`}))],[`fill`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,56,136h64V40a8,8,0,0,1,16,0v96h64a8,8,0,0,1,5.66,13.66Z`}))],[`light`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M204.24,148.24l-72,72a6,6,0,0,1-8.48,0l-72-72a6,6,0,0,1,8.48-8.48L122,201.51V40a6,6,0,0,1,12,0V201.51l61.76-61.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M202.83,146.83l-72,72a4,4,0,0,1-5.66,0l-72-72a4,4,0,0,1,5.66-5.66L124,206.34V40a4,4,0,0,1,8,0V206.34l65.17-65.17a4,4,0,0,1,5.66,5.66Z`}))]]),L=new Map([[`bold`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M208.49,120.49a12,12,0,0,1-17,0L140,69V216a12,12,0,0,1-24,0V69L64.49,120.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0l72,72A12,12,0,0,1,208.49,120.49Z`}))],[`duotone`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M200,112H56l72-72Z`,opacity:`0.2`}),F.createElement(`path`,{d:`M205.66,106.34l-72-72a8,8,0,0,0-11.32,0l-72,72A8,8,0,0,0,56,120h64v96a8,8,0,0,0,16,0V120h64a8,8,0,0,0,5.66-13.66ZM75.31,104,128,51.31,180.69,104Z`}))],[`fill`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M207.39,115.06A8,8,0,0,1,200,120H136v96a8,8,0,0,1-16,0V120H56a8,8,0,0,1-5.66-13.66l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,207.39,115.06Z`}))],[`light`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M204.24,116.24a6,6,0,0,1-8.48,0L134,54.49V216a6,6,0,0,1-12,0V54.49L60.24,116.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0l72,72A6,6,0,0,1,204.24,116.24Z`}))],[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z`}))],[`thin`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M202.83,114.83a4,4,0,0,1-5.66,0L132,49.66V216a4,4,0,0,1-8,0V49.66L58.83,114.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0l72,72A4,4,0,0,1,202.83,114.83Z`}))]]),R=F.forwardRef((e,t)=>F.createElement(o,{ref:t,...e,weights:I}));R.displayName=`ArrowDownIcon`;var z=R,B=F.forwardRef((e,t)=>F.createElement(o,{ref:t,...e,weights:L}));B.displayName=`ArrowUpIcon`;var V=B;function H(){return S(`/api/aggregations`)}function U(e){return S(`/api/aggregations`,{method:`POST`,body:JSON.stringify(e)})}function W(e,t){return S(`/api/aggregations/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)})}function G(e){return S(`/api/aggregations/${encodeURIComponent(e)}`,{method:`DELETE`})}var K=[`priority`,`round-robin`,`fill-first`,`fefo`,`least-quota-first`,`most-quota-first`],q=n();function J(){return{key:`${Date.now()}-${Math.random()}`,provider:``,region:``,model:``,account_id:``,priority:0,weight:100}}function Y(e,t){return e.filter(e=>!t||e.provider===t).map(e=>({id:e.id,label:`${e.name||e.id}${e.region?` · ${e.region}`:``}`})).sort((e,t)=>e.label.localeCompare(t.label))}function X(e){return e.map(e=>({id:e.id,label:e.label}))}function ee(e,t){return(e.find(e=>e.id===t)?.regions||[]).map(e=>({id:e.id,label:e.label}))}function te(e,t,n){let r=new Set,i=[];for(let n of e){if(n.provider&&n.provider!==t)continue;let e=n.id;if(!e||r.has(e))continue;r.add(e);let a=n.display_name||n.route_display_name||e;i.push({id:e,label:`${a} (${e})`})}return i.length||i.push({id:``,label:n(`modelPoolNoModels`)}),i}function Z(e,t){return t(`modelPoolStrategy_${e}`)}function Q(){let{t:e}=a(),{enabled:t,loading:n}=k(),[o,c]=(0,F.useState)([]),[l,p]=(0,F.useState)([]),[m,h]=(0,F.useState)([]),[_,v]=(0,F.useState)([]),[y,S]=(0,F.useState)(!0),[E,M]=(0,F.useState)(``),[N,P]=(0,F.useState)(!1),[I,L]=(0,F.useState)(null),[R,z]=(0,F.useState)(null),[B,K]=(0,F.useState)(!1),J=(0,F.useCallback)(async()=>{S(!0);try{let[e,t,n,r]=await Promise.all([H(),C(),w(),T()]);c(e.data||[]),p(t.data||[]),h(n.data||[]),v(r.data||[]),M(``)}catch(e){M(e instanceof Error?e.message:String(e))}finally{S(!1)}},[]);(0,F.useEffect)(()=>{!t||n||J()},[t,n,J]);async function Y(t,n){let r=t.enabled;c(e=>e.map(e=>e.id===t.id?{...e,enabled:n}:e));try{let r=await W(t.id,{enabled:n});c(e=>e.map(e=>e.id===t.id?r:e)),j({type:`success`,title:e(`modelPoolSaved`)})}catch(e){c(e=>e.map(e=>e.id===t.id?{...e,enabled:r}:e)),j({type:`error`,title:e instanceof Error?e.message:String(e)})}}async function X(){if(R){K(!0);try{await G(R.id),c(e=>e.filter(e=>e.id!==R.id)),j({type:`success`,title:e(`modelPoolDeleted`)}),z(null)}catch(e){j({type:`error`,title:e instanceof Error?e.message:String(e)})}finally{K(!1)}}}return n?(0,q.jsx)(O,{className:`h-64 w-full rounded-xl`}):t?(0,q.jsxs)(`div`,{className:`space-y-6`,children:[(0,q.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`text-title font-semibold tracking-tight`,children:e(`modelPoolTitle`)}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-caption text-muted`,children:e(`modelPoolLead`)})]}),(0,q.jsxs)(s,{onPress:()=>P(!0),children:[(0,q.jsx)(r,{size:16}),e(`modelPoolCreate`)]})]}),E?(0,q.jsx)(u,{status:`danger`,title:E}):null,(0,q.jsx)(f,{className:`overflow-hidden`,children:y?(0,q.jsxs)(`div`,{className:`space-y-3 p-5`,children:[(0,q.jsx)(O,{className:`h-10 w-full`}),(0,q.jsx)(O,{className:`h-10 w-full`}),(0,q.jsx)(O,{className:`h-10 w-full`})]}):o.length===0?(0,q.jsx)(g,{title:e(`modelPoolEmpty`),hint:e(`modelPoolEmptyHint`),icon:(0,q.jsx)(V,{size:28})}):(0,q.jsx)(x,{children:(0,q.jsx)(x.ScrollContainer,{children:(0,q.jsxs)(x.Content,{"aria-label":e(`modelPoolTitle`),children:[(0,q.jsxs)(x.Header,{children:[(0,q.jsx)(x.Column,{children:e(`modelPoolColName`)}),(0,q.jsx)(x.Column,{children:e(`modelPoolColStrategy`)}),(0,q.jsx)(x.Column,{children:e(`modelPoolColMembers`)}),(0,q.jsx)(x.Column,{children:e(`modelPoolColFailover`)}),(0,q.jsx)(x.Column,{children:e(`modelPoolColEnabled`)}),(0,q.jsx)(x.Column,{children:e(`modelPoolColActions`)})]}),(0,q.jsx)(x.Body,{children:o.map(t=>(0,q.jsxs)(x.Row,{children:[(0,q.jsx)(x.Cell,{children:(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`div`,{className:`font-medium`,children:t.name}),(0,q.jsx)(`div`,{className:`mono text-caption text-muted`,children:t.id})]})}),(0,q.jsx)(x.Cell,{children:(0,q.jsx)(D,{size:`sm`,variant:`soft`,children:Z(t.strategy,e)})}),(0,q.jsx)(x.Cell,{children:(0,q.jsx)(`span`,{className:`mono text-caption`,children:t.members.length})}),(0,q.jsx)(x.Cell,{children:(0,q.jsx)(`span`,{className:`text-caption text-muted`,children:t.allow_fallbacks?e(`modelPoolFailoverOn`,{count:t.max_attempts}):e(`modelPoolFailoverOff`)})}),(0,q.jsx)(x.Cell,{children:(0,q.jsx)(b,{isSelected:t.enabled,ariaLabel:`${e(`modelPoolColEnabled`)} ${t.id}`,onChange:e=>void Y(t,e)})}),(0,q.jsx)(x.Cell,{children:(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(s,{size:`sm`,variant:`ghost`,onPress:()=>L(t),children:e(`edit`)}),(0,q.jsx)(s,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":e(`delete`),onPress:()=>z(t),children:(0,q.jsx)(i,{size:16})})]})})]},t.id))})]})})})}),(N||I)&&(0,q.jsx)($,{isOpen:!0,initial:I,descriptors:l,models:m,accounts:_,t:e,onClose:()=>{P(!1),L(null)},onSave:async t=>{I?await W(I.id,t):await U(t),j({type:`success`,title:e(`modelPoolSaved`)}),P(!1),L(null),await J()}}),(0,q.jsx)(d,{isOpen:!!R,title:e(`modelPoolDeleteTitle`),description:R?e(`modelPoolDeleteDesc`,{name:R.name}):``,confirmLabel:e(`delete`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:B,onClose:()=>z(null),onConfirm:()=>void X()})]}):(0,q.jsx)(A,{to:`/`,replace:!0})}function $({isOpen:e,initial:t,descriptors:n,models:a,accounts:o,t:u,onClose:d,onSave:f}){let[g,x]=(0,F.useState)(``),[S,C]=(0,F.useState)(``),[w,T]=(0,F.useState)(`priority`),[D,O]=(0,F.useState)(!0),[k,A]=(0,F.useState)(3),[j,I]=(0,F.useState)([]),[L,R]=(0,F.useState)(``),[B,H]=(0,F.useState)(!1);(0,F.useEffect)(()=>{e&&(x(t?.id||``),C(t?.name||``),T(t?.strategy||`priority`),O(t?.allow_fallbacks??!0),A(t?.max_attempts??3),I((t?.members||[]).map(e=>({...e,key:`${e.provider}-${e.model}-${Math.random()}`}))),R(``))},[t,e]);let U=(0,F.useMemo)(()=>K.map(e=>({id:e,label:Z(e,u)})),[u]),W=(0,F.useMemo)(()=>X(n),[n]);function G(e,t){I(n=>n.map(n=>n.key===e?{...n,...t}:n))}function Q(e,t){I(n=>{let r=[...n],i=e+t;return i<0||i>=r.length?n:([r[e],r[i]]=[r[i],r[e]],r.map((e,t)=>({...e,priority:t})))})}async function $(e){if(e?.preventDefault(),!t&&!g.trim().toLowerCase()){R(u(`modelPoolIdRequired`));return}if(!S.trim()){R(u(`modelPoolNameRequired`));return}if(!j.length){R(u(`modelPoolMembersRequired`));return}if(j.some(e=>!e.provider||!e.model)){R(u(`modelPoolMemberIncomplete`));return}if(!Number.isInteger(k)||k<1||k>64){R(u(`modelPoolAttemptsInvalid`));return}H(!0),R(``);try{let e={name:S.trim(),strategy:w,allow_fallbacks:D,max_attempts:k,members:j.map((e,t)=>({provider:e.provider,region:e.region||``,model:e.model,account_id:e.account_id||``,priority:t,weight:e.weight||100}))};t||(e.id=g.trim().toLowerCase()),await f(e)}catch(e){R(e instanceof Error?e.message:String(e))}finally{H(!1)}}return(0,q.jsx)(_.Root,{isOpen:e,onOpenChange:e=>{!e&&!B&&d()},children:(0,q.jsx)(_.Backdrop,{variant:`blur`,children:(0,q.jsx)(_.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,q.jsx)(_.Dialog,{className:`sm:min-w-[40rem]`,children:(0,q.jsxs)(v,{onSubmit:$,children:[(0,q.jsxs)(_.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(_.Heading,{className:`text-section font-semibold`,children:u(t?`modelPoolEdit`:`modelPoolCreate`)}),(0,q.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:u(`modelPoolEditorHint`)})]}),(0,q.jsx)(_.CloseTrigger,{isDisabled:B,"aria-label":u(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,q.jsx)(E,{size:18})})]}),(0,q.jsxs)(_.Body,{className:`space-y-5 px-6 pb-2 pt-1`,children:[L?(0,q.jsxs)(l,{status:`danger`,children:[(0,q.jsx)(l.Indicator,{}),(0,q.jsx)(l.Content,{children:(0,q.jsx)(l.Title,{children:L})})]}):null,t?null:(0,q.jsx)(h,{label:u(`modelPoolId`),hint:u(`modelPoolIdHint`),children:(0,q.jsx)(m,{value:g,onChange:e=>x(e.target.value),placeholder:`my-claude`,"aria-label":u(`modelPoolId`),disabled:B})}),(0,q.jsx)(h,{label:u(`modelPoolName`),children:(0,q.jsx)(m,{value:S,onChange:e=>C(e.target.value),placeholder:u(`modelPoolNamePh`),"aria-label":u(`modelPoolName`),disabled:B})}),(0,q.jsx)(h,{label:u(`modelPoolStrategy`),hint:u(`modelPoolStrategyHint`),children:(0,q.jsx)(P,{value:w,onChange:T,ariaLabel:u(`modelPoolStrategy`),options:U,className:`w-full`})}),(0,q.jsx)(h,{label:u(`modelPoolFailover`),children:(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,q.jsx)(b,{isSelected:D,ariaLabel:u(`modelPoolFailover`),label:u(`modelPoolFailover`),onChange:O,isDisabled:B}),(0,q.jsx)(y,{value:k,onChange:e=>A(e??3),minValue:1,maxValue:64,isDisabled:B||!D,children:(0,q.jsxs)(y.Group,{children:[(0,q.jsx)(y.DecrementButton,{}),(0,q.jsx)(y.Input,{"aria-label":u(`modelPoolMaxAttempts`)}),(0,q.jsx)(y.IncrementButton,{})]})}),(0,q.jsx)(p,{className:`text-caption text-muted`,children:u(`modelPoolMaxAttemptsHint`)})]})}),(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(c,{className:`text-body font-medium text-muted`,children:u(`modelPoolMembers`)}),(0,q.jsx)(p,{className:`text-caption leading-5 text-muted`,children:u(`modelPoolMembersHint`)})]}),(0,q.jsxs)(s,{size:`sm`,variant:`ghost`,onPress:()=>I(e=>[...e,J()]),isDisabled:B,children:[(0,q.jsx)(r,{size:14}),u(`modelPoolAddMember`)]})]}),j.length===0?(0,q.jsx)(`p`,{className:`rounded-lg bg-surface-secondary px-3 py-2.5 text-caption text-muted`,children:u(`modelPoolMembersEmpty`)}):(0,q.jsx)(`div`,{className:`space-y-2`,children:j.map((e,t)=>{let r=ee(n,e.provider),l=te(a,e.provider,u);return(0,q.jsxs)(`div`,{className:`rounded-xl bg-surface-secondary p-3`,children:[(0,q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,q.jsxs)(`span`,{className:`text-caption font-medium text-muted`,children:[`#`,t+1]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(s,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":u(`modelPoolMoveUp`),onPress:()=>Q(t,-1),isDisabled:B||t===0,children:(0,q.jsx)(V,{size:15})}),(0,q.jsx)(s,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":u(`modelPoolMoveDown`),onPress:()=>Q(t,1),isDisabled:B||t===j.length-1,children:(0,q.jsx)(z,{size:15})}),(0,q.jsx)(s,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":u(`delete`),onPress:()=>I(t=>t.filter(t=>t.key!==e.key)),isDisabled:B,children:(0,q.jsx)(i,{size:15})})]})]}),(0,q.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(c,{className:`text-caption text-muted`,children:u(`modelPoolProvider`)}),(0,q.jsx)(P,{value:e.provider,onChange:t=>G(e.key,{provider:t,region:``,model:``,account_id:``}),ariaLabel:u(`modelPoolProvider`),options:W,className:`w-full`})]}),(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(c,{className:`text-caption text-muted`,children:u(`modelPoolRegion`)}),(0,q.jsx)(P,{value:e.region||``,onChange:t=>G(e.key,{region:t}),ariaLabel:u(`modelPoolRegion`),options:[{id:``,label:u(`modelPoolAnyRegion`)},...r],className:`w-full`})]}),(0,q.jsxs)(`div`,{className:`space-y-1 sm:col-span-2`,children:[(0,q.jsx)(c,{className:`text-caption text-muted`,children:u(`modelPoolAccount`)}),(0,q.jsx)(P,{value:e.account_id||``,onChange:t=>{let n=o.find(e=>e.id===t);G(e.key,{account_id:t,provider:n?.provider||e.provider,region:n?.region||e.region})},ariaLabel:u(`modelPoolAccount`),options:[{id:``,label:u(`modelPoolAnyAccount`)},...Y(o,e.provider)],className:`w-full`}),(0,q.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:u(`modelPoolAccountHint`)})]}),(0,q.jsxs)(`div`,{className:`space-y-1 sm:col-span-2`,children:[(0,q.jsx)(c,{className:`text-caption text-muted`,children:u(`modelPoolModel`)}),(0,q.jsx)(P,{value:e.model,onChange:t=>G(e.key,{model:t}),ariaLabel:u(`modelPoolModel`),options:l,className:`w-full`})]}),(0,q.jsxs)(`div`,{className:`space-y-1 sm:col-span-2`,children:[(0,q.jsx)(c,{className:`text-caption text-muted`,children:u(`modelPoolWeight`)}),(0,q.jsx)(y,{value:e.weight,onChange:t=>G(e.key,{weight:t??100}),minValue:1,maxValue:1e6,isDisabled:B,children:(0,q.jsxs)(y.Group,{children:[(0,q.jsx)(y.DecrementButton,{}),(0,q.jsx)(y.Input,{"aria-label":u(`modelPoolWeight`)}),(0,q.jsx)(y.IncrementButton,{})]})})]})]}),e.provider?(0,q.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-caption text-muted`,children:[(0,q.jsx)(M,{provider:e.provider,size:14}),(0,q.jsx)(`span`,{children:N(e.provider,e.region||``,u)})]}):null]},e.key)})})]})]}),(0,q.jsxs)(_.Footer,{className:`justify-end`,children:[(0,q.jsx)(s,{variant:`ghost`,isDisabled:B,onPress:d,children:u(`cancel`)}),(0,q.jsx)(s,{type:`submit`,isPending:B,children:u(t?`save`:`create`)})]})]})})})})})}export{Q as ModelPoolPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/OverviewPage-B0hJjjae.js b/internal/webui/static/assets/OverviewPage-B0hJjjae.js new file mode 100644 index 00000000..195ce642 --- /dev/null +++ b/internal/webui/static/assets/OverviewPage-B0hJjjae.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TrafficChart-B9w8pS55.js","assets/shim-mfK0Rmj6.js","assets/gsap-C3sDxib7.js","assets/AreaChart-B0YOdVBx.js","assets/CartesianGrid-BJyfpdDb.js","assets/XAxis-DLQkFqxC.js","assets/ReferenceArea-CiIBWWEY.js","assets/FilterToggle-nA-ZS4oO.js","assets/toggle-button-group-C1kahmRj.js","assets/SharedElementTransition-BlCsXfb1.js","assets/label-j5K3TFm8.js","assets/useI18n-DAGWWg9N.js","assets/index-BYut8qRj.js","assets/overview-DcWoRgOQ.js","assets/index-Dr_4VBy4.css","assets/format-B6SmebW-.js"])))=>i.map(i=>d[i]); +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,r as i,t as a}from"./InflightLiveCard-DWPcSiCz.js";import{n as o}from"./Check.es-DrOC94kl.js";import{n as s,pt as c,r as ee}from"./useI18n-DAGWWg9N.js";import{s as te}from"./TimeRangePicker-BqBfH6td.js";import{t as ne}from"./PageAlert-BTp9jdUz.js";import{n as l}from"./useToggle-Zi1rbfHX.js";import{D as u,p as re,u as ie}from"./overview-DcWoRgOQ.js";import{r as d}from"./gsap-C3sDxib7.js";import{Kt as ae,M as oe,O as se,Yt as ce,Zt as le,g as ue,k as de,m as f,p,u as fe,w as pe}from"./index-BYut8qRj.js";import{At as m,a as h,r as g,t as _}from"./AreaChart-B0YOdVBx.js";import{c as v,i as y,n as b,s as x}from"./format-B6SmebW-.js";import{t as S}from"./ProviderMark-IiAZTaQS.js";import{n as me,t as he}from"./provider-gHnttGKq.js";import{i as ge,n as _e,r as ve,t as ye}from"./logsLink-Dske8Q7n.js";var C=t(e(),1),w=new Map([[`bold`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M236,208a12,12,0,0,1-12,12H32a12,12,0,0,1-12-12V48a12,12,0,0,1,24,0v99l43.51-43.52a12,12,0,0,1,17,0L128,127l43-43H160a12,12,0,0,1,0-24h40a12,12,0,0,1,12,12v40a12,12,0,0,1-24,0V101l-51.51,51.52a12,12,0,0,1-17,0L96,129,44,181v15H224A12,12,0,0,1,236,208Z`}))],[`duotone`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M224,64V208H32V48H208A16,16,0,0,1,224,64Z`,opacity:`0.2`}),C.createElement(`path`,{d:`M232,208a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V48a8,8,0,0,1,16,0V156.69l50.34-50.35a8,8,0,0,1,11.32,0L128,132.69,180.69,80H160a8,8,0,0,1,0-16h40a8,8,0,0,1,8,8v40a8,8,0,0,1-16,0V91.31l-58.34,58.35a8,8,0,0,1-11.32,0L96,123.31l-56,56V200H224A8,8,0,0,1,232,208Z`}))],[`fill`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM200,192H56a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v76.69l34.34-34.35a8,8,0,0,1,11.32,0L128,132.69,172.69,88H144a8,8,0,0,1,0-16h48a8,8,0,0,1,8,8v48a8,8,0,0,1-16,0V99.31l-50.34,50.35a8,8,0,0,1-11.32,0L104,131.31l-40,40V176H200a8,8,0,0,1,0,16Z`}))],[`light`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M230,208a6,6,0,0,1-6,6H32a6,6,0,0,1-6-6V48a6,6,0,0,1,12,0V161.52l53.76-53.76a6,6,0,0,1,8.48,0L128,135.51,185.52,78H160a6,6,0,0,1,0-12h40a6,6,0,0,1,6,6v40a6,6,0,0,1-12,0V86.48l-61.76,61.76a6,6,0,0,1-8.48,0L96,120.49l-58,58V202H224A6,6,0,0,1,230,208Z`}))],[`regular`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M232,208a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V48a8,8,0,0,1,16,0V156.69l50.34-50.35a8,8,0,0,1,11.32,0L128,132.69,180.69,80H160a8,8,0,0,1,0-16h40a8,8,0,0,1,8,8v40a8,8,0,0,1-16,0V91.31l-58.34,58.35a8,8,0,0,1-11.32,0L96,123.31l-56,56V200H224A8,8,0,0,1,232,208Z`}))],[`thin`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M228,208a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V48a4,4,0,0,1,8,0V166.34l57.17-57.17a4,4,0,0,1,5.66,0L128,138.34,190.34,76H160a4,4,0,0,1,0-8h40a4,4,0,0,1,4,4v40a4,4,0,0,1-8,0V81.66l-65.17,65.17a4,4,0,0,1-5.66,0L96,117.66l-60,60V204H224A4,4,0,0,1,228,208Z`}))]]),T=new Map([[`bold`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M200,28H160a20,20,0,0,0-20,20V208a20,20,0,0,0,20,20h40a20,20,0,0,0,20-20V48A20,20,0,0,0,200,28Zm-4,176H164V52h32ZM96,28H56A20,20,0,0,0,36,48V208a20,20,0,0,0,20,20H96a20,20,0,0,0,20-20V48A20,20,0,0,0,96,28ZM92,204H60V52H92Z`}))],[`duotone`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M208,48V208a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8h40A8,8,0,0,1,208,48ZM96,40H56a8,8,0,0,0-8,8V208a8,8,0,0,0,8,8H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z`,opacity:`0.2`}),C.createElement(`path`,{d:`M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z`}))],[`fill`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M216,48V208a16,16,0,0,1-16,16H160a16,16,0,0,1-16-16V48a16,16,0,0,1,16-16h40A16,16,0,0,1,216,48ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Z`}))],[`light`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M200,34H160a14,14,0,0,0-14,14V208a14,14,0,0,0,14,14h40a14,14,0,0,0,14-14V48A14,14,0,0,0,200,34Zm2,174a2,2,0,0,1-2,2H160a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2h40a2,2,0,0,1,2,2ZM96,34H56A14,14,0,0,0,42,48V208a14,14,0,0,0,14,14H96a14,14,0,0,0,14-14V48A14,14,0,0,0,96,34Zm2,174a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2H96a2,2,0,0,1,2,2Z`}))],[`regular`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z`}))],[`thin`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M200,36H160a12,12,0,0,0-12,12V208a12,12,0,0,0,12,12h40a12,12,0,0,0,12-12V48A12,12,0,0,0,200,36Zm4,172a4,4,0,0,1-4,4H160a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4h40a4,4,0,0,1,4,4ZM96,36H56A12,12,0,0,0,44,48V208a12,12,0,0,0,12,12H96a12,12,0,0,0,12-12V48A12,12,0,0,0,96,36Zm4,172a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4H96a4,4,0,0,1,4,4Z`}))]]),E=new Map([[`bold`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M234.49,111.07,90.41,22.94A20,20,0,0,0,60,39.87V216.13a20,20,0,0,0,30.41,16.93l144.08-88.13a19.82,19.82,0,0,0,0-33.86ZM84,208.85V47.15L216.16,128Z`}))],[`duotone`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M228.23,134.69,84.15,222.81A8,8,0,0,1,72,216.12V39.88a8,8,0,0,1,12.15-6.69l144.08,88.12A7.82,7.82,0,0,1,228.23,134.69Z`,opacity:`0.2`}),C.createElement(`path`,{d:`M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z`}))],[`fill`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z`}))],[`light`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M231.36,116.19,87.28,28.06a14,14,0,0,0-14.18-.27A13.69,13.69,0,0,0,66,39.87V216.13a13.69,13.69,0,0,0,7.1,12.08,14,14,0,0,0,14.18-.27l144.08-88.13a13.82,13.82,0,0,0,0-23.62Zm-6.26,13.38L81,217.7a2,2,0,0,1-2.06,0,1.78,1.78,0,0,1-1-1.61V39.87a1.78,1.78,0,0,1,1-1.61A2.06,2.06,0,0,1,80,38a2,2,0,0,1,1,.31L225.1,126.43a1.82,1.82,0,0,1,0,3.14Z`}))],[`regular`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z`}))],[`thin`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M230.32,117.9,86.24,29.79a11.91,11.91,0,0,0-12.17-.23A11.71,11.71,0,0,0,68,39.89V216.11a11.71,11.71,0,0,0,6.07,10.33,11.91,11.91,0,0,0,12.17-.23L230.32,138.1a11.82,11.82,0,0,0,0-20.2Zm-4.18,13.37L82.06,219.39a4,4,0,0,1-4.07.07,3.77,3.77,0,0,1-2-3.35V39.89a3.77,3.77,0,0,1,2-3.35,4,4,0,0,1,4.07.07l144.08,88.12a3.8,3.8,0,0,1,0,6.54Z`}))]]),D=new Map([[`bold`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M244,128v64a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h35l-67-67-31.51,31.52a12,12,0,0,1-17,0l-72-72a12,12,0,0,1,17-17L96,119l31.51-31.52a12,12,0,0,1,17,0L220,163V128a12,12,0,0,1,24,0Z`}))],[`duotone`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M232,128v64H168Z`,opacity:`0.2`}),C.createElement(`path`,{d:`M235.06,120.61a8,8,0,0,0-8.72,1.73L200,148.69,141.66,90.34a8,8,0,0,0-11.32,0L96,124.69,29.66,58.34A8,8,0,0,0,18.34,69.66l72,72a8,8,0,0,0,11.32,0L136,107.31,188.69,160l-26.35,26.34A8,8,0,0,0,168,200h64a8,8,0,0,0,8-8V128A8,8,0,0,0,235.06,120.61ZM224,184H187.31L224,147.31Z`}))],[`fill`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M240,128v64a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L188.69,160,136,107.31l-34.34,34.35a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,29.66,58.34L96,124.69l34.34-34.35a8,8,0,0,1,11.32,0L200,148.69l26.34-26.35A8,8,0,0,1,240,128Z`}))],[`light`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M238,128v64a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h49.52L136,104.49l-35.76,35.75a6,6,0,0,1-8.48,0l-72-72a6,6,0,0,1,8.48-8.48L96,127.51l35.76-35.75a6,6,0,0,1,8.48,0L226,177.52V128a6,6,0,0,1,12,0Z`}))],[`regular`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M240,128v64a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h44.69L136,107.31l-34.34,34.35a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,29.66,58.34L96,124.69l34.34-34.35a8,8,0,0,1,11.32,0L224,172.69V128a8,8,0,0,1,16,0Z`}))],[`thin`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M236,128v64a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h54.34L136,101.66,98.83,138.83a4,4,0,0,1-5.66,0l-72-72a4,4,0,0,1,5.66-5.66L96,130.34l37.17-37.17a4,4,0,0,1,5.66,0L228,182.34V128a4,4,0,0,1,8,0Z`}))]]),O=new Map([[`bold`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M244,56v64a12,12,0,0,1-24,0V85l-75.51,75.52a12,12,0,0,1-17,0L96,129,32.49,192.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0L136,135l67-67H168a12,12,0,0,1,0-24h64A12,12,0,0,1,244,56Z`}))],[`duotone`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M232,56v64L168,56Z`,opacity:`0.2`}),C.createElement(`path`,{d:`M232,48H168a8,8,0,0,0-5.66,13.66L188.69,88,136,140.69l-34.34-34.35a8,8,0,0,0-11.32,0l-72,72a8,8,0,0,0,11.32,11.32L96,123.31l34.34,34.35a8,8,0,0,0,11.32,0L200,99.31l26.34,26.35A8,8,0,0,0,240,120V56A8,8,0,0,0,232,48Zm-8,52.69L187.31,64H224Z`}))],[`fill`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M240,56v64a8,8,0,0,1-13.66,5.66L200,99.31l-58.34,58.35a8,8,0,0,1-11.32,0L96,123.31,29.66,189.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0L136,140.69,188.69,88,162.34,61.66A8,8,0,0,1,168,48h64A8,8,0,0,1,240,56Z`}))],[`light`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M238,56v64a6,6,0,0,1-12,0V70.48l-85.76,85.76a6,6,0,0,1-8.48,0L96,120.49,28.24,188.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0L136,143.51,217.52,62H168a6,6,0,0,1,0-12h64A6,6,0,0,1,238,56Z`}))],[`regular`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M240,56v64a8,8,0,0,1-16,0V75.31l-82.34,82.35a8,8,0,0,1-11.32,0L96,123.31,29.66,189.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0L136,140.69,212.69,64H168a8,8,0,0,1,0-16h64A8,8,0,0,1,240,56Z`}))],[`thin`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M236,56v64a4,4,0,0,1-8,0V65.66l-89.17,89.17a4,4,0,0,1-5.66,0L96,117.66,26.83,186.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0L136,146.34,222.34,60H168a4,4,0,0,1,0-8h64A4,4,0,0,1,236,56Z`}))]]),k=C.forwardRef((e,t)=>C.createElement(c,{ref:t,...e,weights:w}));k.displayName=`ChartLineUpIcon`;var be=k,A=C.forwardRef((e,t)=>C.createElement(c,{ref:t,...e,weights:T}));A.displayName=`PauseIcon`;var xe=A,j=C.forwardRef((e,t)=>C.createElement(c,{ref:t,...e,weights:E}));j.displayName=`PlayIcon`;var Se=j,M=C.forwardRef((e,t)=>C.createElement(c,{ref:t,...e,weights:D}));M.displayName=`TrendDownIcon`;var N=M,P=C.forwardRef((e,t)=>C.createElement(c,{ref:t,...e,weights:O}));P.displayName=`TrendUpIcon`;var Ce=P,F=n();function we({emptyLabel:e}){return(0,F.jsx)(`div`,{className:`grid min-h-56 place-items-center rounded-lg bg-surface-secondary px-4 text-body text-muted`,children:e})}function I({samples:e,capacity:t,label:n}){let r=e.length?e:[{at:0,value:0}],i=Math.max(1,t,...r.map(e=>e.value));return(0,F.jsx)(`div`,{className:`h-6 w-[120px] shrink-0`,role:`img`,"aria-label":n,children:(0,F.jsx)(m,{width:`100%`,height:`100%`,children:(0,F.jsxs)(_,{data:r,margin:{top:1,right:0,bottom:1,left:0},children:[(0,F.jsx)(g,{hide:!0,domain:[0,i]}),(0,F.jsx)(h,{type:`monotone`,dataKey:`value`,stroke:`var(--foreground)`,strokeOpacity:.7,strokeWidth:1.25,fill:`var(--foreground)`,fillOpacity:.08,isAnimationActive:!1,dot:!1})]})})})}function Te({live:e,samples:t,t:n,onConcurrencyClick:r}){let i=e?.in_flight??null,a=e?.capacity??0,o=i!=null&&a>0?i/a:0,s=a>0&&i!=null&&i>=a,c=(0,F.jsxs)(F.Fragment,{children:[n(`liveConcurrency`),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsxs)(`span`,{className:`mono tabular text-body font-semibold ${s?`text-warning`:`text-foreground`}`,children:[i??`—`,(0,F.jsxs)(`span`,{className:`font-normal text-muted`,children:[`/`,e?a:`—`]})]}),(0,F.jsx)(`span`,{className:`inline-block h-[3px] w-12 overflow-hidden rounded-[2px] bg-separator`,children:(0,F.jsx)(`span`,{className:`block h-full ${s?`bg-warning`:`bg-foreground/60`}`,style:{width:`${Math.min(100,o*100)}%`}})})]})]});return(0,F.jsxs)(`div`,{"data-testid":`live-strip`,className:`flex min-h-11 flex-wrap items-center gap-x-5 gap-y-2 overflow-hidden rounded-lg bg-surface-secondary px-4 py-2.5 text-caption text-muted sm:h-11 sm:gap-x-6 sm:gap-y-1 sm:py-0`,children:[(0,F.jsx)(`span`,{className:`inline-flex items-center`,children:(0,F.jsx)(`span`,{className:`status-dot`,"data-state":i==null?``:s?`warn`:i>0?`ok`:``})}),r?(0,F.jsx)(`button`,{type:`button`,"data-testid":`live-strip-concurrency`,onClick:r,className:`inline-flex flex-col gap-1 rounded-lg text-left outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-focus sm:flex-row sm:items-center sm:gap-2`,"aria-label":n(`inflightExpandFromConcurrency`),children:c}):(0,F.jsx)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:c}),(0,F.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveRpm`),(0,F.jsx)(`span`,{className:`mono tabular text-body font-semibold text-foreground`,children:e?.rpm??`—`})]}),(0,F.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveTrace`),(0,F.jsx)(I,{samples:t,capacity:a,label:n(`liveTrace`)})]})]})}function Ee(){return u(`/api/live`)}var De=2500,L=Math.round(6e4/De);function Oe(e){let t=e?.intervalMs??2500,[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)([]);return(0,C.useEffect)(()=>{let e=!1,n=null,i=()=>{document.hidden||Ee().then(n=>{if(e)return;r(n);let i=Math.max(L,Math.round(6e4/t));a(e=>[...e,{at:Date.now(),value:n.in_flight}].slice(-i))}).catch(()=>{})},o=()=>{n||document.hidden||(i(),n=setInterval(i,t))},s=()=>{n&&clearInterval(n),n=null},c=()=>document.hidden?s():o();return o(),document.addEventListener(`visibilitychange`,c),()=>{e=!0,s(),document.removeEventListener(`visibilitychange`,c)}},[t]),{live:n,samples:i}}var ke=(0,C.lazy)(()=>le(()=>import(`./TrafficChart-B9w8pS55.js`).then(e=>({default:e.TrafficChart})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))),Ae=3e4,je=3e4,Me={window:{from:``,to:``,hours:24},totals:{requests:0,ok:0,incomplete:0,error:0,canceled:0,streaming:0,success_rate:0},latency:{},tokens:{prompt:0,completion:0,cache_read:0,total:0},status:[],errors:[],models:[],accounts:[],providers:[],series:[]};function Ne(e,t){return!e||e===`(unknown)`?t(`statsUnknown`):he(e,t)}function Pe(e,t,n){return!t||t===`(unassigned)`?n:e.find(e=>e.id===t)?.name||t}var Fe=new Set([`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`]);function Ie(e,t){let n={quota:`logsKindQuota`,rate_limit:`logsKindRateLimit`,auth:`logsKindAuth`,not_ready:`logsKindNotReady`,unavailable:`logsKindUnavailable`,invalid_request:`logsKindInvalidRequest`,model_not_available:`logsKindModelNotAvailable`};return n[e]?t(n[e]):e}var Le=[`ok`,`incomplete`,`error`,`canceled`],R={ok:`bg-success`,incomplete:`bg-warning`,error:`bg-danger`,canceled:`bg-muted`},z={ok:`logsFilterOk`,incomplete:`logsFilterIncomplete`,error:`logsFilterError`,canceled:`logsFilterCanceled`};function B(e,t){return t>0?e/t:null}function Re(e,t){if(!e)return null;let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=Math.max(0,Math.round((n-t)/1e3));if(r<=0)return null;let i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60;return i?`${i}h ${a}m`:a?`${a}m ${String(o).padStart(2,`0`)}s`:`${o}s`}function ze(e,t){let n=[e.down_until,e.cooldown_until].filter(e=>!!e).filter(e=>Date.parse(e)>t);return n.length?n.reduce((e,t)=>Date.parse(e)>=Date.parse(t)?e:t):null}function Be(e,t){return t?`danger`:(e??0)>=80?`warning`:`ok`}function Ve(){let{lang:e,t}=s(),{overview:n,loading:c,error:u}=se(),[d,le]=(0,C.useState)(`today`),[m,h]=(0,C.useState)(null),[g,_]=(0,C.useState)(!1),b=ce(),[he,w]=(0,C.useState)(null),[T,E]=(0,C.useState)(``),[D,O]=(0,C.useState)(!0),[k,be]=(0,C.useState)([]),[A,j]=(0,C.useState)(!0),[M,N]=(0,C.useState)(0),[P,Ce]=(0,C.useState)(null),[I,Ee]=(0,C.useState)(()=>Date.now()),[L,R]=(0,C.useState)(!1),[z,Ve]=(0,C.useState)(!1),{live:V,samples:Ge}=Oe({intervalMs:L?800:De}),Ke=new Map((V?.accounts??[]).map(e=>[e.id,e])),qe=!!n?.proxy?.ok,Je=!!n?.worker?.ok,Ye=n?.worker?.ready_count??0,Xe=n?.worker?.hot_count??0,Ze=V?.in_flight??n?.worker?.in_flight??0,U=he??Me,Qe=(0,C.useMemo)(()=>({requests:t(`chartMetricRequests`),tokens:t(`chartMetricTokens`),latency:t(`chartMetricLatency`),input:t(`chartInput`),output:t(`chartOutput`),cacheRead:t(`chartCacheRead`),p50:t(`statsLatencyP50`),p95:t(`statsLatencyP95`),total:t(`chartTotal`)}),[t]),$e=(0,C.useCallback)((e,t)=>b(ye({},e,t)),[b]),W=n?.routing?.session_affinity,et=(W?.hits??0)+(W?.misses??0),tt=B(W?.hits??0,et),G=k.map(e=>({account:e,until:ze(e,I)})).filter(e=>e.until!=null),nt=G.length>0,rt=new Set(G.map(e=>e.account.id)),it=[...k.filter(e=>e.ready&&!rt.has(e.id)),...k.filter(e=>!e.ready&&!rt.has(e.id))].slice(0,6);(0,C.useEffect)(()=>{if(!nt)return;let e=setInterval(()=>Ee(Date.now()),1e3);return()=>clearInterval(e)},[nt]),(0,C.useEffect)(()=>{let e=!1;return Promise.allSettled([ie(!1),re()]).then(([t,n])=>{e||(t.status===`fulfilled`&&be(t.value.data||[]),n.status===`fulfilled`&&N((n.value.data||[]).length))}).finally(()=>{e||j(!1)}),()=>{e=!0}},[]);let at=m?.start?.toString()??``,ot=m?.end?.toString()??``,K=(0,C.useRef)(0),q=(0,C.useCallback)(e=>{let t=ge(d,m);if(!t){O(!1);return}let n=++K.current;te(t).then(e=>{n===K.current&&(w(e),E(``))}).catch(t=>{n!==K.current||e||(w(null),E(t instanceof Error?t.message:String(t)))}).finally(()=>{n===K.current&&O(!1)})},[d,at,ot]);(0,C.useEffect)(()=>(q(!1),()=>{K.current++}),[q]),(0,C.useEffect)(()=>{if(g)return;let e=Date.now(),t=()=>{document.hidden||(e=Date.now(),q(!0))},n=setInterval(t,Ae),r=()=>{!document.hidden&&Date.now()-e>=Ae&&t()};return document.addEventListener(`visibilitychange`,r),()=>{clearInterval(n),document.removeEventListener(`visibilitychange`,r)}},[g,q]),(0,C.useEffect)(()=>{let e=!1,t=Date.now(),n=()=>{document.hidden||(t=Date.now(),pe().then(t=>{e||Ce(t)}).catch(()=>{}))};n();let r=setInterval(n,je),i=()=>{!document.hidden&&Date.now()-t>=je&&n()};return document.addEventListener(`visibilitychange`,i),()=>{e=!0,clearInterval(r),document.removeEventListener(`visibilitychange`,i)}},[]);let J=Math.floor(U.series.length/2),Y=(e,t)=>e.reduce((e,n)=>e+n[t],0),X=U.series.slice(0,J),Z=U.series.slice(J),st=((e,t)=>e>0?(t-e)/e:null)(Y(X,`requests`),Y(Z,`requests`)),ct=Y(X,`requests`)?Y(X,`ok`)/Y(X,`requests`):null,Q=Y(Z,`requests`)?Y(Z,`ok`)/Y(Z,`requests`):null,lt=ct!=null&&Q!=null?Q-ct:null,ut=[{label:t(`metricRequests`),value:U.totals.requests,kind:`compact`,detail:t(`statsWindowHint`,{window:t(ve[d])}),ok:U.totals.requests>0,trend:st},{label:t(`metricSuccess`),value:U.totals.success_rate,kind:`percent`,detail:`${U.totals.ok} ${t(`logsFilterOk`)} · ${U.totals.incomplete} ${t(`logsFilterIncomplete`)} · ${U.totals.error} ${t(`logsFilterError`)}`,ok:U.totals.requests===0||U.totals.success_rate>=.9,trend:lt},{label:t(`metricLatency`),value:U.latency.p95_ms??U.latency.avg_ms,kind:`ms`,detail:`p50 ${x(U.latency.p50_ms)} · avg ${x(U.latency.avg_ms)}`,ok:U.latency.p95_ms==null||U.latency.p95_ms<8e3,trend:null},{label:t(`metricTokens`),value:U.tokens.total,kind:`compact`,detail:`${y(U.tokens.prompt)} / ${y(U.tokens.completion)}`,ok:!0,trend:null}],dt=B(U.tokens.cache_read,U.tokens.prompt),ft=B(U.totals.streaming,U.totals.requests),pt=[{label:t(`metricCacheHit`),value:dt,kind:`percent`,detail:t(`metricCacheHitDetail`,{read:y(U.tokens.cache_read),prompt:y(U.tokens.prompt)})},{label:t(`metricStreaming`),value:ft,kind:`percent`,detail:t(`metricStreamingDetail`,{count:U.totals.streaming,total:U.totals.requests})},{label:t(`metricCanceled`),value:U.totals.canceled,kind:`int`,detail:t(`metricCanceledDetail`,{rate:v(B(U.totals.canceled,U.totals.requests)??0)})}],mt=Le.map(e=>({key:e,count:U.status.find(t=>t.key===e)?.count??U.totals[e]??0})),$=e=>ye(e,U.window.from,U.window.to);return c&&!n?(0,F.jsx)(fe,{}):(0,F.jsxs)(`div`,{className:`space-y-5 sm:space-y-4`,children:[(0,F.jsxs)(`section`,{className:`grid gap-3 pb-1 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:t(`homeDisplay`)}),(0,F.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:t(`homeLead`)})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,F.jsx)(_e,{value:d,onChange:le,custom:m,onCustomChange:h,onBusy:()=>O(!0),t}),(0,F.jsxs)(de,{delay:300,children:[(0,F.jsx)(ee,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(g?`statsRefreshResume`:`statsRefreshPause`),"aria-pressed":g,onPress:()=>_(e=>!e),children:g?(0,F.jsx)(Se,{size:14}):(0,F.jsx)(xe,{size:14})}),(0,F.jsx)(de.Content,{children:t(g?`statsRefreshPaused`:`statsRefreshAuto`)})]}),(0,F.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,F.jsx)(`div`,{className:`mono text-caption text-muted`,children:n?.time||`—`}),(0,F.jsxs)(`div`,{className:`mt-1 inline-flex items-center gap-2 text-body font-medium`,children:[(0,F.jsx)(`span`,{className:`status-dot`,"data-state":qe&&Je?`ok`:`danger`}),t(qe&&Je?`running`:`degraded`)]})]})]})]}),u?(0,F.jsx)(ne,{title:t(`failedOverview`,{msg:u})}):null,(0,F.jsx)(Te,{live:V,samples:Ge,t,onConcurrencyClick:()=>R(!0)}),(0,F.jsx)(a,{t,expanded:L,onExpandedChange:R,live:L?V:null}),(0,F.jsx)(`section`,{"data-gsap-reveal":!0,className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:ut.map(e=>(0,F.jsxs)(l,{className:`gap-0 p-3.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,F.jsx)(`span`,{className:`status-dot`,"data-state":e.ok?`ok`:`danger`})]}),(0,F.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`tabular text-metric font-medium leading-none`,children:D?(0,F.jsx)(f,{className:`h-7 w-24`}):e.value==null?`—`:(0,F.jsx)(r,{value:e.value,kind:e.kind})}),!D&&e.trend!=null?(0,F.jsx)(Ue,{value:e.trend,hint:t(`trendHalfHint`)}):null]}),(0,F.jsx)(`div`,{className:`mono mt-2 truncate text-caption text-muted`,children:D?(0,F.jsx)(f,{className:`h-3 w-28`}):e.detail})]},e.label))}),(0,F.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-3`,children:pt.map(e=>(0,F.jsx)(l,{className:`gap-0 p-3.5`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,F.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:D?(0,F.jsx)(f,{className:`h-3 w-28`}):e.detail})]}),(0,F.jsx)(`div`,{className:`tabular text-section font-semibold sm:shrink-0`,children:D?(0,F.jsx)(f,{className:`h-5 w-12`}):e.value==null?`—`:(0,F.jsx)(r,{value:e.value,kind:e.kind})})]})},e.label))}),(0,F.jsx)(`section`,{className:`grid gap-3`,children:(0,F.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTraffic`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTrafficHint`)})]}),(0,F.jsx)(oe,{size:`sm`,variant:`soft`,color:U.totals.error?`warning`:`success`,children:v(U.totals.success_rate)})]}),(0,F.jsxs)(`div`,{className:`space-y-4 p-4`,children:[T?(0,F.jsx)(`div`,{className:`text-body text-danger`,children:t(`failedStats`,{msg:T})}):D?(0,F.jsx)(ue,{}):U.series.some(e=>e.requests>0)?(0,F.jsx)(C.Suspense,{fallback:(0,F.jsx)(ue,{}),children:(0,F.jsx)(ke,{series:U.series,lang:e,emptyLabel:t(`statsEmptyTraffic`),okLabel:t(`logsFilterOk`),errorLabel:t(`logsFilterError`),selectHint:t(`statsDragHint`),labels:Qe,onSelectRange:$e})}):(0,F.jsx)(we,{emptyLabel:t(`statsEmptyTraffic`)}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-4 pt-3 sm:grid-cols-4 sm:gap-3`,children:[[t(`statsLatencyP50`),x(U.latency.p50_ms)],[t(`statsLatencyP95`),x(U.latency.p95_ms)],[t(`statsLatencyAvg`),x(U.latency.avg_ms)],[t(`statsTTFB`),x(U.latency.ttfb_avg_ms)]].map(([e,t])=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,F.jsx)(`div`,{className:`mono mt-1 text-body font-medium`,children:D?(0,F.jsx)(f,{className:`h-4 w-16`}):t})]},String(e)))})]})]})}),(0,F.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,.85fr)]`,children:[(0,F.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:t(`statsPool`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsPoolHint`)})]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[!A&&G.length?(0,F.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-2xl bg-surface-secondary px-2 py-0.5 text-caption text-muted transition-colors hover:text-foreground`,"aria-expanded":z,"aria-label":t(`statsCoolingChip`,{count:G.length}),onClick:()=>Ve(e=>!e),children:[(0,F.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":`warn`}),(0,F.jsx)(`span`,{className:`mono tabular`,children:t(`statsCoolingChip`,{count:G.length})}),(0,F.jsx)(o,{size:10,className:`transition-transform duration-200 ${z?`rotate-90`:``}`,"aria-hidden":!0})]}):null,(0,F.jsxs)(ae,{to:`/accounts`,className:`inline-flex items-center gap-1 text-caption font-medium text-muted hover:text-foreground`,children:[t(`navAccounts`),(0,F.jsx)(i,{size:12})]})]})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 gap-y-1 border-b border-separator sm:grid-cols-4 sm:gap-y-0`,children:[[t(`ready`),Ye,`ok`],[t(`hot`),Xe,Xe?`ok`:``],[t(`inFlight`),Ze,Ze?`ok`:``],[t(`statsAffinityHit`),tt==null?`—`:v(tt),``,W?t(`statsAffinityHint`,{hits:W.hits??0,misses:W.misses??0,bindings:W.bindings??0}):``]].map(([e,t,n,r])=>(0,F.jsxs)(`div`,{className:`px-4 py-3 sm:py-2.5`,title:r?String(r):void 0,children:[(0,F.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,F.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 sm:mt-1`,children:[(0,F.jsx)(`span`,{className:`mono text-section font-semibold`,children:t}),n?(0,F.jsx)(`span`,{className:`status-dot`,"data-state":n}):null]})]},String(e)))}),z&&G.length?(0,F.jsxs)(`div`,{className:`border-b border-separator bg-surface-secondary/50 px-4 py-2`,children:[(0,F.jsx)(`div`,{className:`text-caption text-muted`,children:t(`statsCoolingDetails`)}),(0,F.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:G.map(({account:e,until:n})=>(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-caption`,children:[(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground/80`,children:e.name||e.id}),(0,F.jsx)(`span`,{className:`mono shrink-0 text-muted`,children:e.last_error_kind?Ie(e.last_error_kind,t):t(`statsUnknown`)}),(0,F.jsx)(`span`,{className:`mono shrink-0 tabular text-muted sm:w-16 sm:text-right`,children:Re(n,I)??`—`}),(0,F.jsx)(`span`,{className:`mono hidden shrink-0 text-muted sm:inline sm:w-10 sm:text-right`,title:t(`statsBackoffLevel`),children:e.restart_backoff_level?`L${e.restart_backoff_level}`:`—`})]},e.id))})]}):null,(0,F.jsx)(`div`,{className:`divide-y divide-separator`,children:A?(0,F.jsx)(p,{}):k.length===0?(0,F.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t(`noAccounts`)}):it.length===0?(0,F.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t(`statsPoolReadyEmpty`)}):it.map(e=>{let n=e.quota,r=Be(n?.percentage,n?.exceeded),i=Ke.get(e.id),a=i?.in_flight??e.in_flight??e.inFlight??0,o=i?.max_inflight||e.max_inflight||4,s=a>=o;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2.5 px-4 py-3 sm:flex-row sm:items-center sm:gap-3 sm:py-2.5`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3 sm:items-center`,children:[(0,F.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0 sm:mt-0`,"data-state":e.ready?`ok`:`danger`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(S,{provider:e.provider,size:14}),(0,F.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.name||e.id})]}),(0,F.jsxs)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:[me(e.provider,e.region,t),` · `,e.hot?t(`hot`):e.ready?t(`ready`):t(`degraded`)]})]})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 pl-6 sm:shrink-0 sm:pl-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:t(s?`liveSaturated`:`inFlight`),"data-testid":`account-inflight`,children:[(0,F.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:t(`inFlight`)}),(0,F.jsxs)(`span`,{className:`mono text-caption tabular ${s?`text-warning`:`text-muted`}`,children:[a,`/`,o]}),(0,F.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,F.jsx)(`span`,{className:`block h-full ${s?`bg-warning`:`bg-foreground/50`}`,style:{width:`${Math.min(100,a/o*100)}%`}})})]}),n?(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:t(`quota`),children:[(0,F.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:t(`quota`)}),(0,F.jsxs)(`span`,{className:`mono text-caption tabular text-muted`,children:[Math.round(n.percentage??0),`%`]}),(0,F.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,F.jsx)(`span`,{className:`block h-full ${r===`danger`?`bg-danger`:r===`warning`?`bg-warning`:`bg-success`}`,style:{width:`${Math.min(100,Math.max(0,n.percentage??0))}%`}})})]}):null]})]},e.id)})}),(0,F.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,F.jsxs)(`span`,{children:[t(`metricModels`),` `,M]}),(0,F.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[[`qoder`,`workbuddy`,`trae`].map(e=>{let t=k.filter(t=>String(t.provider||`qoder`).toLowerCase()===e).length;return t?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(S,{provider:e,size:11}),t]},e):null}),(0,F.jsxs)(`span`,{children:[k.length,` `,t(`accountCount`)]})]})]})]}),(0,F.jsx)(He,{resources:P,t})]}),(0,F.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-2 2xl:grid-cols-3`,children:[(0,F.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,F.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopProviders`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTopProvidersHint`)})]})}),D?(0,F.jsx)(p,{}):(0,F.jsx)(H,{empty:t(`statsNoProviders`),items:(U.providers||[]).map(e=>({key:e.key,label:Ne(e.key,t),count:e.count,meta:`${e.ok}/${e.count}`,mark:e.key===`(unknown)`?void 0:e.key,href:e.key===`(unknown)`?void 0:$({provider:e.key})}))})]}),(0,F.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,F.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopModels`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`providerCatalog`)})]})}),D?(0,F.jsx)(p,{rows:4}):(0,F.jsx)(H,{empty:t(`statsNoModels`),items:U.models.map(e=>({key:e.key,label:e.key===`(unknown)`?t(`statsUnknown`):e.key,count:e.count,href:e.key===`(unknown)`?void 0:$({model:e.key}),meta:e.latency_avg_ms==null?`${e.ok}/${e.count}`:x(e.latency_avg_ms)}))})]}),(0,F.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,F.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:t(`statsStatusMix`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsStatusMixHint`)})]})}),D?(0,F.jsx)(p,{rows:4}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(We,{items:mt,t}),(0,F.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsErrorMix`)}),(0,F.jsx)(H,{empty:t(`statsNoErrors`),danger:!0,items:U.errors.map(e=>({key:e.key,label:Ie(e.key,t),count:e.count,href:Fe.has(e.key)?$({error_kind:e.key}):void 0}))}),(0,F.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsTopAccounts`)}),(0,F.jsx)(H,{empty:t(`statsNoAccounts`),items:U.accounts.slice(0,5).map(e=>({key:e.key,label:Pe(k,e.key,t(`statsUnassigned`)),count:e.count,href:!e.key||e.key===`(unassigned)`?void 0:$({account:e.key}),meta:`${e.ok}/${e.count}`}))})]})]})]})]})}function V(e,t){return e>=2147483648||t>=200?`danger`:e>=1073741824||t>=100?`warning`:`ok`}function He({resources:e,t}){let n=[...e?.workers??[]].sort((e,t)=>t.rss_bytes-e.rss_bytes),r=e?.server;return(0,F.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:t(`resTitle`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`resHint`)})]}),(0,F.jsx)(oe,{size:`sm`,variant:`soft`,color:e?`success`:`default`,children:e?b(e.total_rss_bytes):`—`})]}),(0,F.jsx)(`div`,{className:`divide-y divide-separator`,children:e?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":V(r?.rss_bytes??0,r?.cpu_percent??0)}),(0,F.jsx)(`div`,{className:`truncate text-body font-medium`,children:t(`resServer`)}),(0,F.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,r?.pid]})]}),(0,F.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[b(r?.rss_bytes),` · `,(r?.cpu_percent??0).toFixed(1),`%`]})]})}),n.length===0?(0,F.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`resEmpty`)}):n.map(e=>(0,F.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":V(e.rss_bytes,e.cpu_percent)}),(0,F.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label||e.account_id}),(0,F.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,e.pid]})]}),(0,F.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[b(e.rss_bytes),` · `,e.cpu_percent.toFixed(1),`%`]})]})},e.pid))]}):(0,F.jsx)(p,{rows:3})}),(0,F.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,F.jsxs)(`span`,{className:`mono`,children:[r?.goroutines??0,` `,t(`resGoroutines`)]}),(0,F.jsx)(`span`,{className:`mono`,children:e?.sampled_at?new Date(e.sampled_at).toLocaleTimeString():`—`})]})]})}function H({items:e,empty:t,danger:n}){let r=(0,C.useRef)(null),i=Math.max(1,...e.map(e=>e.count)),a=e.map(e=>`${e.key}:${e.count}`).join(`|`);return(0,C.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=d.context(()=>{let e=d.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{d.set(`[data-rank-fill]`,{clearProps:`transform`})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=d.utils.toArray(`[data-rank-fill]`);e.length&&d.fromTo(e,{scaleX:0},{scaleX:1,duration:.38,ease:`power2.out`,stagger:.05,transformOrigin:`0% 50%`})})},e);return()=>t.revert()},[a]),e.length?(0,F.jsx)(`div`,{ref:r,className:`divide-y divide-separator`,children:e.map(e=>{let t=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.mark?(0,F.jsx)(S,{provider:e.mark,size:14}):null,(0,F.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label})]}),(0,F.jsx)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:e.meta?`${e.count} · ${e.meta}`:e.count})]}),(0,F.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-[2px] bg-separator`,children:(0,F.jsx)(`div`,{"data-rank-fill":!0,className:`h-full origin-left rounded-[2px] ${n?`bg-danger`:`bg-success`}`,style:{width:`${Math.max(6,e.count/i*100)}%`}})})]});return e.href?(0,F.jsx)(ae,{to:e.href,className:`rank-row block px-4 py-2.5`,title:e.label,children:t},e.key):(0,F.jsx)(`div`,{className:`px-4 py-2.5`,children:t},e.key)})}):(0,F.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t})}function Ue({value:e,hint:t}){let n=Math.abs(e)<.005?`flat`:e>0?`up`:`down`;return(0,F.jsxs)(`span`,{className:`trend-chip`,"data-tone":n,title:t,children:[(0,F.jsx)(n===`down`?N:n===`up`?Ce:be,{size:12,weight:`bold`}),e>0?`+`:``,(e*100).toFixed(1),`%`]})}function We({items:e,t}){let n=e.reduce((e,t)=>e+t.count,0);return n?(0,F.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,F.jsx)(`div`,{className:`flex h-2 gap-px overflow-hidden rounded-[3px] bg-separator`,role:`img`,"aria-label":e.map(e=>`${t(z[e.key])} ${e.count}`).join(`, `),children:e.filter(e=>e.count>0).map(e=>(0,F.jsx)(`div`,{className:R[e.key],style:{width:`${e.count/n*100}%`,minWidth:2}},e.key))}),(0,F.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-x-4 gap-y-1.5`,children:e.map(e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,F.jsx)(`span`,{className:`inline-block size-2 shrink-0 rounded-[2px] ${R[e.key]}`}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted`,children:t(z[e.key])}),(0,F.jsx)(`span`,{className:`mono tabular`,children:e.count}),(0,F.jsx)(`span`,{className:`mono w-10 text-right tabular text-muted`,children:v(e.count/n)})]},e.key))})]}):(0,F.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`statsEmptyTraffic`)})}export{Ve as OverviewPage,we as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/OverviewPage-C6NTQijS.js b/internal/webui/static/assets/OverviewPage-C6NTQijS.js deleted file mode 100644 index 0727b737..00000000 --- a/internal/webui/static/assets/OverviewPage-C6NTQijS.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TrafficChart-BdqUGU1Q.js","assets/shim-mfK0Rmj6.js","assets/gsap-C3sDxib7.js","assets/AreaChart-B0YOdVBx.js","assets/CartesianGrid-BJyfpdDb.js","assets/XAxis-DLQkFqxC.js","assets/ReferenceArea-CiIBWWEY.js","assets/FilterToggle-Bygki2HF.js","assets/toggle-button-group-DR9Hhwb5.js","assets/SharedElementTransition-BlCsXfb1.js","assets/label-DLoR3Z-C.js","assets/useI18n-B77RWTNi.js","assets/index-CmGY2WQi.js","assets/index-CiXcUE0I.css","assets/format-B6SmebW-.js"])))=>i.map(i=>d[i]); -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,r as i,t as a}from"./InflightLiveCard-CQIDgYNq.js";import{n as o}from"./Check.es-BqA3iE7U.js";import{n as s,pt as c,r as ee}from"./useI18n-B77RWTNi.js";import{s as te}from"./TimeRangePicker-KlLSf1l-.js";import{t as ne}from"./PageAlert-r7ZVsH9h.js";import{n as l}from"./useToggle-BRoRhkOA.js";import{r as u}from"./gsap-C3sDxib7.js";import{$ as d,C as re,D as ie,I as ae,Sn as oe,_n as se,at as ce,bn as le,f,h as ue,l as de,nt as fe,p,z as pe}from"./index-CmGY2WQi.js";import{At as m,a as h,r as g,t as _}from"./AreaChart-B0YOdVBx.js";import{c as v,i as y,n as b,s as x}from"./format-B6SmebW-.js";import{t as S}from"./ProviderMark-IiAZTaQS.js";import{n as me,t as he}from"./provider-gHnttGKq.js";import{i as ge,n as _e,r as ve,t as ye}from"./logsLink-BKfeKxl0.js";var C=t(e(),1),w=new Map([[`bold`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M236,208a12,12,0,0,1-12,12H32a12,12,0,0,1-12-12V48a12,12,0,0,1,24,0v99l43.51-43.52a12,12,0,0,1,17,0L128,127l43-43H160a12,12,0,0,1,0-24h40a12,12,0,0,1,12,12v40a12,12,0,0,1-24,0V101l-51.51,51.52a12,12,0,0,1-17,0L96,129,44,181v15H224A12,12,0,0,1,236,208Z`}))],[`duotone`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M224,64V208H32V48H208A16,16,0,0,1,224,64Z`,opacity:`0.2`}),C.createElement(`path`,{d:`M232,208a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V48a8,8,0,0,1,16,0V156.69l50.34-50.35a8,8,0,0,1,11.32,0L128,132.69,180.69,80H160a8,8,0,0,1,0-16h40a8,8,0,0,1,8,8v40a8,8,0,0,1-16,0V91.31l-58.34,58.35a8,8,0,0,1-11.32,0L96,123.31l-56,56V200H224A8,8,0,0,1,232,208Z`}))],[`fill`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM200,192H56a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v76.69l34.34-34.35a8,8,0,0,1,11.32,0L128,132.69,172.69,88H144a8,8,0,0,1,0-16h48a8,8,0,0,1,8,8v48a8,8,0,0,1-16,0V99.31l-50.34,50.35a8,8,0,0,1-11.32,0L104,131.31l-40,40V176H200a8,8,0,0,1,0,16Z`}))],[`light`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M230,208a6,6,0,0,1-6,6H32a6,6,0,0,1-6-6V48a6,6,0,0,1,12,0V161.52l53.76-53.76a6,6,0,0,1,8.48,0L128,135.51,185.52,78H160a6,6,0,0,1,0-12h40a6,6,0,0,1,6,6v40a6,6,0,0,1-12,0V86.48l-61.76,61.76a6,6,0,0,1-8.48,0L96,120.49l-58,58V202H224A6,6,0,0,1,230,208Z`}))],[`regular`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M232,208a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V48a8,8,0,0,1,16,0V156.69l50.34-50.35a8,8,0,0,1,11.32,0L128,132.69,180.69,80H160a8,8,0,0,1,0-16h40a8,8,0,0,1,8,8v40a8,8,0,0,1-16,0V91.31l-58.34,58.35a8,8,0,0,1-11.32,0L96,123.31l-56,56V200H224A8,8,0,0,1,232,208Z`}))],[`thin`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M228,208a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V48a4,4,0,0,1,8,0V166.34l57.17-57.17a4,4,0,0,1,5.66,0L128,138.34,190.34,76H160a4,4,0,0,1,0-8h40a4,4,0,0,1,4,4v40a4,4,0,0,1-8,0V81.66l-65.17,65.17a4,4,0,0,1-5.66,0L96,117.66l-60,60V204H224A4,4,0,0,1,228,208Z`}))]]),T=new Map([[`bold`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M200,28H160a20,20,0,0,0-20,20V208a20,20,0,0,0,20,20h40a20,20,0,0,0,20-20V48A20,20,0,0,0,200,28Zm-4,176H164V52h32ZM96,28H56A20,20,0,0,0,36,48V208a20,20,0,0,0,20,20H96a20,20,0,0,0,20-20V48A20,20,0,0,0,96,28ZM92,204H60V52H92Z`}))],[`duotone`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M208,48V208a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8h40A8,8,0,0,1,208,48ZM96,40H56a8,8,0,0,0-8,8V208a8,8,0,0,0,8,8H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z`,opacity:`0.2`}),C.createElement(`path`,{d:`M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z`}))],[`fill`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M216,48V208a16,16,0,0,1-16,16H160a16,16,0,0,1-16-16V48a16,16,0,0,1,16-16h40A16,16,0,0,1,216,48ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Z`}))],[`light`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M200,34H160a14,14,0,0,0-14,14V208a14,14,0,0,0,14,14h40a14,14,0,0,0,14-14V48A14,14,0,0,0,200,34Zm2,174a2,2,0,0,1-2,2H160a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2h40a2,2,0,0,1,2,2ZM96,34H56A14,14,0,0,0,42,48V208a14,14,0,0,0,14,14H96a14,14,0,0,0,14-14V48A14,14,0,0,0,96,34Zm2,174a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2H96a2,2,0,0,1,2,2Z`}))],[`regular`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z`}))],[`thin`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M200,36H160a12,12,0,0,0-12,12V208a12,12,0,0,0,12,12h40a12,12,0,0,0,12-12V48A12,12,0,0,0,200,36Zm4,172a4,4,0,0,1-4,4H160a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4h40a4,4,0,0,1,4,4ZM96,36H56A12,12,0,0,0,44,48V208a12,12,0,0,0,12,12H96a12,12,0,0,0,12-12V48A12,12,0,0,0,96,36Zm4,172a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4H96a4,4,0,0,1,4,4Z`}))]]),E=new Map([[`bold`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M234.49,111.07,90.41,22.94A20,20,0,0,0,60,39.87V216.13a20,20,0,0,0,30.41,16.93l144.08-88.13a19.82,19.82,0,0,0,0-33.86ZM84,208.85V47.15L216.16,128Z`}))],[`duotone`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M228.23,134.69,84.15,222.81A8,8,0,0,1,72,216.12V39.88a8,8,0,0,1,12.15-6.69l144.08,88.12A7.82,7.82,0,0,1,228.23,134.69Z`,opacity:`0.2`}),C.createElement(`path`,{d:`M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z`}))],[`fill`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z`}))],[`light`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M231.36,116.19,87.28,28.06a14,14,0,0,0-14.18-.27A13.69,13.69,0,0,0,66,39.87V216.13a13.69,13.69,0,0,0,7.1,12.08,14,14,0,0,0,14.18-.27l144.08-88.13a13.82,13.82,0,0,0,0-23.62Zm-6.26,13.38L81,217.7a2,2,0,0,1-2.06,0,1.78,1.78,0,0,1-1-1.61V39.87a1.78,1.78,0,0,1,1-1.61A2.06,2.06,0,0,1,80,38a2,2,0,0,1,1,.31L225.1,126.43a1.82,1.82,0,0,1,0,3.14Z`}))],[`regular`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z`}))],[`thin`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M230.32,117.9,86.24,29.79a11.91,11.91,0,0,0-12.17-.23A11.71,11.71,0,0,0,68,39.89V216.11a11.71,11.71,0,0,0,6.07,10.33,11.91,11.91,0,0,0,12.17-.23L230.32,138.1a11.82,11.82,0,0,0,0-20.2Zm-4.18,13.37L82.06,219.39a4,4,0,0,1-4.07.07,3.77,3.77,0,0,1-2-3.35V39.89a3.77,3.77,0,0,1,2-3.35,4,4,0,0,1,4.07.07l144.08,88.12a3.8,3.8,0,0,1,0,6.54Z`}))]]),D=new Map([[`bold`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M244,128v64a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h35l-67-67-31.51,31.52a12,12,0,0,1-17,0l-72-72a12,12,0,0,1,17-17L96,119l31.51-31.52a12,12,0,0,1,17,0L220,163V128a12,12,0,0,1,24,0Z`}))],[`duotone`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M232,128v64H168Z`,opacity:`0.2`}),C.createElement(`path`,{d:`M235.06,120.61a8,8,0,0,0-8.72,1.73L200,148.69,141.66,90.34a8,8,0,0,0-11.32,0L96,124.69,29.66,58.34A8,8,0,0,0,18.34,69.66l72,72a8,8,0,0,0,11.32,0L136,107.31,188.69,160l-26.35,26.34A8,8,0,0,0,168,200h64a8,8,0,0,0,8-8V128A8,8,0,0,0,235.06,120.61ZM224,184H187.31L224,147.31Z`}))],[`fill`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M240,128v64a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L188.69,160,136,107.31l-34.34,34.35a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,29.66,58.34L96,124.69l34.34-34.35a8,8,0,0,1,11.32,0L200,148.69l26.34-26.35A8,8,0,0,1,240,128Z`}))],[`light`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M238,128v64a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h49.52L136,104.49l-35.76,35.75a6,6,0,0,1-8.48,0l-72-72a6,6,0,0,1,8.48-8.48L96,127.51l35.76-35.75a6,6,0,0,1,8.48,0L226,177.52V128a6,6,0,0,1,12,0Z`}))],[`regular`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M240,128v64a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h44.69L136,107.31l-34.34,34.35a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,29.66,58.34L96,124.69l34.34-34.35a8,8,0,0,1,11.32,0L224,172.69V128a8,8,0,0,1,16,0Z`}))],[`thin`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M236,128v64a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h54.34L136,101.66,98.83,138.83a4,4,0,0,1-5.66,0l-72-72a4,4,0,0,1,5.66-5.66L96,130.34l37.17-37.17a4,4,0,0,1,5.66,0L228,182.34V128a4,4,0,0,1,8,0Z`}))]]),O=new Map([[`bold`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M244,56v64a12,12,0,0,1-24,0V85l-75.51,75.52a12,12,0,0,1-17,0L96,129,32.49,192.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0L136,135l67-67H168a12,12,0,0,1,0-24h64A12,12,0,0,1,244,56Z`}))],[`duotone`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M232,56v64L168,56Z`,opacity:`0.2`}),C.createElement(`path`,{d:`M232,48H168a8,8,0,0,0-5.66,13.66L188.69,88,136,140.69l-34.34-34.35a8,8,0,0,0-11.32,0l-72,72a8,8,0,0,0,11.32,11.32L96,123.31l34.34,34.35a8,8,0,0,0,11.32,0L200,99.31l26.34,26.35A8,8,0,0,0,240,120V56A8,8,0,0,0,232,48Zm-8,52.69L187.31,64H224Z`}))],[`fill`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M240,56v64a8,8,0,0,1-13.66,5.66L200,99.31l-58.34,58.35a8,8,0,0,1-11.32,0L96,123.31,29.66,189.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0L136,140.69,188.69,88,162.34,61.66A8,8,0,0,1,168,48h64A8,8,0,0,1,240,56Z`}))],[`light`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M238,56v64a6,6,0,0,1-12,0V70.48l-85.76,85.76a6,6,0,0,1-8.48,0L96,120.49,28.24,188.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0L136,143.51,217.52,62H168a6,6,0,0,1,0-12h64A6,6,0,0,1,238,56Z`}))],[`regular`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M240,56v64a8,8,0,0,1-16,0V75.31l-82.34,82.35a8,8,0,0,1-11.32,0L96,123.31,29.66,189.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0L136,140.69,212.69,64H168a8,8,0,0,1,0-16h64A8,8,0,0,1,240,56Z`}))],[`thin`,C.createElement(C.Fragment,null,C.createElement(`path`,{d:`M236,56v64a4,4,0,0,1-8,0V65.66l-89.17,89.17a4,4,0,0,1-5.66,0L96,117.66,26.83,186.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0L136,146.34,222.34,60H168a4,4,0,0,1,0-8h64A4,4,0,0,1,236,56Z`}))]]),k=C.forwardRef((e,t)=>C.createElement(c,{ref:t,...e,weights:w}));k.displayName=`ChartLineUpIcon`;var be=k,A=C.forwardRef((e,t)=>C.createElement(c,{ref:t,...e,weights:T}));A.displayName=`PauseIcon`;var xe=A,j=C.forwardRef((e,t)=>C.createElement(c,{ref:t,...e,weights:E}));j.displayName=`PlayIcon`;var Se=j,M=C.forwardRef((e,t)=>C.createElement(c,{ref:t,...e,weights:D}));M.displayName=`TrendDownIcon`;var N=M,P=C.forwardRef((e,t)=>C.createElement(c,{ref:t,...e,weights:O}));P.displayName=`TrendUpIcon`;var Ce=P,F=n();function we({emptyLabel:e}){return(0,F.jsx)(`div`,{className:`grid min-h-56 place-items-center rounded-lg bg-surface-secondary px-4 text-body text-muted`,children:e})}function I({samples:e,capacity:t,label:n}){let r=e.length?e:[{at:0,value:0}],i=Math.max(1,t,...r.map(e=>e.value));return(0,F.jsx)(`div`,{className:`h-6 w-[120px] shrink-0`,role:`img`,"aria-label":n,children:(0,F.jsx)(m,{width:`100%`,height:`100%`,children:(0,F.jsxs)(_,{data:r,margin:{top:1,right:0,bottom:1,left:0},children:[(0,F.jsx)(g,{hide:!0,domain:[0,i]}),(0,F.jsx)(h,{type:`monotone`,dataKey:`value`,stroke:`var(--foreground)`,strokeOpacity:.7,strokeWidth:1.25,fill:`var(--foreground)`,fillOpacity:.08,isAnimationActive:!1,dot:!1})]})})})}function Te({live:e,samples:t,t:n,onConcurrencyClick:r}){let i=e?.in_flight??null,a=e?.capacity??0,o=i!=null&&a>0?i/a:0,s=a>0&&i!=null&&i>=a,c=(0,F.jsxs)(F.Fragment,{children:[n(`liveConcurrency`),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,F.jsxs)(`span`,{className:`mono tabular text-body font-semibold ${s?`text-warning`:`text-foreground`}`,children:[i??`—`,(0,F.jsxs)(`span`,{className:`font-normal text-muted`,children:[`/`,e?a:`—`]})]}),(0,F.jsx)(`span`,{className:`inline-block h-[3px] w-12 overflow-hidden rounded-[2px] bg-separator`,children:(0,F.jsx)(`span`,{className:`block h-full ${s?`bg-warning`:`bg-foreground/60`}`,style:{width:`${Math.min(100,o*100)}%`}})})]})]});return(0,F.jsxs)(`div`,{"data-testid":`live-strip`,className:`flex min-h-11 flex-wrap items-center gap-x-5 gap-y-2 overflow-hidden rounded-lg bg-surface-secondary px-4 py-2.5 text-caption text-muted sm:h-11 sm:gap-x-6 sm:gap-y-1 sm:py-0`,children:[(0,F.jsx)(`span`,{className:`inline-flex items-center`,children:(0,F.jsx)(`span`,{className:`status-dot`,"data-state":i==null?``:s?`warn`:i>0?`ok`:``})}),r?(0,F.jsx)(`button`,{type:`button`,"data-testid":`live-strip-concurrency`,onClick:r,className:`inline-flex flex-col gap-1 rounded-lg text-left outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-focus sm:flex-row sm:items-center sm:gap-2`,"aria-label":n(`inflightExpandFromConcurrency`),children:c}):(0,F.jsx)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:c}),(0,F.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveRpm`),(0,F.jsx)(`span`,{className:`mono tabular text-body font-semibold text-foreground`,children:e?.rpm??`—`})]}),(0,F.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveTrace`),(0,F.jsx)(I,{samples:t,capacity:a,label:n(`liveTrace`)})]})]})}function Ee(){return d(`/api/live`)}var De=2500,L=Math.round(6e4/De);function Oe(e){let t=e?.intervalMs??2500,[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)([]);return(0,C.useEffect)(()=>{let e=!1,n=null,i=()=>{document.hidden||Ee().then(n=>{if(e)return;r(n);let i=Math.max(L,Math.round(6e4/t));a(e=>[...e,{at:Date.now(),value:n.in_flight}].slice(-i))}).catch(()=>{})},o=()=>{n||document.hidden||(i(),n=setInterval(i,t))},s=()=>{n&&clearInterval(n),n=null},c=()=>document.hidden?s():o();return o(),document.addEventListener(`visibilitychange`,c),()=>{e=!0,s(),document.removeEventListener(`visibilitychange`,c)}},[t]),{live:n,samples:i}}var ke=(0,C.lazy)(()=>oe(()=>import(`./TrafficChart-BdqUGU1Q.js`).then(e=>({default:e.TrafficChart})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),Ae=3e4,je=3e4,Me={window:{from:``,to:``,hours:24},totals:{requests:0,ok:0,incomplete:0,error:0,canceled:0,streaming:0,success_rate:0},latency:{},tokens:{prompt:0,completion:0,cache_read:0,total:0},status:[],errors:[],models:[],accounts:[],providers:[],series:[]};function Ne(e,t){return!e||e===`(unknown)`?t(`statsUnknown`):he(e,t)}function Pe(e,t,n){return!t||t===`(unassigned)`?n:e.find(e=>e.id===t)?.name||t}var Fe=new Set([`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`]);function Ie(e,t){let n={quota:`logsKindQuota`,rate_limit:`logsKindRateLimit`,auth:`logsKindAuth`,not_ready:`logsKindNotReady`,unavailable:`logsKindUnavailable`,invalid_request:`logsKindInvalidRequest`,model_not_available:`logsKindModelNotAvailable`};return n[e]?t(n[e]):e}var Le=[`ok`,`incomplete`,`error`,`canceled`],R={ok:`bg-success`,incomplete:`bg-warning`,error:`bg-danger`,canceled:`bg-muted`},z={ok:`logsFilterOk`,incomplete:`logsFilterIncomplete`,error:`logsFilterError`,canceled:`logsFilterCanceled`};function B(e,t){return t>0?e/t:null}function Re(e,t){if(!e)return null;let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=Math.max(0,Math.round((n-t)/1e3));if(r<=0)return null;let i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60;return i?`${i}h ${a}m`:a?`${a}m ${String(o).padStart(2,`0`)}s`:`${o}s`}function ze(e,t){let n=[e.down_until,e.cooldown_until].filter(e=>!!e).filter(e=>Date.parse(e)>t);return n.length?n.reduce((e,t)=>Date.parse(e)>=Date.parse(t)?e:t):null}function Be(e,t){return t?`danger`:(e??0)>=80?`warning`:`ok`}function Ve(){let{lang:e,t}=s(),{overview:n,loading:c,error:u}=ie(),[d,oe]=(0,C.useState)(`today`),[m,h]=(0,C.useState)(null),[g,_]=(0,C.useState)(!1),b=le(),[he,w]=(0,C.useState)(null),[T,E]=(0,C.useState)(``),[D,O]=(0,C.useState)(!0),[k,be]=(0,C.useState)([]),[A,j]=(0,C.useState)(!0),[M,N]=(0,C.useState)(0),[P,Ce]=(0,C.useState)(null),[I,Ee]=(0,C.useState)(()=>Date.now()),[L,R]=(0,C.useState)(!1),[z,Ve]=(0,C.useState)(!1),{live:V,samples:Ge}=Oe({intervalMs:L?800:De}),Ke=new Map((V?.accounts??[]).map(e=>[e.id,e])),qe=!!n?.proxy?.ok,Je=!!n?.worker?.ok,Ye=n?.worker?.ready_count??0,Xe=n?.worker?.hot_count??0,Ze=V?.in_flight??n?.worker?.in_flight??0,U=he??Me,Qe=(0,C.useMemo)(()=>({requests:t(`chartMetricRequests`),tokens:t(`chartMetricTokens`),latency:t(`chartMetricLatency`),input:t(`chartInput`),output:t(`chartOutput`),cacheRead:t(`chartCacheRead`),p50:t(`statsLatencyP50`),p95:t(`statsLatencyP95`),total:t(`chartTotal`)}),[t]),$e=(0,C.useCallback)((e,t)=>b(ye({},e,t)),[b]),W=n?.routing?.session_affinity,et=(W?.hits??0)+(W?.misses??0),tt=B(W?.hits??0,et),G=k.map(e=>({account:e,until:ze(e,I)})).filter(e=>e.until!=null),nt=G.length>0,rt=new Set(G.map(e=>e.account.id)),it=[...k.filter(e=>e.ready&&!rt.has(e.id)),...k.filter(e=>!e.ready&&!rt.has(e.id))].slice(0,6);(0,C.useEffect)(()=>{if(!nt)return;let e=setInterval(()=>Ee(Date.now()),1e3);return()=>clearInterval(e)},[nt]),(0,C.useEffect)(()=>{let e=!1;return Promise.allSettled([ae(!1),pe()]).then(([t,n])=>{e||(t.status===`fulfilled`&&be(t.value.data||[]),n.status===`fulfilled`&&N((n.value.data||[]).length))}).finally(()=>{e||j(!1)}),()=>{e=!0}},[]);let at=m?.start?.toString()??``,ot=m?.end?.toString()??``,K=(0,C.useRef)(0),q=(0,C.useCallback)(e=>{let t=ge(d,m);if(!t){O(!1);return}let n=++K.current;te(t).then(e=>{n===K.current&&(w(e),E(``))}).catch(t=>{n!==K.current||e||(w(null),E(t instanceof Error?t.message:String(t)))}).finally(()=>{n===K.current&&O(!1)})},[d,at,ot]);(0,C.useEffect)(()=>(q(!1),()=>{K.current++}),[q]),(0,C.useEffect)(()=>{if(g)return;let e=Date.now(),t=()=>{document.hidden||(e=Date.now(),q(!0))},n=setInterval(t,Ae),r=()=>{!document.hidden&&Date.now()-e>=Ae&&t()};return document.addEventListener(`visibilitychange`,r),()=>{clearInterval(n),document.removeEventListener(`visibilitychange`,r)}},[g,q]),(0,C.useEffect)(()=>{let e=!1,t=Date.now(),n=()=>{document.hidden||(t=Date.now(),re().then(t=>{e||Ce(t)}).catch(()=>{}))};n();let r=setInterval(n,je),i=()=>{!document.hidden&&Date.now()-t>=je&&n()};return document.addEventListener(`visibilitychange`,i),()=>{e=!0,clearInterval(r),document.removeEventListener(`visibilitychange`,i)}},[]);let J=Math.floor(U.series.length/2),Y=(e,t)=>e.reduce((e,n)=>e+n[t],0),X=U.series.slice(0,J),Z=U.series.slice(J),st=((e,t)=>e>0?(t-e)/e:null)(Y(X,`requests`),Y(Z,`requests`)),ct=Y(X,`requests`)?Y(X,`ok`)/Y(X,`requests`):null,Q=Y(Z,`requests`)?Y(Z,`ok`)/Y(Z,`requests`):null,lt=ct!=null&&Q!=null?Q-ct:null,ut=[{label:t(`metricRequests`),value:U.totals.requests,kind:`compact`,detail:t(`statsWindowHint`,{window:t(ve[d])}),ok:U.totals.requests>0,trend:st},{label:t(`metricSuccess`),value:U.totals.success_rate,kind:`percent`,detail:`${U.totals.ok} ${t(`logsFilterOk`)} · ${U.totals.incomplete} ${t(`logsFilterIncomplete`)} · ${U.totals.error} ${t(`logsFilterError`)}`,ok:U.totals.requests===0||U.totals.success_rate>=.9,trend:lt},{label:t(`metricLatency`),value:U.latency.p95_ms??U.latency.avg_ms,kind:`ms`,detail:`p50 ${x(U.latency.p50_ms)} · avg ${x(U.latency.avg_ms)}`,ok:U.latency.p95_ms==null||U.latency.p95_ms<8e3,trend:null},{label:t(`metricTokens`),value:U.tokens.total,kind:`compact`,detail:`${y(U.tokens.prompt)} / ${y(U.tokens.completion)}`,ok:!0,trend:null}],dt=B(U.tokens.cache_read,U.tokens.prompt),ft=B(U.totals.streaming,U.totals.requests),pt=[{label:t(`metricCacheHit`),value:dt,kind:`percent`,detail:t(`metricCacheHitDetail`,{read:y(U.tokens.cache_read),prompt:y(U.tokens.prompt)})},{label:t(`metricStreaming`),value:ft,kind:`percent`,detail:t(`metricStreamingDetail`,{count:U.totals.streaming,total:U.totals.requests})},{label:t(`metricCanceled`),value:U.totals.canceled,kind:`int`,detail:t(`metricCanceledDetail`,{rate:v(B(U.totals.canceled,U.totals.requests)??0)})}],mt=Le.map(e=>({key:e,count:U.status.find(t=>t.key===e)?.count??U.totals[e]??0})),$=e=>ye(e,U.window.from,U.window.to);return c&&!n?(0,F.jsx)(de,{}):(0,F.jsxs)(`div`,{className:`space-y-5 sm:space-y-4`,children:[(0,F.jsxs)(`section`,{className:`grid gap-3 pb-1 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:t(`homeDisplay`)}),(0,F.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:t(`homeLead`)})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,F.jsx)(_e,{value:d,onChange:oe,custom:m,onCustomChange:h,onBusy:()=>O(!0),t}),(0,F.jsxs)(fe,{delay:300,children:[(0,F.jsx)(ee,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(g?`statsRefreshResume`:`statsRefreshPause`),"aria-pressed":g,onPress:()=>_(e=>!e),children:g?(0,F.jsx)(Se,{size:14}):(0,F.jsx)(xe,{size:14})}),(0,F.jsx)(fe.Content,{children:t(g?`statsRefreshPaused`:`statsRefreshAuto`)})]}),(0,F.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,F.jsx)(`div`,{className:`mono text-caption text-muted`,children:n?.time||`—`}),(0,F.jsxs)(`div`,{className:`mt-1 inline-flex items-center gap-2 text-body font-medium`,children:[(0,F.jsx)(`span`,{className:`status-dot`,"data-state":qe&&Je?`ok`:`danger`}),t(qe&&Je?`running`:`degraded`)]})]})]})]}),u?(0,F.jsx)(ne,{title:t(`failedOverview`,{msg:u})}):null,(0,F.jsx)(Te,{live:V,samples:Ge,t,onConcurrencyClick:()=>R(!0)}),(0,F.jsx)(a,{t,expanded:L,onExpandedChange:R,live:L?V:null}),(0,F.jsx)(`section`,{"data-gsap-reveal":!0,className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:ut.map(e=>(0,F.jsxs)(l,{className:`gap-0 p-3.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,F.jsx)(`span`,{className:`status-dot`,"data-state":e.ok?`ok`:`danger`})]}),(0,F.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`tabular text-metric font-medium leading-none`,children:D?(0,F.jsx)(p,{className:`h-7 w-24`}):e.value==null?`—`:(0,F.jsx)(r,{value:e.value,kind:e.kind})}),!D&&e.trend!=null?(0,F.jsx)(Ue,{value:e.trend,hint:t(`trendHalfHint`)}):null]}),(0,F.jsx)(`div`,{className:`mono mt-2 truncate text-caption text-muted`,children:D?(0,F.jsx)(p,{className:`h-3 w-28`}):e.detail})]},e.label))}),(0,F.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-3`,children:pt.map(e=>(0,F.jsx)(l,{className:`gap-0 p-3.5`,children:(0,F.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,F.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:D?(0,F.jsx)(p,{className:`h-3 w-28`}):e.detail})]}),(0,F.jsx)(`div`,{className:`tabular text-section font-semibold sm:shrink-0`,children:D?(0,F.jsx)(p,{className:`h-5 w-12`}):e.value==null?`—`:(0,F.jsx)(r,{value:e.value,kind:e.kind})})]})},e.label))}),(0,F.jsx)(`section`,{className:`grid gap-3`,children:(0,F.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTraffic`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTrafficHint`)})]}),(0,F.jsx)(ce,{size:`sm`,variant:`soft`,color:U.totals.error?`warning`:`success`,children:v(U.totals.success_rate)})]}),(0,F.jsxs)(`div`,{className:`space-y-4 p-4`,children:[T?(0,F.jsx)(`div`,{className:`text-body text-danger`,children:t(`failedStats`,{msg:T})}):D?(0,F.jsx)(ue,{}):U.series.some(e=>e.requests>0)?(0,F.jsx)(C.Suspense,{fallback:(0,F.jsx)(ue,{}),children:(0,F.jsx)(ke,{series:U.series,lang:e,emptyLabel:t(`statsEmptyTraffic`),okLabel:t(`logsFilterOk`),errorLabel:t(`logsFilterError`),selectHint:t(`statsDragHint`),labels:Qe,onSelectRange:$e})}):(0,F.jsx)(we,{emptyLabel:t(`statsEmptyTraffic`)}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-4 pt-3 sm:grid-cols-4 sm:gap-3`,children:[[t(`statsLatencyP50`),x(U.latency.p50_ms)],[t(`statsLatencyP95`),x(U.latency.p95_ms)],[t(`statsLatencyAvg`),x(U.latency.avg_ms)],[t(`statsTTFB`),x(U.latency.ttfb_avg_ms)]].map(([e,t])=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,F.jsx)(`div`,{className:`mono mt-1 text-body font-medium`,children:D?(0,F.jsx)(p,{className:`h-4 w-16`}):t})]},String(e)))})]})]})}),(0,F.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,.85fr)]`,children:[(0,F.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:t(`statsPool`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsPoolHint`)})]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[!A&&G.length?(0,F.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-2xl bg-surface-secondary px-2 py-0.5 text-caption text-muted transition-colors hover:text-foreground`,"aria-expanded":z,"aria-label":t(`statsCoolingChip`,{count:G.length}),onClick:()=>Ve(e=>!e),children:[(0,F.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":`warn`}),(0,F.jsx)(`span`,{className:`mono tabular`,children:t(`statsCoolingChip`,{count:G.length})}),(0,F.jsx)(o,{size:10,className:`transition-transform duration-200 ${z?`rotate-90`:``}`,"aria-hidden":!0})]}):null,(0,F.jsxs)(se,{to:`/accounts`,className:`inline-flex items-center gap-1 text-caption font-medium text-muted hover:text-foreground`,children:[t(`navAccounts`),(0,F.jsx)(i,{size:12})]})]})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-2 gap-y-1 border-b border-separator sm:grid-cols-4 sm:gap-y-0`,children:[[t(`ready`),Ye,`ok`],[t(`hot`),Xe,Xe?`ok`:``],[t(`inFlight`),Ze,Ze?`ok`:``],[t(`statsAffinityHit`),tt==null?`—`:v(tt),``,W?t(`statsAffinityHint`,{hits:W.hits??0,misses:W.misses??0,bindings:W.bindings??0}):``]].map(([e,t,n,r])=>(0,F.jsxs)(`div`,{className:`px-4 py-3 sm:py-2.5`,title:r?String(r):void 0,children:[(0,F.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,F.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 sm:mt-1`,children:[(0,F.jsx)(`span`,{className:`mono text-section font-semibold`,children:t}),n?(0,F.jsx)(`span`,{className:`status-dot`,"data-state":n}):null]})]},String(e)))}),z&&G.length?(0,F.jsxs)(`div`,{className:`border-b border-separator bg-surface-secondary/50 px-4 py-2`,children:[(0,F.jsx)(`div`,{className:`text-caption text-muted`,children:t(`statsCoolingDetails`)}),(0,F.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:G.map(({account:e,until:n})=>(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-caption`,children:[(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground/80`,children:e.name||e.id}),(0,F.jsx)(`span`,{className:`mono shrink-0 text-muted`,children:e.last_error_kind?Ie(e.last_error_kind,t):t(`statsUnknown`)}),(0,F.jsx)(`span`,{className:`mono shrink-0 tabular text-muted sm:w-16 sm:text-right`,children:Re(n,I)??`—`}),(0,F.jsx)(`span`,{className:`mono hidden shrink-0 text-muted sm:inline sm:w-10 sm:text-right`,title:t(`statsBackoffLevel`),children:e.restart_backoff_level?`L${e.restart_backoff_level}`:`—`})]},e.id))})]}):null,(0,F.jsx)(`div`,{className:`divide-y divide-separator`,children:A?(0,F.jsx)(f,{}):k.length===0?(0,F.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t(`noAccounts`)}):it.length===0?(0,F.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t(`statsPoolReadyEmpty`)}):it.map(e=>{let n=e.quota,r=Be(n?.percentage,n?.exceeded),i=Ke.get(e.id),a=i?.in_flight??e.in_flight??e.inFlight??0,o=i?.max_inflight||e.max_inflight||4,s=a>=o;return(0,F.jsxs)(`div`,{className:`flex flex-col gap-2.5 px-4 py-3 sm:flex-row sm:items-center sm:gap-3 sm:py-2.5`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3 sm:items-center`,children:[(0,F.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0 sm:mt-0`,"data-state":e.ready?`ok`:`danger`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(S,{provider:e.provider,size:14}),(0,F.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.name||e.id})]}),(0,F.jsxs)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:[me(e.provider,e.region,t),` · `,e.hot?t(`hot`):e.ready?t(`ready`):t(`degraded`)]})]})]}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 pl-6 sm:shrink-0 sm:pl-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:t(s?`liveSaturated`:`inFlight`),"data-testid":`account-inflight`,children:[(0,F.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:t(`inFlight`)}),(0,F.jsxs)(`span`,{className:`mono text-caption tabular ${s?`text-warning`:`text-muted`}`,children:[a,`/`,o]}),(0,F.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,F.jsx)(`span`,{className:`block h-full ${s?`bg-warning`:`bg-foreground/50`}`,style:{width:`${Math.min(100,a/o*100)}%`}})})]}),n?(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:t(`quota`),children:[(0,F.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:t(`quota`)}),(0,F.jsxs)(`span`,{className:`mono text-caption tabular text-muted`,children:[Math.round(n.percentage??0),`%`]}),(0,F.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,F.jsx)(`span`,{className:`block h-full ${r===`danger`?`bg-danger`:r===`warning`?`bg-warning`:`bg-success`}`,style:{width:`${Math.min(100,Math.max(0,n.percentage??0))}%`}})})]}):null]})]},e.id)})}),(0,F.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,F.jsxs)(`span`,{children:[t(`metricModels`),` `,M]}),(0,F.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[[`qoder`,`workbuddy`,`trae`].map(e=>{let t=k.filter(t=>String(t.provider||`qoder`).toLowerCase()===e).length;return t?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(S,{provider:e,size:11}),t]},e):null}),(0,F.jsxs)(`span`,{children:[k.length,` `,t(`accountCount`)]})]})]})]}),(0,F.jsx)(He,{resources:P,t})]}),(0,F.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-2 2xl:grid-cols-3`,children:[(0,F.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,F.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopProviders`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTopProvidersHint`)})]})}),D?(0,F.jsx)(f,{}):(0,F.jsx)(H,{empty:t(`statsNoProviders`),items:(U.providers||[]).map(e=>({key:e.key,label:Ne(e.key,t),count:e.count,meta:`${e.ok}/${e.count}`,mark:e.key===`(unknown)`?void 0:e.key,href:e.key===`(unknown)`?void 0:$({provider:e.key})}))})]}),(0,F.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,F.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopModels`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`providerCatalog`)})]})}),D?(0,F.jsx)(f,{rows:4}):(0,F.jsx)(H,{empty:t(`statsNoModels`),items:U.models.map(e=>({key:e.key,label:e.key===`(unknown)`?t(`statsUnknown`):e.key,count:e.count,href:e.key===`(unknown)`?void 0:$({model:e.key}),meta:e.latency_avg_ms==null?`${e.ok}/${e.count}`:x(e.latency_avg_ms)}))})]}),(0,F.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,F.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:t(`statsStatusMix`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsStatusMixHint`)})]})}),D?(0,F.jsx)(f,{rows:4}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(We,{items:mt,t}),(0,F.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsErrorMix`)}),(0,F.jsx)(H,{empty:t(`statsNoErrors`),danger:!0,items:U.errors.map(e=>({key:e.key,label:Ie(e.key,t),count:e.count,href:Fe.has(e.key)?$({error_kind:e.key}):void 0}))}),(0,F.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsTopAccounts`)}),(0,F.jsx)(H,{empty:t(`statsNoAccounts`),items:U.accounts.slice(0,5).map(e=>({key:e.key,label:Pe(k,e.key,t(`statsUnassigned`)),count:e.count,href:!e.key||e.key===`(unassigned)`?void 0:$({account:e.key}),meta:`${e.ok}/${e.count}`}))})]})]})]})]})}function V(e,t){return e>=2147483648||t>=200?`danger`:e>=1073741824||t>=100?`warning`:`ok`}function He({resources:e,t}){let n=[...e?.workers??[]].sort((e,t)=>t.rss_bytes-e.rss_bytes),r=e?.server;return(0,F.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:t(`resTitle`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`resHint`)})]}),(0,F.jsx)(ce,{size:`sm`,variant:`soft`,color:e?`success`:`default`,children:e?b(e.total_rss_bytes):`—`})]}),(0,F.jsx)(`div`,{className:`divide-y divide-separator`,children:e?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":V(r?.rss_bytes??0,r?.cpu_percent??0)}),(0,F.jsx)(`div`,{className:`truncate text-body font-medium`,children:t(`resServer`)}),(0,F.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,r?.pid]})]}),(0,F.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[b(r?.rss_bytes),` · `,(r?.cpu_percent??0).toFixed(1),`%`]})]})}),n.length===0?(0,F.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`resEmpty`)}):n.map(e=>(0,F.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":V(e.rss_bytes,e.cpu_percent)}),(0,F.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label||e.account_id}),(0,F.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,e.pid]})]}),(0,F.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[b(e.rss_bytes),` · `,e.cpu_percent.toFixed(1),`%`]})]})},e.pid))]}):(0,F.jsx)(f,{rows:3})}),(0,F.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,F.jsxs)(`span`,{className:`mono`,children:[r?.goroutines??0,` `,t(`resGoroutines`)]}),(0,F.jsx)(`span`,{className:`mono`,children:e?.sampled_at?new Date(e.sampled_at).toLocaleTimeString():`—`})]})]})}function H({items:e,empty:t,danger:n}){let r=(0,C.useRef)(null),i=Math.max(1,...e.map(e=>e.count)),a=e.map(e=>`${e.key}:${e.count}`).join(`|`);return(0,C.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=u.context(()=>{let e=u.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{u.set(`[data-rank-fill]`,{clearProps:`transform`})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=u.utils.toArray(`[data-rank-fill]`);e.length&&u.fromTo(e,{scaleX:0},{scaleX:1,duration:.38,ease:`power2.out`,stagger:.05,transformOrigin:`0% 50%`})})},e);return()=>t.revert()},[a]),e.length?(0,F.jsx)(`div`,{ref:r,className:`divide-y divide-separator`,children:e.map(e=>{let t=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.mark?(0,F.jsx)(S,{provider:e.mark,size:14}):null,(0,F.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label})]}),(0,F.jsx)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:e.meta?`${e.count} · ${e.meta}`:e.count})]}),(0,F.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-[2px] bg-separator`,children:(0,F.jsx)(`div`,{"data-rank-fill":!0,className:`h-full origin-left rounded-[2px] ${n?`bg-danger`:`bg-success`}`,style:{width:`${Math.max(6,e.count/i*100)}%`}})})]});return e.href?(0,F.jsx)(se,{to:e.href,className:`rank-row block px-4 py-2.5`,title:e.label,children:t},e.key):(0,F.jsx)(`div`,{className:`px-4 py-2.5`,children:t},e.key)})}):(0,F.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t})}function Ue({value:e,hint:t}){let n=Math.abs(e)<.005?`flat`:e>0?`up`:`down`;return(0,F.jsxs)(`span`,{className:`trend-chip`,"data-tone":n,title:t,children:[(0,F.jsx)(n===`down`?N:n===`up`?Ce:be,{size:12,weight:`bold`}),e>0?`+`:``,(e*100).toFixed(1),`%`]})}function We({items:e,t}){let n=e.reduce((e,t)=>e+t.count,0);return n?(0,F.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,F.jsx)(`div`,{className:`flex h-2 gap-px overflow-hidden rounded-[3px] bg-separator`,role:`img`,"aria-label":e.map(e=>`${t(z[e.key])} ${e.count}`).join(`, `),children:e.filter(e=>e.count>0).map(e=>(0,F.jsx)(`div`,{className:R[e.key],style:{width:`${e.count/n*100}%`,minWidth:2}},e.key))}),(0,F.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-x-4 gap-y-1.5`,children:e.map(e=>(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,F.jsx)(`span`,{className:`inline-block size-2 shrink-0 rounded-[2px] ${R[e.key]}`}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted`,children:t(z[e.key])}),(0,F.jsx)(`span`,{className:`mono tabular`,children:e.count}),(0,F.jsx)(`span`,{className:`mono w-10 text-right tabular text-muted`,children:v(e.count/n)})]},e.key))})]}):(0,F.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`statsEmptyTraffic`)})}export{Ve as OverviewPage,we as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/PageAlert-r7ZVsH9h.js b/internal/webui/static/assets/PageAlert-BTp9jdUz.js similarity index 97% rename from internal/webui/static/assets/PageAlert-r7ZVsH9h.js rename to internal/webui/static/assets/PageAlert-BTp9jdUz.js index 51c75dc9..68126bfc 100644 --- a/internal/webui/static/assets/PageAlert-r7ZVsH9h.js +++ b/internal/webui/static/assets/PageAlert-BTp9jdUz.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{I as r,J as i,R as a,Y as o,q as s}from"./useI18n-B77RWTNi.js";import{B as c,s as l,z as u}from"./SharedElementTransition-BlCsXfb1.js";var d=u({defaultVariants:{status:`default`},slots:{base:`alert`,content:`alert__content`,description:`alert__description`,indicator:`alert__indicator`,title:`alert__title`},variants:{status:{accent:{base:`alert--accent`},danger:{base:`alert--danger`},default:{base:`alert--default`},success:{base:`alert--success`},warning:{base:`alert--warning`}}}}),f=t(e(),1),p=n(),m=(0,f.createContext)({}),h=({children:e,className:t,status:n,...i})=>{let a=f.useMemo(()=>d({status:n}),[n]);return(0,p.jsx)(m,{value:{slots:a,status:n},children:(0,p.jsx)(r,{value:{variant:`default`},children:(0,p.jsx)(c.div,{className:a?.base({className:t}),"data-slot":`alert-root`,...i,children:e})})})},g=Object.assign(h,{Root:h,Indicator:({children:e,className:t,...n})=>{let{slots:r,status:u}=(0,f.use)(m),d=()=>{switch(u){case`accent`:return(0,p.jsx)(s,{"data-slot":`alert-default-icon`});case`success`:return(0,p.jsx)(i,{"data-slot":`alert-default-icon`});case`warning`:return(0,p.jsx)(o,{"data-slot":`alert-default-icon`});case`danger`:return(0,p.jsx)(a,{"data-slot":`alert-default-icon`});default:return(0,p.jsx)(s,{"data-slot":`alert-default-icon`})}};return(0,p.jsx)(c.div,{className:l(r?.indicator,t),"data-slot":`alert-indicator`,...n,children:e??d()})},Content:({children:e,className:t,...n})=>{let{slots:r}=(0,f.use)(m);return(0,p.jsx)(c.div,{className:l(r?.content,t),"data-slot":`alert-content`,...n,children:e})},Title:({children:e,className:t,...n})=>{let{slots:r}=(0,f.use)(m);return(0,p.jsx)(c.p,{className:l(r?.title,t),"data-slot":`alert-title`,...n,children:e})},Description:({children:e,className:t,...n})=>{let{slots:r}=(0,f.use)(m);return(0,p.jsx)(c.span,{className:l(r?.description,t),"data-slot":`alert-description`,...n,children:e})}});function _({status:e=`danger`,title:t,description:n}){return(0,p.jsxs)(g,{status:e,children:[(0,p.jsx)(g.Indicator,{}),(0,p.jsxs)(g.Content,{children:[(0,p.jsx)(g.Title,{children:t}),n?(0,p.jsx)(g.Description,{children:n}):null]})]})}export{g as n,_ as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{I as r,J as i,R as a,Y as o,q as s}from"./useI18n-DAGWWg9N.js";import{B as c,s as l,z as u}from"./SharedElementTransition-BlCsXfb1.js";var d=u({defaultVariants:{status:`default`},slots:{base:`alert`,content:`alert__content`,description:`alert__description`,indicator:`alert__indicator`,title:`alert__title`},variants:{status:{accent:{base:`alert--accent`},danger:{base:`alert--danger`},default:{base:`alert--default`},success:{base:`alert--success`},warning:{base:`alert--warning`}}}}),f=t(e(),1),p=n(),m=(0,f.createContext)({}),h=({children:e,className:t,status:n,...i})=>{let a=f.useMemo(()=>d({status:n}),[n]);return(0,p.jsx)(m,{value:{slots:a,status:n},children:(0,p.jsx)(r,{value:{variant:`default`},children:(0,p.jsx)(c.div,{className:a?.base({className:t}),"data-slot":`alert-root`,...i,children:e})})})},g=Object.assign(h,{Root:h,Indicator:({children:e,className:t,...n})=>{let{slots:r,status:u}=(0,f.use)(m),d=()=>{switch(u){case`accent`:return(0,p.jsx)(s,{"data-slot":`alert-default-icon`});case`success`:return(0,p.jsx)(i,{"data-slot":`alert-default-icon`});case`warning`:return(0,p.jsx)(o,{"data-slot":`alert-default-icon`});case`danger`:return(0,p.jsx)(a,{"data-slot":`alert-default-icon`});default:return(0,p.jsx)(s,{"data-slot":`alert-default-icon`})}};return(0,p.jsx)(c.div,{className:l(r?.indicator,t),"data-slot":`alert-indicator`,...n,children:e??d()})},Content:({children:e,className:t,...n})=>{let{slots:r}=(0,f.use)(m);return(0,p.jsx)(c.div,{className:l(r?.content,t),"data-slot":`alert-content`,...n,children:e})},Title:({children:e,className:t,...n})=>{let{slots:r}=(0,f.use)(m);return(0,p.jsx)(c.p,{className:l(r?.title,t),"data-slot":`alert-title`,...n,children:e})},Description:({children:e,className:t,...n})=>{let{slots:r}=(0,f.use)(m);return(0,p.jsx)(c.span,{className:l(r?.description,t),"data-slot":`alert-description`,...n,children:e})}});function _({status:e=`danger`,title:t,description:n}){return(0,p.jsxs)(g,{status:e,children:[(0,p.jsx)(g.Indicator,{}),(0,p.jsxs)(g.Content,{children:[(0,p.jsx)(g.Title,{children:t}),n?(0,p.jsx)(g.Description,{children:n}):null]})]})}export{g as n,_ as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/Plus.es-Cg0e8UP-.js b/internal/webui/static/assets/Plus.es-BKtgxOxU.js similarity index 95% rename from internal/webui/static/assets/Plus.es-Cg0e8UP-.js rename to internal/webui/static/assets/Plus.es-BKtgxOxU.js index 0fe74e1f..0a609c2b 100644 --- a/internal/webui/static/assets/Plus.es-Cg0e8UP-.js +++ b/internal/webui/static/assets/Plus.es-BKtgxOxU.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-B77RWTNi.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`PlusIcon`;var o=a;export{o as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-DAGWWg9N.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`PlusIcon`;var o=a;export{o as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/ProvidersPage-B_ytzi8k.js b/internal/webui/static/assets/ProvidersPage-B_ytzi8k.js deleted file mode 100644 index 28429a4f..00000000 --- a/internal/webui/static/assets/ProvidersPage-B_ytzi8k.js +++ /dev/null @@ -1 +0,0 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{i as r,r as i,t as a}from"./SearchBar-DwSqSsBT.js";import{n as o,r as s}from"./useI18n-B77RWTNi.js";import{t as c}from"./PageAlert-r7ZVsH9h.js";import{n as l}from"./useToggle-BRoRhkOA.js";import{t as u}from"./EmptyPanel-Bs-jQMvG.js";import{t as d}from"./modal-q_Ums9Et.js";import{t as f}from"./CompactSwitch-BinKb1rw.js";import{t as p}from"./table-CRVB37zZ.js";import{B as ee,D as te,K as ne,Q as re,V as ie,Z as ae,at as m,d as oe,en as h,fn as se,hn as ce,ln as g,nt as _,u as le}from"./index-CmGY2WQi.js";import{d as v,f as y}from"./format-B6SmebW-.js";import{t as b}from"./ProviderMark-IiAZTaQS.js";import{n as x,r as S}from"./provider-gHnttGKq.js";import{t as ue}from"./FilterSelect-B8vbCqfN.js";var C=t(e(),1),w=n();function T(e){return e?e>=1e6?`${(e/1e6).toString().replace(/\.0$/,``)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e):`—`}function de({model:e,t,onClose:n}){if(!e)return null;let r=e.reasoning_options||[],i=e.catalog_context_length||e.default_context_length||e.context_length,a=e.catalog_context_length_max,o=v(e),s=y(e),c=String(e.provider||e.owned_by||`qoder`).trim().toLowerCase(),l=String(e.region||e.regions?.[0]||``).trim().toLowerCase(),u=x(c,l||void 0,t),f=c===`trae`?S(e):void 0;return(0,w.jsx)(d.Root,{isOpen:!0,onOpenChange:e=>{e||n()},children:(0,w.jsx)(d.Backdrop,{variant:`blur`,children:(0,w.jsx)(d.Container,{size:`md`,scroll:`inside`,children:(0,w.jsxs)(d.Dialog,{children:[(0,w.jsxs)(d.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsx)(`div`,{className:`text-section`,children:e.display_name||e.id}),s?(0,w.jsx)(m,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null]}),(0,w.jsx)(`div`,{className:`mono mt-1 text-caption text-muted`,children:e.id}),(0,w.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[u,o?` · ${o}`:``]})]}),(0,w.jsx)(d.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,w.jsx)(h,{size:16})})]}),(0,w.jsxs)(d.Body,{className:`space-y-4 px-5 pb-5`,children:[(0,w.jsxs)(`section`,{children:[(0,w.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:t(`contextWindowCol`)}),(0,w.jsxs)(`div`,{className:`mt-1 text-body`,children:[T(i),a&&a!==i?` → ${T(a)}`:``]}),e.supports_max_mode?(0,w.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(c===`qoder`?`qoderMaxModeHint`:`maxModeHint`)}):null,!e.supports_max_mode&&a&&a!==i?(0,w.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`workbuddyContextHint`)}):null,f?f.prompt_max_tokens?(0,w.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[t(`promptMaxTokens`),`: `,T(f.prompt_max_tokens)]}):null:e.prompt_max_tokens?(0,w.jsxs)(`div`,{className:`mt-1 text-caption text-muted`,children:[t(`promptMaxTokens`),`: `,T(e.prompt_max_tokens)]}):null,f?f.max_output_tokens?(0,w.jsxs)(`div`,{className:`text-caption text-muted`,children:[t(`maxOutputTokens`),`: `,T(f.max_output_tokens)]}):null:e.max_output_tokens?(0,w.jsxs)(`div`,{className:`text-caption text-muted`,children:[t(`maxOutputTokens`),`: `,T(e.max_output_tokens)]}):null]}),(0,w.jsxs)(`section`,{children:[(0,w.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:t(`reasoningLevels`)}),r.length?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`reasoningHint`)}),(0,w.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:r.map(n=>{let r=`reasoningLevel_${n}`,i=t(r);return(0,w.jsxs)(m,{size:`sm`,variant:`soft`,color:n===(e.reasoning_effort||e.reasoning_default)?`success`:`default`,children:[i===r?n:i,n===e.reasoning_default?` · ${t(`defaultValue`)}`:``,n===e.reasoning_effort&&n!==e.reasoning_default?` · ${t(`custom`)}`:``]},n)})})]}):(0,w.jsx)(`div`,{className:`mt-1 text-body text-muted`,children:e.reasoning_type?t(`reasoningFixed`,{type:e.reasoning_type}):t(`noReasoningLevels`)})]})]})]})})})})}function fe(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id});return t}function E(e){return e.settings_key||e.id}function D(e){return String(e.provider||e.owned_by||`qoder`).trim().toLowerCase()}function O(e){let t=String(e.region||``).trim().toLowerCase();if(t)return t;let n=e.regions||[];return String(n[0]||``).trim().toLowerCase()}function k(e){return`${D(e)}:${O(e)||`any`}:${e.settings_key||e.id}:${e.native_model||e.mapped_key||``}`}function A(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function j(e,t){let n=`reasoningLevel_${t}`,r=e(n);return r===n?t:r}function M({label:e,hint:t}){return(0,w.jsxs)(_,{children:[(0,w.jsx)(_.Trigger,{children:(0,w.jsx)(`span`,{className:`cursor-help text-caption text-muted`,children:e})}),(0,w.jsx)(_.Content,{children:(0,w.jsx)(`p`,{className:`max-w-xs text-caption leading-5`,children:t})})]})}function N({model:e,saving:t,t:n,variant:r=`table`,onToggleTraeMax:i,onReasoningChange:a}){let o=D(e),s=r===`card`,c=s?`w-full min-w-0`:`w-full max-w-[7.5rem] min-w-0`;return(0,w.jsxs)(`div`,{className:s?`flex min-w-0 flex-col gap-3`:`flex min-w-0 flex-col gap-1.5`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,w.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[T(e.catalog_context_length||e.context_length),e.catalog_context_length_max&&e.catalog_context_length_max!==(e.catalog_context_length||e.context_length)?` → ${T(e.catalog_context_length_max)}`:``]}),o===`workbuddy`&&e.catalog_context_length_max&&e.catalog_context_length_max!==(e.catalog_context_length||e.context_length)?(0,w.jsx)(M,{label:n(`catalogWindow`),hint:n(`workbuddyContextHint`)}):null]}),(o===`trae`||o===`qoder`)&&e.supports_max_mode?(0,w.jsxs)(`div`,{className:s?`flex flex-col gap-1.5`:`flex items-center gap-2`,children:[s?(0,w.jsx)(M,{label:`${n(`maxMode`)}${e.catalog_context_length_max?` ${T(e.catalog_context_length_max)}`:``}`,hint:n(o===`qoder`?`qoderMaxModeHint`:`maxModeHint`)}):null,(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(f,{isSelected:!!e.max_mode,isDisabled:t,ariaLabel:`${e.id} ${n(`maxMode`)}`,onChange:t=>i(e,t)}),s?null:(0,w.jsx)(M,{label:`${n(`maxMode`)}${e.catalog_context_length_max?` ${T(e.catalog_context_length_max)}`:``}`,hint:n(o===`qoder`?`qoderMaxModeHint`:`maxModeHint`)})]})]}):null,(e.reasoning_options||[]).length>1?(0,w.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,w.jsx)(M,{label:n(`reasoningLevels`),hint:n(`reasoningHint`)}),(0,w.jsx)(ue,{className:c,ariaLabel:`${e.id} ${n(`reasoningLevels`)}`,value:e.reasoning_effort||e.reasoning_default||e.reasoning_options?.[0]||``,onChange:t=>{t&&a(e,t)},options:(e.reasoning_options||[]).map(e=>({id:e,label:j(n,e)}))})]}):(e.reasoning_options||[]).length===1?(0,w.jsx)(M,{label:`${n(`reasoningLevels`)} ${j(n,e.reasoning_options[0])}`,hint:n(`reasoningHint`)}):e.reasoning_type?(0,w.jsx)(`span`,{className:`text-caption text-muted`,children:n(`reasoningFixed`,{type:e.reasoning_type})}):o===`trae`&&!e.supports_max_mode?(0,w.jsx)(M,{label:n(`catalogWindow`),hint:n(`catalogWindowHint`)}):null]})}function P({model:e,t,onDetails:n}){return(0,w.jsxs)(s,{size:`sm`,variant:`ghost`,onPress:()=>n(e),children:[(0,w.jsx)(g,{size:14}),t(`modelDetails`)]})}function F(){let{t:e}=o(),{overview:t,loading:n}=te(),[d,f]=(0,C.useState)(``),[h,g]=(0,C.useState)(``),[_,S]=(0,C.useState)([]),[T,M]=(0,C.useState)(1),[F,pe]=(0,C.useState)(50),[I,L]=(0,C.useState)(!1),[R,z]=(0,C.useState)(``),[B,V]=(0,C.useState)(``),[me,H]=(0,C.useState)(!1),[U,W]=(0,C.useState)(null),[G,K]=(0,C.useState)([]),[he,ge]=(0,C.useState)(!0);(0,C.useEffect)(()=>{let e=!1;return ee(void 0,`regional`).then(t=>{e||K(t.data||[])}).catch(()=>void 0).finally(()=>{e||ge(!1)}),ie().then(t=>{e||S(fe(t.data||[]))}).catch(()=>void 0),()=>{e=!0}},[]);let q=(0,C.useMemo)(()=>{let t=d.trim().toLowerCase(),[n,r]=h.includes(`:`)?h.split(`:`,2):[h,``];return G.filter(i=>{let a=D(i),o=O(i);if(n&&a!==n||r&&o!==r)return!1;if(!t)return!0;let s=x(a,o||void 0,e);return`${i.display_name||``} ${i.id} ${i.mapped_key||``} ${a} ${s} ${i.owned_by||``} ${o} ${i.credits||``} ${i.free?`free`:``}`.toLowerCase().includes(t)})},[d,G,h,e]),J=[d,h,F].join(`\0`),[Y,_e]=(0,C.useState)(J);Y!==J&&(_e(J),M(1));let X=Math.max(1,Math.ceil(q.length/F)),Z=Math.min(Y===J?Math.max(1,T):1,X);T!==Z&&M(Z);let Q=(0,C.useMemo)(()=>{let e=(Z-1)*F;return q.slice(e,e+F)},[Z,q,F]),ve=q.length===0?0:(Z-1)*F+1,ye=Math.min(q.length,Z*F),be=q.length?e(`logsShownTotal`,{shown:`${ve}–${ye}`,total:q.length}):e(`shownTotal`,{shown:0,total:G.length});if(n&&!t||he)return(0,w.jsx)(le,{});function xe(e,t){let n=E(e),r=D(e),i=G.map(e=>{if(E(e)!==n||D(e)!==r)return e;let i=e.reasoning_effort||e.reasoning_default||``,a=e.catalog_context_length||e.default_context_length||e.context_length||0,o=e.catalog_context_length_max||0;return{...e,max_mode:t,context_length:t&&o?o:a,default_context_length:a,context_custom:r===`qoder`?t:t||!!(i&&i!==e.reasoning_default)}});K(i)}function Se(e,t){let n=E(e),r=D(e),i=G.map(e=>E(e)!==n||D(e)!==r?e:{...e,reasoning_effort:t,context_custom:!!e.max_mode||!!(t&&t!==e.reasoning_default)});K(i)}async function Ce(){L(!0),V(``),H(!1);try{let e=await ne(void 0,`regional`);K(e.data||[])}catch(e){H(!0),V(e instanceof Error?e.message:String(e))}finally{L(!1)}}async function $(t,n){let r=D(t);if(r!==`trae`&&r!==`workbuddy`&&r!==`kimi`&&r!==`codearts`)return;let i=E(t);z(i),V(``),H(!1);try{await re(r,i,n),Se(t,n),V(e(`reasoningSaved`,{model:t.id,level:j(e,n)}))}catch(e){H(!0),V(e instanceof Error?e.message:String(e))}finally{z(``)}}async function we(t,n){if(!t.supports_max_mode){H(!0),V(e(`contextMaxUnavailable`));return}let r=E(t),i=D(t);z(r),V(``),H(!1);try{await ae(i,r,n,t.catalog_context_length_max),xe(t,n),V(e(n?`contextMaxOn`:`contextMaxOff`,{model:t.id}))}catch(e){H(!0),V(e instanceof Error?e.message:String(e))}finally{z(``)}}return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsxs)(`section`,{className:`grid gap-5 pb-6 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,w.jsxs)(`div`,{"data-gsap-reveal":!0,children:[(0,w.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`availableModels`)}),(0,w.jsx)(`p`,{className:`mt-1 text-body text-muted`,children:G.length?be:e(`noModelsYet`)})]}),(0,w.jsxs)(`div`,{"data-gsap-reveal":!0,className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`,children:[(0,w.jsx)(a,{className:`w-full min-w-0 sm:w-72`,value:d,onChange:f,placeholder:e(`filterPh`),ariaLabel:e(`filter`)}),(0,w.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,w.jsx)(ue,{ariaLabel:e(`providerCol`),value:h,onChange:g,options:[{id:``,label:e(`providerFilterAll`)},..._.map(t=>({id:t.value,label:x(t.provider,t.region,e)}))]}),(0,w.jsxs)(s,{size:`sm`,variant:`secondary`,isPending:I,onPress:()=>void Ce(),children:[(0,w.jsx)(ce,{size:14}),e(I?`refreshing`:`refresh`)]})]})]})]}),B?(0,w.jsx)(c,{status:me?`danger`:`success`,title:B}):null,(0,w.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-separator px-4 py-4 sm:items-center sm:px-5`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,w.jsx)(`div`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-secondary text-muted`,children:(0,w.jsx)(se,{size:16})}),(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`div`,{className:`text-body font-semibold`,children:e(`providerCatalog`)}),(0,w.jsx)(`div`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:e(`contextConfigHint`)})]})]}),(0,w.jsx)(m,{size:`sm`,variant:`soft`,className:`shrink-0`,children:q.length})]}),I||n?(0,w.jsx)(oe,{}):q.length===0?(0,w.jsx)(u,{icon:(0,w.jsx)(r,{size:22}),title:G.length?e(`noModelsMatch`):e(`noProviders`),hint:G.length?d||h||e(`noModelsMatch`):e(`noModelsYet`)}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`divide-y divide-separator lg:hidden`,children:Q.map(t=>{let n=E(t),r=R===n,i=D(t),a=O(t),o=x(i,a||void 0,e),s=v(t),c=y(t);return(0,w.jsxs)(`article`,{className:`space-y-3 px-4 py-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,w.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":t.stale?void 0:`ok`}),(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsx)(`div`,{className:`truncate font-medium`,children:t.display_name||t.id}),c?(0,w.jsx)(m,{size:`sm`,variant:`soft`,color:`success`,children:e(`modelFree`)}):null,s?(0,w.jsx)(`span`,{className:`mono text-caption text-muted`,children:s}):null]}),(0,w.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:t.id}),A(t)?(0,w.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:e(`routedTo`,{model:A(t)})}):null]})]}),(0,w.jsx)(m,{size:`sm`,variant:`soft`,color:t.context_custom||t.stale?`warning`:`success`,children:t.context_custom?e(`custom`):e(`defaultValue`)})]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-caption`,children:[(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,w.jsx)(b,{provider:i,size:14}),(0,w.jsx)(`span`,{className:`font-medium`,children:o})]}),(0,w.jsx)(`span`,{className:`mono break-all text-muted`,children:t.mapped_key||t.native_model||t.id})]}),(0,w.jsx)(N,{model:t,saving:r,t:e,variant:`card`,onToggleTraeMax:(e,t)=>void we(e,t),onReasoningChange:(e,t)=>void $(e,t)}),(0,w.jsx)(P,{model:t,t:e,onDetails:W})]},k(t))})}),(0,w.jsx)(p,{className:`hidden min-w-0 lg:block`,children:(0,w.jsx)(p.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,w.jsxs)(p.Content,{"aria-label":e(`availableModels`),className:`min-w-[68rem]`,children:[(0,w.jsxs)(p.Header,{children:[(0,w.jsx)(p.Column,{isRowHeader:!0,children:e(`modelCol`)}),(0,w.jsx)(p.Column,{children:e(`requestIdCol`)}),(0,w.jsx)(p.Column,{children:e(`providerCol`)}),(0,w.jsx)(p.Column,{children:e(`qoderKeyCol`)}),(0,w.jsx)(p.Column,{children:e(`modelDefaultsCol`)}),(0,w.jsx)(p.Column,{children:e(`stateCol`)}),(0,w.jsx)(p.Column,{children:e(`actions`)})]}),(0,w.jsx)(p.Body,{children:Q.map(t=>{let n=E(t),r=R===n,i=D(t),a=O(t),o=x(i,a||void 0,e),s=v(t),c=y(t);return(0,w.jsxs)(p.Row,{children:[(0,w.jsx)(p.Cell,{children:(0,w.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,w.jsx)(`span`,{className:`status-dot`,"data-state":t.stale?void 0:`ok`}),(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsx)(`div`,{className:`font-medium`,children:t.display_name||t.id}),c?(0,w.jsx)(m,{size:`sm`,variant:`soft`,color:`success`,children:e(`modelFree`)}):null,s?(0,w.jsx)(`span`,{className:`mono text-caption text-muted`,children:s}):null]}),A(t)?(0,w.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:e(`routedTo`,{model:A(t)})}):null]})]})}),(0,w.jsx)(p.Cell,{children:(0,w.jsx)(`span`,{className:`mono text-caption font-medium`,children:t.id})}),(0,w.jsx)(p.Cell,{children:(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(b,{provider:i,size:14}),(0,w.jsx)(`span`,{className:`text-caption font-medium`,children:o})]})}),(0,w.jsx)(p.Cell,{children:(0,w.jsx)(`span`,{className:`mono text-caption text-muted`,children:t.mapped_key||t.native_model||t.id})}),(0,w.jsx)(p.Cell,{children:(0,w.jsx)(N,{model:t,saving:r,t:e,variant:`table`,onToggleTraeMax:(e,t)=>void we(e,t),onReasoningChange:(e,t)=>void $(e,t)})}),(0,w.jsx)(p.Cell,{children:(0,w.jsx)(m,{size:`sm`,variant:`soft`,color:t.context_custom||t.stale?`warning`:`success`,children:t.context_custom?e(`custom`):e(`defaultValue`)})}),(0,w.jsx)(p.Cell,{children:(0,w.jsx)(P,{model:t,t:e,onDetails:W})})]},k(t))})})]})})})]})]}),(0,w.jsx)(de,{model:U?G.find(e=>E(e)===E(U))||U:null,t:e,onClose:()=>W(null)}),(0,w.jsx)(i,{total:q.length,page:Z,pageCount:X,pageSize:F,loading:I,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:Z,pages:X}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:M,onPageSize:pe})]})}export{F as ProvidersPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/ProvidersPage-CICSPpDj.js b/internal/webui/static/assets/ProvidersPage-CICSPpDj.js new file mode 100644 index 00000000..a0fe1f85 --- /dev/null +++ b/internal/webui/static/assets/ProvidersPage-CICSPpDj.js @@ -0,0 +1 @@ +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{i as r,r as i,t as a}from"./SearchBar-UDaAllIT.js";import{n as o,r as s}from"./useI18n-DAGWWg9N.js";import{t as c}from"./PageAlert-BTp9jdUz.js";import{n as l}from"./useToggle-Zi1rbfHX.js";import{t as u}from"./EmptyPanel-Bs-jQMvG.js";import{t as d}from"./modal-BqXo29An.js";import{t as f}from"./CompactSwitch-CzZldrIr.js";import{t as p}from"./table-CocoYVkm.js";import{E as m,g as ee,m as te,n as ne,x as re}from"./overview-DcWoRgOQ.js";import{Bt as ie,Dt as h,Ft as ae,Lt as g,M as _,O as oe,Wt as se,d as ce,f as le,k as v}from"./index-BYut8qRj.js";import{d as ue,f as y}from"./format-B6SmebW-.js";import{t as de}from"./ProviderMark-IiAZTaQS.js";import{n as b,r as x}from"./provider-gHnttGKq.js";import{t as fe}from"./FilterSelect-BkT3LDQz.js";var S=t(e(),1),C=n();function w(e){return e?e>=1e6?`${(e/1e6).toString().replace(/\.0$/,``)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e):`—`}function T({label:e,value:t}){return(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-1.5`,children:[(0,C.jsx)(`span`,{className:`text-caption text-muted`,children:e}),(0,C.jsx)(`span`,{className:`min-w-0 text-right text-caption font-medium`,children:t})]})}function pe({model:e,t,onClose:n}){if(!e)return null;let r=e.reasoning_options||[],i=e.catalog_context_length||e.default_context_length||e.context_length,a=e.catalog_context_length_max,o=y(e),s=String(e.provider||e.owned_by||`qoder`).trim().toLowerCase(),c=String(e.region||e.regions?.[0]||``).trim().toLowerCase(),l=b(s,c||void 0,t),u=s===`trae`?x(e):void 0,f=e.supports_images===!0?t(`imageInputDeclared`):e.supports_images===!1?t(`imageInputUnsupported`):t(`imageInputNotDeclared`),p=u?.prompt_max_tokens||e.prompt_max_tokens,m=u?.max_output_tokens||e.max_output_tokens;return(0,C.jsx)(d.Root,{isOpen:!0,onOpenChange:e=>{e||n()},children:(0,C.jsx)(d.Backdrop,{variant:`blur`,children:(0,C.jsx)(d.Container,{size:`md`,scroll:`inside`,children:(0,C.jsxs)(d.Dialog,{children:[(0,C.jsxs)(d.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(`div`,{className:`truncate text-section`,children:e.display_name||e.id}),o?(0,C.jsx)(_,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null]}),(0,C.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:e.id})]}),(0,C.jsx)(d.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,C.jsx)(h,{size:16})})]}),(0,C.jsxs)(d.Body,{className:`space-y-3 px-5 pb-5`,children:[(0,C.jsxs)(`section`,{className:`divide-y divide-separator rounded-lg border border-separator px-3 py-1`,children:[(0,C.jsx)(T,{label:t(`providerCol`),value:l}),(0,C.jsx)(T,{label:t(`contextWindowCol`),value:(0,C.jsxs)(`span`,{className:`mono`,children:[w(i),a&&a!==i?` → ${w(a)}`:``]})}),p?(0,C.jsx)(T,{label:t(`promptMaxTokens`),value:(0,C.jsx)(`span`,{className:`mono`,children:w(p)})}):null,m?(0,C.jsx)(T,{label:t(`maxOutputTokens`),value:(0,C.jsx)(`span`,{className:`mono`,children:w(m)})}):null,(0,C.jsx)(T,{label:t(`imageInput`),value:f})]}),(0,C.jsxs)(`section`,{children:[(0,C.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:t(`reasoningLevels`)}),r.length?(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map(e=>(0,C.jsx)(_,{size:`sm`,variant:`soft`,color:`default`,children:(0,C.jsx)(`span`,{className:`mono`,children:e})},e))}):(0,C.jsx)(`div`,{className:`text-caption text-muted`,children:e.reasoning_type?t(`reasoningFixed`,{type:e.reasoning_type}):t(`noReasoningLevels`)})]})]})]})})})})}function me(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id});return t}function E(e){return e.settings_key||e.id}function D(e){return String(e.provider||e.owned_by||`qoder`).trim().toLowerCase()}function O(e){let t=String(e.region||``).trim().toLowerCase();if(t)return t;let n=e.regions||[];return String(n[0]||``).trim().toLowerCase()}function k(e){return`${D(e)}:${O(e)||`any`}:${e.settings_key||e.id}:${e.native_model||e.mapped_key||``}`}function A(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function j({model:e,saving:t,t:n,variant:r=`table`,onToggleTraeMax:i}){let a=D(e),o=r===`card`,s=e.catalog_context_length||e.context_length,c=e.catalog_context_length_max,l=!!(c&&c!==s),u=e.reasoning_options||[],d=(a===`trae`||a===`qoder`)&&e.supports_max_mode,p=u.length?u.join(` / `):e.reasoning_type?n(`reasoningFixed`,{type:e.reasoning_type}):`—`;return(0,C.jsxs)(`div`,{className:o?`flex min-w-0 flex-col gap-2`:`flex min-w-0 flex-col gap-1`,children:[(0,C.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,C.jsxs)(`span`,{className:`mono text-caption font-medium`,children:[w(s),l?` → ${w(c)}`:``]}),d?(0,C.jsx)(f,{isSelected:!!e.max_mode,isDisabled:t,ariaLabel:`${e.id} ${n(`maxMode`)}`,onChange:t=>i(e,t)}):null]}),(0,C.jsx)(`div`,{className:`min-w-0 truncate text-caption text-muted`,title:p,children:p})]})}function M({model:e,t,onDetails:n}){return(0,C.jsxs)(s,{size:`sm`,variant:`ghost`,onPress:()=>n(e),children:[(0,C.jsx)(g,{size:14}),t(`modelDetails`)]})}function N(){let{t:e}=o(),{overview:t,loading:n}=oe(),[d,f]=(0,S.useState)(``),[h,g]=(0,S.useState)(``),[x,w]=(0,S.useState)([]),[T,N]=(0,S.useState)(1),[P,he]=(0,S.useState)(50),[F,I]=(0,S.useState)(!1),[L,R]=(0,S.useState)(``),[z,B]=(0,S.useState)(``),[ge,V]=(0,S.useState)(!1),[H,U]=(0,S.useState)(null),[W,G]=(0,S.useState)([]),[_e,ve]=(0,S.useState)(!0),[K,q]=(0,S.useState)(!1),[J,Y]=(0,S.useState)(null);(0,S.useEffect)(()=>{let e=!1;return te(void 0,`regional`).then(t=>{e||G(t.data||[])}).catch(()=>void 0).finally(()=>{e||ve(!1)}),ee().then(t=>{e||w(me(t.data||[]))}).catch(()=>void 0),()=>{e=!0}},[]);let X=(0,S.useMemo)(()=>{let t=d.trim().toLowerCase(),[n,r]=h.includes(`:`)?h.split(`:`,2):[h,``];return W.filter(i=>{let a=D(i),o=O(i);if(n&&a!==n||r&&o!==r)return!1;if(!t)return!0;let s=b(a,o||void 0,e);return`${i.display_name||``} ${i.id} ${i.mapped_key||``} ${a} ${s} ${i.owned_by||``} ${o} ${i.credits||``} ${i.free?`free`:``}`.toLowerCase().includes(t)})},[d,W,h,e]),Z=[d,h,P].join(`\0`),[ye,be]=(0,S.useState)(Z);ye!==Z&&(be(Z),N(1));let Q=Math.max(1,Math.ceil(X.length/P)),$=Math.min(ye===Z?Math.max(1,T):1,Q);T!==$&&N($);let xe=(0,S.useMemo)(()=>{let e=($-1)*P;return X.slice(e,e+P)},[$,X,P]),Se=X.length===0?0:($-1)*P+1,Ce=Math.min(X.length,$*P),we=X.length?e(`logsShownTotal`,{shown:`${Se}–${Ce}`,total:X.length}):e(`shownTotal`,{shown:0,total:W.length});if(n&&!t||_e)return(0,C.jsx)(ce,{});function Te(e,t){let n=E(e),r=D(e),i=W.map(e=>{if(E(e)!==n||D(e)!==r)return e;let i=e.reasoning_effort||e.reasoning_default||``,a=e.catalog_context_length||e.default_context_length||e.context_length||0,o=e.catalog_context_length_max||0;return{...e,max_mode:t,context_length:t&&o?o:a,default_context_length:a,context_custom:r===`qoder`?t:t||!!(i&&i!==e.reasoning_default)}});G(i)}async function Ee(){I(!0),B(``),V(!1);try{let e=await re(void 0,`regional`);G(e.data||[])}catch(e){V(!0),B(e instanceof Error?e.message:String(e))}finally{I(!1)}}function De(e){return J?.results.find(t=>t.model===e.id)}function Oe(t){let n=De(t);if(!n)return(0,C.jsx)(_,{size:`sm`,variant:`soft`,color:`default`,children:e(`checkNotRun`)});let r=n.accounts||[],i=r.length?r.filter(e=>e.ok).length:+!!n.ok,a=r.length||n.attempt_count||+!!n.ok;return(0,C.jsxs)(_,{size:`sm`,variant:`soft`,color:n.ok?`success`:`danger`,children:[n.ok?e(`checkResultOK`):e(`checkResultFailed`),a?` · ${e(`checkPassedAccounts`,{passed:i,total:a})}`:``]})}async function ke(){if(!W.length){B(e(`checkModelsEmpty`)),V(!1);return}q(!0),Y(null),B(``),V(!1);try{let t=await ne(W.map(e=>e.id));Y(t),B(e(`checkModelsSummary`,{passed:t.summary.passed,failed:t.summary.failed,total:t.summary.total,elapsed:t.elapsed_ms}))}catch(e){V(!0),B(e instanceof Error?e.message:String(e))}finally{q(!1)}}async function Ae(t,n){if(!t.supports_max_mode){V(!0),B(e(`contextMaxUnavailable`));return}let r=E(t),i=D(t);R(r),B(``),V(!1);try{await m(i,r,n,t.catalog_context_length_max),Te(t,n),B(e(n?`contextMaxOn`:`contextMaxOff`,{model:t.id}))}catch(e){V(!0),B(e instanceof Error?e.message:String(e))}finally{R(``)}}return(0,C.jsxs)(`div`,{className:`space-y-6`,children:[(0,C.jsxs)(`section`,{className:`grid gap-5 pb-6 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,C.jsxs)(`div`,{"data-gsap-reveal":!0,children:[(0,C.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`availableModels`)}),(0,C.jsx)(`p`,{className:`mt-1 text-body text-muted`,children:W.length?we:e(`noModelsYet`)})]}),(0,C.jsxs)(`div`,{"data-gsap-reveal":!0,className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`,children:[(0,C.jsx)(a,{className:`w-full min-w-0 sm:w-72`,value:d,onChange:f,placeholder:e(`filterPh`),ariaLabel:e(`filter`)}),(0,C.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,C.jsx)(fe,{ariaLabel:e(`providerCol`),value:h,onChange:g,options:[{id:``,label:e(`providerFilterAll`)},...x.map(t=>({id:t.value,label:b(t.provider,t.region,e)}))]}),(0,C.jsxs)(s,{size:`sm`,variant:`secondary`,isPending:F||K,onPress:()=>void Ee(),children:[(0,C.jsx)(se,{size:14}),e(F?`refreshing`:`refresh`)]}),(0,C.jsxs)(v,{children:[(0,C.jsx)(v.Trigger,{children:(0,C.jsxs)(s,{size:`sm`,variant:`secondary`,isPending:K,isDisabled:F||W.length===0,onPress:()=>void ke(),children:[(0,C.jsx)(ae,{size:14}),e(K?`checkingModels`:`checkAllModels`)]})}),(0,C.jsx)(v.Content,{children:(0,C.jsx)(`p`,{className:`max-w-xs text-caption leading-5`,children:e(`checkModelsHint`)})})]})]})]})]}),z?(0,C.jsx)(c,{status:ge?`danger`:`success`,title:z}):null,J?(0,C.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-separator px-4 py-4 sm:items-center sm:px-5`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-body font-semibold`,children:e(`checkAllModels`)}),(0,C.jsx)(`div`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:e(`checkModelsSummary`,{passed:J.summary.passed,failed:J.summary.failed,total:J.summary.total,elapsed:J.elapsed_ms})})]}),(0,C.jsxs)(_,{size:`sm`,variant:`soft`,color:J.summary.failed?`warning`:`success`,className:`shrink-0`,children:[J.summary.passed,`/`,J.summary.total]})]}),(0,C.jsx)(p,{className:`hidden min-w-0 lg:block`,children:(0,C.jsx)(p.ScrollContainer,{className:`max-h-[24rem] min-w-0 overflow-auto`,children:(0,C.jsxs)(p.Content,{"aria-label":e(`checkAllModels`),className:`min-w-[52rem]`,children:[(0,C.jsxs)(p.Header,{children:[(0,C.jsx)(p.Column,{isRowHeader:!0,children:e(`modelCol`)}),(0,C.jsx)(p.Column,{children:e(`stateCol`)}),(0,C.jsx)(p.Column,{children:e(`account`)}),(0,C.jsx)(p.Column,{children:e(`providerCol`)}),(0,C.jsx)(p.Column,{children:e(`logsColLatency`)}),(0,C.jsx)(p.Column,{children:e(`checkAccountResults`)}),(0,C.jsx)(p.Column,{children:e(`response`)})]}),(0,C.jsx)(p.Body,{children:J.results.map(t=>(0,C.jsxs)(p.Row,{children:[(0,C.jsx)(p.Cell,{children:(0,C.jsx)(`span`,{className:`mono text-caption font-medium`,children:t.model})}),(0,C.jsx)(p.Cell,{children:(0,C.jsx)(_,{size:`sm`,variant:`soft`,color:t.ok?`success`:t.code===`no_models`||t.message===`model required`?`warning`:`danger`,children:t.ok?e(`checkResultOK`):t.code===`no_models`||t.message===`model required`?e(`checkResultSkipped`):e(`checkResultFailed`)})}),(0,C.jsx)(p.Cell,{children:(0,C.jsx)(`span`,{className:`mono text-caption text-muted`,children:t.account_id||`—`})}),(0,C.jsx)(p.Cell,{children:(0,C.jsx)(`span`,{className:`text-caption`,children:t.provider||`—`})}),(0,C.jsx)(p.Cell,{children:(0,C.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[t.latency_ms,`ms`]})}),(0,C.jsx)(p.Cell,{children:(0,C.jsx)(`div`,{className:`space-y-1`,children:(t.accounts||[]).length?t.accounts.map(n=>(0,C.jsxs)(`div`,{className:`text-caption leading-4`,children:[(0,C.jsx)(`span`,{className:`mono font-medium`,children:n.account_id}),(0,C.jsxs)(`span`,{className:n.ok?`text-success`:`text-danger`,children:[` `,n.ok?e(`checkResultOK`):e(`checkResultFailed`)]}),(0,C.jsxs)(`span`,{className:`text-muted`,children:[` · `,n.latency_ms,`ms`]}),n.message?(0,C.jsx)(`span`,{className:`block break-all text-muted`,children:n.message}):null]},`${t.model}:${n.account_id}`)):(0,C.jsx)(`span`,{className:`text-caption text-muted`,children:`—`})})}),(0,C.jsx)(p.Cell,{children:(0,C.jsx)(`span`,{className:`break-all text-caption text-muted`,children:t.message||(t.ok?e(`checkResultOK`):``)})})]},t.model))})]})})}),(0,C.jsx)(`div`,{className:`divide-y divide-separator lg:hidden`,children:J.results.map(t=>(0,C.jsxs)(`div`,{className:`space-y-1 px-4 py-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,C.jsx)(`span`,{className:`mono min-w-0 truncate text-caption font-medium`,children:t.model}),(0,C.jsx)(_,{size:`sm`,variant:`soft`,color:t.ok?`success`:`danger`,children:t.ok?e(`checkResultOK`):e(`checkResultFailed`)})]}),(0,C.jsxs)(`div`,{className:`text-caption text-muted`,children:[t.account_id||t.provider||`—`,` · `,t.latency_ms,`ms`]}),(t.accounts||[]).length?(0,C.jsx)(`div`,{className:`space-y-0.5`,children:t.accounts.map(n=>(0,C.jsxs)(`div`,{className:`text-caption leading-4`,children:[(0,C.jsx)(`span`,{className:`mono font-medium`,children:n.account_id}),(0,C.jsxs)(`span`,{className:n.ok?`text-success`:`text-danger`,children:[` `,n.ok?e(`checkResultOK`):e(`checkResultFailed`)]}),(0,C.jsxs)(`span`,{className:`text-muted`,children:[` · `,n.latency_ms,`ms`]}),n.message?(0,C.jsx)(`span`,{className:`block break-all text-muted`,children:n.message}):null]},`${t.model}:${n.account_id}`))}):null,t.message?(0,C.jsx)(`div`,{className:`break-all text-caption text-muted`,children:t.message}):null]},t.model))})]}):null,(0,C.jsxs)(l,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-separator px-4 py-4 sm:items-center sm:px-5`,children:[(0,C.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,C.jsx)(`div`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-secondary text-muted`,children:(0,C.jsx)(ie,{size:16})}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-body font-semibold`,children:e(`providerCatalog`)}),(0,C.jsx)(`div`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:e(`contextConfigHint`)})]})]}),(0,C.jsx)(_,{size:`sm`,variant:`soft`,className:`shrink-0`,children:X.length})]}),F||n?(0,C.jsx)(le,{}):X.length===0?(0,C.jsx)(u,{icon:(0,C.jsx)(r,{size:22}),title:W.length?e(`noModelsMatch`):e(`noProviders`),hint:W.length?d||h||e(`noModelsMatch`):e(`noModelsYet`)}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`div`,{className:`divide-y divide-separator lg:hidden`,children:xe.map(t=>{let n=E(t),r=L===n,i=D(t),a=O(t),o=b(i,a||void 0,e),s=ue(t),c=y(t);return(0,C.jsxs)(`article`,{className:`space-y-3 px-4 py-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,C.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,C.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":t.stale?void 0:`ok`}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(`div`,{className:`truncate font-medium`,children:t.display_name||t.id}),c?(0,C.jsx)(_,{size:`sm`,variant:`soft`,color:`success`,children:e(`modelFree`)}):null,s?(0,C.jsx)(`span`,{className:`mono text-caption text-muted`,children:s}):null]}),(0,C.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:t.id}),A(t)?(0,C.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:e(`routedTo`,{model:A(t)})}):null]})]}),Oe(t)]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-caption`,children:[(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,C.jsx)(de,{provider:i,size:14}),(0,C.jsx)(`span`,{className:`font-medium`,children:o})]}),(0,C.jsx)(`span`,{className:`mono break-all text-muted`,children:t.mapped_key||t.native_model||t.id})]}),(0,C.jsx)(j,{model:t,saving:r,t:e,variant:`card`,onToggleTraeMax:(e,t)=>void Ae(e,t)}),(0,C.jsx)(M,{model:t,t:e,onDetails:U})]},k(t))})}),(0,C.jsx)(p,{className:`hidden min-w-0 lg:block`,children:(0,C.jsx)(p.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,C.jsxs)(p.Content,{"aria-label":e(`availableModels`),className:`min-w-[68rem]`,children:[(0,C.jsxs)(p.Header,{children:[(0,C.jsx)(p.Column,{isRowHeader:!0,children:e(`modelCol`)}),(0,C.jsx)(p.Column,{children:e(`requestIdCol`)}),(0,C.jsx)(p.Column,{children:e(`providerCol`)}),(0,C.jsx)(p.Column,{children:e(`qoderKeyCol`)}),(0,C.jsx)(p.Column,{children:e(`modelDefaultsCol`)}),(0,C.jsx)(p.Column,{children:e(`stateCol`)}),(0,C.jsx)(p.Column,{children:e(`modelDetailsCol`)})]}),(0,C.jsx)(p.Body,{children:xe.map(t=>{let n=E(t),r=L===n,i=D(t),a=O(t),o=b(i,a||void 0,e),s=ue(t),c=y(t);return(0,C.jsxs)(p.Row,{children:[(0,C.jsx)(p.Cell,{children:(0,C.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,C.jsx)(`span`,{className:`status-dot`,"data-state":t.stale?void 0:`ok`}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(`div`,{className:`font-medium`,children:t.display_name||t.id}),c?(0,C.jsx)(_,{size:`sm`,variant:`soft`,color:`success`,children:e(`modelFree`)}):null,s?(0,C.jsx)(`span`,{className:`mono text-caption text-muted`,children:s}):null]}),A(t)?(0,C.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:e(`routedTo`,{model:A(t)})}):null]})]})}),(0,C.jsx)(p.Cell,{children:(0,C.jsx)(`span`,{className:`mono text-caption font-medium`,children:t.id})}),(0,C.jsx)(p.Cell,{children:(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(de,{provider:i,size:14}),(0,C.jsx)(`span`,{className:`text-caption font-medium`,children:o})]})}),(0,C.jsx)(p.Cell,{children:(0,C.jsx)(`span`,{className:`mono text-caption text-muted`,children:t.mapped_key||t.native_model||t.id})}),(0,C.jsx)(p.Cell,{children:(0,C.jsx)(j,{model:t,saving:r,t:e,variant:`table`,onToggleTraeMax:(e,t)=>void Ae(e,t)})}),(0,C.jsx)(p.Cell,{children:Oe(t)}),(0,C.jsx)(p.Cell,{children:(0,C.jsx)(M,{model:t,t:e,onDetails:U})})]},k(t))})})]})})})]})]}),(0,C.jsx)(pe,{model:H?W.find(e=>k(e)===k(H))||H:null,t:e,onClose:()=>U(null)}),(0,C.jsx)(i,{total:X.length,page:$,pageCount:Q,pageSize:P,loading:F,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:$,pages:Q}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:N,onPageSize:he})]})}export{N as ProvidersPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/SearchBar-DwSqSsBT.js b/internal/webui/static/assets/SearchBar-UDaAllIT.js similarity index 97% rename from internal/webui/static/assets/SearchBar-DwSqSsBT.js rename to internal/webui/static/assets/SearchBar-UDaAllIT.js index 3fbcac16..c8d67e99 100644 --- a/internal/webui/static/assets/SearchBar-DwSqSsBT.js +++ b/internal/webui/static/assets/SearchBar-UDaAllIT.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{H as r,V as i,Z as a,pt as o}from"./useI18n-B77RWTNi.js";import{B as s,c,s as l,z as u}from"./SharedElementTransition-BlCsXfb1.js";import{t as d}from"./search-field-d32AuGpH.js";import{n as f,t as p}from"./toggle-button-group-DR9Hhwb5.js";var m=t(e(),1),h=new Map([[`bold`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),m.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),g=m.forwardRef((e,t)=>m.createElement(o,{ref:t,...e,weights:h}));g.displayName=`MagnifyingGlassIcon`;var _=g,v=u({defaultVariants:{size:`md`},slots:{base:`pagination`,content:`pagination__content`,ellipsis:`pagination__ellipsis`,item:`pagination__item`,link:`pagination__link`,summary:`pagination__summary`},variants:{size:{lg:{base:`pagination--lg`},md:{base:`pagination--md`},sm:{base:`pagination--sm`}}}}),y=n(),b=(0,m.createContext)({}),x=({children:e,className:t,size:n,...r})=>{let i=m.useMemo(()=>v({size:n}),[n]);return(0,y.jsx)(b,{value:{slots:i},children:(0,y.jsx)(s.nav,{"aria-label":`pagination`,"data-slot":`pagination`,role:`navigation`,...r,className:l(i.base,t),children:e})})};x.displayName=`HeroUI.Pagination`;var S=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b);return(0,y.jsx)(s.div,{className:l(r?.summary,t),"data-slot":`pagination-summary`,dir:`auto`,...n,children:e})};S.displayName=`HeroUI.Pagination.Summary`;var C=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b);return(0,y.jsx)(s.ul,{className:l(r?.content,t),"data-slot":`pagination-content`,...n,children:e})};C.displayName=`HeroUI.Pagination.Content`;var w=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b);return(0,y.jsx)(s.li,{className:l(r?.item,t),"data-slot":`pagination-item`,...n,children:e})};w.displayName=`HeroUI.Pagination.Item`;var T=({children:e,className:t,isActive:n,...r})=>{let{slots:i}=(0,m.use)(b);return(0,y.jsx)(a,{"aria-current":n?`page`:void 0,className:c(t,i?.link()),"data-active":n?`true`:void 0,"data-slot":`pagination-link`,...r,children:e})};T.displayName=`HeroUI.Pagination.Link`;var E=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b),i=`${r?.link()??``} pagination__link--nav`.trim();return(0,y.jsx)(a,{className:c(t,i),"data-slot":`pagination-previous`,...n,children:e})};E.displayName=`HeroUI.Pagination.Previous`;var D=({children:e,className:t,...n})=>(0,y.jsx)(s.span,{"aria-hidden":`true`,className:t,"data-slot":`pagination-previous-icon`,...n,children:e??(0,y.jsx)(i,{})});D.displayName=`HeroUI.Pagination.PreviousIcon`;var O=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b),i=`${r?.link()??``} pagination__link--nav`.trim();return(0,y.jsx)(a,{className:c(t,i),"data-slot":`pagination-next`,...n,children:e})};O.displayName=`HeroUI.Pagination.Next`;var k=({children:e,className:t,...n})=>(0,y.jsx)(s.span,{"aria-hidden":`true`,className:t,"data-slot":`pagination-next-icon`,...n,children:e??(0,y.jsx)(r,{})});k.displayName=`HeroUI.Pagination.NextIcon`;var A=({className:e,...t})=>{let{slots:n}=(0,m.use)(b);return(0,y.jsx)(s.span,{"aria-hidden":`true`,className:l(n?.ellipsis,e),"data-slot":`pagination-ellipsis`,...t,children:`…`})};A.displayName=`HeroUI.Pagination.Ellipsis`;var j=Object.assign(x,{Content:C,Ellipsis:A,Item:w,Link:T,Next:O,NextIcon:k,Previous:E,PreviousIcon:D,Root:x,Summary:S}),M=[20,50,100],N=[20,50,100];function P(e,t){if(t<=7)return Array.from({length:t},(e,t)=>t+1);let n=[1];e>3&&n.push(`gap`);let r=Math.max(2,e-1),i=Math.min(t-1,e+1);for(let e=r;e<=i;e++)n.push(e);return e{let t=Number([...e][0]);d.includes(t)&&u(t)},"aria-label":a,children:d.map(e=>(0,y.jsx)(f,{id:String(e),children:e},e))})]}),(0,y.jsxs)(j,{size:`sm`,className:`w-fit`,children:[(0,y.jsx)(j.Summary,{className:`mono text-caption`,children:o}),(0,y.jsxs)(j.Content,{children:[(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Previous,{isDisabled:i||t<=1,onPress:()=>l(Math.max(1,t-1)),"aria-label":s,children:(0,y.jsx)(j.PreviousIcon,{})})}),m.map((e,n)=>e===`gap`?(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Ellipsis,{})},`gap-${n}`):(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Link,{isActive:e===t,isDisabled:i,onPress:()=>l(e),children:e})},e)),(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Next,{isDisabled:i||t>=n,onPress:()=>l(Math.min(n,t+1)),"aria-label":c,children:(0,y.jsx)(j.NextIcon,{})})})]})]})]})}function I({value:e,onChange:t,placeholder:n,ariaLabel:r,className:i}){return(0,y.jsx)(d,{"aria-label":r,value:e,onChange:t,className:i,children:(0,y.jsxs)(d.Group,{children:[(0,y.jsx)(d.SearchIcon,{}),(0,y.jsx)(d.Input,{placeholder:n}),(0,y.jsx)(d.ClearButton,{})]})})}export{_ as i,N as n,F as r,I as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{H as r,V as i,Z as a,pt as o}from"./useI18n-DAGWWg9N.js";import{B as s,c,s as l,z as u}from"./SharedElementTransition-BlCsXfb1.js";import{t as d}from"./search-field-BuHlt4Rv.js";import{n as f,t as p}from"./toggle-button-group-C1kahmRj.js";var m=t(e(),1),h=new Map([[`bold`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),m.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),g=m.forwardRef((e,t)=>m.createElement(o,{ref:t,...e,weights:h}));g.displayName=`MagnifyingGlassIcon`;var _=g,v=u({defaultVariants:{size:`md`},slots:{base:`pagination`,content:`pagination__content`,ellipsis:`pagination__ellipsis`,item:`pagination__item`,link:`pagination__link`,summary:`pagination__summary`},variants:{size:{lg:{base:`pagination--lg`},md:{base:`pagination--md`},sm:{base:`pagination--sm`}}}}),y=n(),b=(0,m.createContext)({}),x=({children:e,className:t,size:n,...r})=>{let i=m.useMemo(()=>v({size:n}),[n]);return(0,y.jsx)(b,{value:{slots:i},children:(0,y.jsx)(s.nav,{"aria-label":`pagination`,"data-slot":`pagination`,role:`navigation`,...r,className:l(i.base,t),children:e})})};x.displayName=`HeroUI.Pagination`;var S=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b);return(0,y.jsx)(s.div,{className:l(r?.summary,t),"data-slot":`pagination-summary`,dir:`auto`,...n,children:e})};S.displayName=`HeroUI.Pagination.Summary`;var C=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b);return(0,y.jsx)(s.ul,{className:l(r?.content,t),"data-slot":`pagination-content`,...n,children:e})};C.displayName=`HeroUI.Pagination.Content`;var w=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b);return(0,y.jsx)(s.li,{className:l(r?.item,t),"data-slot":`pagination-item`,...n,children:e})};w.displayName=`HeroUI.Pagination.Item`;var T=({children:e,className:t,isActive:n,...r})=>{let{slots:i}=(0,m.use)(b);return(0,y.jsx)(a,{"aria-current":n?`page`:void 0,className:c(t,i?.link()),"data-active":n?`true`:void 0,"data-slot":`pagination-link`,...r,children:e})};T.displayName=`HeroUI.Pagination.Link`;var E=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b),i=`${r?.link()??``} pagination__link--nav`.trim();return(0,y.jsx)(a,{className:c(t,i),"data-slot":`pagination-previous`,...n,children:e})};E.displayName=`HeroUI.Pagination.Previous`;var D=({children:e,className:t,...n})=>(0,y.jsx)(s.span,{"aria-hidden":`true`,className:t,"data-slot":`pagination-previous-icon`,...n,children:e??(0,y.jsx)(i,{})});D.displayName=`HeroUI.Pagination.PreviousIcon`;var O=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b),i=`${r?.link()??``} pagination__link--nav`.trim();return(0,y.jsx)(a,{className:c(t,i),"data-slot":`pagination-next`,...n,children:e})};O.displayName=`HeroUI.Pagination.Next`;var k=({children:e,className:t,...n})=>(0,y.jsx)(s.span,{"aria-hidden":`true`,className:t,"data-slot":`pagination-next-icon`,...n,children:e??(0,y.jsx)(r,{})});k.displayName=`HeroUI.Pagination.NextIcon`;var A=({className:e,...t})=>{let{slots:n}=(0,m.use)(b);return(0,y.jsx)(s.span,{"aria-hidden":`true`,className:l(n?.ellipsis,e),"data-slot":`pagination-ellipsis`,...t,children:`…`})};A.displayName=`HeroUI.Pagination.Ellipsis`;var j=Object.assign(x,{Content:C,Ellipsis:A,Item:w,Link:T,Next:O,NextIcon:k,Previous:E,PreviousIcon:D,Root:x,Summary:S}),M=[20,50,100],N=[20,50,100];function P(e,t){if(t<=7)return Array.from({length:t},(e,t)=>t+1);let n=[1];e>3&&n.push(`gap`);let r=Math.max(2,e-1),i=Math.min(t-1,e+1);for(let e=r;e<=i;e++)n.push(e);return e{let t=Number([...e][0]);d.includes(t)&&u(t)},"aria-label":a,children:d.map(e=>(0,y.jsx)(f,{id:String(e),children:e},e))})]}),(0,y.jsxs)(j,{size:`sm`,className:`w-fit`,children:[(0,y.jsx)(j.Summary,{className:`mono text-caption`,children:o}),(0,y.jsxs)(j.Content,{children:[(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Previous,{isDisabled:i||t<=1,onPress:()=>l(Math.max(1,t-1)),"aria-label":s,children:(0,y.jsx)(j.PreviousIcon,{})})}),m.map((e,n)=>e===`gap`?(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Ellipsis,{})},`gap-${n}`):(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Link,{isActive:e===t,isDisabled:i,onPress:()=>l(e),children:e})},e)),(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Next,{isDisabled:i||t>=n,onPress:()=>l(Math.min(n,t+1)),"aria-label":c,children:(0,y.jsx)(j.NextIcon,{})})})]})]})]})}function I({value:e,onChange:t,placeholder:n,ariaLabel:r,className:i}){return(0,y.jsx)(d,{"aria-label":r,value:e,onChange:t,className:i,children:(0,y.jsxs)(d.Group,{children:[(0,y.jsx)(d.SearchIcon,{}),(0,y.jsx)(d.Input,{placeholder:n}),(0,y.jsx)(d.ClearButton,{})]})})}export{_ as i,N as n,F as r,I as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/ShieldCheck.es-F8LRNwGN.js b/internal/webui/static/assets/ShieldCheck.es-Dqq1rq1d.js similarity index 98% rename from internal/webui/static/assets/ShieldCheck.es-F8LRNwGN.js rename to internal/webui/static/assets/ShieldCheck.es-Dqq1rq1d.js index 1309df60..5cafd5b6 100644 --- a/internal/webui/static/assets/ShieldCheck.es-F8LRNwGN.js +++ b/internal/webui/static/assets/ShieldCheck.es-Dqq1rq1d.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-B77RWTNi.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,36H48A20,20,0,0,0,28,56v56c0,54.29,26.32,87.22,48.4,105.29,23.71,19.39,47.44,26,48.44,26.29a12.1,12.1,0,0,0,6.32,0c1-.28,24.73-6.9,48.44-26.29,22.08-18.07,48.4-51,48.4-105.29V56A20,20,0,0,0,208,36Zm-4,76c0,35.71-13.09,64.69-38.91,86.15A126.28,126.28,0,0,1,128,219.38a126.14,126.14,0,0,1-37.09-21.23C65.09,176.69,52,147.71,52,112V60H204ZM79.51,144.49a12,12,0,1,1,17-17L112,143l47.51-47.52a12,12,0,0,1,17,17l-56,56a12,12,0,0,1-17,0Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,56v56c0,96-88,120-88,120S40,208,40,112V56a8,8,0,0,1,8-8H208A8,8,0,0,1,216,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm-34.32,69.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,42H48A14,14,0,0,0,34,56v56c0,51.94,25.12,83.4,46.2,100.64,22.73,18.6,45.27,24.89,46.22,25.15a6,6,0,0,0,3.16,0c.95-.26,23.49-6.55,46.22-25.15C196.88,195.4,222,163.94,222,112V56A14,14,0,0,0,208,42Zm2,70c0,37.76-13.94,68.39-41.44,91.06A131.17,131.17,0,0,1,128,225.72a130.94,130.94,0,0,1-40.56-22.66C59.94,180.39,46,149.76,46,112V56a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2ZM172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,44H48A12,12,0,0,0,36,56v56c0,51.16,24.73,82.12,45.47,99.1,22.4,18.32,44.55,24.5,45.48,24.76a4,4,0,0,0,2.1,0c.93-.26,23.08-6.44,45.48-24.76,20.74-17,45.47-47.94,45.47-99.1V56A12,12,0,0,0,208,44Zm4,68c0,38.44-14.23,69.63-42.29,92.71A132.45,132.45,0,0,1,128,227.82a132.23,132.23,0,0,1-41.71-23.11C58.23,181.63,44,150.44,44,112V56a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-41.17-10.83a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`ShieldCheckIcon`;var o=a;export{o as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-DAGWWg9N.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,36H48A20,20,0,0,0,28,56v56c0,54.29,26.32,87.22,48.4,105.29,23.71,19.39,47.44,26,48.44,26.29a12.1,12.1,0,0,0,6.32,0c1-.28,24.73-6.9,48.44-26.29,22.08-18.07,48.4-51,48.4-105.29V56A20,20,0,0,0,208,36Zm-4,76c0,35.71-13.09,64.69-38.91,86.15A126.28,126.28,0,0,1,128,219.38a126.14,126.14,0,0,1-37.09-21.23C65.09,176.69,52,147.71,52,112V60H204ZM79.51,144.49a12,12,0,1,1,17-17L112,143l47.51-47.52a12,12,0,0,1,17,17l-56,56a12,12,0,0,1-17,0Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,56v56c0,96-88,120-88,120S40,208,40,112V56a8,8,0,0,1,8-8H208A8,8,0,0,1,216,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm-34.32,69.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,42H48A14,14,0,0,0,34,56v56c0,51.94,25.12,83.4,46.2,100.64,22.73,18.6,45.27,24.89,46.22,25.15a6,6,0,0,0,3.16,0c.95-.26,23.49-6.55,46.22-25.15C196.88,195.4,222,163.94,222,112V56A14,14,0,0,0,208,42Zm2,70c0,37.76-13.94,68.39-41.44,91.06A131.17,131.17,0,0,1,128,225.72a130.94,130.94,0,0,1-40.56-22.66C59.94,180.39,46,149.76,46,112V56a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2ZM172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,44H48A12,12,0,0,0,36,56v56c0,51.16,24.73,82.12,45.47,99.1,22.4,18.32,44.55,24.5,45.48,24.76a4,4,0,0,0,2.1,0c.93-.26,23.08-6.44,45.48-24.76,20.74-17,45.47-47.94,45.47-99.1V56A12,12,0,0,0,208,44Zm4,68c0,38.44-14.23,69.63-42.29,92.71A132.45,132.45,0,0,1,128,227.82a132.23,132.23,0,0,1-41.71-23.11C58.23,181.63,44,150.44,44,112V56a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-41.17-10.83a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`ShieldCheckIcon`;var o=a;export{o as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/SidebarUpdateDialog-QMlmsibN.js b/internal/webui/static/assets/SidebarUpdateDialog-C1Ql9j5-.js similarity index 83% rename from internal/webui/static/assets/SidebarUpdateDialog-QMlmsibN.js rename to internal/webui/static/assets/SidebarUpdateDialog-C1Ql9j5-.js index 94e05f48..69d271d5 100644 --- a/internal/webui/static/assets/SidebarUpdateDialog-QMlmsibN.js +++ b/internal/webui/static/assets/SidebarUpdateDialog-C1Ql9j5-.js @@ -1 +1 @@ -import{n as e}from"./shim-mfK0Rmj6.js";import{r as t}from"./useI18n-B77RWTNi.js";import{t as n}from"./PageAlert-r7ZVsH9h.js";import{t as r}from"./modal-q_Ums9Et.js";import{en as i}from"./index-CmGY2WQi.js";import{n as a,r as o,t as s}from"./UpdateControls-B_y4QTcu.js";var c=e();function l({open:e,update:l,release:u,version:d,lang:f,labels:p,onClose:m,onGoToUpdate:h}){return(0,c.jsx)(r.Root,{isOpen:e,onOpenChange:e=>{e||m()},children:(0,c.jsx)(r.Backdrop,{variant:`blur`,children:(0,c.jsx)(r.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,c.jsxs)(r.Dialog,{children:[(0,c.jsxs)(r.Header,{className:`items-start justify-between gap-4`,children:[(0,c.jsxs)(`div`,{children:[(0,c.jsx)(r.Heading,{className:`text-section font-semibold`,children:p.versionUpdate}),(0,c.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:u?.tag_name||d})]}),(0,c.jsx)(r.CloseTrigger,{"aria-label":p.close,className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,c.jsx)(i,{size:16})})]}),(0,c.jsxs)(r.Body,{className:`space-y-4`,children:[l.error?(0,c.jsx)(n,{title:l.error}):null,(0,c.jsx)(s,{update:l}),(0,c.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:p.releaseNotes}),(0,c.jsx)(a,{markdown:o(u?.body,f),emptyLabel:p.emptyNotes})]}),(0,c.jsxs)(r.Footer,{className:`justify-end`,children:[(0,c.jsx)(t,{variant:`ghost`,className:`mr-auto`,onPress:h,children:p.goToUpdate}),(0,c.jsx)(t,{variant:`secondary`,onPress:m,children:p.close})]})]})})})})}export{l as SidebarUpdateDialog}; \ No newline at end of file +import{n as e}from"./shim-mfK0Rmj6.js";import{r as t}from"./useI18n-DAGWWg9N.js";import{t as n}from"./PageAlert-BTp9jdUz.js";import{t as r}from"./modal-BqXo29An.js";import{Dt as i}from"./index-BYut8qRj.js";import{n as a,r as o,t as s}from"./UpdateControls-Cd_MTxBw.js";var c=e();function l({open:e,update:l,release:u,version:d,lang:f,labels:p,onClose:m,onGoToUpdate:h}){return(0,c.jsx)(r.Root,{isOpen:e,onOpenChange:e=>{e||m()},children:(0,c.jsx)(r.Backdrop,{variant:`blur`,children:(0,c.jsx)(r.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,c.jsxs)(r.Dialog,{children:[(0,c.jsxs)(r.Header,{className:`items-start justify-between gap-4`,children:[(0,c.jsxs)(`div`,{children:[(0,c.jsx)(r.Heading,{className:`text-section font-semibold`,children:p.versionUpdate}),(0,c.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:u?.tag_name||d})]}),(0,c.jsx)(r.CloseTrigger,{"aria-label":p.close,className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,c.jsx)(i,{size:16})})]}),(0,c.jsxs)(r.Body,{className:`space-y-4`,children:[l.error?(0,c.jsx)(n,{title:l.error}):null,(0,c.jsx)(s,{update:l}),(0,c.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:p.releaseNotes}),(0,c.jsx)(a,{markdown:o(u?.body,f),emptyLabel:p.emptyNotes})]}),(0,c.jsxs)(r.Footer,{className:`justify-end`,children:[(0,c.jsx)(t,{variant:`ghost`,className:`mr-auto`,onPress:h,children:p.goToUpdate}),(0,c.jsx)(t,{variant:`secondary`,onPress:m,children:p.close})]})]})})})})}export{l as SidebarUpdateDialog}; \ No newline at end of file diff --git a/internal/webui/static/assets/SystemPage-DqpX1wmZ.js b/internal/webui/static/assets/SystemPage-DqpX1wmZ.js deleted file mode 100644 index b0eeddc5..00000000 --- a/internal/webui/static/assets/SystemPage-DqpX1wmZ.js +++ /dev/null @@ -1 +0,0 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./clipboard-DfpIZ3R1.js";import{t as a}from"./ShieldCheck.es-F8LRNwGN.js";import{n as o,pt as s,r as c}from"./useI18n-B77RWTNi.js";import{t as l}from"./label-DLoR3Z-C.js";import{t as u}from"./list-box-rbke8Feh.js";import{t as d}from"./accordion-IDhFN4Ix.js";import{t as f}from"./PageAlert-r7ZVsH9h.js";import{t as p}from"./ConfirmDialog-CNztRgAW.js";import{n as m}from"./useToggle-BRoRhkOA.js";import{n as h,r as g,t as _}from"./FormRow-DvxQavWE.js";import{t as v}from"./modal-q_Ums9Et.js";import{n as y,t as b}from"./tabs-BShFVox8.js";import{t as x}from"./select-BRn66sMj.js";import{t as S}from"./CompactSwitch-BinKb1rw.js";import{S as ee,T as C,V as w,at as T,bn as E,cn as te,dn as ne,en as D,gn as re,hn as ie,m as ae,p as O,pn as k,tt as oe,w as se,xn as ce}from"./index-CmGY2WQi.js";import{n as A,r as j,t as le}from"./UpdateControls-B_y4QTcu.js";import{a as ue,i as de}from"./keys-C0KNDmKA.js";var M=t(e(),1),N=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232.49,192.49l-32,32a12,12,0,0,1-17,0l-32-32a12,12,0,0,1,17-17L180,187V141L128,89,76,141V187l11.51-11.52a12,12,0,0,1,17,17l-32,32a12,12,0,0,1-17,0l-32-32a12,12,0,1,1,17-17L52,187V136a12,12,0,0,1,3.51-8.49L116,67V24a12,12,0,0,1,24,0V67l60.49,60.48A12,12,0,0,1,204,136v51l11.51-11.52a12,12,0,0,1,17,17Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M192,136v80H64V136l64-64Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M229.66,189.66l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L184,196.69V139.31l-56-56-56,56v57.38l18.34-18.35a8,8,0,0,1,11.32,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L56,196.69V136a8,8,0,0,1,2.34-5.66L120,68.69V24a8,8,0,0,1,16,0V68.69l61.66,61.65A8,8,0,0,1,200,136v60.69l18.34-18.35a8,8,0,0,1,11.32,11.32Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M229.66,189.66l-32,32a8,8,0,0,1-11.32,0l-32-32A8,8,0,0,1,160,176h24V139.31l-56-56-56,56V176H96a8,8,0,0,1,5.66,13.66l-32,32a8,8,0,0,1-11.32,0l-32-32A8,8,0,0,1,32,176H56V136a8,8,0,0,1,2.34-5.66L120,68.69V24a8,8,0,0,1,16,0V68.69l61.66,61.65A8,8,0,0,1,200,136v40h24a8,8,0,0,1,5.66,13.66Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M228.24,188.24l-32,32a6,6,0,0,1-8.48,0l-32-32a6,6,0,0,1,8.48-8.48L186,201.51v-63l-58-58-58,58v63l21.76-21.75a6,6,0,0,1,8.48,8.48l-32,32a6,6,0,0,1-8.48,0l-32-32a6,6,0,0,1,8.48-8.48L58,201.51V136a6,6,0,0,1,1.76-4.24L122,69.51V24a6,6,0,0,1,12,0V69.51l62.24,62.25A6,6,0,0,1,198,136v65.51l21.76-21.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M229.66,189.66l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L184,196.69V139.31l-56-56-56,56v57.38l18.34-18.35a8,8,0,0,1,11.32,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L56,196.69V136a8,8,0,0,1,2.34-5.66L120,68.69V24a8,8,0,0,1,16,0V68.69l61.66,61.65A8,8,0,0,1,200,136v60.69l18.34-18.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M226.83,186.83l-32,32a4,4,0,0,1-5.66,0l-32-32a4,4,0,0,1,5.66-5.66L188,206.34V137.66l-60-60-60,60v68.68l25.17-25.17a4,4,0,0,1,5.66,5.66l-32,32a4,4,0,0,1-5.66,0l-32-32a4,4,0,0,1,5.66-5.66L60,206.34V136a4,4,0,0,1,1.17-2.83L124,70.34V24a4,4,0,0,1,8,0V70.34l62.83,62.83A4,4,0,0,1,196,136v70.34l25.17-25.17a4,4,0,0,1,5.66,5.66Z`}))]]),P=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M196,35.52C177.62,25.51,153.48,20,128,20S78.38,25.51,60,35.52C39.37,46.79,28,62.58,28,80v96c0,17.42,11.37,33.21,32,44.48,18.35,10,42.49,15.52,68,15.52s49.62-5.51,68-15.52c20.66-11.27,32-27.06,32-44.48V80C228,62.58,216.63,46.79,196,35.52ZM204,128c0,17-31.21,36-76,36s-76-19-76-36v-8.46a88.9,88.9,0,0,0,8,4.94c18.35,10,42.49,15.52,68,15.52s49.62-5.51,68-15.52a88.9,88.9,0,0,0,8-4.94ZM128,44c44.79,0,76,19,76,36s-31.21,36-76,36S52,97,52,80,83.21,44,128,44Zm0,168c-44.79,0-76-19-76-36v-8.46a88.9,88.9,0,0,0,8,4.94c18.35,10,42.49,15.52,68,15.52s49.62-5.51,68-15.52a88.9,88.9,0,0,0,8-4.94V176C204,193,172.79,212,128,212Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,80c0,26.51-39.4,48-88,48S40,106.51,40,80s39.4-48,88-48S216,53.49,216,80Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64ZM69.61,53.08C85.07,44.65,105.81,40,128,40s42.93,4.65,58.39,13.08C200.12,60.57,208,70.38,208,80s-7.88,19.43-21.61,26.92C170.93,115.35,150.19,120,128,120s-42.93-4.65-58.39-13.08C55.88,99.43,48,89.62,48,80S55.88,60.57,69.61,53.08ZM186.39,202.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64Zm-21.61,74.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M128,26C75.29,26,34,49.72,34,80v96c0,30.28,41.29,54,94,54s94-23.72,94-54V80C222,49.72,180.71,26,128,26Zm0,12c44.45,0,82,19.23,82,42s-37.55,42-82,42S46,102.77,46,80,83.55,38,128,38Zm82,138c0,22.77-37.55,42-82,42s-82-19.23-82-42V154.79C62,171.16,92.37,182,128,182s66-10.84,82-27.21Zm0-48c0,22.77-37.55,42-82,42s-82-19.23-82-42V106.79C62,123.16,92.37,134,128,134s66-10.84,82-27.21Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64ZM69.61,53.08C85.07,44.65,105.81,40,128,40s42.93,4.65,58.39,13.08C200.12,60.57,208,70.38,208,80s-7.88,19.43-21.61,26.92C170.93,115.35,150.19,120,128,120s-42.93-4.65-58.39-13.08C55.88,99.43,48,89.62,48,80S55.88,60.57,69.61,53.08ZM186.39,202.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M192.14,42.55C174.94,33.17,152.16,28,128,28S81.06,33.17,63.86,42.55C45.89,52.35,36,65.65,36,80v96c0,14.35,9.89,27.65,27.86,37.45,17.2,9.38,40,14.55,64.14,14.55s46.94-5.17,64.14-14.55c18-9.8,27.86-23.1,27.86-37.45V80C220,65.65,210.11,52.35,192.14,42.55ZM212,176c0,11.29-8.41,22.1-23.69,30.43C172.27,215.18,150.85,220,128,220s-44.27-4.82-60.31-13.57C52.41,198.1,44,187.29,44,176V149.48c4.69,5.93,11.37,11.34,19.86,16,17.2,9.38,40,14.55,64.14,14.55s46.94-5.17,64.14-14.55c8.49-4.63,15.17-10,19.86-16Zm0-48c0,11.29-8.41,22.1-23.69,30.43C172.27,167.18,150.85,172,128,172s-44.27-4.82-60.31-13.57C52.41,150.1,44,139.29,44,128V101.48c4.69,5.93,11.37,11.34,19.86,16,17.2,9.38,40,14.55,64.14,14.55s46.94-5.17,64.14-14.55c8.49-4.63,15.17-10,19.86-16Zm-23.69-17.57C172.27,119.18,150.85,124,128,124s-44.27-4.82-60.31-13.57C52.41,102.1,44,91.29,44,80s8.41-22.1,23.69-30.43C83.73,40.82,105.15,36,128,36s44.27,4.82,60.31,13.57C203.59,57.9,212,68.71,212,80S203.59,102.1,188.31,110.43Z`}))]]),F=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M40,92H70.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24H137.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24Zm64-24A12,12,0,1,1,92,80,12,12,0,0,1,104,68Zm112,96H201.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24h94.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24Zm-48,24a12,12,0,1,1,12-12A12,12,0,0,1,168,188Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M128,80a24,24,0,1,1-24-24A24,24,0,0,1,128,80Zm40,72a24,24,0,1,0,24,24A24,24,0,0,0,168,152Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M32,80a8,8,0,0,1,8-8H77.17a28,28,0,0,1,53.66,0H216a8,8,0,0,1,0,16H130.83a28,28,0,0,1-53.66,0H40A8,8,0,0,1,32,80Zm184,88H194.83a28,28,0,0,0-53.66,0H40a8,8,0,0,0,0,16H141.17a28,28,0,0,0,53.66,0H216a8,8,0,0,0,0-16Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M40,86H74.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12H133.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12Zm64-24A18,18,0,1,1,86,80,18,18,0,0,1,104,62ZM216,170H197.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12h98.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12Zm-48,24a18,18,0,1,1,18-18A18,18,0,0,1,168,194Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M40,84H76.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8H131.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8Zm64-24A20,20,0,1,1,84,80,20,20,0,0,1,104,60ZM216,172H195.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8H140.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8Zm-48,24a20,20,0,1,1,20-20A20,20,0,0,1,168,196Z`}))]]),I=M.forwardRef((e,t)=>M.createElement(s,{ref:t,...e,weights:N}));I.displayName=`ArrowsSplitIcon`;var fe=I,L=M.forwardRef((e,t)=>M.createElement(s,{ref:t,...e,weights:P}));L.displayName=`DatabaseIcon`;var pe=L,R=M.forwardRef((e,t)=>M.createElement(s,{ref:t,...e,weights:F}));R.displayName=`SlidersHorizontalIcon`;var z=R,B=n();function me({settings:e,onSaved:t}){let{t:n}=o(),r=E(),[i,a]=(0,M.useState)(null),[s,l]=(0,M.useState)({}),[u,d]=(0,M.useState)(!1),[p,h]=(0,M.useState)(``);(0,M.useEffect)(()=>{let e=!0;return w().then(t=>{e&&a((t.data||[]).filter(e=>e.regions.some(e=>e.checkin)))}).catch(t=>{e&&h(String(t))}),()=>{e=!1}},[]);async function v(n,r){if(!(!e||r===e.checkin_times[n])){d(!0),h(``);try{t(await C({checkin_times:{[n]:r}}))}catch(e){h(e instanceof Error?e.message:String(e))}finally{l(e=>{let t={...e};return delete t[n],t}),d(!1)}}}return(0,B.jsxs)(m,{"data-gsap-reveal":!0,children:[(0,B.jsxs)(m.Header,{children:[(0,B.jsx)(m.Title,{children:n(`checkinDefaultsTitle`)}),(0,B.jsx)(m.Description,{children:n(`checkinDefaultsHint`)})]}),(0,B.jsxs)(m.Content,{className:`space-y-4`,children:[p?(0,B.jsx)(f,{title:p}):null,!e||!i?(0,B.jsx)(O,{className:`h-24 w-full`}):i.map(t=>(0,B.jsx)(_,{label:t.label,hint:t.regions.filter(e=>e.checkin).map(t=>`${t.label} · ${t.checkin?.timezone===`Local`?e.timezone:t.checkin?.timezone}`).join(` / `),children:(0,B.jsx)(g,{type:`time`,value:s[t.id]??e.checkin_times[t.id]??``,disabled:u,"aria-label":`${t.label} ${n(`autoCheckinTime`)}`,onChange:e=>l(n=>({...n,[t.id]:e.target.value})),onBlur:e=>void v(t.id,e.target.value)})},t.id))]}),(0,B.jsx)(m.Footer,{children:(0,B.jsx)(c,{variant:`secondary`,onPress:()=>r(`/accounts`),children:n(`navAccounts`)})})]})}function V(e,t){if(!e)return``;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toLocaleDateString(t===`zh`?`zh-CN`:`en-US`,{year:`numeric`,month:`short`,day:`numeric`})}function he({releases:e,currentVersion:t,nextVersion:n,rollbackTags:r,canRollback:i,submitting:a,onRestore:s}){let{t:l,lang:u}=o();if(!e.length)return null;let f=n&&n!==t?n:t,p=e.some(e=>e.tag_name===f)?f:e[0]?.tag_name,m=new Set(r);return(0,B.jsxs)(`div`,{className:`mt-5`,children:[(0,B.jsx)(`div`,{className:`mb-2`,children:(0,B.jsx)(`p`,{className:`text-caption font-medium text-foreground`,children:l(`versionHistory`)})}),(0,B.jsx)(d,{className:`rounded-lg bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:p?[p]:[],children:e.map(e=>{let r=e.tag_name,o=r===t,f=!!(n&&r===n&&n!==t),p=i&&m.has(r)&&!o,h=V(e.published_at,u);return(0,B.jsxs)(d.Item,{id:r,children:[(0,B.jsx)(d.Heading,{children:(0,B.jsxs)(d.Trigger,{className:`items-center gap-3 px-3 py-2.5 text-left`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`mono text-body font-semibold`,children:r}),o?(0,B.jsx)(T,{size:`sm`,variant:`soft`,color:`success`,children:l(`versionCurrentBadge`)}):null,f?(0,B.jsx)(T,{size:`sm`,variant:`soft`,color:`warning`,children:l(`versionLatestBadge`)}):null,h?(0,B.jsx)(`span`,{className:`truncate text-caption text-muted`,children:h}):null]}),(0,B.jsx)(d.Indicator,{})]})}),(0,B.jsx)(d.Panel,{children:(0,B.jsxs)(d.Body,{className:`px-3 pb-3`,children:[(0,B.jsx)(`div`,{className:`release-notes-box release-notes-box--compact`,children:(0,B.jsx)(A,{markdown:j(e.body,u),emptyLabel:l(`updateNoNotes`)})}),p?(0,B.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,B.jsx)(c,{size:`sm`,variant:`ghost`,isDisabled:a,onPress:()=>s(r),children:l(`restoreThisVersion`)})}):null]})})]},r)})})]})}function H(e){let t=new Set,n=[];for(let r of e){let e=r.tag_name?.trim();!e||t.has(e)||(t.add(e),n.push({...r,tag_name:e}))}return n}function ge(e,t,n,r,i){return r?.length?H(r):H([...n?[n]:t?[{tag_name:t}]:[],...e?[{tag_name:e}]:[],...i||[]])}var _e=[`general`,`routing`,`security`,`updates`];function U(){let{t:e}=o(),[t,n]=ce(),s=t.get(`tab`),d=s&&_e.includes(s)?s:`general`,w=e=>n(e===`general`?{}:{tab:e},{replace:!0}),{setApiKey:E}=oe(),[O,A]=(0,M.useState)(null),[j,N]=(0,M.useState)(null),[P,F]=(0,M.useState)(``),[I,L]=(0,M.useState)(!1),[R,V]=(0,M.useState)(!1),[H,U]=(0,M.useState)(!1),[W,G]=(0,M.useState)(``),[ve,K]=(0,M.useState)(!1),[q,J]=(0,M.useState)(``),Y=ee(),{info:X,loading:ye,checking:be,submitting:Z,error:Q,setError:$,load:xe,canRollback:Se,rollbackTo:Ce}=Y,we=(0,M.useMemo)(()=>ge(X?.current_version||``,X?.next_version,X?.release,X?.recent_releases,X?.rollback_versions),[X?.current_version,X?.next_version,X?.release,X?.recent_releases,X?.rollback_versions]),Te=(0,M.useMemo)(()=>(X?.rollback_versions||[]).map(e=>e.tag_name),[X?.rollback_versions]);(0,M.useEffect)(()=>{let e=window.setTimeout(()=>{de().then(A).catch(()=>void 0),se().then(e=>{N(e),F(e.proxy_url||``)}).catch(e=>$(e instanceof Error?e.message:String(e)))},0);return()=>window.clearTimeout(e)},[$]);async function Ee(e){let t=j?.cross_provider_model_pool??!0;N(t=>t&&{...t,cross_provider_model_pool:e}),L(!0),$(``);try{N(await C({cross_provider_model_pool:e}))}catch(e){N(e=>e&&{...e,cross_provider_model_pool:t}),$(e instanceof Error?e.message:String(e))}finally{L(!1)}}async function De(e){let t=j?.checkin_disabled_accounts??!1;N(t=>t&&{...t,checkin_disabled_accounts:e}),L(!0),$(``);try{N(await C({checkin_disabled_accounts:e}))}catch(e){N(e=>e&&{...e,checkin_disabled_accounts:t}),$(e instanceof Error?e.message:String(e))}finally{L(!1)}}async function Oe(e){let t=j?.proxy_url||``;if(e===t){F(t);return}let n=P;F(e),N(t=>t&&{...t,proxy_url:e}),L(!0),$(``);try{let t=await C({proxy_url:e});N(t),F(t.proxy_url||``)}catch(e){F(n),N(e=>e&&{...e,proxy_url:t}),$(e instanceof Error?e.message:String(e))}finally{L(!1)}}async function ke(e){let t=j?.routing_strategy||`round-robin`;N(t=>t&&{...t,routing_strategy:e}),L(!0),$(``);try{N(await C({routing_strategy:e}))}catch(e){N(e=>e&&{...e,routing_strategy:t}),$(e instanceof Error?e.message:String(e))}finally{L(!1)}}return ye&&!X?(0,B.jsx)(ae,{}):(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:e(`systemSettingsTitle`)}),(0,B.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`systemSettingsLead`)})]}),(0,B.jsxs)(c,{size:`sm`,variant:`secondary`,isPending:be,onPress:()=>void xe(!0),children:[(0,B.jsx)(ie,{size:15}),e(`checkUpdates`)]})]}),Q?(0,B.jsx)(f,{title:Q}):null,(0,B.jsxs)(b,{selectedKey:d,onSelectionChange:e=>w(String(e)),children:[(0,B.jsx)(b.ListContainer,{className:`w-fit max-w-full overflow-x-auto`,children:(0,B.jsxs)(b.List,{"aria-label":e(`systemSettingsTitle`),children:[(0,B.jsxs)(y,{id:`general`,className:`gap-1.5 whitespace-nowrap`,children:[(0,B.jsx)(b.Indicator,{}),(0,B.jsx)(ne,{size:13}),e(`settingsTabGeneral`)]}),(0,B.jsxs)(y,{id:`routing`,className:`gap-1.5 whitespace-nowrap`,children:[(0,B.jsx)(b.Indicator,{}),(0,B.jsx)(fe,{size:13}),e(`settingsTabRouting`)]}),(0,B.jsxs)(y,{id:`security`,className:`gap-1.5 whitespace-nowrap`,children:[(0,B.jsx)(b.Indicator,{}),(0,B.jsx)(a,{size:13}),e(`settingsTabSecurity`)]}),(0,B.jsxs)(y,{id:`updates`,className:`gap-1.5 whitespace-nowrap`,children:[(0,B.jsx)(b.Indicator,{}),(0,B.jsx)(re,{size:13}),e(`settingsTabUpdates`)]})]})}),(0,B.jsx)(b.Panel,{id:`general`,className:`pt-5`,children:(0,B.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,B.jsxs)(m,{"data-gsap-reveal":!0,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,B.jsx)(z,{size:15})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold`,children:e(`proxySettingsTitle`)}),(0,B.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`proxySettingsHint`)})]})]}),(0,B.jsxs)(`div`,{className:`mt-4 space-y-1.5`,children:[(0,B.jsx)(l,{className:`text-body font-medium text-muted`,children:e(`proxyUrl`)}),(0,B.jsx)(g,{value:P,onChange:e=>F(e.target.value),onBlur:e=>void Oe(e.target.value.trim()),placeholder:e(`proxyUrlPlaceholder`),disabled:I||!j}),(0,B.jsx)(h,{className:`text-caption leading-5 text-muted`,children:e(`proxyUrlHint`)})]})]}),(0,B.jsxs)(m,{"data-gsap-reveal":!0,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,B.jsx)(k,{size:15})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold`,children:e(`checkinDisabledAccountsTitle`)}),(0,B.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`checkinDisabledAccountsHint`)})]})]}),(0,B.jsx)(S,{isSelected:j?.checkin_disabled_accounts??!1,isDisabled:I||!j,ariaLabel:e(`checkinDisabledAccountsAriaLabel`),onChange:e=>void De(e)})]}),(0,B.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,B.jsx)(`span`,{children:e(`checkinDisabledAccountsStatus`)}),(0,B.jsx)(`span`,{className:`font-medium text-foreground`,children:j?.checkin_disabled_accounts?e(`enabled`):e(`disabled`)})]})]}),(0,B.jsx)(me,{settings:j,onSaved:N})]})}),(0,B.jsx)(b.Panel,{id:`routing`,className:`pt-5`,children:(0,B.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,B.jsxs)(m,{"data-gsap-reveal":!0,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,B.jsx)(z,{size:15})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold`,children:e(`routingStrategyTitle`)}),(0,B.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`routingStrategyHint`)})]})]}),(0,B.jsx)(`div`,{className:`mt-4 pt-4`,children:(0,B.jsx)(_,{label:e(`routingStrategy`),children:(0,B.jsxs)(x,{fullWidth:!0,"aria-label":e(`routingStrategy`),value:j?.routing_strategy||`round-robin`,isDisabled:I||!j,onChange:e=>{typeof e==`string`&&e&&ke(e)},children:[(0,B.jsxs)(x.Trigger,{className:`items-center`,children:[(0,B.jsx)(x.Value,{className:`min-w-0 truncate`}),(0,B.jsx)(x.Indicator,{})]}),(0,B.jsx)(x.Popover,{children:(0,B.jsxs)(u,{children:[(0,B.jsxs)(u.Item,{id:`round-robin`,textValue:`round-robin`,children:[(0,B.jsx)(l,{children:e(`routingRoundRobin`)}),(0,B.jsx)(u.ItemIndicator,{})]}),(0,B.jsxs)(u.Item,{id:`weighted-round-robin`,textValue:`weighted-round-robin`,children:[(0,B.jsx)(l,{children:e(`routingWeightedRoundRobin`)}),(0,B.jsx)(u.ItemIndicator,{})]}),(0,B.jsxs)(u.Item,{id:`fill-first`,textValue:`fill-first`,children:[(0,B.jsx)(l,{children:e(`routingFillFirst`)}),(0,B.jsx)(u.ItemIndicator,{})]}),(0,B.jsxs)(u.Item,{id:`fefo`,textValue:`fefo`,children:[(0,B.jsx)(l,{children:e(`routingFEFO`)}),(0,B.jsx)(u.ItemIndicator,{})]})]})})]})})}),(0,B.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2 pt-3 text-caption text-muted sm:grid-cols-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:j?.session_affinity?.ttl_seconds?`${Math.round(j.session_affinity.ttl_seconds/60)}m`:`—`}),e(`sessionAffinityTTL`)]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:j?.session_affinity?.hits??0}),e(`sessionAffinityHits`)]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:j?.session_affinity?.misses??0}),e(`sessionAffinityMisses`)]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:j?.session_affinity?.escapes??0}),e(`sessionAffinityEscapes`)]})]}),j?.session_affinity?.last_escape_reason?(0,B.jsxs)(h,{className:`mt-3 text-caption`,children:[e(`lastSessionEscape`),`: `,j.session_affinity.last_escape_reason]}):null,j?.session_affinity?.last_miss_reason?(0,B.jsxs)(h,{className:`mt-1 text-caption`,children:[e(`lastSessionMiss`),`: `,j.session_affinity.last_miss_reason]}):null]}),(0,B.jsxs)(m,{"data-gsap-reveal":!0,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,B.jsx)(z,{size:15})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold`,children:e(`crossProviderModelPoolTitle`)}),(0,B.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`crossProviderModelPoolHint`)})]})]}),(0,B.jsx)(S,{isSelected:j?.cross_provider_model_pool??!0,isDisabled:I||!j,ariaLabel:e(`crossProviderModelPoolAriaLabel`),onChange:e=>void Ee(e)})]}),(0,B.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,B.jsx)(`span`,{children:e(`crossProviderModelPoolStatus`)}),(0,B.jsx)(`span`,{className:`font-medium text-foreground`,children:j?.cross_provider_model_pool?e(`enabled`):e(`disabled`)})]})]})]})}),(0,B.jsx)(b.Panel,{id:`security`,className:`pt-5`,children:(0,B.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,B.jsxs)(m,{"data-gsap-reveal":!0,children:[(0,B.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,B.jsx)(te,{size:15})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold`,children:e(`consoleKeyTitle`)}),(0,B.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyHint`)})]})]})}),(0,B.jsx)(`code`,{className:`mono mt-4 block rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:O?.prefix||`—`}),(0,B.jsx)(`p`,{className:`mt-3 text-caption leading-5 text-muted`,children:e(`consoleKeyLead`)}),(0,B.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,B.jsx)(c,{size:`sm`,variant:`ghost`,isPending:R,onPress:()=>U(!0),children:e(`consoleKeyRotate`)})})]}),(0,B.jsxs)(m,{"data-gsap-reveal":!0,children:[(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,B.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,B.jsx)(pe,{size:15})}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold`,children:e(`sqliteProtection`)}),(0,B.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`sqliteProtectionHint`)})]})]}),(0,B.jsx)(a,{size:18,className:`text-success`})]}),(0,B.jsx)(`div`,{className:`mono mt-4 rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:`/data`}),(0,B.jsxs)(`div`,{className:`mt-3 grid gap-2 text-caption text-muted`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(k,{size:14,className:`text-muted`}),e(`sqliteBackupBeforeUpdate`)]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(k,{size:14,className:`text-muted`}),e(`sqliteKeepFive`)]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(k,{size:14,className:`text-muted`}),e(`sqliteRollbackTogether`)]})]})]})]})}),(0,B.jsx)(b.Panel,{id:`updates`,className:`pt-5`,children:(0,B.jsx)(`div`,{className:`grid gap-5`,children:(0,B.jsxs)(m,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`font-semibold`,children:e(`versionUpdate`)}),(0,B.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:e(`latestVersionHint`)})]}),(0,B.jsx)(T,{size:`sm`,variant:`soft`,color:X?.has_update?`warning`:`success`,children:X?.has_update?e(`updateAvailable`):e(`upToDate`)})]}),(0,B.jsxs)(`div`,{className:`px-5 py-5`,children:[(0,B.jsx)(le,{update:Y}),(0,B.jsx)(he,{releases:we,currentVersion:X?.current_version||``,nextVersion:X?.next_version,rollbackTags:Te,canRollback:Se,submitting:Z,onRestore:J})]})]})})})]}),(0,B.jsx)(p,{isOpen:!!q,title:e(`restoreVersionTitle`,{version:q}),description:e(`restoreVersionHint`),confirmLabel:e(`restoreThisVersion`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:Z,status:`warning`,confirmVariant:`primary`,onClose:()=>{Z||J(``)},onConfirm:()=>{let e=q;J(``),Ce(e)}}),(0,B.jsx)(v.Root,{isOpen:H,onOpenChange:e=>{!e&&!R&&U(!1)},children:(0,B.jsx)(v.Backdrop,{variant:`blur`,isDismissable:!R,children:(0,B.jsx)(v.Container,{placement:`center`,size:`sm`,children:(0,B.jsxs)(v.Dialog,{children:[(0,B.jsxs)(v.Header,{className:`items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(v.Heading,{className:`text-section font-semibold`,children:e(`consoleKeyRotate`)}),(0,B.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyRotateHint`)})]}),(0,B.jsx)(v.CloseTrigger,{isDisabled:R,"aria-label":e(`close`),className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,B.jsx)(D,{size:16})})]}),(0,B.jsxs)(v.Footer,{className:`justify-end`,children:[(0,B.jsx)(c,{variant:`ghost`,isDisabled:R,onPress:()=>U(!1),children:e(`cancel`)}),(0,B.jsx)(c,{variant:`danger`,isPending:R,onPress:()=>{V(!0),ue().then(e=>{A(e),G(e.secret||``),e.secret&&E(e.secret),U(!1)}).catch(e=>{$(e instanceof Error?e.message:String(e))}).finally(()=>V(!1))},children:e(`consoleKeyRotateNow`)})]})]})})})}),(0,B.jsx)(v.Root,{isOpen:!!W,onOpenChange:e=>{e||G(``)},children:(0,B.jsx)(v.Backdrop,{variant:`blur`,children:(0,B.jsx)(v.Container,{placement:`center`,size:`lg`,children:(0,B.jsxs)(v.Dialog,{children:[(0,B.jsxs)(v.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(v.Heading,{className:`text-section font-semibold`,children:e(`consoleKeySecretTitle`)}),(0,B.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`consoleKeySecretHint`)})]}),(0,B.jsx)(v.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,B.jsx)(D,{size:18})})]}),(0,B.jsx)(v.Body,{className:`px-6 pb-2`,children:(0,B.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:W})}),(0,B.jsxs)(v.Footer,{className:`justify-end`,children:[(0,B.jsx)(c,{variant:`ghost`,onPress:()=>G(``),children:e(`close`)}),(0,B.jsxs)(c,{onPress:()=>{i(W),K(!0),window.setTimeout(()=>K(!1),1200)},children:[(0,B.jsx)(r,{size:14}),e(ve?`copied`:`copy`)]})]})]})})})})]})}export{U as SystemPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/SystemPage-ykdoQuuk.js b/internal/webui/static/assets/SystemPage-ykdoQuuk.js new file mode 100644 index 00000000..d2f40ebf --- /dev/null +++ b/internal/webui/static/assets/SystemPage-ykdoQuuk.js @@ -0,0 +1 @@ +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./clipboard-DG4c5Ihq.js";import{t as a}from"./ShieldCheck.es-Dqq1rq1d.js";import{n as o,pt as s,r as c}from"./useI18n-DAGWWg9N.js";import{t as l}from"./label-j5K3TFm8.js";import{t as u}from"./list-box-CGt1vjr2.js";import{t as d}from"./accordion-CX4F9HFo.js";import{t as f}from"./PageAlert-BTp9jdUz.js";import{t as p}from"./ConfirmDialog-2wOP1m7E.js";import{n as m}from"./useToggle-Zi1rbfHX.js";import{n as h,r as g,t as _}from"./FormRow-6b4yVFYc.js";import{t as v}from"./modal-BqXo29An.js";import{n as y,t as b}from"./tabs-CvBWSueW.js";import{t as x}from"./select-6cCnF9ka.js";import{t as S}from"./CompactSwitch-CzZldrIr.js";import{A as ee,g as C}from"./overview-DcWoRgOQ.js";import{C as te,Dt as w,E as T,Gt as ne,It as re,M as E,O as ie,T as ae,Ut as oe,Vt as D,Wt as se,Xt as ce,Yt as O,h as le,m as k,zt as ue}from"./index-BYut8qRj.js";import{n as A,r as j,t as de}from"./UpdateControls-Cd_MTxBw.js";import{a as fe,i as pe}from"./keys-mrKPFyc7.js";var M=t(e(),1),N=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M196,35.52C177.62,25.51,153.48,20,128,20S78.38,25.51,60,35.52C39.37,46.79,28,62.58,28,80v96c0,17.42,11.37,33.21,32,44.48,18.35,10,42.49,15.52,68,15.52s49.62-5.51,68-15.52c20.66-11.27,32-27.06,32-44.48V80C228,62.58,216.63,46.79,196,35.52ZM204,128c0,17-31.21,36-76,36s-76-19-76-36v-8.46a88.9,88.9,0,0,0,8,4.94c18.35,10,42.49,15.52,68,15.52s49.62-5.51,68-15.52a88.9,88.9,0,0,0,8-4.94ZM128,44c44.79,0,76,19,76,36s-31.21,36-76,36S52,97,52,80,83.21,44,128,44Zm0,168c-44.79,0-76-19-76-36v-8.46a88.9,88.9,0,0,0,8,4.94c18.35,10,42.49,15.52,68,15.52s49.62-5.51,68-15.52a88.9,88.9,0,0,0,8-4.94V176C204,193,172.79,212,128,212Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,80c0,26.51-39.4,48-88,48S40,106.51,40,80s39.4-48,88-48S216,53.49,216,80Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64ZM69.61,53.08C85.07,44.65,105.81,40,128,40s42.93,4.65,58.39,13.08C200.12,60.57,208,70.38,208,80s-7.88,19.43-21.61,26.92C170.93,115.35,150.19,120,128,120s-42.93-4.65-58.39-13.08C55.88,99.43,48,89.62,48,80S55.88,60.57,69.61,53.08ZM186.39,202.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64Zm-21.61,74.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M128,26C75.29,26,34,49.72,34,80v96c0,30.28,41.29,54,94,54s94-23.72,94-54V80C222,49.72,180.71,26,128,26Zm0,12c44.45,0,82,19.23,82,42s-37.55,42-82,42S46,102.77,46,80,83.55,38,128,38Zm82,138c0,22.77-37.55,42-82,42s-82-19.23-82-42V154.79C62,171.16,92.37,182,128,182s66-10.84,82-27.21Zm0-48c0,22.77-37.55,42-82,42s-82-19.23-82-42V106.79C62,123.16,92.37,134,128,134s66-10.84,82-27.21Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64ZM69.61,53.08C85.07,44.65,105.81,40,128,40s42.93,4.65,58.39,13.08C200.12,60.57,208,70.38,208,80s-7.88,19.43-21.61,26.92C170.93,115.35,150.19,120,128,120s-42.93-4.65-58.39-13.08C55.88,99.43,48,89.62,48,80S55.88,60.57,69.61,53.08ZM186.39,202.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M192.14,42.55C174.94,33.17,152.16,28,128,28S81.06,33.17,63.86,42.55C45.89,52.35,36,65.65,36,80v96c0,14.35,9.89,27.65,27.86,37.45,17.2,9.38,40,14.55,64.14,14.55s46.94-5.17,64.14-14.55c18-9.8,27.86-23.1,27.86-37.45V80C220,65.65,210.11,52.35,192.14,42.55ZM212,176c0,11.29-8.41,22.1-23.69,30.43C172.27,215.18,150.85,220,128,220s-44.27-4.82-60.31-13.57C52.41,198.1,44,187.29,44,176V149.48c4.69,5.93,11.37,11.34,19.86,16,17.2,9.38,40,14.55,64.14,14.55s46.94-5.17,64.14-14.55c8.49-4.63,15.17-10,19.86-16Zm0-48c0,11.29-8.41,22.1-23.69,30.43C172.27,167.18,150.85,172,128,172s-44.27-4.82-60.31-13.57C52.41,150.1,44,139.29,44,128V101.48c4.69,5.93,11.37,11.34,19.86,16,17.2,9.38,40,14.55,64.14,14.55s46.94-5.17,64.14-14.55c8.49-4.63,15.17-10,19.86-16Zm-23.69-17.57C172.27,119.18,150.85,124,128,124s-44.27-4.82-60.31-13.57C52.41,102.1,44,91.29,44,80s8.41-22.1,23.69-30.43C83.73,40.82,105.15,36,128,36s44.27,4.82,60.31,13.57C203.59,57.9,212,68.71,212,80S203.59,102.1,188.31,110.43Z`}))]]),P=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M40,92H70.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24H137.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24Zm64-24A12,12,0,1,1,92,80,12,12,0,0,1,104,68Zm112,96H201.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24h94.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24Zm-48,24a12,12,0,1,1,12-12A12,12,0,0,1,168,188Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M128,80a24,24,0,1,1-24-24A24,24,0,0,1,128,80Zm40,72a24,24,0,1,0,24,24A24,24,0,0,0,168,152Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M32,80a8,8,0,0,1,8-8H77.17a28,28,0,0,1,53.66,0H216a8,8,0,0,1,0,16H130.83a28,28,0,0,1-53.66,0H40A8,8,0,0,1,32,80Zm184,88H194.83a28,28,0,0,0-53.66,0H40a8,8,0,0,0,0,16H141.17a28,28,0,0,0,53.66,0H216a8,8,0,0,0,0-16Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M40,86H74.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12H133.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12Zm64-24A18,18,0,1,1,86,80,18,18,0,0,1,104,62ZM216,170H197.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12h98.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12Zm-48,24a18,18,0,1,1,18-18A18,18,0,0,1,168,194Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M40,84H76.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8H131.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8Zm64-24A20,20,0,1,1,84,80,20,20,0,0,1,104,60ZM216,172H195.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8H140.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8Zm-48,24a20,20,0,1,1,20-20A20,20,0,0,1,168,196Z`}))]]),F=M.forwardRef((e,t)=>M.createElement(s,{ref:t,...e,weights:N}));F.displayName=`DatabaseIcon`;var me=F,I=M.forwardRef((e,t)=>M.createElement(s,{ref:t,...e,weights:P}));I.displayName=`SlidersHorizontalIcon`;var L=I,R=n();function he({settings:e,onSaved:t}){let{t:n}=o(),r=O(),[i,a]=(0,M.useState)(null),[s,l]=(0,M.useState)({}),[u,d]=(0,M.useState)(!1),[p,h]=(0,M.useState)(``);(0,M.useEffect)(()=>{let e=!0;return C().then(t=>{e&&a((t.data||[]).filter(e=>e.regions.some(e=>e.checkin)))}).catch(t=>{e&&h(String(t))}),()=>{e=!1}},[]);async function v(n,r){if(!(!e||r===e.checkin_times[n])){d(!0),h(``);try{t(await T({checkin_times:{[n]:r}}))}catch(e){h(e instanceof Error?e.message:String(e))}finally{l(e=>{let t={...e};return delete t[n],t}),d(!1)}}}return(0,R.jsxs)(m,{"data-gsap-reveal":!0,children:[(0,R.jsxs)(m.Header,{children:[(0,R.jsx)(m.Title,{children:n(`checkinDefaultsTitle`)}),(0,R.jsx)(m.Description,{children:n(`checkinDefaultsHint`)})]}),(0,R.jsxs)(m.Content,{className:`space-y-4`,children:[p?(0,R.jsx)(f,{title:p}):null,!e||!i?(0,R.jsx)(k,{className:`h-24 w-full`}):i.map(t=>(0,R.jsx)(_,{label:t.label,hint:t.regions.filter(e=>e.checkin).map(t=>`${t.label} · ${t.checkin?.timezone===`Local`?e.timezone:t.checkin?.timezone}`).join(` / `),children:(0,R.jsx)(g,{type:`time`,value:s[t.id]??e.checkin_times[t.id]??``,disabled:u,"aria-label":`${t.label} ${n(`autoCheckinTime`)}`,onChange:e=>l(n=>({...n,[t.id]:e.target.value})),onBlur:e=>void v(t.id,e.target.value)})},t.id))]}),(0,R.jsx)(m.Footer,{children:(0,R.jsx)(c,{variant:`secondary`,onPress:()=>r(`/accounts`),children:n(`navAccounts`)})})]})}function z(e,t){if(!e)return``;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toLocaleDateString(t===`zh`?`zh-CN`:`en-US`,{year:`numeric`,month:`short`,day:`numeric`})}function ge({releases:e,currentVersion:t,nextVersion:n,rollbackTags:r,canRollback:i,submitting:a,onRestore:s}){let{t:l,lang:u}=o();if(!e.length)return null;let f=n&&n!==t?n:t,p=e.some(e=>e.tag_name===f)?f:e[0]?.tag_name,m=new Set(r);return(0,R.jsxs)(`div`,{className:`mt-5`,children:[(0,R.jsx)(`div`,{className:`mb-2`,children:(0,R.jsx)(`p`,{className:`text-caption font-medium text-foreground`,children:l(`versionHistory`)})}),(0,R.jsx)(d,{className:`rounded-lg bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:p?[p]:[],children:e.map(e=>{let r=e.tag_name,o=r===t,f=!!(n&&r===n&&n!==t),p=i&&m.has(r)&&!o,h=z(e.published_at,u);return(0,R.jsxs)(d.Item,{id:r,children:[(0,R.jsx)(d.Heading,{children:(0,R.jsxs)(d.Trigger,{className:`items-center gap-3 px-3 py-2.5 text-left`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`mono text-body font-semibold`,children:r}),o?(0,R.jsx)(E,{size:`sm`,variant:`soft`,color:`success`,children:l(`versionCurrentBadge`)}):null,f?(0,R.jsx)(E,{size:`sm`,variant:`soft`,color:`warning`,children:l(`versionLatestBadge`)}):null,h?(0,R.jsx)(`span`,{className:`truncate text-caption text-muted`,children:h}):null]}),(0,R.jsx)(d.Indicator,{})]})}),(0,R.jsx)(d.Panel,{children:(0,R.jsxs)(d.Body,{className:`px-3 pb-3`,children:[(0,R.jsx)(`div`,{className:`release-notes-box release-notes-box--compact`,children:(0,R.jsx)(A,{markdown:j(e.body,u),emptyLabel:l(`updateNoNotes`)})}),p?(0,R.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,R.jsx)(c,{size:`sm`,variant:`ghost`,isDisabled:a,onPress:()=>s(r),children:l(`restoreThisVersion`)})}):null]})})]},r)})})]})}function B(e){let t=new Set,n=[];for(let r of e){let e=r.tag_name?.trim();!e||t.has(e)||(t.add(e),n.push({...r,tag_name:e}))}return n}function _e(e,t,n,r,i){return r?.length?B(r):B([...n?[n]:t?[{tag_name:t}]:[],...e?[{tag_name:e}]:[],...i||[]])}var ve=[`general`,`routing`,`security`,`updates`];function V(){let{t:e}=o(),[t,n]=ce(),s=t.get(`tab`),d=s&&ve.includes(s)?s:`general`,C=e=>n(e===`general`?{}:{tab:e},{replace:!0}),{setApiKey:O}=ee(),{refresh:k}=ie(),[A,j]=(0,M.useState)(null),[N,P]=(0,M.useState)(null),[F,I]=(0,M.useState)(``),[z,B]=(0,M.useState)(!1),[V,H]=(0,M.useState)(!1),[ye,U]=(0,M.useState)(!1),[W,G]=(0,M.useState)(``),[be,K]=(0,M.useState)(!1),[q,J]=(0,M.useState)(``),Y=te(),{info:X,loading:xe,checking:Se,submitting:Z,error:Q,setError:$,load:Ce,canRollback:we,rollbackTo:Te}=Y,Ee=(0,M.useMemo)(()=>_e(X?.current_version||``,X?.next_version,X?.release,X?.recent_releases,X?.rollback_versions),[X?.current_version,X?.next_version,X?.release,X?.recent_releases,X?.rollback_versions]),De=(0,M.useMemo)(()=>(X?.rollback_versions||[]).map(e=>e.tag_name),[X?.rollback_versions]);(0,M.useEffect)(()=>{let e=window.setTimeout(()=>{pe().then(j).catch(()=>void 0),ae().then(e=>{P(e),I(e.proxy_url||``)}).catch(e=>$(e instanceof Error?e.message:String(e)))},0);return()=>window.clearTimeout(e)},[$]);async function Oe(e){let t=N?.cross_provider_model_pool??!0;P(t=>t&&{...t,cross_provider_model_pool:e}),B(!0),$(``);try{P(await T({cross_provider_model_pool:e})),k(void 0,{silent:!0}).catch(()=>void 0)}catch(e){P(e=>e&&{...e,cross_provider_model_pool:t}),$(e instanceof Error?e.message:String(e))}finally{B(!1)}}async function ke(e){let t=N?.checkin_disabled_accounts??!1;P(t=>t&&{...t,checkin_disabled_accounts:e}),B(!0),$(``);try{P(await T({checkin_disabled_accounts:e}))}catch(e){P(e=>e&&{...e,checkin_disabled_accounts:t}),$(e instanceof Error?e.message:String(e))}finally{B(!1)}}async function Ae(e){let t=N?.proxy_url||``;if(e===t){I(t);return}let n=F;I(e),P(t=>t&&{...t,proxy_url:e}),B(!0),$(``);try{let t=await T({proxy_url:e});P(t),I(t.proxy_url||``)}catch(e){I(n),P(e=>e&&{...e,proxy_url:t}),$(e instanceof Error?e.message:String(e))}finally{B(!1)}}async function je(e){let t=N?.routing_strategy||`round-robin`;P(t=>t&&{...t,routing_strategy:e}),B(!0),$(``);try{P(await T({routing_strategy:e}))}catch(e){P(e=>e&&{...e,routing_strategy:t}),$(e instanceof Error?e.message:String(e))}finally{B(!1)}}return xe&&!X?(0,R.jsx)(le,{}):(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-4 pb-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{"data-gsap-reveal":!0,className:`text-title font-semibold`,children:e(`systemSettingsTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(`systemSettingsLead`)})]}),(0,R.jsxs)(c,{size:`sm`,variant:`secondary`,isPending:Se,onPress:()=>void Ce(!0),children:[(0,R.jsx)(se,{size:15}),e(`checkUpdates`)]})]}),Q?(0,R.jsx)(f,{title:Q}):null,(0,R.jsxs)(b,{selectedKey:d,onSelectionChange:e=>C(String(e)),children:[(0,R.jsx)(b.ListContainer,{className:`w-fit max-w-full overflow-x-auto`,children:(0,R.jsxs)(b.List,{"aria-label":e(`systemSettingsTitle`),children:[(0,R.jsxs)(y,{id:`general`,className:`gap-1.5 whitespace-nowrap`,children:[(0,R.jsx)(b.Indicator,{}),(0,R.jsx)(ue,{size:13}),e(`settingsTabGeneral`)]}),(0,R.jsxs)(y,{id:`routing`,className:`gap-1.5 whitespace-nowrap`,children:[(0,R.jsx)(b.Indicator,{}),(0,R.jsx)(oe,{size:13}),e(`settingsTabRouting`)]}),(0,R.jsxs)(y,{id:`security`,className:`gap-1.5 whitespace-nowrap`,children:[(0,R.jsx)(b.Indicator,{}),(0,R.jsx)(a,{size:13}),e(`settingsTabSecurity`)]}),(0,R.jsxs)(y,{id:`updates`,className:`gap-1.5 whitespace-nowrap`,children:[(0,R.jsx)(b.Indicator,{}),(0,R.jsx)(ne,{size:13}),e(`settingsTabUpdates`)]})]})}),(0,R.jsx)(b.Panel,{id:`general`,className:`pt-5`,children:(0,R.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,R.jsxs)(m,{"data-gsap-reveal":!0,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,R.jsx)(L,{size:15})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-semibold`,children:e(`proxySettingsTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`proxySettingsHint`)})]})]}),(0,R.jsxs)(`div`,{className:`mt-4 space-y-1.5`,children:[(0,R.jsx)(l,{className:`text-body font-medium text-muted`,children:e(`proxyUrl`)}),(0,R.jsx)(g,{value:F,onChange:e=>I(e.target.value),onBlur:e=>void Ae(e.target.value.trim()),placeholder:e(`proxyUrlPlaceholder`),disabled:z||!N}),(0,R.jsx)(h,{className:`text-caption leading-5 text-muted`,children:e(`proxyUrlHint`)})]})]}),(0,R.jsxs)(m,{"data-gsap-reveal":!0,children:[(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,R.jsx)(D,{size:15})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-semibold`,children:e(`checkinDisabledAccountsTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`checkinDisabledAccountsHint`)})]})]}),(0,R.jsx)(S,{isSelected:N?.checkin_disabled_accounts??!1,isDisabled:z||!N,ariaLabel:e(`checkinDisabledAccountsAriaLabel`),onChange:e=>void ke(e)})]}),(0,R.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,R.jsx)(`span`,{children:e(`checkinDisabledAccountsStatus`)}),(0,R.jsx)(`span`,{className:`font-medium text-foreground`,children:N?.checkin_disabled_accounts?e(`enabled`):e(`disabled`)})]})]}),(0,R.jsx)(he,{settings:N,onSaved:P})]})}),(0,R.jsx)(b.Panel,{id:`routing`,className:`pt-5`,children:(0,R.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,R.jsxs)(m,{"data-gsap-reveal":!0,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,R.jsx)(L,{size:15})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-semibold`,children:e(`routingStrategyTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`routingStrategyHint`)})]})]}),(0,R.jsx)(`div`,{className:`mt-4 pt-4`,children:(0,R.jsx)(_,{label:e(`routingStrategy`),children:(0,R.jsxs)(x,{fullWidth:!0,"aria-label":e(`routingStrategy`),value:N?.routing_strategy||`round-robin`,isDisabled:z||!N,onChange:e=>{typeof e==`string`&&e&&je(e)},children:[(0,R.jsxs)(x.Trigger,{className:`items-center`,children:[(0,R.jsx)(x.Value,{className:`min-w-0 truncate`}),(0,R.jsx)(x.Indicator,{})]}),(0,R.jsx)(x.Popover,{children:(0,R.jsxs)(u,{children:[(0,R.jsxs)(u.Item,{id:`round-robin`,textValue:`round-robin`,children:[(0,R.jsx)(l,{children:e(`routingRoundRobin`)}),(0,R.jsx)(u.ItemIndicator,{})]}),(0,R.jsxs)(u.Item,{id:`weighted-round-robin`,textValue:`weighted-round-robin`,children:[(0,R.jsx)(l,{children:e(`routingWeightedRoundRobin`)}),(0,R.jsx)(u.ItemIndicator,{})]}),(0,R.jsxs)(u.Item,{id:`fill-first`,textValue:`fill-first`,children:[(0,R.jsx)(l,{children:e(`routingFillFirst`)}),(0,R.jsx)(u.ItemIndicator,{})]}),(0,R.jsxs)(u.Item,{id:`fefo`,textValue:`fefo`,children:[(0,R.jsx)(l,{children:e(`routingFEFO`)}),(0,R.jsx)(u.ItemIndicator,{})]}),(0,R.jsxs)(u.Item,{id:`least-quota-first`,textValue:`least-quota-first`,children:[(0,R.jsx)(l,{children:e(`routingLeastQuotaFirst`)}),(0,R.jsx)(u.ItemIndicator,{})]}),(0,R.jsxs)(u.Item,{id:`most-quota-first`,textValue:`most-quota-first`,children:[(0,R.jsx)(l,{children:e(`routingMostQuotaFirst`)}),(0,R.jsx)(u.ItemIndicator,{})]})]})})]})})}),(0,R.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2 pt-3 text-caption text-muted sm:grid-cols-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:N?.session_affinity?.ttl_seconds?`${Math.round(N.session_affinity.ttl_seconds/60)}m`:`—`}),e(`sessionAffinityTTL`)]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:N?.session_affinity?.hits??0}),e(`sessionAffinityHits`)]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:N?.session_affinity?.misses??0}),e(`sessionAffinityMisses`)]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:N?.session_affinity?.escapes??0}),e(`sessionAffinityEscapes`)]})]}),N?.session_affinity?.last_escape_reason?(0,R.jsxs)(h,{className:`mt-3 text-caption`,children:[e(`lastSessionEscape`),`: `,N.session_affinity.last_escape_reason]}):null,N?.session_affinity?.last_miss_reason?(0,R.jsxs)(h,{className:`mt-1 text-caption`,children:[e(`lastSessionMiss`),`: `,N.session_affinity.last_miss_reason]}):null]}),(0,R.jsxs)(m,{"data-gsap-reveal":!0,children:[(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,R.jsx)(L,{size:15})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-semibold`,children:e(`crossProviderModelPoolTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`crossProviderModelPoolHint`)})]})]}),(0,R.jsx)(S,{isSelected:N?.cross_provider_model_pool??!0,isDisabled:z||!N,ariaLabel:e(`crossProviderModelPoolAriaLabel`),onChange:e=>void Oe(e)})]}),(0,R.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,R.jsx)(`span`,{children:e(`crossProviderModelPoolStatus`)}),(0,R.jsx)(`span`,{className:`font-medium text-foreground`,children:N?.cross_provider_model_pool?e(`enabled`):e(`disabled`)})]})]})]})}),(0,R.jsx)(b.Panel,{id:`security`,className:`pt-5`,children:(0,R.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,R.jsxs)(m,{"data-gsap-reveal":!0,children:[(0,R.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,R.jsx)(re,{size:15})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-semibold`,children:e(`consoleKeyTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyHint`)})]})]})}),(0,R.jsx)(`code`,{className:`mono mt-4 block rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:A?.prefix||`—`}),(0,R.jsx)(`p`,{className:`mt-3 text-caption leading-5 text-muted`,children:e(`consoleKeyLead`)}),(0,R.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,R.jsx)(c,{size:`sm`,variant:`ghost`,isPending:V,onPress:()=>U(!0),children:e(`consoleKeyRotate`)})})]}),(0,R.jsxs)(m,{"data-gsap-reveal":!0,children:[(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,R.jsx)(me,{size:15})}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-semibold`,children:e(`sqliteProtection`)}),(0,R.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`sqliteProtectionHint`)})]})]}),(0,R.jsx)(a,{size:18,className:`text-success`})]}),(0,R.jsx)(`div`,{className:`mono mt-4 rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:`/data`}),(0,R.jsxs)(`div`,{className:`mt-3 grid gap-2 text-caption text-muted`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(D,{size:14,className:`text-muted`}),e(`sqliteBackupBeforeUpdate`)]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(D,{size:14,className:`text-muted`}),e(`sqliteKeepFive`)]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(D,{size:14,className:`text-muted`}),e(`sqliteRollbackTogether`)]})]})]})]})}),(0,R.jsx)(b.Panel,{id:`updates`,className:`pt-5`,children:(0,R.jsx)(`div`,{className:`grid gap-5`,children:(0,R.jsxs)(m,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-semibold`,children:e(`versionUpdate`)}),(0,R.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:e(`latestVersionHint`)})]}),(0,R.jsx)(E,{size:`sm`,variant:`soft`,color:X?.has_update?`warning`:`success`,children:X?.has_update?e(`updateAvailable`):e(`upToDate`)})]}),(0,R.jsxs)(`div`,{className:`px-5 py-5`,children:[(0,R.jsx)(de,{update:Y}),(0,R.jsx)(ge,{releases:Ee,currentVersion:X?.current_version||``,nextVersion:X?.next_version,rollbackTags:De,canRollback:we,submitting:Z,onRestore:J})]})]})})})]}),(0,R.jsx)(p,{isOpen:!!q,title:e(`restoreVersionTitle`,{version:q}),description:e(`restoreVersionHint`),confirmLabel:e(`restoreThisVersion`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:Z,status:`warning`,confirmVariant:`primary`,onClose:()=>{Z||J(``)},onConfirm:()=>{let e=q;J(``),Te(e)}}),(0,R.jsx)(v.Root,{isOpen:ye,onOpenChange:e=>{!e&&!V&&U(!1)},children:(0,R.jsx)(v.Backdrop,{variant:`blur`,isDismissable:!V,children:(0,R.jsx)(v.Container,{placement:`center`,size:`sm`,children:(0,R.jsxs)(v.Dialog,{children:[(0,R.jsxs)(v.Header,{className:`items-start justify-between gap-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(v.Heading,{className:`text-section font-semibold`,children:e(`consoleKeyRotate`)}),(0,R.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyRotateHint`)})]}),(0,R.jsx)(v.CloseTrigger,{isDisabled:V,"aria-label":e(`close`),className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,R.jsx)(w,{size:16})})]}),(0,R.jsxs)(v.Footer,{className:`justify-end`,children:[(0,R.jsx)(c,{variant:`ghost`,isDisabled:V,onPress:()=>U(!1),children:e(`cancel`)}),(0,R.jsx)(c,{variant:`danger`,isPending:V,onPress:()=>{H(!0),fe().then(e=>{j(e),G(e.secret||``),e.secret&&O(e.secret),U(!1)}).catch(e=>{$(e instanceof Error?e.message:String(e))}).finally(()=>H(!1))},children:e(`consoleKeyRotateNow`)})]})]})})})}),(0,R.jsx)(v.Root,{isOpen:!!W,onOpenChange:e=>{e||G(``)},children:(0,R.jsx)(v.Backdrop,{variant:`blur`,children:(0,R.jsx)(v.Container,{placement:`center`,size:`lg`,children:(0,R.jsxs)(v.Dialog,{children:[(0,R.jsxs)(v.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(v.Heading,{className:`text-section font-semibold`,children:e(`consoleKeySecretTitle`)}),(0,R.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`consoleKeySecretHint`)})]}),(0,R.jsx)(v.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,R.jsx)(w,{size:18})})]}),(0,R.jsx)(v.Body,{className:`px-6 pb-2`,children:(0,R.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:W})}),(0,R.jsxs)(v.Footer,{className:`justify-end`,children:[(0,R.jsx)(c,{variant:`ghost`,onPress:()=>G(``),children:e(`close`)}),(0,R.jsxs)(c,{onPress:()=>{i(W),K(!0),window.setTimeout(()=>K(!1),1200)},children:[(0,R.jsx)(r,{size:14}),e(be?`copied`:`copy`)]})]})]})})})})]})}export{V as SystemPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/TimeRangePicker-BqBfH6td.js b/internal/webui/static/assets/TimeRangePicker-BqBfH6td.js new file mode 100644 index 00000000..5c87e714 --- /dev/null +++ b/internal/webui/static/assets/TimeRangePicker-BqBfH6td.js @@ -0,0 +1 @@ +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{A as r,D as i,E as a,H as o,I as s,O as c,Q as l,V as u,X as d,Z as f,a as p,j as m,k as h,ot as g,ut as _,w as v,z as y}from"./useI18n-DAGWWg9N.js";import{$ as b,A as x,B as S,Ct as C,F as w,G as T,I as E,J as D,L as O,M as k,N as A,Q as ee,R as te,Y as j,Z as ne,_t as M,a as re,c as N,ct as ie,d as P,dt as ae,f as oe,j as se,k as F,l as ce,lt as le,m as ue,o as de,q as I,s as L,tt as fe,u as pe,w as me,x as he,z as ge}from"./SharedElementTransition-BlCsXfb1.js";import{t as _e}from"./useUpdateEffect-DR9d7F-l.js";import{a as ve,c as ye,d as be,f as xe,g as Se,h as Ce,l as we,m as Te,n as Ee,o as De,p as Oe,r as ke,t as Ae,u as je,v as Me,y as Ne}from"./label-j5K3TFm8.js";import{n as Pe,r as Fe,t as Ie}from"./useSpinButton-DMIzR_Mu.js";import{t as Le}from"./assertion-BLQtDfw6.js";import{D as Re}from"./overview-DcWoRgOQ.js";import{Ct as ze,St as Be,Tt as Ve,U as He,W as Ue,bt as We,ot as Ge,wt as Ke,xt as qe,yt as Je}from"./index-BYut8qRj.js";var R=t(e(),1);function Ye(e,t){let n=(0,R.useRef)(null);return e&&n.current&&t(e,n.current)&&(e=n.current),n.current=e,e}var Xe=ge({slots:{trigger:`calendar-year-picker__trigger`,triggerHeading:`calendar-year-picker__trigger-heading`,triggerIndicator:`calendar-year-picker__trigger-indicator`,yearCell:`calendar-year-picker__year-cell`,yearGrid:`calendar-year-picker__year-grid`}}),Ze=ge({defaultVariants:{},slots:{base:`range-calendar`,cell:`range-calendar__cell`,cellIndicator:`range-calendar__cell-indicator`,grid:`range-calendar__grid`,gridBody:`range-calendar__grid-body`,gridHeader:`range-calendar__grid-header`,gridRow:`range-calendar__grid-row`,header:`range-calendar__header`,headerCell:`range-calendar__header-cell`,heading:`range-calendar__heading`,navButton:`range-calendar__nav-button`,navButtonIcon:`range-calendar__nav-button-icon`},variants:{}}),Qe=ge({base:`date-field`,defaultVariants:{fullWidth:!1},variants:{fullWidth:{false:``,true:`date-field--full-width`}}}),$e=ge({slots:{base:`date-range-picker`,popover:`date-range-picker__popover`,rangeSeparator:`date-range-picker__range-separator`,trigger:`date-range-picker__trigger`,triggerIndicator:`date-range-picker__trigger-indicator`}}),et=ge({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`date-input-group`,input:`date-input-group__input`,inputContainer:`date-input-group__input-container`,prefix:`date-input-group__prefix`,segment:`date-input-group__segment`,suffix:`date-input-group__suffix`},variants:{fullWidth:{false:{},true:{base:`date-input-group--full-width`}},variant:{primary:{base:`date-input-group--primary`},secondary:{base:`date-input-group--secondary`}}}}),tt=ge({base:`time-field`,defaultVariants:{fullWidth:!1},variants:{fullWidth:{false:``,true:`time-field--full-width`}}});function nt(e){let t=Ge({usage:`search`,...e}),n=(0,R.useCallback)((e,n)=>n.length===0||(e=e.normalize(`NFC`),n=n.normalize(`NFC`),t.compare(e.slice(0,n.length),n)===0),[t]),r=(0,R.useCallback)((e,n)=>n.length===0||(e=e.normalize(`NFC`),n=n.normalize(`NFC`),t.compare(e.slice(-n.length),n)===0),[t]),i=(0,R.useCallback)((e,n)=>{if(n.length===0)return!0;e=e.normalize(`NFC`),n=n.normalize(`NFC`);let r=0,i=n.length;for(;r+i<=e.length;r++){let a=e.slice(r,r+i);if(t.compare(n,a)===0)return!0}return!1},[t]);return(0,R.useMemo)(()=>({startsWith:n,endsWith:r,contains:i}),[n,r,i])}function rt(e,t){return e-t*Math.floor(e/t)}var it=1721426;function at(e,t,n,r){t=st(e,t);let i=t-1,a=-2;return n<=2?a=0:ot(t)&&(a=-1),1721425+365*i+Math.floor(i/4)-Math.floor(i/100)+Math.floor(i/400)+Math.floor((367*n-362)/12+a+r)}function ot(e){return e%4==0&&(e%100!=0||e%400==0)}function st(e,t){return e===`BC`?1-t:t}function ct(e){let t=`AD`;return e<=0&&(t=`BC`,e=1-e),[t,e]}var lt={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]},z=class{fromJulianDay(e){let t=e,n=t-it,r=Math.floor(n/146097),i=rt(n,146097),a=Math.floor(i/36524),o=rt(i,36524),s=Math.floor(o/1461),c=rt(o,1461),l=Math.floor(c/365),[u,d]=ct(r*400+a*100+s*4+l+ +(a!==4&&l!==4)),f=t-at(u,d,1,1),p=2;t=0?e:t:e||t}function zt(e){return e=G(e,new z),Bt(st(e.era,e.year),e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Bt(e,t,n,r,i,a,o){let s=new Date;return s.setUTCHours(r,i,a,o),s.setUTCFullYear(e,t-1,n),s.getTime()}function Vt(e,t){if(t===`UTC`)return 0;if(e>0&&t===Tt()&&!Et())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:r,day:i,hour:a,minute:o,second:s}=Ut(e,t);return Bt(n,r,i,a,o,s,0)-Math.floor(e/1e3)*1e3}var Ht=new Map;function Ut(e,t){let n=Ht.get(t);n||(n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,hour12:!1,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}),Ht.set(t,n));let r=n.formatToParts(new Date(e)),i={};for(let e of r)e.type!==`literal`&&(i[e.type]=e.value);return{year:i.era===`BC`||i.era===`B`?-i.year+1:+i.year,month:+i.month,day:+i.day,hour:i.hour===`24`?0:+i.hour,minute:+i.minute,second:+i.second}}var Wt=864e5;function Gt(e,t,n,r){return(n===r?[n]:[n,r]).filter(n=>Kt(e,t,n))}function Kt(e,t,n){let r=Ut(n,t);return e.year===r.year&&e.month===r.month&&e.day===r.day&&e.hour===r.hour&&e.minute===r.minute&&e.second===r.second}function V(e,t,n=`compatible`){let r=W(e);if(t===`UTC`)return zt(r);if(t===Tt()&&n===`compatible`&&!Et()){r=G(r,new z);let e=new Date,t=st(r.era,r.year);return e.setFullYear(t,r.month-1,r.day),e.setHours(r.hour,r.minute,r.second,r.millisecond),e.getTime()}let i=zt(r),a=Vt(i-Wt,t),o=Vt(i+Wt,t),s=Gt(r,t,i-a,i-o);if(s.length===1)return s[0];if(s.length>1)switch(n){case`compatible`:case`earlier`:return s[0];case`later`:return s[s.length-1];case`reject`:throw RangeError(`Multiple possible absolute times found`)}switch(n){case`earlier`:return Math.min(i-a,i-o);case`compatible`:case`later`:return Math.max(i-a,i-o);case`reject`:throw RangeError(`No such absolute time found`)}}function qt(e,t,n=`compatible`){return new Date(V(e,t,n))}function H(e,t){let n=Vt(e,t),r=new Date(e+n),i=r.getUTCFullYear(),a=r.getUTCMonth()+1,o=r.getUTCDate(),s=r.getUTCHours(),c=r.getUTCMinutes(),l=r.getUTCSeconds(),u=r.getUTCMilliseconds();return new zn(i<1?`BC`:`AD`,i<1?-i+1:i,a,o,t,n,s,c,l,u)}function U(e){return new q(e.calendar,e.era,e.year,e.month,e.day)}function W(e,t){let n=0,r=0,i=0,a=0;if(`timeZone`in e)({hour:n,minute:r,second:i,millisecond:a}=e);else if(`hour`in e&&!t)return e;return t&&({hour:n,minute:r,second:i,millisecond:a}=t),new Rn(e.calendar,e.era,e.year,e.month,e.day,n,r,i,a)}function Jt(e){return new Ln(e.hour,e.minute,e.second,e.millisecond)}function G(e,t){if(mt(e.calendar,t))return e;let n=t.fromJulianDay(e.calendar.toJulianDay(e)),r=e.copy();return r.calendar=t,r.era=n.era,r.year=n.year,r.month=n.month,r.day=n.day,on(r),r}function Yt(e,t,n){return e instanceof zn?e.timeZone===t?e:Zt(e,t):H(V(e,t,n),t)}function Xt(e){let t=zt(e)-e.offset;return new Date(t)}function Zt(e,t){return G(H(zt(e)-e.offset,t),e.calendar)}function Qt(e){return Zt(e,Tt())}var $t=36e5;function en(e,t){let n=e.copy(),r=`hour`in n?mn(n,t):0;tn(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,nn(n),an(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=r,rn(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let i=n.calendar.getYearsInEra(n);if(n.year>i){let e=n.calendar.isInverseEra?.(n);n.year=i,n.month=e?1:n.calendar.getMonthsInYear(n),n.day=e?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let a=n.calendar.getMonthsInYear(n);return n.month>a&&(n.month=a,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function tn(e,t){e.calendar.isInverseEra?.(e)&&(t=-t),e.year+=t}function nn(e){for(;e.month<1;)tn(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,tn(e,1)}function rn(e){for(;e.day<1;)e.month--,nn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,nn(e)}function an(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function on(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),an(e)}function sn(e){let t={};for(let n in e)typeof e[n]==`number`&&(t[n]=-e[n]);return t}function cn(e,t){return en(e,sn(t))}function ln(e,t){let n=e.copy();return t.era!=null&&(n.era=t.era),t.year!=null&&(n.year=t.year),t.month!=null&&(n.month=t.month),t.day!=null&&(n.day=t.day),on(n),n}function un(e,t){let n=e.copy();return t.hour!=null&&(n.hour=t.hour),t.minute!=null&&(n.minute=t.minute),t.second!=null&&(n.second=t.second),t.millisecond!=null&&(n.millisecond=t.millisecond),fn(n),n}function dn(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=pn(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=pn(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=pn(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=pn(e.hour,24),t}function fn(e){e.millisecond=Math.max(0,Math.min(e.millisecond,999)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function pn(e,t){let n=e%t;return n<0&&(n+=t),n}function mn(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,dn(e)}function hn(e,t){let n=e.copy();return mn(n,t),n}function gn(e,t){return hn(e,sn(t))}function _n(e,t,n,r){let i=e.copy();switch(t){case`era`:{let t=e.calendar.getEras(),a=t.indexOf(e.era);if(a<0)throw Error(`Invalid era: `+e.era);a=yn(a,n,0,t.length-1,r?.round),i.era=t[a],on(i);break}case`year`:i.calendar.isInverseEra?.(i)&&(n=-n),i.year=yn(e.year,n,-1/0,9999,r?.round),i.year===-1/0&&(i.year=1),i.calendar.balanceYearMonth&&i.calendar.balanceYearMonth(i,e);break;case`month`:i.month=yn(e.month,n,1,e.calendar.getMonthsInYear(e),r?.round);break;case`day`:i.day=yn(e.day,n,1,e.calendar.getDaysInMonth(e),r?.round);break;default:throw Error(`Unsupported field `+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(i),on(i),i}function vn(e,t,n,r){let i=e.copy();switch(t){case`hour`:{let t=e.hour,a=0,o=23;if(r?.hourCycle===12){let e=t>=12;a=e?12:0,o=e?23:11}i.hour=yn(t,n,a,o,r?.round);break}case`minute`:i.minute=yn(e.minute,n,0,59,r?.round);break;case`second`:i.second=yn(e.second,n,0,59,r?.round);break;case`millisecond`:i.millisecond=yn(e.millisecond,n,0,999,r?.round);break;default:throw Error(`Unsupported field `+t)}return i}function yn(e,t,n,r,i=!1){if(i){e+=Math.sign(t),e0?Math.ceil(e/i)*i:Math.floor(e/i)*i,e>r&&(e=n)}else e+=t,er&&(e=n+(e-r-1));return e}function bn(e,t){let n;return n=t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0?V(en(W(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days}),e.timeZone):zt(e)-e.offset,n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5,G(H(n,e.timeZone),e.calendar)}function xn(e,t){return bn(e,sn(t))}function Sn(e,t,n,r){switch(t){case`hour`:{let t=0,i=23;if(r?.hourCycle===12){let n=e.hour>=12;t=n?12:0,i=n?23:11}let a=W(e),o=G(un(a,{hour:t}),new z),s=[V(o,e.timeZone,`earlier`),V(o,e.timeZone,`later`)].filter(t=>H(t,e.timeZone).day===o.day)[0],c=G(un(a,{hour:i}),new z),l=[V(c,e.timeZone,`earlier`),V(c,e.timeZone,`later`)].filter(t=>H(t,e.timeZone).day===c.day).pop(),u=zt(e)-e.offset,d=Math.floor(u/$t),f=u%$t;return u=yn(d,n,Math.floor(s/$t),Math.floor(l/$t),r?.round)*$t+f,G(H(u,e.timeZone),e.calendar)}case`minute`:case`second`:case`millisecond`:return vn(e,t,n,r);case`era`:case`year`:case`month`:case`day`:return G(H(V(_n(W(e),t,n,r),e.timeZone),e.timeZone),e.calendar);default:throw Error(`Unsupported field `+t)}}function Cn(e,t,n){let r=W(e),i=un(ln(r,t),t);return i.compare(r)===0?e:G(H(V(i,e.timeZone,n),e.timeZone),e.calendar)}var wn=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Tn=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/,En=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Dn(e){let t=e.match(wn);if(!t)throw En.test(e)?Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):Error(`Invalid ISO 8601 date string: `+e);let n=new q(K(t[1],0,9999),K(t[2],1,12),1);return n.day=K(t[3],1,n.calendar.getDaysInMonth(n)),n}function On(e){let t=e.match(Tn);if(!t)throw En.test(e)?Error(`Invalid ISO 8601 date time string: ${e}. Use parseAbsolute() instead.`):Error(`Invalid ISO 8601 date time string: `+e);let n=K(t[1],-9999,9999),r=new Rn(n<1?`BC`:`AD`,n<1?-n+1:n,K(t[2],1,12),1,t[4]?K(t[4],0,23):0,t[5]?K(t[5],0,59):0,t[6]?K(t[6],0,59):0,t[7]?K(t[7],0,1/0)*1e3:0);return r.day=K(t[3],0,r.calendar.getDaysInMonth(r)),r}function kn(e,t){let n=e.match(En);if(!n)throw Error(`Invalid ISO 8601 date time string: `+e);let r=K(n[1],-9999,9999),i=new zn(r<1?`BC`:`AD`,r<1?-r+1:r,K(n[2],1,12),1,t,0,n[4]?K(n[4],0,23):0,n[5]?K(n[5],0,59):0,n[6]?K(n[6],0,59):0,n[7]?K(n[7],0,1/0)*1e3:0);return i.day=K(n[3],0,i.calendar.getDaysInMonth(i)),n[8]&&(i.offset=K(n[8],-23,23)*36e5+K(n[9]??`0`,0,59)*6e4),Zt(i,t)}function An(e){return kn(e,Tt())}function K(e,t,n){let r=Number(e);if(rn)throw RangeError(`Value out of range: ${t} <= ${r} <= ${n}`);return r}function jn(e){return`${String(e.hour).padStart(2,`0`)}:${String(e.minute).padStart(2,`0`)}:${String(e.second).padStart(2,`0`)}${e.millisecond?String(e.millisecond/1e3).slice(1):``}`}function Mn(e){let t=G(e,new z),n;return n=t.era===`BC`?t.year===1?`0000`:`-`+String(Math.abs(1-t.year)).padStart(6,`00`):String(t.year).padStart(4,`0`),`${n}-${String(t.month).padStart(2,`0`)}-${String(t.day).padStart(2,`0`)}`}function Nn(e){return`${Mn(e)}T${jn(e)}`}function Pn(e){let t=Math.sign(e)<0?`-`:`+`;e=Math.abs(e);let n=Math.floor(e/36e5),r=Math.floor(e%36e5/6e4),i=Math.floor(e%36e5%6e4/1e3),a=`${t}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`;return i!==0&&(a+=`:${String(i).padStart(2,`0`)}`),a}function Fn(e){return`${Nn(e)}${Pn(e.offset)}[${e.timeZone}]`}function In(e){let t=typeof e[0]==`object`?e.shift():new z,n;if(typeof e[0]==`string`)n=e.shift();else{let e=t.getEras();n=e[e.length-1]}let r=e.shift(),i=e.shift(),a=e.shift();return[t,n,r,i,a]}var q=class e{constructor(...e){let[t,n,r,i,a]=In(e);this.calendar=t,this.era=n,this.year=r,this.month=i,this.day=a,on(this)}copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day):new e(this.calendar,this.year,this.month,this.day)}add(e){return en(this,e)}subtract(e){return cn(this,e)}set(e){return ln(this,e)}cycle(e,t,n){return _n(this,e,t,n)}toDate(e){return qt(this,e)}toString(){return Mn(this)}compare(e){return bt(this,e)}},Ln=class e{constructor(e=0,t=0,n=0,r=0){this.hour=e,this.minute=t,this.second=n,this.millisecond=r,fn(this)}copy(){return new e(this.hour,this.minute,this.second,this.millisecond)}add(e){return hn(this,e)}subtract(e){return gn(this,e)}set(e){return un(this,e)}cycle(e,t,n){return vn(this,e,t,n)}toString(){return jn(this)}compare(e){return xt(this,e)}},Rn=class e{constructor(...e){let[t,n,r,i,a]=In(e);this.calendar=t,this.era=n,this.year=r,this.month=i,this.day=a,this.hour=e.shift()||0,this.minute=e.shift()||0,this.second=e.shift()||0,this.millisecond=e.shift()||0,on(this)}copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new e(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(e){return en(this,e)}subtract(e){return cn(this,e)}set(e){return ln(un(this,e),e)}cycle(e,t,n){switch(e){case`era`:case`year`:case`month`:case`day`:return _n(this,e,t,n);default:return vn(this,e,t,n)}}toDate(e,t){return qt(this,e,t)}toString(){return Nn(this)}compare(e){let t=bt(this,e);return t===0?xt(this,W(e)):t}},zn=class e{constructor(...e){let[t,n,r,i,a]=In(e),o=e.shift(),s=e.shift();this.calendar=t,this.era=n,this.year=r,this.month=i,this.day=a,this.timeZone=o,this.offset=s,this.hour=e.shift()||0,this.minute=e.shift()||0,this.second=e.shift()||0,this.millisecond=e.shift()||0,on(this)}copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new e(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(e){return bn(this,e)}subtract(e){return xn(this,e)}set(e,t){return Cn(this,e,t)}cycle(e,t,n){return Sn(this,e,t,n)}toDate(){return Xt(this)}toString(){return Fn(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(e){return this.toDate().getTime()-Yt(e,this.timeZone).toDate().getTime()}},Bn=[[1868,9,8],[1912,7,30],[1926,12,25],[1989,1,8],[2019,5,1]],Vn=[[1912,7,29],[1926,12,24],[1989,1,7],[2019,4,30]],Hn=[1867,1911,1925,1988,2018],Un=[`meiji`,`taisho`,`showa`,`heisei`,`reiwa`];function Wn(e){let t=Bn.findIndex(([t,n,r])=>e.year=0){let[,n,r]=Bn[t];e.month=Math.max(n,e.month),e.month===n&&(e.day=Math.max(r,e.day))}}getEras(){return Un}getYearsInEra(e){let t=Un.indexOf(e.era),n=Bn[t],r=Bn[t+1];if(r==null)return 9999-n[0]+1;let i=r[0]-n[0];return(e.month0?[`minguo`,t]:[`before_minguo`,1-t]}var er=class extends z{fromJulianDay(e){let t=super.fromJulianDay(e),[n,r]=$n(st(t.era,t.year));return new q(this,n,r,t.month,t.day)}toJulianDay(e){return super.toJulianDay(tr(e))}getEras(){return[`before_minguo`,`minguo`]}balanceDate(e){let[t,n]=$n(Qn(e));e.era=t,e.year=n}isInverseEra(e){return e.era===`before_minguo`}getDaysInMonth(e){return super.getDaysInMonth(tr(e))}getYearsInEra(e){return e.era===`before_minguo`?9999:8088}constructor(...e){super(...e),this.identifier=`roc`}};function tr(e){let[t,n]=ct(Qn(e));return new q(t,n,e.month,e.day)}var nr=1948320,rr=[0,31,62,93,124,155,186,216,246,276,306,336],ir=class{fromJulianDay(e){let t=e-nr,n=1+Math.floor((33*t+3)/12053),r=t-(365*(n-1)+Math.floor((8*n+21)/33)),i=Math.floor(r<216?r/31:(r-6)/30),a=r-rr[i]+1;return new q(this,n,i+1,a)}toJulianDay(e){let t=1948319+365*(e.year-1)+Math.floor((8*e.year+21)/33);return t+=rr[e.month-1],t+=e.day,t}getMonthsInYear(){return 12}getDaysInMonth(e){return e.month<=6?31:e.month<=11||rt(25*e.year+11,33)<8?30:29}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getEras(){return[`AP`]}getYearsInEra(){return 9377}constructor(){this.identifier=`persian`}},ar=78,or=80,sr=class extends z{fromJulianDay(e){let t=super.fromJulianDay(e),n=t.year-ar,r=e-at(t.era,t.year,1,1),i;r=8&&(i+=(e.month-7)*30),i+=e.day-1,i)}getDaysInMonth(e){return e.month===1&&ot(e.year+ar)||e.month>=2&&e.month<=6?31:30}getYearsInEra(){return 9919}getEras(){return[`saka`]}balanceDate(){}constructor(...e){super(...e),this.identifier=`indian`}},cr=1948440,lr=1948439,J=1300,ur=1600,dr=460322;function fr(e,t,n,r){return r+Math.ceil(29.5*(n-1))+(t-1)*354+Math.floor((3+11*t)/30)+e-1}function pr(e,t,n){let r=Math.floor((30*(n-t)+10646)/10631),i=Math.min(12,Math.ceil((n-(29+fr(t,r,1,1)))/29.5)+1);return new q(e,r,i,n-fr(t,r,i,1)+1)}function mr(e){return(14+11*e)%30<11}var hr=class{fromJulianDay(e){return pr(this,cr,e)}toJulianDay(e){return fr(cr,e.year,e.month,e.day)}getDaysInMonth(e){let t=29+e.month%2;return e.month===12&&mr(e.year)&&t++,t}getMonthsInYear(){return 12}getDaysInYear(e){return mr(e.year)?355:354}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 30}getYearsInEra(){return 9665}getEras(){return[`AH`]}constructor(){this.identifier=`islamic-civil`}},gr=class extends hr{fromJulianDay(e){return pr(this,lr,e)}toJulianDay(e){return fr(lr,e.year,e.month,e.day)}constructor(...e){super(...e),this.identifier=`islamic-tbla`}},_r=`qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=`,vr,yr;function br(e){return dr+yr[e-J]}function xr(e,t){let n=e-J,r=1<<11-(t-1);return(vr[n]&r)===0?29:30}function Sr(e,t){let n=br(e);for(let r=1;re.charCodeAt(0)).buffer),!yr){yr=new Uint32Array(301);let e=0;for(let t=J;t<=ur;t++){yr[t-J]=e;for(let n=1;n<=12;n++)e+=xr(t,n)}}}fromJulianDay(e){let t=e-cr,n=br(J),r=br(ur);if(tr)return super.fromJulianDay(e);{let e=1299,n=1,r=1;for(;r>0;){e++,r=t-br(e)+1;let i=Cr(e);if(r===i){n=12;break}if(rt;)r-=t,n++,t=xr(e,n);break}}return new q(this,e,n,t-Sr(e,n)+1)}}toJulianDay(e){return e.yearur?super.toJulianDay(e):cr+Sr(e.year,e.month)+(e.day-1)}getDaysInMonth(e){return e.yearur?super.getDaysInMonth(e):xr(e.year,e.month)}getDaysInYear(e){return e.yearur?super.getDaysInYear(e):Cr(e.year)}},Tr=347997,Er=25920,Dr=765433;function Or(e){return rt(e*7+1,19)<7}function kr(e){let t=Math.floor((235*e-234)/19),n=12084+13753*t,r=t*29+Math.floor(n/25920);return rt(3*(r+1),7)<3&&(r+=1),r}function Ar(e){let t=kr(e-1),n=kr(e);return kr(e+1)-n===356?2:+(n-t===382)}function jr(e){return kr(e)+Ar(e)}function Mr(e){return jr(e+1)-jr(e)}function Nr(e){let t=Mr(e);switch(t>380&&(t-=30),t){case 353:return 0;case 354:return 1;case 355:return 2}}function Pr(e,t){if(t>=6&&!Or(e)&&t++,t===4||t===7||t===9||t===11||t===13)return 29;let n=Nr(e);return t===2?n===2?30:29:t===3?n===0?29:30:t===6?Or(e)?30:0:30}var Fr=class{fromJulianDay(e){let t=e-Tr,n=t*Er/Dr,r=Math.floor((19*n+234)/235)+1,i=jr(r),a=Math.floor(t-i);for(;a<1;)r--,i=jr(r),a=Math.floor(t-i);let o=1,s=0;for(;s6?e.month--:!Or(t.year)&&Or(e.year)&&t.month>6&&e.month++)}constructor(){this.identifier=`hebrew`}},Ir=1723856,Lr=1824665,Rr=5500;function zr(e,t,n,r){return e+365*t+Math.floor(t/4)+30*(n-1)+r-1}function Br(e,t){let n=Math.floor(4*(t-e)/1461),r=1+Math.floor((t-zr(e,n,1,1))/30);return[n,r,t+1-zr(e,n,r,1)]}function Vr(e){return Math.floor(e%4/3)}function Hr(e,t){return t%13==0?Vr(e)+5:30}var Ur=class{fromJulianDay(e){let[t,n,r]=Br(Ir,e),i=`AM`;return t<=0&&(i=`AA`,t+=Rr),new q(this,i,t,n,r)}toJulianDay(e){let t=e.year;return e.era===`AA`&&(t-=Rr),zr(Ir,t,e.month,e.day)}getDaysInMonth(e){return Hr(e.year,e.month)}getMonthsInYear(){return 13}getDaysInYear(e){return 365+Vr(e.year)}getMaximumMonthsInYear(){return 13}getMaximumDaysInMonth(){return 30}getYearsInEra(e){return e.era===`AA`?9999:9991}getEras(){return[`AA`,`AM`]}constructor(){this.identifier=`ethiopic`}},Wr=class extends Ur{fromJulianDay(e){let[t,n,r]=Br(Ir,e);return t+=Rr,new q(this,`AA`,t,n,r)}getEras(){return[`AA`]}getYearsInEra(){return 9999}constructor(...e){super(...e),this.identifier=`ethioaa`}},Gr=class extends Ur{fromJulianDay(e){let[t,n,r]=Br(Lr,e),i=`CE`;return t<=0&&(i=`BCE`,t=1-t),new q(this,i,t,n,r)}toJulianDay(e){let t=e.year;return e.era===`BCE`&&(t=1-t),zr(Lr,t,e.month,e.day)}getDaysInMonth(e){let t=e.year;return e.era===`BCE`&&(t=1-t),Hr(t,e.month)}isInverseEra(e){return e.era===`BCE`}balanceDate(e){e.year<=0&&(e.era=e.era===`BCE`?`CE`:`BCE`,e.year=1-e.year)}getEras(){return[`BCE`,`CE`]}getYearsInEra(e){return e.era===`BCE`?9999:9715}constructor(...e){super(...e),this.identifier=`coptic`}};function Kr(e){switch(e){case`buddhist`:return new Yn;case`ethiopic`:return new Ur;case`ethioaa`:return new Wr;case`coptic`:return new Gr;case`hebrew`:return new Fr;case`indian`:return new sr;case`islamic-civil`:return new hr;case`islamic-tbla`:return new gr;case`islamic-umalqura`:return new wr;case`japanese`:return new Kn;case`persian`:return new ir;case`roc`:return new er;default:return new z}}var qr=new Map,Y=class{constructor(e,t={}){this.formatter=Yr(e,t),this.options=t}format(e){return this.formatter.format(e)}formatToParts(e){return this.formatter.formatToParts(e)}formatRange(e,t){if(typeof this.formatter.formatRange==`function`)return this.formatter.formatRange(e,t);if(t= start date`);return`${this.formatter.format(e)} \u{2013} ${this.formatter.format(t)}`}formatRangeToParts(e,t){if(typeof this.formatter.formatRangeToParts==`function`)return this.formatter.formatRangeToParts(e,t);if(t= start date`);let n=this.formatter.formatToParts(e),r=this.formatter.formatToParts(t);return[...n.map(e=>({...e,source:`startRange`})),{type:`literal`,value:` – `,source:`shared`},...r.map(e=>({...e,source:`endRange`}))]}resolvedOptions(){let e=this.formatter.resolvedOptions();return $r()&&(this.resolvedHourCycle||=ei(e.locale,this.options),e.hourCycle=this.resolvedHourCycle,e.hour12=this.resolvedHourCycle===`h11`||this.resolvedHourCycle===`h12`),e.calendar===`ethiopic-amete-alem`&&(e.calendar=`ethioaa`),e}},Jr={true:{ja:`h11`},false:{}};function Yr(e,t={}){if(typeof t.hour12==`boolean`&&Zr()){t={...t};let n=Jr[String(t.hour12)][e.split(`-`)[0]],r=t.hour12?`h12`:`h23`;t.hourCycle=n??r,delete t.hour12}let n=e+(t?Object.entries(t).sort((e,t)=>e[0]e.type===`hour`).value,10),i=parseInt(n.formatToParts(new Date(2020,2,3,23)).find(e=>e.type===`hour`).value,10);if(r===0&&i===23)return`h23`;if(r===24&&i===23)return`h24`;if(r===0&&i===11)return`h11`;if(r===12&&i===11)return`h12`;throw Error(`Unexpected hour cycle result`)}var X=n(),ti=[`day`,`month`,`year`],ni={hour:1,minute:2,second:3};function ri(e,t){let{autoComplete:n,isDisabled:r,name:a}=e,{visuallyHiddenProps:o}=i({style:{position:`fixed`,top:0,left:0}}),s=60;t.granularity===`second`?s=1:t.granularity===`hour`&&(s=3600);let c=``;t.value&&(c=t.granularity===`day`?U(t.value).toString():W(`timeZone`in t.value?Qt(t.value):t.value).toString());let l=t.granularity===`day`?`date`:`datetime-local`,u=[`hour`,`minute`,`second`],d=0;return u.includes(t.granularity)&&(d=ni[t.granularity],u=u.slice(0,d)),{containerProps:{...o,"aria-hidden":!0,"data-react-aria-prevent-focus":!0,"data-a11y-ignore":`aria-hidden-focus`},inputProps:{tabIndex:-1,autoComplete:n,disabled:r,type:l,form:``,name:a,step:s,value:c,onChange:e=>{let n=fe(e).value.toString();if(n)try{let e=On(n);if(t.granularity===`day`&&(e=Dn(n)),`setSegment`in t)for(let n in e)ti.includes(n)&&t.setSegment(n,e[n]),u.includes(n)&&t.setSegment(n,e[n]);t.setValue(e)}catch{}}}}}function ii(e){let{state:t}=e,{containerProps:n,inputProps:r}=ri({...e},t);return R.createElement(`div`,{...n,"data-testid":`hidden-dateinput-container`},R.createElement(`input`,r))}var ai={};ai={calendar:`التقويم`,day:`يوم`,dayPeriod:`ص/م`,endDate:`تاريخ الانتهاء`,era:`العصر`,hour:`الساعات`,minute:`الدقائق`,month:`الشهر`,second:`الثواني`,selectedDateDescription:e=>`\u{62A}\u{627}\u{631}\u{64A}\u{62E} \u{645}\u{62D}\u{62F}\u{62F}: ${e.date}`,selectedRangeDescription:e=>`\u{627}\u{644}\u{645}\u{62F}\u{649} \u{627}\u{644}\u{632}\u{645}\u{646}\u{64A} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}: ${e.startDate} \u{625}\u{644}\u{649} ${e.endDate}`,selectedTimeDescription:e=>`\u{627}\u{644}\u{648}\u{642}\u{62A} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}: ${e.time}`,startDate:`تاريخ البدء`,timeZoneName:`التوقيت`,weekday:`اليوم`,year:`السنة`};var oi={};oi={calendar:`Календар`,day:`ден`,dayPeriod:`пр.об./сл.об.`,endDate:`Крайна дата`,era:`ера`,hour:`час`,minute:`минута`,month:`месец`,second:`секунда`,selectedDateDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.startDate} \u{434}\u{43E} ${e.endDate}`,selectedTimeDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{43E} \u{432}\u{440}\u{435}\u{43C}\u{435}: ${e.time}`,startDate:`Начална дата`,timeZoneName:`часова зона`,weekday:`ден от седмицата`,year:`година`};var si={};si={calendar:`Kalendář`,day:`den`,dayPeriod:`část dne`,endDate:`Konečné datum`,era:`letopočet`,hour:`hodina`,minute:`minuta`,month:`měsíc`,second:`sekunda`,selectedDateDescription:e=>`Vybran\xe9 datum: ${e.date}`,selectedRangeDescription:e=>`Vybran\xe9 obdob\xed: ${e.startDate} a\u{17E} ${e.endDate}`,selectedTimeDescription:e=>`Vybran\xfd \u{10D}as: ${e.time}`,startDate:`Počáteční datum`,timeZoneName:`časové pásmo`,weekday:`den v týdnu`,year:`rok`};var ci={};ci={calendar:`Kalender`,day:`dag`,dayPeriod:`AM/PM`,endDate:`Slutdato`,era:`æra`,hour:`time`,minute:`minut`,month:`måned`,second:`sekund`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt interval: ${e.startDate} til ${e.endDate}`,selectedTimeDescription:e=>`Valgt tidspunkt: ${e.time}`,startDate:`Startdato`,timeZoneName:`tidszone`,weekday:`ugedag`,year:`år`};var li={};li={calendar:`Kalender`,day:`Tag`,dayPeriod:`Tageshälfte`,endDate:`Enddatum`,era:`Epoche`,hour:`Stunde`,minute:`Minute`,month:`Monat`,second:`Sekunde`,selectedDateDescription:e=>`Ausgew\xe4hltes Datum: ${e.date}`,selectedRangeDescription:e=>`Ausgew\xe4hlter Bereich: ${e.startDate} bis ${e.endDate}`,selectedTimeDescription:e=>`Ausgew\xe4hlte Zeit: ${e.time}`,startDate:`Startdatum`,timeZoneName:`Zeitzone`,weekday:`Wochentag`,year:`Jahr`};var ui={};ui={calendar:`Ημερολόγιο`,day:`ημέρα`,dayPeriod:`π.μ./μ.μ.`,endDate:`Ημερομηνία λήξης`,era:`περίοδος`,hour:`ώρα`,minute:`λεπτό`,month:`μήνας`,second:`δευτερόλεπτο`,selectedDateDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3B7} \u{3B7}\u{3BC}\u{3B5}\u{3C1}\u{3BF}\u{3BC}\u{3B7}\u{3BD}\u{3AF}\u{3B1}: ${e.date}`,selectedRangeDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3BF} \u{3B5}\u{3CD}\u{3C1}\u{3BF}\u{3C2}: ${e.startDate} \u{3AD}\u{3C9}\u{3C2} ${e.endDate}`,selectedTimeDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3B7} \u{3CE}\u{3C1}\u{3B1}: ${e.time}`,startDate:`Ημερομηνία έναρξης`,timeZoneName:`ζώνη ώρας`,weekday:`καθημερινή`,year:`έτος`};var di={};di={era:`era`,year:`year`,month:`month`,day:`day`,hour:`hour`,minute:`minute`,second:`second`,dayPeriod:`AM/PM`,calendar:`Calendar`,startDate:`Start Date`,endDate:`End Date`,weekday:`day of the week`,timeZoneName:`time zone`,selectedDateDescription:e=>`Selected Date: ${e.date}`,selectedRangeDescription:e=>`Selected Range: ${e.startDate} to ${e.endDate}`,selectedTimeDescription:e=>`Selected Time: ${e.time}`};var fi={};fi={calendar:`Calendario`,day:`día`,dayPeriod:`a.\xA0m./p.\xA0m.`,endDate:`Fecha final`,era:`era`,hour:`hora`,minute:`minuto`,month:`mes`,second:`segundo`,selectedDateDescription:e=>`Fecha seleccionada: ${e.date}`,selectedRangeDescription:e=>`Rango seleccionado: ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Hora seleccionada: ${e.time}`,startDate:`Fecha de inicio`,timeZoneName:`zona horaria`,weekday:`día de la semana`,year:`año`};var pi={};pi={calendar:`Kalender`,day:`päev`,dayPeriod:`enne/pärast lõunat`,endDate:`Lõppkuupäev`,era:`ajastu`,hour:`tund`,minute:`minut`,month:`kuu`,second:`sekund`,selectedDateDescription:e=>`Valitud kuup\xe4ev: ${e.date}`,selectedRangeDescription:e=>`Valitud vahemik: ${e.startDate} kuni ${e.endDate}`,selectedTimeDescription:e=>`Valitud aeg: ${e.time}`,startDate:`Alguskuupäev`,timeZoneName:`ajavöönd`,weekday:`nädalapäev`,year:`aasta`};var mi={};mi={calendar:`Kalenteri`,day:`päivä`,dayPeriod:`vuorokaudenaika`,endDate:`Päättymispäivä`,era:`aikakausi`,hour:`tunti`,minute:`minuutti`,month:`kuukausi`,second:`sekunti`,selectedDateDescription:e=>`Valittu p\xe4iv\xe4m\xe4\xe4r\xe4: ${e.date}`,selectedRangeDescription:e=>`Valittu aikav\xe4li: ${e.startDate} \u{2013} ${e.endDate}`,selectedTimeDescription:e=>`Valittu aika: ${e.time}`,startDate:`Alkamispäivä`,timeZoneName:`aikavyöhyke`,weekday:`viikonpäivä`,year:`vuosi`};var hi={};hi={calendar:`Calendrier`,day:`jour`,dayPeriod:`cadran`,endDate:`Date de fin`,era:`ère`,hour:`heure`,minute:`minute`,month:`mois`,second:`seconde`,selectedDateDescription:e=>`Date s\xe9lectionn\xe9e\xa0: ${e.date}`,selectedRangeDescription:e=>`Plage s\xe9lectionn\xe9e\xa0: ${e.startDate} au ${e.endDate}`,selectedTimeDescription:e=>`Heure choisie\xa0: ${e.time}`,startDate:`Date de début`,timeZoneName:`fuseau horaire`,weekday:`jour de la semaine`,year:`année`};var gi={};gi={calendar:`לוח שנה`,day:`יום`,dayPeriod:`לפנה״צ/אחה״צ`,endDate:`תאריך סיום`,era:`תקופה`,hour:`שעה`,minute:`דקה`,month:`חודש`,second:`שנייה`,selectedDateDescription:e=>`\u{5EA}\u{5D0}\u{5E8}\u{5D9}\u{5DA} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.date}`,selectedRangeDescription:e=>`\u{5D8}\u{5D5}\u{5D5}\u{5D7} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.startDate} \u{5E2}\u{5D3} ${e.endDate}`,selectedTimeDescription:e=>`\u{5D6}\u{5DE}\u{5DF} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.time}`,startDate:`תאריך התחלה`,timeZoneName:`אזור זמן`,weekday:`יום בשבוע`,year:`שנה`};var _i={};_i={calendar:`Kalendar`,day:`dan`,dayPeriod:`AM/PM`,endDate:`Datum završetka`,era:`era`,hour:`sat`,minute:`minuta`,month:`mjesec`,second:`sekunda`,selectedDateDescription:e=>`Odabrani datum: ${e.date}`,selectedRangeDescription:e=>`Odabrani raspon: ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Odabrano vrijeme: ${e.time}`,startDate:`Datum početka`,timeZoneName:`vremenska zona`,weekday:`dan u tjednu`,year:`godina`};var vi={};vi={calendar:`Naptár`,day:`nap`,dayPeriod:`napszak`,endDate:`Befejező dátum`,era:`éra`,hour:`óra`,minute:`perc`,month:`hónap`,second:`másodperc`,selectedDateDescription:e=>`Kijel\xf6lt d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Kijel\xf6lt tartom\xe1ny: ${e.startDate}\u{2013}${e.endDate}`,selectedTimeDescription:e=>`Kijel\xf6lt id\u{151}: ${e.time}`,startDate:`Kezdő dátum`,timeZoneName:`időzóna`,weekday:`hét napja`,year:`év`};var yi={};yi={calendar:`Calendario`,day:`giorno`,dayPeriod:`AM/PM`,endDate:`Data finale`,era:`era`,hour:`ora`,minute:`minuto`,month:`mese`,second:`secondo`,selectedDateDescription:e=>`Data selezionata: ${e.date}`,selectedRangeDescription:e=>`Intervallo selezionato: da ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Ora selezionata: ${e.time}`,startDate:`Data iniziale`,timeZoneName:`fuso orario`,weekday:`giorno della settimana`,year:`anno`};var bi={};bi={calendar:`カレンダー`,day:`日`,dayPeriod:`午前/午後`,endDate:`終了日`,era:`時代`,hour:`時`,minute:`分`,month:`月`,second:`秒`,selectedDateDescription:e=>`\u{9078}\u{629E}\u{3057}\u{305F}\u{65E5}\u{4ED8} : ${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{629E}\u{7BC4}\u{56F2} : ${e.startDate} \u{304B}\u{3089} ${e.endDate}`,selectedTimeDescription:e=>`\u{9078}\u{629E}\u{3057}\u{305F}\u{6642}\u{9593} : ${e.time}`,startDate:`開始日`,timeZoneName:`タイムゾーン`,weekday:`曜日`,year:`年`};var xi={};xi={calendar:`달력`,day:`일`,dayPeriod:`오전/오후`,endDate:`종료일`,era:`연호`,hour:`시`,minute:`분`,month:`월`,second:`초`,selectedDateDescription:e=>`\u{C120}\u{D0DD} \u{C77C}\u{C790}: ${e.date}`,selectedRangeDescription:e=>`\u{C120}\u{D0DD} \u{BC94}\u{C704}: ${e.startDate} ~ ${e.endDate}`,selectedTimeDescription:e=>`\u{C120}\u{D0DD} \u{C2DC}\u{AC04}: ${e.time}`,startDate:`시작일`,timeZoneName:`시간대`,weekday:`요일`,year:`년`};var Si={};Si={calendar:`Kalendorius`,day:`diena`,dayPeriod:`iki pietų / po pietų`,endDate:`Pabaigos data`,era:`era`,hour:`valanda`,minute:`minutė`,month:`mėnuo`,second:`sekundė`,selectedDateDescription:e=>`Pasirinkta data: ${e.date}`,selectedRangeDescription:e=>`Pasirinktas intervalas: nuo ${e.startDate} iki ${e.endDate}`,selectedTimeDescription:e=>`Pasirinktas laikas: ${e.time}`,startDate:`Pradžios data`,timeZoneName:`laiko juosta`,weekday:`savaitės diena`,year:`metai`};var Ci={};Ci={calendar:`Kalendārs`,day:`diena`,dayPeriod:`priekšpusdienā/pēcpusdienā`,endDate:`Beigu datums`,era:`ēra`,hour:`stundas`,minute:`minūtes`,month:`mēnesis`,second:`sekundes`,selectedDateDescription:e=>`Atlas\u{12B}tais datums: ${e.date}`,selectedRangeDescription:e=>`Atlas\u{12B}tais diapazons: no ${e.startDate} l\u{12B}dz ${e.endDate}`,selectedTimeDescription:e=>`Atlas\u{12B}tais laiks: ${e.time}`,startDate:`Sākuma datums`,timeZoneName:`laika josla`,weekday:`nedēļas diena`,year:`gads`};var wi={};wi={calendar:`Kalender`,day:`dag`,dayPeriod:`a.m./p.m.`,endDate:`Sluttdato`,era:`tidsalder`,hour:`time`,minute:`minutt`,month:`måned`,second:`sekund`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt omr\xe5de: ${e.startDate} til ${e.endDate}`,selectedTimeDescription:e=>`Valgt tid: ${e.time}`,startDate:`Startdato`,timeZoneName:`tidssone`,weekday:`ukedag`,year:`år`};var Ti={};Ti={calendar:`Kalender`,day:`dag`,dayPeriod:`a.m./p.m.`,endDate:`Einddatum`,era:`tijdperk`,hour:`uur`,minute:`minuut`,month:`maand`,second:`seconde`,selectedDateDescription:e=>`Geselecteerde datum: ${e.date}`,selectedRangeDescription:e=>`Geselecteerd bereik: ${e.startDate} tot ${e.endDate}`,selectedTimeDescription:e=>`Geselecteerde tijd: ${e.time}`,startDate:`Startdatum`,timeZoneName:`tijdzone`,weekday:`dag van de week`,year:`jaar`};var Ei={};Ei={calendar:`Kalendarz`,day:`dzień`,dayPeriod:`rano / po południu / wieczorem`,endDate:`Data końcowa`,era:`era`,hour:`godzina`,minute:`minuta`,month:`miesiąc`,second:`sekunda`,selectedDateDescription:e=>`Wybrana data: ${e.date}`,selectedRangeDescription:e=>`Wybrany zakres: ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Wybrany czas: ${e.time}`,startDate:`Data początkowa`,timeZoneName:`strefa czasowa`,weekday:`dzień tygodnia`,year:`rok`};var Di={};Di={calendar:`Calendário`,day:`dia`,dayPeriod:`AM/PM`,endDate:`Data final`,era:`era`,hour:`hora`,minute:`minuto`,month:`mês`,second:`segundo`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Hora selecionada: ${e.time}`,startDate:`Data inicial`,timeZoneName:`fuso horário`,weekday:`dia da semana`,year:`ano`};var Oi={};Oi={calendar:`Calendário`,day:`dia`,dayPeriod:`am/pm`,endDate:`Data de Término`,era:`era`,hour:`hora`,minute:`minuto`,month:`mês`,second:`segundo`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Hora selecionada: ${e.time}`,startDate:`Data de Início`,timeZoneName:`fuso horário`,weekday:`dia da semana`,year:`ano`};var ki={};ki={calendar:`Calendar`,day:`zi`,dayPeriod:`a.m/p.m.`,endDate:`Dată final`,era:`eră`,hour:`oră`,minute:`minut`,month:`lună`,second:`secundă`,selectedDateDescription:e=>`Dat\u{103} selectat\u{103}: ${e.date}`,selectedRangeDescription:e=>`Interval selectat: de la ${e.startDate} p\xe2n\u{103} la ${e.endDate}`,selectedTimeDescription:e=>`Ora selectat\u{103}: ${e.time}`,startDate:`Dată început`,timeZoneName:`fus orar`,weekday:`ziua din săptămână`,year:`an`};var Ai={};Ai={calendar:`Календарь`,day:`день`,dayPeriod:`AM/PM`,endDate:`Дата окончания`,era:`эра`,hour:`час`,minute:`минута`,month:`месяц`,second:`секунда`,selectedDateDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{430}\u{44F} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{44B}\u{439} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: \u{441} ${e.startDate} \u{43F}\u{43E} ${e.endDate}`,selectedTimeDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{43E}\u{435} \u{432}\u{440}\u{435}\u{43C}\u{44F}: ${e.time}`,startDate:`Дата начала`,timeZoneName:`часовой пояс`,weekday:`день недели`,year:`год`};var ji={};ji={calendar:`Kalendár`,day:`deň`,dayPeriod:`AM/PM`,endDate:`Dátum ukončenia`,era:`letopočet`,hour:`hodina`,minute:`minúta`,month:`mesiac`,second:`sekunda`,selectedDateDescription:e=>`Vybrat\xfd d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Vybrat\xfd rozsah: od ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Vybrat\xfd \u{10D}as: ${e.time}`,startDate:`Dátum začatia`,timeZoneName:`časové pásmo`,weekday:`deň týždňa`,year:`rok`};var Mi={};Mi={calendar:`Koledar`,day:`dan`,dayPeriod:`dop/pop`,endDate:`Datum konca`,era:`doba`,hour:`ura`,minute:`minuta`,month:`mesec`,second:`sekunda`,selectedDateDescription:e=>`Izbrani datum: ${e.date}`,selectedRangeDescription:e=>`Izbrano obmo\u{10D}je: ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Izbrani \u{10D}as: ${e.time}`,startDate:`Datum začetka`,timeZoneName:`časovni pas`,weekday:`dan v tednu`,year:`leto`};var Ni={};Ni={calendar:`Kalendar`,day:`дан`,dayPeriod:`пре подне/по подне`,endDate:`Datum završetka`,era:`ера`,hour:`сат`,minute:`минут`,month:`месец`,second:`секунд`,selectedDateDescription:e=>`Izabrani datum: ${e.date}`,selectedRangeDescription:e=>`Izabrani opseg: od ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Izabrano vreme: ${e.time}`,startDate:`Datum početka`,timeZoneName:`временска зона`,weekday:`дан у недељи`,year:`година`};var Pi={};Pi={calendar:`Kalender`,day:`dag`,dayPeriod:`fm/em`,endDate:`Slutdatum`,era:`era`,hour:`timme`,minute:`minut`,month:`månad`,second:`sekund`,selectedDateDescription:e=>`Valt datum: ${e.date}`,selectedRangeDescription:e=>`Valt intervall: ${e.startDate} till ${e.endDate}`,selectedTimeDescription:e=>`Vald tid: ${e.time}`,startDate:`Startdatum`,timeZoneName:`tidszon`,weekday:`veckodag`,year:`år`};var Fi={};Fi={calendar:`Takvim`,day:`gün`,dayPeriod:`ÖÖ/ÖS`,endDate:`Bitiş Tarihi`,era:`çağ`,hour:`saat`,minute:`dakika`,month:`ay`,second:`saniye`,selectedDateDescription:e=>`Se\xe7ilen Tarih: ${e.date}`,selectedRangeDescription:e=>`Se\xe7ilen Aral\u{131}k: ${e.startDate} - ${e.endDate}`,selectedTimeDescription:e=>`Se\xe7ilen Zaman: ${e.time}`,startDate:`Başlangıç Tarihi`,timeZoneName:`saat dilimi`,weekday:`haftanın günü`,year:`yıl`};var Ii={};Ii={calendar:`Календар`,day:`день`,dayPeriod:`дп/пп`,endDate:`Дата завершення`,era:`ера`,hour:`година`,minute:`хвилина`,month:`місяць`,second:`секунда`,selectedDateDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{438}\u{439} \u{434}\u{456}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.startDate} \u{2014} ${e.endDate}`,selectedTimeDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{438}\u{439} \u{447}\u{430}\u{441}: ${e.time}`,startDate:`Дата початку`,timeZoneName:`часовий пояс`,weekday:`день тижня`,year:`рік`};var Li={};Li={calendar:`日历`,day:`日`,dayPeriod:`上午/下午`,endDate:`结束日期`,era:`纪元`,hour:`小时`,minute:`分钟`,month:`月`,second:`秒`,selectedDateDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{8303}\u{56F4}\u{FF1A}${e.startDate} \u{81F3} ${e.endDate}`,selectedTimeDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{65F6}\u{95F4}\u{FF1A}${e.time}`,startDate:`开始日期`,timeZoneName:`时区`,weekday:`工作日`,year:`年`};var Ri={};Ri={calendar:`日曆`,day:`日`,dayPeriod:`上午/下午`,endDate:`結束日期`,era:`纪元`,hour:`小时`,minute:`分钟`,month:`月`,second:`秒`,selectedDateDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{7BC4}\u{570D}\u{FF1A}${e.startDate} \u{81F3} ${e.endDate}`,selectedTimeDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{6642}\u{9593}\u{FF1A}${e.time}`,startDate:`開始日期`,timeZoneName:`时区`,weekday:`工作日`,year:`年`};var zi={};zi={"ar-AE":ai,"bg-BG":oi,"cs-CZ":si,"da-DK":ci,"de-DE":li,"el-GR":ui,"en-US":di,"es-ES":fi,"et-EE":pi,"fi-FI":mi,"fr-FR":hi,"he-IL":gi,"hr-HR":_i,"hu-HU":vi,"it-IT":yi,"ja-JP":bi,"ko-KR":xi,"lt-LT":Si,"lv-LV":Ci,"nb-NO":wi,"nl-NL":Ti,"pl-PL":Ei,"pt-BR":Di,"pt-PT":Oi,"ro-RO":ki,"ru-RU":Ai,"sk-SK":ji,"sl-SI":Mi,"sr-SP":Ni,"sv-SE":Pi,"tr-TR":Fi,"uk-UA":Ii,"zh-CN":Li,"zh-TW":Ri};function Bi(e,t,n){let{direction:r}=F(),i=(0,R.useMemo)(()=>de(t),[t]),{keyboardProps:a}=he({shortcuts:{"Alt+ArrowDown":()=>{if(`setOpen`in e){e.setOpen(!0);return}return!1},"Alt+ArrowUp":()=>{if(`setOpen`in e){e.setOpen(!0);return}return!1},ArrowLeft:e=>{if(n)return!1;if(r===`rtl`){if(t.current){let n=fe(e),r=Vi(t.current,n.getBoundingClientRect().left,-1);if(r){r.focus();return}}}else{i.focusPrevious();return}return!1},ArrowRight:e=>{if(n)return!1;if(r===`rtl`){if(t.current){let n=fe(e),r=Vi(t.current,n.getBoundingClientRect().left,1);if(r){r.focus();return}}}else{i.focusNext();return}return!1}},allowRepeats:!0}),o=()=>{if(!t.current)return;let e=window.event?fe(window.event):null,n=re(t.current,{tabbable:!0});if(e&&=(n.currentNode=e,n.previousNode()),!e){let t;do t=n.lastChild(),t&&(e=t);while(t)}for(;e?.hasAttribute(`data-placeholder`);){let t=n.previousNode();if(t&&t.hasAttribute(`data-placeholder`))e=t;else break}e&&e.focus()},{pressProps:s}=ue({preventFocusOnPress:!0,allowTextSelectionOnPress:!0,onPressStart(e){e.pointerType===`mouse`&&o()},onPress(e){(e.pointerType===`touch`||e.pointerType===`pen`)&&o()}});return D(s,a)}function Vi(e,t,n){let r=re(e,{tabbable:!0}),i=r.nextNode(),a=null,o=1/0;for(;i;){let e=i.getBoundingClientRect().left-t,s=Math.abs(e);Math.sign(e)===n&&s{t.confirmPlaceholder(),t.value!==u.current&&t.commitValidation(),e.onBlur?.(n)},onFocusWithinChange:e.onFocusChange}),f=h(Hi(zi),`@react-aria/datepicker`),p=t.maxGranularity===`hour`?`selectedTimeDescription`:`selectedDateDescription`,m=t.maxGranularity===`hour`?`time`:`date`,g=t.value?f.format(p,{[m]:t.formatValue({month:`long`})}):``,_=Ke(g),v=e.__reactAriaDateFieldRole===`presentation`?s[`aria-describedby`]:[_[`aria-describedby`],s[`aria-describedby`]].filter(Boolean).join(` `)||void 0,y=e[Gi],b=(0,R.useMemo)(()=>y||de(n),[y,n]),x=Bi(t,n,e[Wi]===`presentation`);Ui.set(t,{ariaLabel:e[`aria-label`],ariaLabelledBy:[o.id,e[`aria-labelledby`]].filter(Boolean).join(` `)||void 0,ariaDescribedBy:v,focusManager:b});let S=(0,R.useRef)(e.autoFocus),C;C=e.__reactAriaDateFieldRole===`presentation`?{role:`presentation`}:D(s,{role:`group`,"aria-disabled":e.isDisabled||void 0,"aria-describedby":v}),(0,R.useEffect)(()=>{S.current&&b.focusFirst(),S.current=!1},[b]),Ne(e.inputRef,t.defaultValue,t.setValue),ve({...e,focus(){b.focusFirst()}},t,e.inputRef);let w={type:`hidden`,name:e.name,form:e.form,value:t.value?.toString()||``,disabled:e.isDisabled};e.validationBehavior===`native`&&(w.type=`text`,w.hidden=!0,w.required=e.isRequired,w.onChange=()=>{});let T=I(e);return{labelProps:{...o,onClick:()=>{b.focusFirst()}},fieldProps:D(T,C,x,d,{onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,style:{unicodeBidi:`isolate`}}),inputProps:w,descriptionProps:c,errorMessageProps:l,isInvalid:r,validationErrors:i,validationDetails:a}}function qi(e,t,n){let r=Ki(e,t,n);return r.inputProps.value=t.timeValue?.toString()||``,r}function Z(e){e=Ye(e??{},Ji);let{locale:t}=F();return(0,R.useMemo)(()=>new Y(t,e),[t,e])}function Ji(e,t){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(t[r]!==e[r])return!1;return!0}function Yi(e){return e&&e.__esModule?e.default:e}function Xi(){let{locale:e}=F(),t=c(Yi(zi),`@react-aria/datepicker`);return(0,R.useMemo)(()=>{try{return new Intl.DisplayNames(e,{type:`dateTimeField`})}catch{return new Zi(e,t)}},[e,t])}var Zi=class{constructor(e,t){this.locale=e,this.dictionary=t}of(e){return this.dictionary.getStringForLocale(e,this.locale)}};function Qi(e,t,n){let r=(0,R.useRef)(``),{locale:i,direction:a}=F(),o=Xi(),{ariaLabel:s,ariaLabelledBy:c,ariaDescribedBy:l,focusManager:u}=Ui.get(t),d=e.isPlaceholder?``:e.text,f=(0,R.useMemo)(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),p=Z({month:`long`,timeZone:f.timeZone}),m=Z({hour:`numeric`,hour12:f.hour12,timeZone:f.timeZone});if(e.type===`month`&&!e.isPlaceholder){let e=p.format(t.dateValue);d=e===d?e:`${d} \u{2013} ${e}`}else e.type===`hour`&&!e.isPlaceholder&&(d=m.format(t.dateValue));let{spinButtonProps:h}=Ie({value:e.value??void 0,textValue:d,minValue:e.minValue,maxValue:e.maxValue,isDisabled:t.isDisabled,isReadOnly:t.isReadOnly||!e.isEditable,isRequired:t.isRequired,onIncrement:()=>{r.current=``,t.increment(e.type)},onDecrement:()=>{r.current=``,t.decrement(e.type)},onIncrementPage:()=>{r.current=``,t.incrementPage(e.type)},onDecrementPage:()=>{r.current=``,t.decrementPage(e.type)},onIncrementToMax:()=>{r.current=``,t.incrementToMax(e.type)},onDecrementToMin:()=>{r.current=``,t.decrementToMin(e.type)}}),v=(0,R.useMemo)(()=>new Pe(i,{maximumFractionDigits:0}),[i]),y=()=>{if(e.text===e.placeholder&&u.focusPrevious(),v.isValidPartialNumber(e.text)&&!t.isReadOnly&&!e.isPlaceholder){let n=e.text.slice(0,-1),i=v.parse(n);n=i===0?``:n,n.length===0||i===0?t.clearSegment(e.type):t.setSegment(e.type,i),r.current=n}else(e.type===`dayPeriod`||e.type===`era`)&&t.clearSegment(e.type)},{keyboardProps:x}=he({shortcuts:{Backspace:()=>{y()},Delete:()=>{y()},"Mod+a":()=>{}},allowRepeats:!0}),{startsWith:S}=nt({sensitivity:`base`}),w=Z({hour:`numeric`,hour12:!0}),T=(0,R.useMemo)(()=>{let e=new Date;return e.setHours(0),w.formatToParts(e).find(e=>e.type===`dayPeriod`).value},[w]),E=(0,R.useMemo)(()=>{let e=new Date;return e.setHours(12),w.formatToParts(e).find(e=>e.type===`dayPeriod`).value},[w]),O=Z({year:`numeric`,era:`narrow`,timeZone:`UTC`}),k=(0,R.useMemo)(()=>{if(e.type!==`era`)return[];let n=G(new q(1,1,1),t.calendar),r=t.calendar.getEras().map(e=>{let t=n.set({year:1,month:1,day:1,era:e}).toDate(`UTC`);return{era:e,formatted:O.formatToParts(t).find(e=>e.type===`era`).value}}),i=$i(r.map(e=>e.formatted));if(i)for(let e of r)e.formatted=e.formatted.slice(i);return r},[O,t.calendar,e.type]),A=n=>{if(t.isDisabled||t.isReadOnly)return;let i=r.current+n;switch(e.type){case`dayPeriod`:if(S(T,n))t.setSegment(`dayPeriod`,0);else if(S(E,n))t.setSegment(`dayPeriod`,1);else break;u.focusNext();break;case`era`:{let e=k.find(e=>S(e.formatted,n));e&&(t.setSegment(`era`,e.era),u.focusNext());break}case`day`:case`hour`:case`minute`:case`second`:case`month`:case`year`:{if(!v.isValidPartialNumber(i))return;let a=v.parse(i),o=a;if(e.maxValue!==void 0&&a>e.maxValue&&(o=v.parse(n)),isNaN(a))return;t.setSegment(e.type,o),e.maxValue!==void 0&&(Number(a+`0`)>e.maxValue||i.length>=String(e.maxValue).length)?(r.current=``,u.focusNext()):r.current=i;break}}},ee=()=>{r.current=``,n.current&&ze(n.current,{containingElement:Ve(n.current)}),window.getSelection()?.collapse(n.current)},te=(0,R.useRef)(typeof document<`u`?document:null);g(te,`selectionchange`,()=>{let e=window.getSelection();e?.anchorNode&&ne(n.current,e?.anchorNode)&&b()===n.current&&e.collapse(n.current)});let j=(0,R.useRef)(``);g(n,`beforeinput`,r=>{if(n.current)switch(r.preventDefault(),r.inputType){case`deleteContentBackward`:case`deleteContentForward`:v.isValidPartialNumber(e.text)&&!t.isReadOnly&&y();break;case`insertCompositionText`:j.current=n.current.textContent,n.current.textContent=n.current.textContent;break;default:r.data!=null&&A(r.data)}}),g(n,`input`,e=>{let{inputType:t,data:r}=e;t===`insertCompositionText`&&(n.current&&(n.current.textContent=j.current),r!=null&&(S(T,r)||S(E,r))&&A(r))}),ae(()=>{let e=n.current;return()=>{b()===e&&(u.focusPrevious()||u.focusNext())}},[n,u]);let M=C()||e.type===`timeZoneName`?{role:`textbox`,"aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e!==(0,R.useMemo)(()=>t.segments.find(e=>e.isEditable),[t.segments])&&!t.isInvalid&&(l=void 0);let re=le(),N=!t.isDisabled&&!t.isReadOnly&&e.isEditable,ie=e.type===`literal`?``:o.of(e.type),P=_({"aria-label":`${ie}${s?`, ${s}`:``}${c?`, `:``}`,"aria-labelledby":c});if(e.type===`literal`)return{segmentProps:{"aria-hidden":!0}};let oe={caretColor:`transparent`};if(a===`rtl`){oe.unicodeBidi=`embed`;let t=f[e.type];(t===`numeric`||t===`2-digit`)&&(oe.direction=`ltr`)}return{segmentProps:D(h,P,{id:re,...M,...x,"aria-invalid":t.isInvalid?`true`:void 0,"aria-describedby":l,"aria-readonly":t.isReadOnly||!e.isEditable?`true`:void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:N,suppressContentEditableWarning:N,spellCheck:N?`false`:void 0,autoCorrect:N?`off`:void 0,enterKeyHint:N?`next`:void 0,inputMode:t.isDisabled||e.type===`dayPeriod`||e.type===`era`||!N?void 0:`numeric`,tabIndex:t.isDisabled?void 0:0,onFocus:ee,style:oe,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}function $i(e){e.sort();let t=e[0],n=e[e.length-1];for(let e=0;e`\u{64A}\u{62C}\u{628} \u{623}\u{646} \u{62A}\u{643}\u{648}\u{646} \u{627}\u{644}\u{642}\u{64A}\u{645}\u{629} ${e.maxValue} \u{623}\u{648} \u{642}\u{628}\u{644} \u{630}\u{644}\u{643}.`,rangeReversed:`تاريخ البدء يجب أن يكون قبل تاريخ الانتهاء.`,rangeUnderflow:e=>`\u{64A}\u{62C}\u{628} \u{623}\u{646} \u{62A}\u{643}\u{648}\u{646} \u{627}\u{644}\u{642}\u{64A}\u{645}\u{629} ${e.minValue} \u{623}\u{648} \u{628}\u{639}\u{62F} \u{630}\u{644}\u{643}.`,unavailableDate:`البيانات المحددة غير متاحة.`};var ta={};ta={rangeOverflow:e=>`\u{421}\u{442}\u{43E}\u{439}\u{43D}\u{43E}\u{441}\u{442}\u{442}\u{430} \u{442}\u{440}\u{44F}\u{431}\u{432}\u{430} \u{434}\u{430} \u{435} ${e.maxValue} \u{438}\u{43B}\u{438} \u{43F}\u{43E}-\u{440}\u{430}\u{43D}\u{43D}\u{430}.`,rangeReversed:`Началната дата трябва да е преди крайната.`,rangeUnderflow:e=>`\u{421}\u{442}\u{43E}\u{439}\u{43D}\u{43E}\u{441}\u{442}\u{442}\u{430} \u{442}\u{440}\u{44F}\u{431}\u{432}\u{430} \u{434}\u{430} \u{435} ${e.minValue} \u{438}\u{43B}\u{438} \u{43F}\u{43E}-\u{43A}\u{44A}\u{441}\u{43D}\u{43E}.`,unavailableDate:`Избраната дата не е налична.`};var na={};na={rangeOverflow:e=>`Hodnota mus\xed b\xfdt ${e.maxValue} nebo d\u{159}\xedv\u{11B}j\u{161}\xed.`,rangeReversed:`Datum zahájení musí předcházet datu ukončení.`,rangeUnderflow:e=>`Hodnota mus\xed b\xfdt ${e.minValue} nebo pozd\u{11B}j\u{161}\xed.`,unavailableDate:`Vybrané datum není k dispozici.`};var ra={};ra={rangeOverflow:e=>`V\xe6rdien skal v\xe6re ${e.maxValue} eller tidligere.`,rangeReversed:`Startdatoen skal være før slutdatoen.`,rangeUnderflow:e=>`V\xe6rdien skal v\xe6re ${e.minValue} eller nyere.`,unavailableDate:`Den valgte dato er ikke tilgængelig.`};var ia={};ia={rangeOverflow:e=>`Der Wert muss ${e.maxValue} oder fr\xfcher sein.`,rangeReversed:`Das Startdatum muss vor dem Enddatum liegen.`,rangeUnderflow:e=>`Der Wert muss ${e.minValue} oder sp\xe4ter sein.`,unavailableDate:`Das ausgewählte Datum ist nicht verfügbar.`};var aa={};aa={rangeOverflow:e=>`\u{397} \u{3C4}\u{3B9}\u{3BC}\u{3AE} \u{3C0}\u{3C1}\u{3AD}\u{3C0}\u{3B5}\u{3B9} \u{3BD}\u{3B1} \u{3B5}\u{3AF}\u{3BD}\u{3B1}\u{3B9} ${e.maxValue} \u{3AE} \u{3C0}\u{3B1}\u{3BB}\u{3B1}\u{3B9}\u{3CC}\u{3C4}\u{3B5}\u{3C1}\u{3B7}.`,rangeReversed:`Η ημερομηνία έναρξης πρέπει να είναι πριν από την ημερομηνία λήξης.`,rangeUnderflow:e=>`\u{397} \u{3C4}\u{3B9}\u{3BC}\u{3AE} \u{3C0}\u{3C1}\u{3AD}\u{3C0}\u{3B5}\u{3B9} \u{3BD}\u{3B1} \u{3B5}\u{3AF}\u{3BD}\u{3B1}\u{3B9} ${e.minValue} \u{3AE} \u{3BC}\u{3B5}\u{3C4}\u{3B1}\u{3B3}\u{3B5}\u{3BD}\u{3AD}\u{3C3}\u{3C4}\u{3B5}\u{3C1}\u{3B7}.`,unavailableDate:`Η επιλεγμένη ημερομηνία δεν είναι διαθέσιμη.`};var oa={};oa={rangeUnderflow:e=>`Value must be ${e.minValue} or later.`,rangeOverflow:e=>`Value must be ${e.maxValue} or earlier.`,rangeReversed:`Start date must be before end date.`,unavailableDate:`Selected date unavailable.`};var sa={};sa={rangeOverflow:e=>`El valor debe ser ${e.maxValue} o anterior.`,rangeReversed:`La fecha de inicio debe ser anterior a la fecha de finalización.`,rangeUnderflow:e=>`El valor debe ser ${e.minValue} o posterior.`,unavailableDate:`Fecha seleccionada no disponible.`};var ca={};ca={rangeOverflow:e=>`V\xe4\xe4rtus peab olema ${e.maxValue} v\xf5i varasem.`,rangeReversed:`Alguskuupäev peab olema enne lõppkuupäeva.`,rangeUnderflow:e=>`V\xe4\xe4rtus peab olema ${e.minValue} v\xf5i hilisem.`,unavailableDate:`Valitud kuupäev pole saadaval.`};var la={};la={rangeOverflow:e=>`Arvon on oltava ${e.maxValue} tai sit\xe4 aikaisempi.`,rangeReversed:`Aloituspäivän on oltava ennen lopetuspäivää.`,rangeUnderflow:e=>`Arvon on oltava ${e.minValue} tai sit\xe4 my\xf6h\xe4isempi.`,unavailableDate:`Valittu päivämäärä ei ole käytettävissä.`};var ua={};ua={rangeOverflow:e=>`La valeur doit \xeatre ${e.maxValue} ou ant\xe9rieure.`,rangeReversed:`La date de début doit être antérieure à la date de fin.`,rangeUnderflow:e=>`La valeur doit \xeatre ${e.minValue} ou ult\xe9rieure.`,unavailableDate:`La date sélectionnée n’est pas disponible.`};var da={};da={rangeOverflow:e=>`\u{5D4}\u{5E2}\u{5E8}\u{5DA} \u{5D7}\u{5D9}\u{5D9}\u{5D1} \u{5DC}\u{5D4}\u{5D9}\u{5D5}\u{5EA} ${e.maxValue} \u{5D0}\u{5D5} \u{5DE}\u{5D5}\u{5E7}\u{5D3}\u{5DD} \u{5D9}\u{5D5}\u{5EA}\u{5E8}.`,rangeReversed:`תאריך ההתחלה חייב להיות לפני תאריך הסיום.`,rangeUnderflow:e=>`\u{5D4}\u{5E2}\u{5E8}\u{5DA} \u{5D7}\u{5D9}\u{5D9}\u{5D1} \u{5DC}\u{5D4}\u{5D9}\u{5D5}\u{5EA} ${e.minValue} \u{5D0}\u{5D5} \u{5DE}\u{5D0}\u{5D5}\u{5D7}\u{5E8} \u{5D9}\u{5D5}\u{5EA}\u{5E8}.`,unavailableDate:`התאריך הנבחר אינו זמין.`};var fa={};fa={rangeOverflow:e=>`Vrijednost mora biti ${e.maxValue} ili ranije.`,rangeReversed:`Datum početka mora biti prije datuma završetka.`,rangeUnderflow:e=>`Vrijednost mora biti ${e.minValue} ili kasnije.`,unavailableDate:`Odabrani datum nije dostupan.`};var pa={};pa={rangeOverflow:e=>`Az \xe9rt\xe9knek ${e.maxValue} vagy kor\xe1bbinak kell lennie.`,rangeReversed:`A kezdő dátumnak a befejező dátumnál korábbinak kell lennie.`,rangeUnderflow:e=>`Az \xe9rt\xe9knek ${e.minValue} vagy k\xe9s\u{151}bbinek kell lennie.`,unavailableDate:`A kiválasztott dátum nem érhető el.`};var ma={};ma={rangeOverflow:e=>`Il valore deve essere ${e.maxValue} o precedente.`,rangeReversed:`La data di inizio deve essere antecedente alla data di fine.`,rangeUnderflow:e=>`Il valore deve essere ${e.minValue} o successivo.`,unavailableDate:`Data selezionata non disponibile.`};var ha={};ha={rangeOverflow:e=>`\u{5024}\u{306F} ${e.maxValue} \u{4EE5}\u{4E0B}\u{306B}\u{3059}\u{308B}\u{5FC5}\u{8981}\u{304C}\u{3042}\u{308A}\u{307E}\u{3059}\u{3002}`,rangeReversed:`開始日は終了日より前にする必要があります。`,rangeUnderflow:e=>`\u{5024}\u{306F} ${e.minValue} \u{4EE5}\u{4E0A}\u{306B}\u{3059}\u{308B}\u{5FC5}\u{8981}\u{304C}\u{3042}\u{308A}\u{307E}\u{3059}\u{3002}`,unavailableDate:`選択した日付は使用できません。`};var ga={};ga={rangeOverflow:e=>`\u{AC12}\u{C740} ${e.maxValue} \u{C774}\u{C804}\u{C774}\u{C5B4}\u{C57C} \u{D569}\u{B2C8}\u{B2E4}.`,rangeReversed:`시작일은 종료일 이전이어야 합니다.`,rangeUnderflow:e=>`\u{AC12}\u{C740} ${e.minValue} \u{C774}\u{D6C4}\u{C5EC}\u{C57C} \u{D569}\u{B2C8}\u{B2E4}.`,unavailableDate:`선택한 날짜를 사용할 수 없습니다.`};var _a={};_a={rangeOverflow:e=>`Reik\u{161}m\u{117} turi b\u{16B}ti ${e.maxValue} arba ankstesn\u{117}.`,rangeReversed:`Pradžios data turi būti ankstesnė nei pabaigos data.`,rangeUnderflow:e=>`Reik\u{161}m\u{117} turi b\u{16B}ti ${e.minValue} arba naujesn\u{117}.`,unavailableDate:`Pasirinkta data nepasiekiama.`};var va={};va={rangeOverflow:e=>`V\u{113}rt\u{12B}bai ir j\u{101}b\u{16B}t ${e.maxValue} vai agr\u{101}kai.`,rangeReversed:`Sākuma datumam ir jābūt pirms beigu datuma.`,rangeUnderflow:e=>`V\u{113}rt\u{12B}bai ir j\u{101}b\u{16B}t ${e.minValue} vai v\u{113}l\u{101}kai.`,unavailableDate:`Atlasītais datums nav pieejams.`};var ya={};ya={rangeOverflow:e=>`Verdien m\xe5 v\xe6re ${e.maxValue} eller tidligere.`,rangeReversed:`Startdatoen må være før sluttdatoen.`,rangeUnderflow:e=>`Verdien m\xe5 v\xe6re ${e.minValue} eller senere.`,unavailableDate:`Valgt dato utilgjengelig.`};var ba={};ba={rangeOverflow:e=>`Waarde moet ${e.maxValue} of eerder zijn.`,rangeReversed:`De startdatum moet voor de einddatum liggen.`,rangeUnderflow:e=>`Waarde moet ${e.minValue} of later zijn.`,unavailableDate:`Geselecteerde datum niet beschikbaar.`};var xa={};xa={rangeOverflow:e=>`Warto\u{15B}\u{107} musi mie\u{107} warto\u{15B}\u{107} ${e.maxValue} lub wcze\u{15B}niejsz\u{105}.`,rangeReversed:`Data rozpoczęcia musi być wcześniejsza niż data zakończenia.`,rangeUnderflow:e=>`Warto\u{15B}\u{107} musi mie\u{107} warto\u{15B}\u{107} ${e.minValue} lub p\xf3\u{17A}niejsz\u{105}.`,unavailableDate:`Wybrana data jest niedostępna.`};var Sa={};Sa={rangeOverflow:e=>`O valor deve ser ${e.maxValue} ou anterior.`,rangeReversed:`A data inicial deve ser anterior à data final.`,rangeUnderflow:e=>`O valor deve ser ${e.minValue} ou posterior.`,unavailableDate:`Data selecionada indisponível.`};var Ca={};Ca={rangeOverflow:e=>`O valor tem de ser ${e.maxValue} ou anterior.`,rangeReversed:`A data de início deve ser anterior à data de fim.`,rangeUnderflow:e=>`O valor tem de ser ${e.minValue} ou posterior.`,unavailableDate:`Data selecionada indisponível.`};var wa={};wa={rangeOverflow:e=>`Valoarea trebuie s\u{103} fie ${e.maxValue} sau anterioar\u{103}.`,rangeReversed:`Data de început trebuie să fie anterioară datei de sfârșit.`,rangeUnderflow:e=>`Valoarea trebuie s\u{103} fie ${e.minValue} sau ulterioar\u{103}.`,unavailableDate:`Data selectată nu este disponibilă.`};var Ta={};Ta={rangeOverflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{438}\u{435} \u{434}\u{43E}\u{43B}\u{436}\u{43D}\u{43E} \u{431}\u{44B}\u{442}\u{44C} \u{43D}\u{435} \u{43F}\u{43E}\u{437}\u{436}\u{435} ${e.maxValue}.`,rangeReversed:`Дата начала должна предшествовать дате окончания.`,rangeUnderflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{438}\u{435} \u{434}\u{43E}\u{43B}\u{436}\u{43D}\u{43E} \u{431}\u{44B}\u{442}\u{44C} \u{43D}\u{435} \u{440}\u{430}\u{43D}\u{44C}\u{448}\u{435} ${e.minValue}.`,unavailableDate:`Выбранная дата недоступна.`};var Ea={};Ea={rangeOverflow:e=>`Hodnota mus\xed by\u{165} ${e.maxValue} alebo skor\u{161}ia.`,rangeReversed:`Dátum začiatku musí byť skorší ako dátum konca.`,rangeUnderflow:e=>`Hodnota mus\xed by\u{165} ${e.minValue} alebo neskor\u{161}ia.`,unavailableDate:`Vybratý dátum je nedostupný.`};var Da={};Da={rangeOverflow:e=>`Vrednost mora biti ${e.maxValue} ali starej\u{161}a.`,rangeReversed:`Začetni datum mora biti pred končnim datumom.`,rangeUnderflow:e=>`Vrednost mora biti ${e.minValue} ali novej\u{161}a.`,unavailableDate:`Izbrani datum ni na voljo.`};var Oa={};Oa={rangeOverflow:e=>`Vrednost mora da bude ${e.maxValue} ili starija.`,rangeReversed:`Datum početka mora biti pre datuma završetka.`,rangeUnderflow:e=>`Vrednost mora da bude ${e.minValue} ili novija.`,unavailableDate:`Izabrani datum nije dostupan.`};var ka={};ka={rangeOverflow:e=>`V\xe4rdet m\xe5ste vara ${e.maxValue} eller tidigare.`,rangeReversed:`Startdatumet måste vara före slutdatumet.`,rangeUnderflow:e=>`V\xe4rdet m\xe5ste vara ${e.minValue} eller senare.`,unavailableDate:`Det valda datumet är inte tillgängligt.`};var Aa={};Aa={rangeOverflow:e=>`De\u{11F}er, ${e.maxValue} veya \xf6ncesi olmal\u{131}d\u{131}r.`,rangeReversed:`Başlangıç tarihi bitiş tarihinden önce olmalıdır.`,rangeUnderflow:e=>`De\u{11F}er, ${e.minValue} veya sonras\u{131} olmal\u{131}d\u{131}r.`,unavailableDate:`Seçilen tarih kullanılamıyor.`};var ja={};ja={rangeOverflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{43D}\u{44F} \u{43C}\u{430}\u{454} \u{431}\u{443}\u{442}\u{438} \u{43D}\u{435} \u{43F}\u{456}\u{437}\u{43D}\u{456}\u{448}\u{435} ${e.maxValue}.`,rangeReversed:`Дата початку має передувати даті завершення.`,rangeUnderflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{43D}\u{44F} \u{43C}\u{430}\u{454} \u{431}\u{443}\u{442}\u{438} \u{43D}\u{435} \u{440}\u{430}\u{43D}\u{456}\u{448}\u{435} ${e.minValue}.`,unavailableDate:`Вибрана дата недоступна.`};var Ma={};Ma={rangeOverflow:e=>`\u{503C}\u{5FC5}\u{987B}\u{662F} ${e.maxValue} \u{6216}\u{66F4}\u{65E9}\u{65E5}\u{671F}\u{3002}`,rangeReversed:`开始日期必须早于结束日期。`,rangeUnderflow:e=>`\u{503C}\u{5FC5}\u{987B}\u{662F} ${e.minValue} \u{6216}\u{66F4}\u{665A}\u{65E5}\u{671F}\u{3002}`,unavailableDate:`所选日期不可用。`};var Na={};Na={rangeOverflow:e=>`\u{503C}\u{5FC5}\u{9808}\u{662F} ${e.maxValue} \u{6216}\u{66F4}\u{65E9}\u{3002}`,rangeReversed:`開始日期必須在結束日期之前。`,rangeUnderflow:e=>`\u{503C}\u{5FC5}\u{9808}\u{662F} ${e.minValue} \u{6216}\u{66F4}\u{665A}\u{3002}`,unavailableDate:`所選日期無法使用。`};var Pa={};Pa={"ar-AE":ea,"bg-BG":ta,"cs-CZ":na,"da-DK":ra,"de-DE":ia,"el-GR":aa,"en-US":oa,"es-ES":sa,"et-EE":ca,"fi-FI":la,"fr-FR":ua,"he-IL":da,"hr-HR":fa,"hu-HU":pa,"it-IT":ma,"ja-JP":ha,"ko-KR":ga,"lt-LT":_a,"lv-LV":va,"nb-NO":ya,"nl-NL":ba,"pl-PL":xa,"pt-BR":Sa,"pt-PT":Ca,"ro-RO":wa,"ru-RU":Ta,"sk-SK":Ea,"sl-SI":Da,"sr-SP":Oa,"sv-SE":ka,"tr-TR":Aa,"uk-UA":ja,"zh-CN":Ma,"zh-TW":Na};function Fa(e){return e&&e.__esModule?e.default:e}var Ia=new m(Fa(Pa));function La(){let e=typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return e}function Ra(e,t,n,i,a){let o=e!=null&&n!=null&&e.compare(n)>0,s=e!=null&&t!=null&&e.compare(t)<0,c=e!=null&&i?.(e)||!1,l=o||s||c,u=[];if(l){let e=La(),i=m.getGlobalDictionaryForPackage(`@react-stately/datepicker`)||Ia,l=new r(e,i),d=new Y(e,Ha({},a)),f=d.resolvedOptions().timeZone;s&&t!=null&&u.push(l.format(`rangeUnderflow`,{minValue:d.format(t.toDate(f))})),o&&n!=null&&u.push(l.format(`rangeOverflow`,{maxValue:d.format(n.toDate(f))})),c&&u.push(l.format(`unavailableDate`))}return{isInvalid:l,validationErrors:u,validationDetails:{badInput:c,customError:!1,patternMismatch:!1,rangeOverflow:o,rangeUnderflow:s,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!l}}}function za(e,t,n,r,i){let a=Ra(e?.start??null,t,n,r,i),o=Ra(e?.end??null,t,n,r,i),s=we(a,o);if(e?.end!=null&&e.start!=null&&e.end.compare(e.start)<0){let e=m.getGlobalDictionaryForPackage(`@react-stately/datepicker`)||Ia;s=we(s,{isInvalid:!0,validationErrors:[e.getStringForLocale(`rangeReversed`,La())],validationDetails:{...be,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})}return s}var Ba={year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`},Va={year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`};function Ha(e,t){e={...t.shouldForceLeadingZeros?Va:Ba,...e};let n=t.granularity||`minute`,r=Object.keys(e),i=r.indexOf(t.maxGranularity??`year`);i<0&&(i=0);let a=r.indexOf(n);if(a<0&&(a=2),i>a)throw Error(`maxGranularity must be greater than granularity`);let o=r.slice(i,a+1).reduce((t,n)=>(t[n]=e[n],t),{});return t.hourCycle!=null&&(o.hour12=t.hourCycle===12),o.timeZone=t.timeZone||`UTC`,(n===`hour`||n===`minute`||n===`second`)&&t.timeZone&&!t.hideTimeZone&&(o.timeZoneName=`short`),t.showEra&&i===0&&(o.era=`short`),o}function Ua(e){return e&&`hour`in e?e:new Ln}function Wa(e,t){if(e===null)return null;if(e)return G(e,t)}function Ga(e,t,n,r){if(e)return Wa(e,n);let i=G(vt(r??Tt()).set({hour:0,minute:0,second:0,millisecond:0}),n);return t===`year`||t===`month`||t===`day`?U(i):r?i:W(i)}function Ka(e,t){let n=e&&`timeZone`in e?e.timeZone:void 0,r=e&&`minute`in e?`minute`:`day`;if(e&&t&&!(t in e))throw Error(`Invalid granularity `+t+` for value `+e.toString());let[i,a]=(0,R.useState)([r,n]);e&&(i[0]!==r||i[1]!==n)&&a([r,n]),t||=e?r:i[0];let o=e?n:i[1];return[t,o]}var qa=new m({ach:{year:`mwaka`,month:`dwe`,day:`nino`},af:{year:`jjjj`,month:`mm`,day:`dd`},am:{year:`ዓዓዓዓ`,month:`ሚሜ`,day:`ቀቀ`},an:{year:`aaaa`,month:`mm`,day:`dd`},ar:{year:`سنة`,month:`شهر`,day:`يوم`},ast:{year:`aaaa`,month:`mm`,day:`dd`},az:{year:`iiii`,month:`aa`,day:`gg`},be:{year:`гггг`,month:`мм`,day:`дд`},bg:{year:`гггг`,month:`мм`,day:`дд`},bn:{year:`yyyy`,month:`মিমি`,day:`dd`},br:{year:`bbbb`,month:`mm`,day:`dd`},bs:{year:`gggg`,month:`mm`,day:`dd`},ca:{year:`aaaa`,month:`mm`,day:`dd`},cak:{year:`jjjj`,month:`ii`,day:`q'q'`},ckb:{year:`ساڵ`,month:`مانگ`,day:`ڕۆژ`},cs:{year:`rrrr`,month:`mm`,day:`dd`},cy:{year:`bbbb`,month:`mm`,day:`dd`},da:{year:`åååå`,month:`mm`,day:`dd`},de:{year:`jjjj`,month:`mm`,day:`tt`},dsb:{year:`llll`,month:`mm`,day:`źź`},el:{year:`εεεε`,month:`μμ`,day:`ηη`},en:{year:`yyyy`,month:`mm`,day:`dd`},eo:{year:`jjjj`,month:`mm`,day:`tt`},es:{year:`aaaa`,month:`mm`,day:`dd`},et:{year:`aaaa`,month:`kk`,day:`pp`},eu:{year:`uuuu`,month:`hh`,day:`ee`},fa:{year:`سال`,month:`ماه`,day:`روز`},ff:{year:`hhhh`,month:`ll`,day:`ññ`},fi:{year:`vvvv`,month:`kk`,day:`pp`},fr:{year:`aaaa`,month:`mm`,day:`jj`},fy:{year:`jjjj`,month:`mm`,day:`dd`},ga:{year:`bbbb`,month:`mm`,day:`ll`},gd:{year:`bbbb`,month:`mm`,day:`ll`},gl:{year:`aaaa`,month:`mm`,day:`dd`},he:{year:`שנה`,month:`חודש`,day:`יום`},hr:{year:`gggg`,month:`mm`,day:`dd`},hsb:{year:`llll`,month:`mm`,day:`dd`},hu:{year:`éééé`,month:`hh`,day:`nn`},ia:{year:`aaaa`,month:`mm`,day:`dd`},id:{year:`tttt`,month:`bb`,day:`hh`},is:{year:`áááá`,month:`mm`,day:`dd`},it:{year:`aaaa`,month:`mm`,day:`gg`},ja:{year:`年`,month:`月`,day:`日`},ka:{year:`წწწწ`,month:`თთ`,day:`რრ`},kk:{year:`жжжж`,month:`аа`,day:`кк`},kn:{year:`ವವವವ`,month:`ಮಿಮೀ`,day:`ದಿದಿ`},ko:{year:`연도`,month:`월`,day:`일`},lb:{year:`jjjj`,month:`mm`,day:`dd`},lo:{year:`ປປປປ`,month:`ດດ`,day:`ວວ`},lt:{year:`mmmm`,month:`mm`,day:`dd`},lv:{year:`gggg`,month:`mm`,day:`dd`},meh:{year:`aaaa`,month:`mm`,day:`dd`},ml:{year:`വർഷം`,month:`മാസം`,day:`തീയതി`},ms:{year:`tttt`,month:`mm`,day:`hh`},nb:{year:`åååå`,month:`mm`,day:`dd`},nl:{year:`jjjj`,month:`mm`,day:`dd`},nn:{year:`åååå`,month:`mm`,day:`dd`},no:{year:`åååå`,month:`mm`,day:`dd`},oc:{year:`aaaa`,month:`mm`,day:`jj`},pl:{year:`rrrr`,month:`mm`,day:`dd`},pt:{year:`aaaa`,month:`mm`,day:`dd`},rm:{year:`oooo`,month:`mm`,day:`dd`},ro:{year:`aaaa`,month:`ll`,day:`zz`},ru:{year:`гггг`,month:`мм`,day:`дд`},sc:{year:`aaaa`,month:`mm`,day:`dd`},scn:{year:`aaaa`,month:`mm`,day:`jj`},sk:{year:`rrrr`,month:`mm`,day:`dd`},sl:{year:`llll`,month:`mm`,day:`dd`},sr:{year:`гггг`,month:`мм`,day:`дд`},"sr-Latn":{year:`gggg`,month:`mm`,day:`dd`},sv:{year:`åååå`,month:`mm`,day:`dd`},szl:{year:`rrrr`,month:`mm`,day:`dd`},tg:{year:`сссс`,month:`мм`,day:`рр`},th:{year:`ปปปป`,month:`ดด`,day:`วว`},tr:{year:`yyyy`,month:`aa`,day:`gg`},uk:{year:`рррр`,month:`мм`,day:`дд`},"zh-CN":{year:`年`,month:`月`,day:`日`},"zh-TW":{year:`年`,month:`月`,day:`日`}},`en`);function Ja(e,t,n){return e===`era`||e===`dayPeriod`?t:e===`year`||e===`month`||e===`day`?qa.getStringForLocale(e,n):`––`}var Ya=class e{constructor(e,t,n){if(this.era=n?.era??null,this.calendar=e,this.year=n?.year??null,this.month=n?.month??null,this.day=n?.day??null,this.hour=n?.hour??null,this.hourCycle=t,this.dayPeriod=null,this.minute=n?.minute??null,this.second=n?.second??null,this.millisecond=n?.millisecond??null,this.offset=`offset`in(n??{})?n.offset:null,this.hour!=null){let[e,n]=Za(this.hour,t);this.dayPeriod=e,this.hour=n}}copy(){let t=new e(this.calendar,this.hourCycle);return t.era=this.era,t.year=this.year,t.month=this.month,t.day=this.day,t.hour=this.hour,t.dayPeriod=this.dayPeriod,t.minute=this.minute,t.second=this.second,t.millisecond=this.millisecond,t.offset=this.offset,t}isComplete(e){return e.every(e=>this[e]!=null)}validate(e,t){return t.every(t=>{if((t===`hour`||t===`dayPeriod`)&&`hour`in e){let[t,n]=Za(e.hour,this.hourCycle);return this.dayPeriod===t&&this.hour===n}return this[t]===e[t]})}isCleared(e){return e.every(e=>this[e]===null)}set(e,t,n){let r=this.copy();return r[e]=t,e===`hour`&&r.dayPeriod==null&&`hour`in n&&(r.dayPeriod=Za(n.hour,this.hourCycle)[0]),e===`year`&&r.era==null&&(r.era=n.era),e!==`second`&&e!==`literal`&&e!==`timeZoneName`&&(r.offset=null),r}clear(e){let t=this.copy();return t[e]=null,e===`year`&&(t.era=null),t.offset=null,t}cycle(e,t,n,r){let i=this.copy();if(i[e]==null&&e!==`dayPeriod`&&e!==`era`){if(e===`hour`&&`hour`in n){let[e,t]=Za(n.hour,this.hourCycle);i.dayPeriod=e,i.hour=t}else i[e]=n[e];return e===`year`&&i.era==null&&(i.era=n.era),i}switch(e){case`era`:{let e=this.calendar.getEras(),n=e.indexOf(i.era);n=Xa(n,t,0,e.length-1),i.era=e[n];break}case`year`:{let r=new q(this.calendar,this.era??n.era,this.year??n.year,this.month??1,this.day??1);r=r.cycle(e,t,{round:e===`year`}),i.era=r.era,i.year=r.year;break}case`month`:i.month=Xa(i.month??1,t,1,this.calendar.getMaximumMonthsInYear());break;case`day`:i.day=Xa(i.day??1,t,1,this.calendar.getMaximumDaysInMonth());break;case`hour`:{let e=r.some(e=>[`year`,`month`,`day`].includes(e));if(`timeZone`in n&&(!e||i.year!=null&&i.month!=null&&i.day!=null)){let e=this.toValue(n);e=e.cycle(`hour`,t,{hourCycle:this.hourCycle===`h12`?12:24,round:!1});let[r,a]=Za(e.hour,this.hourCycle);i.hour=a,i.dayPeriod=r,i.offset=e.offset}else{let e=i.hour??0,r=this.getSegmentLimits(`hour`);i.hour=Xa(e,t,r.minValue,r.maxValue),i.dayPeriod==null&&`hour`in n&&(i.dayPeriod=Za(n.hour,this.hourCycle)[0])}break}case`dayPeriod`:i.dayPeriod=Xa(i.dayPeriod??0,t,0,1);break;case`minute`:i.minute=Xa(i.minute??0,t,0,59,!0);break;case`second`:i.second=Xa(i.second??0,t,0,59,!0)}return i}toValue(e){if(`hour`in e){let t=this.hour;t==null?(this.hourCycle===`h12`||this.hourCycle===`h11`)&&(t=this.dayPeriod===1?12:0):t=Qa(t,this.dayPeriod??0,this.hourCycle);let n=e.set({era:this.era??e.era,year:this.year??e.year,month:this.month??e.month,day:this.day??e.day,hour:t??e.hour,minute:this.minute??e.minute,second:this.second??e.second,millisecond:this.millisecond??e.millisecond});return`offset`in n&&this.offset!=null&&n.offset!==this.offset&&(n=n.add({milliseconds:n.offset-this.offset})),n}return e.set({era:this.era??e.era,year:this.year??e.year,month:this.month??e.month,day:this.day??e.day})}getSegmentLimits(e){switch(e){case`era`:{let e=this.calendar.getEras();return{value:this.era==null?e.length-1:e.indexOf(this.era),minValue:0,maxValue:e.length-1}}case`year`:return{value:this.year,minValue:1,maxValue:9999};case`month`:return{value:this.month,minValue:1,maxValue:this.calendar.getMaximumMonthsInYear()};case`day`:return{value:this.day,minValue:1,maxValue:this.calendar.getMaximumDaysInMonth()};case`dayPeriod`:return{value:this.dayPeriod,minValue:0,maxValue:1};case`hour`:{let e=0,t=23;return this.hourCycle===`h12`?(e=1,t=12):this.hourCycle===`h11`&&(e=0,t=11),{value:this.hour,minValue:e,maxValue:t}}case`minute`:return{value:this.minute,minValue:0,maxValue:59};case`second`:return{value:this.second,minValue:0,maxValue:59}}}};function Xa(e,t,n,r,i=!1){if(i){e+=Math.sign(t),e0?Math.ceil(e/i)*i:Math.floor(e/i)*i,e>r&&(e=n)}else e+=t,er&&(e=n+(e-r-1));return e}function Za(e,t){let n=+(e>=12);switch(t){case`h11`:e>=12&&(e-=12);break;case`h12`:e===0?e=12:e>12&&(e-=12);break;case`h23`:n=null;break;case`h24`:e+=1,n=null}return[n,e]}function Qa(e,t,n){switch(n){case`h11`:t===1&&(e+=12);break;case`h12`:e===12&&(e=0),t===1&&(e+=12);break;case`h24`:--e}return e}var $a={year:!0,month:!0,day:!0,hour:!0,minute:!0,second:!0,dayPeriod:!0,era:!0},eo={year:5,month:2,day:7,hour:2,minute:15,second:15},to={dayperiod:`dayPeriod`,relatedYear:`year`,yearName:`literal`,unknown:`literal`};function no(e){let{locale:t,createCalendar:n,hideTimeZone:r,isDisabled:i=!1,isReadOnly:a=!1,isRequired:o=!1,minValue:s,maxValue:c,isDateUnavailable:l}=e,u=e.value||e.defaultValue||e.placeholderValue||null,[d,f]=Ka(u,e.granularity),p=f||`UTC`;if(u&&!(d in u))throw Error(`Invalid granularity `+d+` for value `+u.toString());let[m,h]=(0,R.useMemo)(()=>{let r=new Y(t,{dateStyle:`short`,timeStyle:`short`,hour12:e.hourCycle==null?void 0:e.hourCycle===12}).resolvedOptions();return[n(r.calendar),r.hourCycle]},[t,e.hourCycle,n]),[g,_]=ce(e.value,e.defaultValue??null,e.onChange),[v]=(0,R.useState)(g),y=(0,R.useMemo)(()=>Wa(g,m)??null,[g,m]),[b,x]=(0,R.useState)(()=>new Ya(m,h,y)),S=m.identifier===`gregory`&&b.era===`BC`,C=(0,R.useMemo)(()=>({granularity:d,maxGranularity:e.maxGranularity??`year`,timeZone:f,hideTimeZone:r,hourCycle:e.hourCycle,showEra:S,shouldForceLeadingZeros:e.shouldForceLeadingZeros}),[e.maxGranularity,d,e.hourCycle,e.shouldForceLeadingZeros,f,r,S]),w=(0,R.useMemo)(()=>Ha({},C),[C]),T=(0,R.useMemo)(()=>new Y(t,w),[t,w]),E=(0,R.useMemo)(()=>T.resolvedOptions(),[T]),D=(0,R.useMemo)(()=>Ga(e.placeholderValue,d,m,f),[e.placeholderValue,d,m,f]),O=(0,R.useMemo)(()=>{let t=h===`h11`||h===`h12`,n=[`era`,`year`,`month`,`day`,`hour`,...t?[`dayPeriod`]:[],`minute`,`second`],r=n.indexOf(e.maxGranularity||`era`),i=n.indexOf(d===`hour`&&t?`dayPeriod`:d);return n.slice(r,i+1)},[e.maxGranularity,d,h]),[k,A]=(0,R.useState)(y),[ee,te]=(0,R.useState)(m),[j,ne]=(0,R.useState)(h);(y!==k||h!==j||!mt(m,ee))&&(b=new Ya(m,h,y),A(y),te(m),ne(h),x(b));let M=t=>{if(!(e.isDisabled||e.isReadOnly)){if(t==null||t instanceof Ya&&t.isCleared(O))x(new Ya(m,h,y)),_(null);else if(!(t instanceof Ya))t=G(t,u?.calendar||new z),x(new Ya(m,h,y)),_(t);else{if(t.isComplete(O)){let e=t.toValue(y??D);if(t.validate(e,O)){let t=G(e,u?.calendar||new z);if(!g||t.compare(g)!==0){x(new Ya(m,h,y)),_(t);return}}}x(t)}}},re=(0,R.useMemo)(()=>b.toValue(y??D).toDate(p),[b,p,y,D]),N=(0,R.useMemo)(()=>ro(re,b,T,E,m,t,d),[re,T,E,b,m,t,d]),ie=(e,t)=>{M(b.cycle(e,t,D,O))},P=(0,R.useMemo)(()=>Ra(g,s,c,l,C),[g,s,c,l,C]),ae=Oe({...e,value:g,builtinValidation:P}),oe=ae.displayValidation.isInvalid,se=e.validationState||(oe?`invalid`:null);return{...ae,value:y,defaultValue:e.defaultValue??v,dateValue:re,calendar:m,setValue:M,segments:N,dateFormatter:T,validationState:se,isInvalid:oe,granularity:d,maxGranularity:e.maxGranularity??`year`,isDisabled:i,isReadOnly:a,isRequired:o,increment(e){ie(e,1)},decrement(e){ie(e,-1)},incrementPage(e){ie(e,eo[e]||1)},decrementPage(e){ie(e,-(eo[e]||1))},incrementToMax(e){let t=e===`hour`&&h===`h12`?11:b.getSegmentLimits(e).maxValue;M(b.set(e,t,D))},decrementToMin(e){let t=e===`hour`&&h===`h12`?12:b.getSegmentLimits(e).minValue;M(b.set(e,t,D))},setSegment(e,t){M(b.set(e,t,D))},confirmPlaceholder(){if(!(e.isDisabled||e.isReadOnly)&&b.isComplete(O)){let e=G(b.toValue(y??D),u?.calendar||new z);(!g||e.compare(g)!==0)&&_(e),x(new Ya(m,h,y))}},clearSegment(e){let t=b;e!==`timeZoneName`&&e!==`literal`&&(t=b.clear(e)),M(t)},formatValue(e){if(!y)return``;let n=Ha(e,C);return new Y(t,n).format(re)},getDateFormatter(e,t){return new Y(e,Ha({},{...C,...t}))}}}function ro(e,t,n,r,i,a,o){let s=[`hour`,`minute`,`second`],c=n.formatToParts(e),l=new Fe(a,{useGrouping:!1}),u=new Fe(a,{useGrouping:!1,minimumIntegerDigits:2});for(let e of c)if(e.type===`year`||e.type===`month`||e.type===`day`||e.type===`hour`){let n=t[e.type]??0;e.value=r[e.type]===`2-digit`?u.format(n):l.format(n)}let d=[];for(let e of c){let n=to[e.type]||e.type,r=$a[n];n===`era`&&i.getEras().length===1&&(r=!1);let c=$a[n]&&t[e.type]==null,l=$a[n]?Ja(n,e.value,a):null,u={type:n,text:c?l:e.value,...t.getSegmentLimits(n),isPlaceholder:c,placeholder:l,isEditable:r};n===`hour`?(d.push({type:`literal`,text:`⁦`,isPlaceholder:!1,placeholder:``,isEditable:!1}),d.push(u),n===o&&d.push({type:`literal`,text:`⁩`,isPlaceholder:!1,placeholder:``,isEditable:!1})):s.includes(n)&&n===o?(d.push(u),d.push({type:`literal`,text:`⁩`,isPlaceholder:!1,placeholder:``,isEditable:!1})):d.push(u)}return d}function io(e){let{placeholderValue:t=new Ln,minValue:n,maxValue:r,defaultValue:i,granularity:a,validate:o}=e,[s,c]=ce(e.value,i??null,e.onChange),l=s||t,u=l&&`day`in l?l:void 0,d=i&&`timeZone`in i?i.timeZone:void 0,f=(0,R.useMemo)(()=>{let e=l&&`timeZone`in l?l.timeZone:void 0;return(e||d)&&t?Yt(ao(t),e||d):ao(t)},[t,l,d]),p=(0,R.useMemo)(()=>ao(n,u),[n,u]),m=(0,R.useMemo)(()=>ao(r,u),[r,u]),h=(0,R.useMemo)(()=>s&&`day`in s?Jt(s):s,[s]),g=(0,R.useMemo)(()=>s==null?null:ao(s),[s]),_=(0,R.useMemo)(()=>i==null?null:ao(i),[i]),v=e=>{c(u||d?e:e&&Jt(e))};return{...no({...e,value:g,defaultValue:_,minValue:p,maxValue:m,onChange:v,granularity:a||`minute`,maxGranularity:`hour`,placeholderValue:f??void 0,createCalendar:()=>new z,validate:(0,R.useCallback)(()=>o?.(s),[o,s])}),timeValue:h}}function ao(e,t=yt(Tt())){return e?`day`in e?e:W(t,e):null}var oo=(0,R.createContext)(null),so=(0,R.createContext)(null),co=(0,R.createContext)(null),lo=(0,R.createContext)(null),uo=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,oo);let{validationBehavior:n}=O(ye)||{},r=e.validationBehavior??n??`native`,{locale:i}=F(),a=no({...e,locale:i,createCalendar:Kr,validationBehavior:r}),o=(0,R.useRef)(null),[s,c]=A(!e[`aria-label`]&&!e[`aria-labelledby`]),l=(0,R.useRef)(null),{labelProps:u,fieldProps:d,inputProps:f,descriptionProps:m,errorMessageProps:h,...g}=Ki({...E(e),label:c,inputRef:l,validationBehavior:r},a,o),_=k({...E(e),values:{state:a,isInvalid:a.isInvalid,isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:e.isRequired||!1},defaultClassName:`react-aria-DateField`}),v=I(e,{global:!0});return delete v.id,R.createElement(x,{values:[[co,a],[Se,{...d,ref:o,isInvalid:a.isInvalid,isDisabled:a.isDisabled}],[Ee,{...f,ref:l}],[Me,{...u,ref:s,elementType:`span`}],[p,{slots:{description:m,errorMessage:h}}],[Te,g]]},R.createElement(w.div,{...v,..._,ref:t,slot:e.slot||void 0,"data-invalid":a.isInvalid||void 0,"data-disabled":a.isDisabled||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":e.isRequired||void 0}),R.createElement(ii,{autoComplete:e.autoComplete,name:e.name,isDisabled:e.isDisabled,state:a}))}),fo=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,so);let{validationBehavior:n}=O(ye)||{},r=e.validationBehavior??n??`native`,{locale:i}=F(),a=io({...e,locale:i,validationBehavior:r}),o=(0,R.useRef)(null),[s,c]=A(!e[`aria-label`]&&!e[`aria-labelledby`]),l=(0,R.useRef)(null),{labelProps:u,fieldProps:d,inputProps:f,descriptionProps:m,errorMessageProps:h,...g}=qi({...E(e),label:c,inputRef:l,validationBehavior:r},a,o),_=k({...e,values:{state:a,isInvalid:a.isInvalid,isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TimeField`}),v=I(e,{global:!0});return delete v.id,R.createElement(x,{values:[[lo,a],[Se,{...d,ref:o,isInvalid:a.isInvalid,isDisabled:a.isDisabled}],[Ee,{...f,ref:l}],[Me,{...u,ref:s,elementType:`span`}],[p,{slots:{description:m,errorMessage:h}}],[Te,g]]},R.createElement(w.div,{...v,..._,ref:t,slot:e.slot||void 0,"data-invalid":a.isInvalid||void 0,"data-disabled":a.isDisabled||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":e.isRequired||void 0}))}),po=(0,R.forwardRef)(function(e,t){let n=(0,R.useContext)(co),r=(0,R.useContext)(lo);return n||r?R.createElement(ho,{...e,ref:t}):R.createElement(mo,{...e,ref:t})}),mo=(0,R.forwardRef)((e,t)=>{let[n,r]=se({slot:e.slot},t,oo),{locale:i}=F(),a=no({...n,locale:i,createCalendar:Kr}),o=(0,R.useRef)(null),{fieldProps:s,inputProps:c}=Ki({...n,inputRef:o},a,r);return R.createElement(x,{values:[[co,a],[Ee,{...c,ref:o}],[Se,{...s,ref:r,isInvalid:a.isInvalid,isDisabled:a.isDisabled}]]},R.createElement(ho,e))}),ho=(0,R.forwardRef)((e,t)=>{let{className:n,children:r}=e,i=(0,R.useContext)(co),a=(0,R.useContext)(lo),o=i??a;return R.createElement(R.Fragment,null,R.createElement(Ce,{...e,ref:t,slot:e.slot||void 0,className:n??`react-aria-DateInput`,isReadOnly:o.isReadOnly,isInvalid:o.isInvalid,isDisabled:o.isDisabled},o.segments.map((e,t)=>(0,R.cloneElement)(r(e),{key:t}))),R.createElement(ke,{className:``}))}),go=(0,R.forwardRef)(function({segment:e,...t},n){let r=(0,R.useContext)(co),i=(0,R.useContext)(lo),a=r??i,o=T(n),{segmentProps:s}=Qi(e,a,o),{focusProps:c,isFocused:l,isFocusVisible:u}=P(),{hoverProps:d,isHovered:f}=pe({...t,isDisabled:a.isDisabled||e.type===`literal`}),p=k({...t,values:{...e,isReadOnly:a.isReadOnly,isInvalid:a.isInvalid,isDisabled:a.isDisabled,isHovered:f,isFocused:l,isFocusVisible:u},defaultChildren:e.text,defaultClassName:`react-aria-DateSegment`});return R.createElement(w.span,{...D(I(t,{global:!0}),s,c,d),...p,style:s.style,ref:o,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":a.isInvalid||void 0,"data-readonly":a.isReadOnly||void 0,"data-disabled":a.isDisabled||void 0,"data-type":e.type,"data-hovered":f||void 0,"data-focused":l||void 0,"data-focus-visible":u||void 0})}),_o=(0,R.createContext)({}),vo=({children:e,className:t,fullWidth:n,variant:r,...i})=>{let a=R.useMemo(()=>et({fullWidth:n,variant:r}),[n,r]);return(0,X.jsx)(_o,{value:{slots:a},children:(0,X.jsx)(Ce,{className:N(t,a?.base()),"data-slot":`date-input-group`,...i,children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})})},yo=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(S.div,{className:L(r?.prefix,t),"data-slot":`date-input-group-prefix`,...n,children:e})},bo=({className:e,...t})=>{let{slots:n}=(0,R.use)(_o);return(0,X.jsx)(po,{className:N(e,n?.input()),"data-slot":`date-input-group-input`,...t})},xo=({className:e,segment:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(go,{className:L(r?.segment,e),"data-slot":`date-input-group-segment`,segment:t,...n})},So=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(S.div,{className:L(r?.inputContainer,t),"data-slot":`date-input-group-input-container`,...n,children:e})},Co=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(S.div,{className:L(r?.suffix,t),"data-slot":`date-input-group-suffix`,...n,children:e})};function wo({children:e,className:t,fullWidth:n,...r}){let i=R.useMemo(()=>Qe({fullWidth:n}),[n]);return(0,X.jsx)(uo,{"data-required":Le(r.isRequired),"data-slot":`date-field`,...r,className:N(t,i),children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})}var To=Object.assign(wo,{Root:wo,Group:vo,Input:bo,InputContainer:So,Segment:xo,Prefix:yo,Suffix:Co}),Eo={};Eo={dateRange:e=>`${e.startDate} \u{625}\u{644}\u{649} ${e.endDate}`,dateSelected:e=>`${e.date} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}`,finishRangeSelectionPrompt:`انقر لإنهاء عملية تحديد نطاق التاريخ`,maximumDate:`آخر تاريخ متاح`,minimumDate:`أول تاريخ متاح`,next:`التالي`,previous:`السابق`,selectedDateDescription:e=>`\u{62A}\u{627}\u{631}\u{64A}\u{62E} \u{645}\u{62D}\u{62F}\u{62F}: ${e.date}`,selectedRangeDescription:e=>`\u{627}\u{644}\u{645}\u{62F}\u{649} \u{627}\u{644}\u{632}\u{645}\u{646}\u{64A} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}: ${e.dateRange}`,startRangeSelectionPrompt:`انقر لبدء عملية تحديد نطاق التاريخ`,todayDate:e=>`\u{627}\u{644}\u{64A}\u{648}\u{645}\u{60C} ${e.date}`,todayDateSelected:e=>`\u{627}\u{644}\u{64A}\u{648}\u{645}\u{60C} ${e.date} \u{645}\u{62D}\u{62F}\u{62F}`};var Do={};Do={dateRange:e=>`${e.startDate} \u{434}\u{43E} ${e.endDate}`,dateSelected:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{43E} \u{435} ${e.date}`,finishRangeSelectionPrompt:`Натиснете, за да довършите избора на времеви интервал`,maximumDate:`Последна налична дата`,minimumDate:`Първа налична дата`,next:`Напред`,previous:`Назад`,selectedDateDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.dateRange}`,startRangeSelectionPrompt:`Натиснете, за да пристъпите към избора на времеви интервал`,todayDate:e=>`\u{414}\u{43D}\u{435}\u{441}, ${e.date}`,todayDateSelected:e=>`\u{414}\u{43D}\u{435}\u{441}, ${e.date} \u{441}\u{430} \u{438}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{438}`};var Oo={};Oo={dateRange:e=>`${e.startDate} a\u{17E} ${e.endDate}`,dateSelected:e=>`Vybr\xe1no ${e.date}`,finishRangeSelectionPrompt:`Kliknutím dokončíte výběr rozsahu dat`,maximumDate:`Poslední dostupné datum`,minimumDate:`První dostupné datum`,next:`Další`,previous:`Předchozí`,selectedDateDescription:e=>`Vybran\xe9 datum: ${e.date}`,selectedRangeDescription:e=>`Vybran\xe9 obdob\xed: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknutím zahájíte výběr rozsahu dat`,todayDate:e=>`Dnes, ${e.date}`,todayDateSelected:e=>`Dnes, vybr\xe1no ${e.date}`};var ko={};ko={dateRange:e=>`${e.startDate} til ${e.endDate}`,dateSelected:e=>`${e.date} valgt`,finishRangeSelectionPrompt:`Klik for at fuldføre valg af datoområde`,maximumDate:`Sidste ledige dato`,minimumDate:`Første ledige dato`,next:`Næste`,previous:`Forrige`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt interval: ${e.dateRange}`,startRangeSelectionPrompt:`Klik for at starte valg af datoområde`,todayDate:e=>`I dag, ${e.date}`,todayDateSelected:e=>`I dag, ${e.date} valgt`};var Ao={};Ao={dateRange:e=>`${e.startDate} bis ${e.endDate}`,dateSelected:e=>`${e.date} ausgew\xe4hlt`,finishRangeSelectionPrompt:`Klicken, um die Auswahl des Datumsbereichs zu beenden`,maximumDate:`Letztes verfügbares Datum`,minimumDate:`Erstes verfügbares Datum`,next:`Weiter`,previous:`Zurück`,selectedDateDescription:e=>`Ausgew\xe4hltes Datum: ${e.date}`,selectedRangeDescription:e=>`Ausgew\xe4hlter Bereich: ${e.dateRange}`,startRangeSelectionPrompt:`Klicken, um die Auswahl des Datumsbereichs zu beginnen`,todayDate:e=>`Heute, ${e.date}`,todayDateSelected:e=>`Heute, ${e.date} ausgew\xe4hlt`};var jo={};jo={dateRange:e=>`${e.startDate} \u{3AD}\u{3C9}\u{3C2} ${e.endDate}`,dateSelected:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3B8}\u{3B7}\u{3BA}\u{3B5} ${e.date}`,finishRangeSelectionPrompt:`Κάντε κλικ για να ολοκληρώσετε την επιλογή εύρους ημερομηνιών`,maximumDate:`Τελευταία διαθέσιμη ημερομηνία`,minimumDate:`Πρώτη διαθέσιμη ημερομηνία`,next:`Επόμενο`,previous:`Προηγούμενο`,selectedDateDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3B7} \u{3B7}\u{3BC}\u{3B5}\u{3C1}\u{3BF}\u{3BC}\u{3B7}\u{3BD}\u{3AF}\u{3B1}: ${e.date}`,selectedRangeDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3BF} \u{3B5}\u{3CD}\u{3C1}\u{3BF}\u{3C2}: ${e.dateRange}`,startRangeSelectionPrompt:`Κάντε κλικ για να ξεκινήσετε την επιλογή εύρους ημερομηνιών`,todayDate:e=>`\u{3A3}\u{3AE}\u{3BC}\u{3B5}\u{3C1}\u{3B1}, ${e.date}`,todayDateSelected:e=>`\u{3A3}\u{3AE}\u{3BC}\u{3B5}\u{3C1}\u{3B1}, \u{3B5}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3C4}\u{3B7}\u{3BA}\u{3B5} ${e.date}`};var Mo={};Mo={previous:`Previous`,next:`Next`,selectedDateDescription:e=>`Selected Date: ${e.date}`,selectedRangeDescription:e=>`Selected Range: ${e.dateRange}`,todayDate:e=>`Today, ${e.date}`,todayDateSelected:e=>`Today, ${e.date} selected`,dateSelected:e=>`${e.date} selected`,startRangeSelectionPrompt:`Click to start selecting date range`,finishRangeSelectionPrompt:`Click to finish selecting date range`,minimumDate:`First available date`,maximumDate:`Last available date`,dateRange:e=>`${e.startDate} to ${e.endDate}`};var No={};No={dateRange:e=>`${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} seleccionado`,finishRangeSelectionPrompt:`Haga clic para terminar de seleccionar rango de fechas`,maximumDate:`Última fecha disponible`,minimumDate:`Primera fecha disponible`,next:`Siguiente`,previous:`Anterior`,selectedDateDescription:e=>`Fecha seleccionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo seleccionado: ${e.dateRange}`,startRangeSelectionPrompt:`Haga clic para comenzar a seleccionar un rango de fechas`,todayDate:e=>`Hoy, ${e.date}`,todayDateSelected:e=>`Hoy, ${e.date} seleccionado`};var Po={};Po={dateRange:e=>`${e.startDate} kuni ${e.endDate}`,dateSelected:e=>`${e.date} valitud`,finishRangeSelectionPrompt:`Klõpsake kuupäevavahemiku valimise lõpetamiseks`,maximumDate:`Viimane saadaolev kuupäev`,minimumDate:`Esimene saadaolev kuupäev`,next:`Järgmine`,previous:`Eelmine`,selectedDateDescription:e=>`Valitud kuup\xe4ev: ${e.date}`,selectedRangeDescription:e=>`Valitud vahemik: ${e.dateRange}`,startRangeSelectionPrompt:`Klõpsake kuupäevavahemiku valimiseks`,todayDate:e=>`T\xe4na, ${e.date}`,todayDateSelected:e=>`T\xe4na, ${e.date} valitud`};var Fo={};Fo={dateRange:e=>`${e.startDate} \u{2013} ${e.endDate}`,dateSelected:e=>`${e.date} valittu`,finishRangeSelectionPrompt:`Lopeta päivämääräalueen valinta napsauttamalla tätä.`,maximumDate:`Viimeinen varattavissa oleva päivämäärä`,minimumDate:`Ensimmäinen varattavissa oleva päivämäärä`,next:`Seuraava`,previous:`Edellinen`,selectedDateDescription:e=>`Valittu p\xe4iv\xe4m\xe4\xe4r\xe4: ${e.date}`,selectedRangeDescription:e=>`Valittu aikav\xe4li: ${e.dateRange}`,startRangeSelectionPrompt:`Aloita päivämääräalueen valinta napsauttamalla tätä.`,todayDate:e=>`T\xe4n\xe4\xe4n, ${e.date}`,todayDateSelected:e=>`T\xe4n\xe4\xe4n, ${e.date} valittu`};var Io={};Io={dateRange:e=>`${e.startDate} \xe0 ${e.endDate}`,dateSelected:e=>`${e.date} s\xe9lectionn\xe9`,finishRangeSelectionPrompt:`Cliquer pour finir de sélectionner la plage de dates`,maximumDate:`Dernière date disponible`,minimumDate:`Première date disponible`,next:`Suivant`,previous:`Précédent`,selectedDateDescription:e=>`Date s\xe9lectionn\xe9e\xa0: ${e.date}`,selectedRangeDescription:e=>`Plage s\xe9lectionn\xe9e\xa0: ${e.dateRange}`,startRangeSelectionPrompt:`Cliquer pour commencer à sélectionner la plage de dates`,todayDate:e=>`Aujourd'hui, ${e.date}`,todayDateSelected:e=>`Aujourd\u{2019}hui, ${e.date} s\xe9lectionn\xe9`};var Lo={};Lo={dateRange:e=>`${e.startDate} \u{5E2}\u{5D3} ${e.endDate}`,dateSelected:e=>`${e.date} \u{5E0}\u{5D1}\u{5D7}\u{5E8}`,finishRangeSelectionPrompt:`חץ כדי לסיים את בחירת טווח התאריכים`,maximumDate:`תאריך פנוי אחרון`,minimumDate:`תאריך פנוי ראשון`,next:`הבא`,previous:`הקודם`,selectedDateDescription:e=>`\u{5EA}\u{5D0}\u{5E8}\u{5D9}\u{5DA} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.date}`,selectedRangeDescription:e=>`\u{5D8}\u{5D5}\u{5D5}\u{5D7} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.dateRange}`,startRangeSelectionPrompt:`לחץ כדי להתחיל בבחירת טווח התאריכים`,todayDate:e=>`\u{5D4}\u{5D9}\u{5D5}\u{5DD}, ${e.date}`,todayDateSelected:e=>`\u{5D4}\u{5D9}\u{5D5}\u{5DD}, ${e.date} \u{5E0}\u{5D1}\u{5D7}\u{5E8}`};var Ro={};Ro={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`${e.date} odabran`,finishRangeSelectionPrompt:`Kliknite da dovršite raspon odabranih datuma`,maximumDate:`Posljednji raspoloživi datum`,minimumDate:`Prvi raspoloživi datum`,next:`Sljedeći`,previous:`Prethodni`,selectedDateDescription:e=>`Odabrani datum: ${e.date}`,selectedRangeDescription:e=>`Odabrani raspon: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknite da započnete raspon odabranih datuma`,todayDate:e=>`Danas, ${e.date}`,todayDateSelected:e=>`Danas, odabran ${e.date}`};var zo={};zo={dateRange:e=>`${e.startDate}\u{2013}${e.endDate}`,dateSelected:e=>`${e.date} kiv\xe1lasztva`,finishRangeSelectionPrompt:`Kattintson a dátumtartomány kijelölésének befejezéséhez`,maximumDate:`Utolsó elérhető dátum`,minimumDate:`Az első elérhető dátum`,next:`Következő`,previous:`Előző`,selectedDateDescription:e=>`Kijel\xf6lt d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Kijel\xf6lt tartom\xe1ny: ${e.dateRange}`,startRangeSelectionPrompt:`Kattintson a dátumtartomány kijelölésének indításához`,todayDate:e=>`Ma, ${e.date}`,todayDateSelected:e=>`Ma, ${e.date} kijel\xf6lve`};var Bo={};Bo={dateRange:e=>`Da ${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} selezionata`,finishRangeSelectionPrompt:`Fai clic per completare la selezione dell’intervallo di date`,maximumDate:`Ultima data disponibile`,minimumDate:`Prima data disponibile`,next:`Successivo`,previous:`Precedente`,selectedDateDescription:e=>`Data selezionata: ${e.date}`,selectedRangeDescription:e=>`Intervallo selezionato: ${e.dateRange}`,startRangeSelectionPrompt:`Fai clic per selezionare l’intervallo di date`,todayDate:e=>`Oggi, ${e.date}`,todayDateSelected:e=>`Oggi, ${e.date} selezionata`};var Vo={};Vo={dateRange:e=>`${e.startDate} \u{304B}\u{3089} ${e.endDate}`,dateSelected:e=>`${e.date} \u{3092}\u{9078}\u{629E}`,finishRangeSelectionPrompt:`クリックして日付範囲の選択を終了`,maximumDate:`最終利用可能日`,minimumDate:`最初の利用可能日`,next:`次へ`,previous:`前へ`,selectedDateDescription:e=>`\u{9078}\u{629E}\u{3057}\u{305F}\u{65E5}\u{4ED8} : ${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{629E}\u{7BC4}\u{56F2} : ${e.dateRange}`,startRangeSelectionPrompt:`クリックして日付範囲の選択を開始`,todayDate:e=>`\u{672C}\u{65E5}\u{3001}${e.date}`,todayDateSelected:e=>`\u{672C}\u{65E5}\u{3001}${e.date} \u{3092}\u{9078}\u{629E}`};var Ho={};Ho={dateRange:e=>`${e.startDate} ~ ${e.endDate}`,dateSelected:e=>`${e.date} \u{C120}\u{D0DD}\u{B428}`,finishRangeSelectionPrompt:`날짜 범위 선택을 완료하려면 클릭하십시오.`,maximumDate:`마지막으로 사용 가능한 일자`,minimumDate:`처음으로 사용 가능한 일자`,next:`다음`,previous:`이전`,selectedDateDescription:e=>`\u{C120}\u{D0DD} \u{C77C}\u{C790}: ${e.date}`,selectedRangeDescription:e=>`\u{C120}\u{D0DD} \u{BC94}\u{C704}: ${e.dateRange}`,startRangeSelectionPrompt:`날짜 범위 선택을 시작하려면 클릭하십시오.`,todayDate:e=>`\u{C624}\u{B298}, ${e.date}`,todayDateSelected:e=>`\u{C624}\u{B298}, ${e.date} \u{C120}\u{D0DD}\u{B428}`};var Uo={};Uo={dateRange:e=>`Nuo ${e.startDate} iki ${e.endDate}`,dateSelected:e=>`Pasirinkta ${e.date}`,finishRangeSelectionPrompt:`Spustelėkite, kad baigtumėte pasirinkti datų intervalą`,maximumDate:`Paskutinė galima data`,minimumDate:`Pirmoji galima data`,next:`Paskesnis`,previous:`Ankstesnis`,selectedDateDescription:e=>`Pasirinkta data: ${e.date}`,selectedRangeDescription:e=>`Pasirinktas intervalas: ${e.dateRange}`,startRangeSelectionPrompt:`Spustelėkite, kad pradėtumėte pasirinkti datų intervalą`,todayDate:e=>`\u{160}iandien, ${e.date}`,todayDateSelected:e=>`\u{160}iandien, pasirinkta ${e.date}`};var Wo={};Wo={dateRange:e=>`No ${e.startDate} l\u{12B}dz ${e.endDate}`,dateSelected:e=>`Atlas\u{12B}ts: ${e.date}`,finishRangeSelectionPrompt:`Noklikšķiniet, lai pabeigtu datumu diapazona atlasi`,maximumDate:`Pēdējais pieejamais datums`,minimumDate:`Pirmais pieejamais datums`,next:`Tālāk`,previous:`Atpakaļ`,selectedDateDescription:e=>`Atlas\u{12B}tais datums: ${e.date}`,selectedRangeDescription:e=>`Atlas\u{12B}tais diapazons: ${e.dateRange}`,startRangeSelectionPrompt:`Noklikšķiniet, lai sāktu datumu diapazona atlasi`,todayDate:e=>`\u{160}odien, ${e.date}`,todayDateSelected:e=>`Atlas\u{12B}ta \u{161}odiena, ${e.date}`};var Go={};Go={dateRange:e=>`${e.startDate} til ${e.endDate}`,dateSelected:e=>`${e.date} valgt`,finishRangeSelectionPrompt:`Klikk for å fullføre valg av datoområde`,maximumDate:`Siste tilgjengelige dato`,minimumDate:`Første tilgjengelige dato`,next:`Neste`,previous:`Forrige`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt omr\xe5de: ${e.dateRange}`,startRangeSelectionPrompt:`Klikk for å starte valg av datoområde`,todayDate:e=>`I dag, ${e.date}`,todayDateSelected:e=>`I dag, ${e.date} valgt`};var Ko={};Ko={dateRange:e=>`${e.startDate} tot ${e.endDate}`,dateSelected:e=>`${e.date} geselecteerd`,finishRangeSelectionPrompt:`Klik om de selectie van het datumbereik te voltooien`,maximumDate:`Laatste beschikbare datum`,minimumDate:`Eerste beschikbare datum`,next:`Volgende`,previous:`Vorige`,selectedDateDescription:e=>`Geselecteerde datum: ${e.date}`,selectedRangeDescription:e=>`Geselecteerd bereik: ${e.dateRange}`,startRangeSelectionPrompt:`Klik om het datumbereik te selecteren`,todayDate:e=>`Vandaag, ${e.date}`,todayDateSelected:e=>`Vandaag, ${e.date} geselecteerd`};var qo={};qo={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`Wybrano ${e.date}`,finishRangeSelectionPrompt:`Kliknij, aby zakończyć wybór zakresu dat`,maximumDate:`Ostatnia dostępna data`,minimumDate:`Pierwsza dostępna data`,next:`Dalej`,previous:`Wstecz`,selectedDateDescription:e=>`Wybrana data: ${e.date}`,selectedRangeDescription:e=>`Wybrany zakres: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknij, aby rozpocząć wybór zakresu dat`,todayDate:e=>`Dzisiaj, ${e.date}`,todayDateSelected:e=>`Dzisiaj wybrano ${e.date}`};var Jo={};Jo={dateRange:e=>`${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} selecionado`,finishRangeSelectionPrompt:`Clique para concluir a seleção do intervalo de datas`,maximumDate:`Última data disponível`,minimumDate:`Primeira data disponível`,next:`Próximo`,previous:`Anterior`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.dateRange}`,startRangeSelectionPrompt:`Clique para iniciar a seleção do intervalo de datas`,todayDate:e=>`Hoje, ${e.date}`,todayDateSelected:e=>`Hoje, ${e.date} selecionado`};var Yo={};Yo={dateRange:e=>`${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} selecionado`,finishRangeSelectionPrompt:`Clique para terminar de selecionar o intervalo de datas`,maximumDate:`Última data disponível`,minimumDate:`Primeira data disponível`,next:`Próximo`,previous:`Anterior`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.dateRange}`,startRangeSelectionPrompt:`Clique para começar a selecionar o intervalo de datas`,todayDate:e=>`Hoje, ${e.date}`,todayDateSelected:e=>`Hoje, ${e.date} selecionado`};var Xo={};Xo={dateRange:e=>`De la ${e.startDate} p\xe2n\u{103} la ${e.endDate}`,dateSelected:e=>`${e.date} selectat\u{103}`,finishRangeSelectionPrompt:`Apăsaţi pentru a finaliza selecţia razei pentru dată`,maximumDate:`Ultima dată disponibilă`,minimumDate:`Prima dată disponibilă`,next:`Următorul`,previous:`Înainte`,selectedDateDescription:e=>`Dat\u{103} selectat\u{103}: ${e.date}`,selectedRangeDescription:e=>`Interval selectat: ${e.dateRange}`,startRangeSelectionPrompt:`Apăsaţi pentru a începe selecţia razei pentru dată`,todayDate:e=>`Ast\u{103}zi, ${e.date}`,todayDateSelected:e=>`Azi, ${e.date} selectat\u{103}`};var Zo={};Zo={dateRange:e=>`\u{421} ${e.startDate} \u{43F}\u{43E} ${e.endDate}`,dateSelected:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`,finishRangeSelectionPrompt:`Щелкните, чтобы завершить выбор диапазона дат`,maximumDate:`Последняя доступная дата`,minimumDate:`Первая доступная дата`,next:`Далее`,previous:`Назад`,selectedDateDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{430}\u{44F} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{44B}\u{439} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.dateRange}`,startRangeSelectionPrompt:`Щелкните, чтобы начать выбор диапазона дат`,todayDate:e=>`\u{421}\u{435}\u{433}\u{43E}\u{434}\u{43D}\u{44F}, ${e.date}`,todayDateSelected:e=>`\u{421}\u{435}\u{433}\u{43E}\u{434}\u{43D}\u{44F}, \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`};var Qo={};Qo={dateRange:e=>`Od ${e.startDate} do ${e.endDate}`,dateSelected:e=>`Vybrat\xfd d\xe1tum ${e.date}`,finishRangeSelectionPrompt:`Kliknutím dokončíte výber rozsahu dátumov`,maximumDate:`Posledný dostupný dátum`,minimumDate:`Prvý dostupný dátum`,next:`Nasledujúce`,previous:`Predchádzajúce`,selectedDateDescription:e=>`Vybrat\xfd d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Vybrat\xfd rozsah: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknutím spustíte výber rozsahu dátumov`,todayDate:e=>`Dnes ${e.date}`,todayDateSelected:e=>`Vybrat\xfd dne\u{161}n\xfd d\xe1tum ${e.date}`};var $o={};$o={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`${e.date} izbrano`,finishRangeSelectionPrompt:`Kliknite za dokončanje izbire datumskega obsega`,maximumDate:`Zadnji razpoložljivi datum`,minimumDate:`Prvi razpoložljivi datum`,next:`Naprej`,previous:`Nazaj`,selectedDateDescription:e=>`Izbrani datum: ${e.date}`,selectedRangeDescription:e=>`Izbrano obmo\u{10D}je: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknite za začetek izbire datumskega obsega`,todayDate:e=>`Danes, ${e.date}`,todayDateSelected:e=>`Danes, ${e.date} izbrano`};var es={};es={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`${e.date} izabran`,finishRangeSelectionPrompt:`Kliknite da dovršite opseg izabranih datuma`,maximumDate:`Zadnji raspoloživi datum`,minimumDate:`Prvi raspoloživi datum`,next:`Sledeći`,previous:`Prethodni`,selectedDateDescription:e=>`Izabrani datum: ${e.date}`,selectedRangeDescription:e=>`Izabrani period: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknite da započnete opseg izabranih datuma`,todayDate:e=>`Danas, ${e.date}`,todayDateSelected:e=>`Danas, izabran ${e.date}`};var ts={};ts={dateRange:e=>`${e.startDate} till ${e.endDate}`,dateSelected:e=>`${e.date} har valts`,finishRangeSelectionPrompt:`Klicka för att avsluta val av datumintervall`,maximumDate:`Sista tillgängliga datum`,minimumDate:`Första tillgängliga datum`,next:`Nästa`,previous:`Föregående`,selectedDateDescription:e=>`Valt datum: ${e.date}`,selectedRangeDescription:e=>`Valt intervall: ${e.dateRange}`,startRangeSelectionPrompt:`Klicka för att välja datumintervall`,todayDate:e=>`Idag, ${e.date}`,todayDateSelected:e=>`Idag, ${e.date} har valts`};var ns={};ns={dateRange:e=>`${e.startDate} - ${e.endDate}`,dateSelected:e=>`${e.date} se\xe7ildi`,finishRangeSelectionPrompt:`Tarih aralığı seçimini tamamlamak için tıklayın`,maximumDate:`Son müsait tarih`,minimumDate:`İlk müsait tarih`,next:`Sonraki`,previous:`Önceki`,selectedDateDescription:e=>`Se\xe7ilen Tarih: ${e.date}`,selectedRangeDescription:e=>`Se\xe7ilen Aral\u{131}k: ${e.dateRange}`,startRangeSelectionPrompt:`Tarih aralığı seçimini başlatmak için tıklayın`,todayDate:e=>`Bug\xfcn, ${e.date}`,todayDateSelected:e=>`Bug\xfcn, ${e.date} se\xe7ildi`};var rs={};rs={dateRange:e=>`${e.startDate} \u{2014} ${e.endDate}`,dateSelected:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`,finishRangeSelectionPrompt:`Натисніть, щоб завершити вибір діапазону дат`,maximumDate:`Остання доступна дата`,minimumDate:`Перша доступна дата`,next:`Наступний`,previous:`Попередній`,selectedDateDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{438}\u{439} \u{434}\u{456}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.dateRange}`,startRangeSelectionPrompt:`Натисніть, щоб почати вибір діапазону дат`,todayDate:e=>`\u{421}\u{44C}\u{43E}\u{433}\u{43E}\u{434}\u{43D}\u{456}, ${e.date}`,todayDateSelected:e=>`\u{421}\u{44C}\u{43E}\u{433}\u{43E}\u{434}\u{43D}\u{456}, \u{432}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`};var is={};is={dateRange:e=>`${e.startDate} \u{81F3} ${e.endDate}`,dateSelected:e=>`\u{5DF2}\u{9009}\u{62E9} ${e.date}`,finishRangeSelectionPrompt:`单击以完成选择日期范围`,maximumDate:`最后一个可用日期`,minimumDate:`第一个可用日期`,next:`下一页`,previous:`上一页`,selectedDateDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{8303}\u{56F4}\u{FF1A}${e.dateRange}`,startRangeSelectionPrompt:`单击以开始选择日期范围`,todayDate:e=>`\u{4ECA}\u{5929}\u{FF0C}\u{5373} ${e.date}`,todayDateSelected:e=>`\u{5DF2}\u{9009}\u{62E9}\u{4ECA}\u{5929}\u{FF0C}\u{5373} ${e.date}`};var as={};as={dateRange:e=>`${e.startDate} \u{81F3} ${e.endDate}`,dateSelected:e=>`\u{5DF2}\u{9078}\u{53D6} ${e.date}`,finishRangeSelectionPrompt:`按一下以完成選取日期範圍`,maximumDate:`最後一個可用日期`,minimumDate:`第一個可用日期`,next:`下一頁`,previous:`上一頁`,selectedDateDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{7BC4}\u{570D}\u{FF1A}${e.dateRange}`,startRangeSelectionPrompt:`按一下以開始選取日期範圍`,todayDate:e=>`\u{4ECA}\u{5929}\u{FF0C}${e.date}`,todayDateSelected:e=>`\u{5DF2}\u{9078}\u{53D6}\u{4ECA}\u{5929}\u{FF0C}${e.date}`};var os={};os={"ar-AE":Eo,"bg-BG":Do,"cs-CZ":Oo,"da-DK":ko,"de-DE":Ao,"el-GR":jo,"en-US":Mo,"es-ES":No,"et-EE":Po,"fi-FI":Fo,"fr-FR":Io,"he-IL":Lo,"hr-HR":Ro,"hu-HU":zo,"it-IT":Bo,"ja-JP":Vo,"ko-KR":Ho,"lt-LT":Uo,"lv-LV":Wo,"nb-NO":Go,"nl-NL":Ko,"pl-PL":qo,"pt-BR":Jo,"pt-PT":Yo,"ro-RO":Xo,"ru-RU":Zo,"sk-SK":Qo,"sl-SI":$o,"sr-SP":es,"sv-SE":ts,"tr-TR":ns,"uk-UA":rs,"zh-CN":is,"zh-TW":as};function ss(e){return e&&e.__esModule?e.default:e}var cs=new WeakMap;function ls(e){return e?.calendar.identifier===`gregory`&&e.era===`BC`?`short`:void 0}function us(e){let t=h(ss(os),`@react-aria/calendar`),n,r;`highlightedRange`in e?{start:n,end:r}=e.highlightedRange||{}:(n=Array.isArray(e.value)?e.value[0]:e.value??void 0,r=Array.isArray(e.value)?e.value.at(-1):e.value??void 0);let i=Z({weekday:`long`,month:`long`,year:`numeric`,day:`numeric`,era:ls(n)||ls(r),timeZone:e.timeZone}),{locale:a}=F(),o=(0,R.useMemo)(()=>new Intl.ListFormat(a),[a]),s=`anchorDate`in e?e.anchorDate:null;return(0,R.useMemo)(()=>{if(!s&&n&&r){if(B(n,r)){let r=i.format(n.toDate(e.timeZone));return t.format(`selectedDateDescription`,{date:r})}if(`highlightedRange`in e){let a=fs(i,t,n,r,e.timeZone);return t.format(`selectedRangeDescription`,{dateRange:a})}if(Array.isArray(e.value)){let n=e.value.map(t=>i.format(t.toDate(e.timeZone))),r=o.format(n);return t.format(`selectedDateDescription`,{date:r})}}return``},[n,r,s,e,t,i,o])}function ds(e,t,n,r){let i=h(ss(os),`@react-aria/calendar`),a=ls(e)||ls(t),o=Z({month:`long`,year:`numeric`,era:a,calendar:e.calendar.identifier,timeZone:n}),s=Z({month:`long`,year:`numeric`,day:`numeric`,era:a,calendar:e.calendar.identifier,timeZone:n});return(0,R.useMemo)(()=>{if(B(e,Dt(e))){let a=e,s=t;if(e.calendar.getFormattableMonth&&(a=e.calendar.getFormattableMonth(e)),t.calendar.getFormattableMonth&&(s=t.calendar.getFormattableMonth(t)),B(t,Ot(e)))return o.format(a.toDate(n));if(B(t,Ot(t)))return r?fs(o,i,a,s,n):o.formatRange(a.toDate(n),s.toDate(n))}return r?fs(s,i,e,t,n):s.formatRange(e.toDate(n),t.toDate(n))},[e,t,o,s,i,n,r])}function fs(e,t,n,r,i){let a=e.formatRangeToParts(n.toDate(i),r.toDate(i)),o=-1;for(let e=0;eo&&(c+=a[e].value);return t.format(`dateRange`,{startDate:s,endDate:c})}function ps(e){return e&&e.__esModule?e.default:e}function ms(e,t){let n=h(ps(os),`@react-aria/calendar`),r=I(e),i=ds(t.visibleRange.start,t.visibleRange.end,t.timeZone,!1),a=ds(t.visibleRange.start,t.visibleRange.end,t.timeZone,!0);_e(()=>{t.isFocused||l(a)},[a]);let o=us(t);_e(()=>{o&&l(o,`polite`,4e3)},[o]);let s=ie([!!e.errorMessage,e.isInvalid,e.validationState]);cs.set(t,{ariaLabel:e[`aria-label`],ariaLabelledBy:e[`aria-labelledby`],errorMessageId:s,selectedDateDescription:o});let[c,u]=(0,R.useState)(!1),d=e.isDisabled||t.isNextVisibleRangeInvalid();d&&c&&(u(!1),t.setFocused(!0));let[f,p]=(0,R.useState)(!1),m=e.isDisabled||t.isPreviousVisibleRangeInvalid();m&&f&&(p(!1),t.setFocused(!0));let g=_({id:e.id,"aria-label":[e[`aria-label`],a].filter(Boolean).join(`, `),"aria-labelledby":e[`aria-labelledby`]});return{calendarProps:D(r,g,{role:`application`,"aria-details":e[`aria-details`]||void 0,"aria-describedby":e[`aria-describedby`]||void 0}),nextButtonProps:{onPress:()=>t.focusNextPage(),"aria-label":n.format(`next`),isDisabled:d,onFocusChange:u},prevButtonProps:{onPress:()=>t.focusPreviousPage(),"aria-label":n.format(`previous`),isDisabled:m,onFocusChange:p},errorMessageProps:{id:s},title:i}}function hs(e,t){let{startDate:n=t.visibleRange.start,endDate:r=t.visibleRange.end,firstDayOfWeek:i}=e,{direction:a}=F(),{keyboardProps:o}=he({shortcuts:{End:()=>{t.focusSectionEnd()},Home:()=>{t.focusSectionStart()},Escape:()=>(`setAnchorDate`in t&&t.setAnchorDate(null),!1)}}),{keyboardProps:s}=he({shortcuts:{Enter:()=>{t.selectFocusedDate()}," ":()=>{t.selectFocusedDate()},PageUp:()=>{t.focusPreviousSection()},"Shift+PageUp":()=>{t.focusPreviousSection(!0)},PageDown:()=>{t.focusNextSection()},"Shift+PageDown":()=>{t.focusNextSection(!0)},ArrowLeft:()=>{a===`rtl`?t.focusNextDay():t.focusPreviousDay()},ArrowUp:()=>{t.focusPreviousRow()},ArrowRight:()=>{a===`rtl`?t.focusPreviousDay():t.focusNextDay()},ArrowDown:()=>{t.focusNextRow()}},allowRepeats:!0}),c=ds(n,r,t.timeZone,!0),{ariaLabel:l,ariaLabelledBy:u}=cs.get(t),d=_({"aria-label":[l,c].filter(Boolean).join(`, `),"aria-labelledby":u}),f=Z({weekday:e.weekdayStyle||`narrow`,timeZone:t.timeZone}),{locale:p}=F(),m=(0,R.useMemo)(()=>{let e=t.visibleDuration.days&&t.visibleDuration.days<7,r=e?n:At(yt(t.timeZone),p,i),a=e?t.visibleDuration.days:7;return[...Array(a).keys()].map(e=>{let n=r.add({days:e}).toDate(t.timeZone);return f.format(n)})},[p,t.timeZone,f,i,n,t.visibleDuration.days]),h=t.getWeeksInMonth(n);return{gridProps:D(d,{role:`grid`,"aria-readonly":t.isReadOnly||void 0,"aria-disabled":t.isDisabled||void 0,"aria-multiselectable":`highlightedRange`in t||t.selectionMode===`multiple`||void 0,onFocus:()=>t.setFocused(!0),onBlur:()=>t.setFocused(!1)},o,s),headerProps:{"aria-hidden":!0},weekDays:m,weeksInMonth:h}}function gs(e){return e&&e.__esModule?e.default:e}function _s(e,t,n){let{date:r,isDisabled:i}=e,{errorMessageId:a,selectedDateDescription:o}=cs.get(t),s=h(gs(os),`@react-aria/calendar`),c=Z({weekday:`long`,day:`numeric`,month:`long`,year:`numeric`,era:ls(r),timeZone:t.timeZone}),l=t.isCellFocused(r)&&!e.isOutsideMonth;i=i||t.isCellDisabled(r)||!!e.isOutsideMonth;let u=t.isCellUnavailable(r),d=!i&&!u,f=t.isSelected(r)&&d,p=!1;t.isValueInvalid&&(`highlightedRange`in t?p=!t.anchorDate&&t.highlightedRange!=null&&r.compare(t.highlightedRange.start)>=0&&r.compare(t.highlightedRange.end)<=0:Array.isArray(t.value)?p=t.value.some(e=>B(e,r)):t.value&&(p=B(t.value,r))),p&&!i&&(f=!0),r=Ye(r,pt);let m=(0,R.useMemo)(()=>r.toDate(t.timeZone),[r,t.timeZone]),g=ht(r,t.timeZone),_=(0,R.useMemo)(()=>{let e=``;return`highlightedRange`in t&&t.value&&!t.anchorDate&&(B(r,t.value.start)||B(r,t.value.end))&&(e=o+`, `),e+=c.format(m),g?e=s.format(f?`todayDateSelected`:`todayDate`,{date:e}):f&&(e=s.format(`dateSelected`,{date:e})),t.minValue&&B(r,t.minValue)?e+=`, `+s.format(`minimumDate`):t.maxValue&&B(r,t.maxValue)&&(e+=`, `+s.format(`maximumDate`)),e},[c,m,s,f,g,r,t,o]),v=``;`anchorDate`in t&&l&&!t.isReadOnly&&d&&(v=t.anchorDate?s.format(`finishRangeSelectionPrompt`):s.format(`startRangeSelectionPrompt`));let y=Ke(v),x=(0,R.useRef)(!1),S=(0,R.useRef)(!1),C=(0,R.useRef)(void 0),{pressProps:w,isPressed:T}=ue({shouldCancelOnPointerExit:`anchorDate`in t&&!!t.anchorDate,preventFocusOnPress:!0,isDisabled:!d||t.isReadOnly,onPressStart(e){if(t.isReadOnly){t.setFocusedDate(r),t.setFocused(!0);return}if(`highlightedRange`in t&&!t.anchorDate&&(e.pointerType===`mouse`||e.pointerType===`touch`)){if(t.highlightedRange&&!p){if(B(r,t.highlightedRange.start)){t.setAnchorDate(t.highlightedRange.end),t.setFocusedDate(r),t.setFocused(!0),t.setDragging(!0),S.current=!0;return}if(B(r,t.highlightedRange.end)){t.setAnchorDate(t.highlightedRange.start),t.setFocusedDate(r),t.setFocused(!0),t.setDragging(!0),S.current=!0;return}}let n=()=>{t.setDragging(!0),C.current=void 0,t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0),x.current=!0};e.pointerType===`touch`?C.current=setTimeout(n,200):n()}},onPressEnd(){S.current=!1,x.current=!1,clearTimeout(C.current),C.current=void 0},onPress(){!(`anchorDate`in t)&&!t.isReadOnly&&(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0))},onPressUp(e){t.isReadOnly||(`anchorDate`in t&&C.current&&(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0)),`anchorDate`in t&&(S.current?t.setAnchorDate(r):t.anchorDate&&!x.current?(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0)):e.pointerType===`keyboard`&&!t.anchorDate?(t.selectDate(r),t.focusNearestAvailableDate(r)):e.pointerType===`virtual`&&(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0))))}}),E;i||(E=B(r,t.focusedDate)?0:-1),(0,R.useEffect)(()=>{l&&n.current&&(M(n.current),me()!==`pointer`&&b()===n.current&&ze(n.current,{containingElement:Ve(n.current)}))},[l,n]);let O=Z({day:`numeric`,timeZone:t.timeZone,calendar:r.calendar.identifier}),k=(0,R.useMemo)(()=>O.formatToParts(m).find(e=>e.type===`day`).value,[O,m]);return{cellProps:{role:`gridcell`,"aria-disabled":!d||void 0,"aria-selected":f||void 0,"aria-invalid":p||void 0},buttonProps:D(w,{onFocus(){i||(t.setFocusedDate(r),t.setFocused(!0))},tabIndex:E,role:`button`,"aria-disabled":!d||void 0,"aria-label":_,"aria-invalid":p||void 0,"aria-describedby":[p?a:void 0,y[`aria-describedby`]].filter(Boolean).join(` `)||void 0,onPointerEnter(e){`highlightDate`in t&&(e.pointerType!==`touch`||t.isDragging)&&d&&t.highlightDate(r)},onPointerDown(e){let t=fe(e);t instanceof HTMLElement&&`releasePointerCapture`in t&&(`hasPointerCapture`in t?t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId):t.releasePointerCapture(e.pointerId))},onContextMenu(e){e.preventDefault()}}),isPressed:T,isFocused:l,isSelected:f,isDisabled:i,isUnavailable:u,isOutsideVisibleRange:r.compare(t.visibleRange.start)<0||r.compare(t.visibleRange.end)>0,isInvalid:p,formattedDate:k}}function vs(e,t){let n=Z({year:e.format?.year||`numeric`,era:e.format?.era||(t.focusedDate.calendar.identifier===`gregory`&&t.focusedDate.era===`BC`?`short`:void 0),calendar:t.focusedDate.calendar.identifier,timeZone:t.timeZone}),r=e.visibleYears||20,i=t.focusedDate.subtract({years:Math.floor(r/2)}),a=t.focusedDate.add({years:Math.ceil(r/2)-1});t.maxValue&&a.compare(t.maxValue)>0&&(a=U(t.maxValue),i=a.subtract({years:r-1})),t.minValue&&i.compare(t.minValue)<0&&(i=U(t.minValue),a=i.add({years:r-1}),t.maxValue&&a.compare(t.maxValue)>0&&(a=U(t.maxValue)));let o=[],s=i,c=0;for(;s.compare(a)<=0;)ft(s,t.focusedDate)&&(c=o.length),o.push({id:o.length,date:s,formatted:n.format(s.toDate(t.timeZone))}),s=s.add({years:1});let{locale:l}=F();return{"aria-label":(0,R.useMemo)(()=>new Intl.DisplayNames(l,{type:`dateTimeField`}).of(`year`),[l]),value:c,onChange:e=>{e!=null&&t.setFocusedDate(o[e].date)},items:o}}function ys(e,t){let n=(0,R.useMemo)(()=>{let n=t.visibleRange.start;return e.offset&&(n=n.add(e.offset)),n},[t.visibleRange.start,e.offset]),r=t.visibleDuration.days||t.visibleDuration.weeks,i=Z({day:e.format?.day||(r?`numeric`:void 0),month:e.format?.month||`long`,year:e.format?.year||`numeric`,era:e.format?.era||n&&n.calendar.identifier===`gregory`&&n.era===`BC`?`short`:void 0,calendar:t.visibleRange?.start.calendar.identifier,timeZone:t.timeZone});return(0,R.useMemo)(()=>{if(r)return i.formatRange(n.toDate(t.timeZone),t.visibleRange.end.toDate(t.timeZone));let e=n.calendar.getFormattableMonth?n.calendar.getFormattableMonth(n):n;return i.format(e.toDate(t.timeZone))},[i,r,n,t.timeZone,t.visibleRange.end])}function bs(e,t,n){let{commitBehavior:r=`select`,...i}=e,a=ms(i,t),o=(0,R.useRef)(!1),s=(0,R.useRef)(typeof window<`u`?window:null);g(s,`pointerdown`,e=>{o.current=e.width===0&&e.height===0});let c={clear:()=>t.clearSelection(),reset:()=>t.setAnchorDate(null),select:()=>t.commitSelection()};return g(s,`pointerup`,e=>{if(o.current){o.current=!1;return}if(t.setDragging(!1),!t.anchorDate)return;let i=e.target;n.current&&ee(n.current)&&(!ne(n.current,i)||!i.closest(`button, [role="button"]`))&&c[r]()}),a.calendarProps.onBlur=e=>{n.current&&(!e.relatedTarget||!ne(n.current,e.relatedTarget))&&t.anchorDate&&c[r]()},g(n,`touchmove`,e=>{t.isDragging&&e.preventDefault()},{passive:!1,capture:!0}),a}function xs(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function Ss(e,t,n,r,i){let a={};for(let e in t)a[e]=Math.floor(t[e]/2),a[e]>0&&t[e]%2==0&&a[e]--;return Ts(e,Cs(e,t,n).subtract(a),t,n,r,i)}function Cs(e,t,n,r,i){let a=e;return t.years?a=kt(e):t.months?a=Dt(e):(t.weeks||t.days&&t.days>7)&&(a=At(e,n)),Ts(e,a,t,n,r,i)}function ws(e,t,n,r,i){let a={...t};return a.days?a.days--:a.weeks?a.weeks--:a.months?a.months--:a.years&&a.years--,Ts(e,Cs(e,t,n).subtract(a),t,n,r,i)}function Ts(e,t,n,r,i,a){if(i&&e.compare(i)>=0){let e=Rt(t,Cs(U(i),n,r));e&&(t=e)}if(a&&e.compare(a)<=0){let e=Lt(t,ws(U(a),n,r));e&&(t=e)}return t}function Es(e,t,n){if(t){let n=Rt(e,U(t));n&&(e=n)}if(n){let t=Lt(e,U(n));t&&(e=t)}return e}function Ds(e,t,n){if(!n)return e;for(;e.compare(t)>=0&&n(e);)e=e.subtract({days:1});return e.compare(t)>=0?e:null}function Os(e,t){return e===t||e.days===t.days&&e.weeks===t.weeks&&e.months===t.months&&e.years===t.years}function ks(e){let t=(0,R.useMemo)(()=>new Y(e.locale),[e.locale]),n=(0,R.useMemo)(()=>t.resolvedOptions(),[t]),{locale:r,createCalendar:i,visibleDuration:a={months:1},minValue:o,maxValue:s,selectionAlignment:c,isDateUnavailable:l,pageBehavior:u=`visible`,selectionMode:d=`single`,firstDayOfWeek:f,weeksInMonth:p}=e,m=(0,R.useMemo)(()=>i(n.calendar),[i,n.calendar]),[h,g]=ce(e.value,e.defaultValue??null,e.onChange),_=(0,R.useMemo)(()=>Array.isArray(h)?h.map(e=>G(U(e),m)):h?G(U(h),m):null,[h,m]),v=(0,R.useMemo)(()=>{let e=Array.isArray(h)?h[0]:h;return e&&`timeZone`in e?e.timeZone:n.timeZone},[h,n.timeZone]),y=(0,R.useMemo)(()=>e.focusedValue?Es(G(U(e.focusedValue),m),o,s):void 0,[e.focusedValue,m,o,s]),b=(0,R.useMemo)(()=>e.defaultFocusedValue?Es(G(U(e.defaultFocusedValue),m),o,s):Es(_?Array.isArray(_)?_[0]:_:G(yt(v),m),o,s),[e.defaultFocusedValue,_,v,m,o,s]),[x,S]=ce(y,b,e.onFocusChange),C=()=>{switch(c){case`start`:return Cs(x,a,r,o,s);case`end`:return ws(x,a,r,o,s);default:return Ss(x,a,r,o,s)}},[w,T]=(0,R.useState)(C),[E,D]=(0,R.useState)(e.autoFocus||!1),[O,k]=(0,R.useState)(a);Os(a,O)||(k(a),T(C()));let A=(0,R.useMemo)(()=>{let e={...a};return e.days?e.days--:e.days=-1,w.add(e)},[w,a]),[ee,te]=(0,R.useState)(m);if(!mt(m,ee)){let e=G(x,m);T(Ss(e,a,r,o,s)),S(e),te(m)}xs(x,o,s)?S(Es(x,o,s)):x.compare(w)<0?T(ws(x,a,r,o,s)):x.compare(A)>0&&T(Cs(x,a,r,o,s));function j(e){e=Es(e,o,s),S(e)}function ne(e){let t=Ds(Es(e,o,s),w,l);if(!t)return null;let n=Array.isArray(h)?h[0]:h,r=G(t,n?.calendar||new z);return n&&`hour`in n?n.set(r):r}function M(t){if(!e.isDisabled&&!e.isReadOnly){if(t===null){g(d===`multiple`?[]:null);return}if(Array.isArray(t))g(t.map(ne).filter(Boolean));else{let e=ne(t);e&&g(e)}}}let re=(0,R.useMemo)(()=>_?Array.isArray(_)?_.some(e=>l?.(e)||xs(e,o,s)):l?.(_)||xs(_,o,s):!1,[_,l,o,s]),N=e.isInvalid||e.validationState===`invalid`||re,ie=N?`invalid`:null,P=(0,R.useMemo)(()=>u===`visible`?a:As(a),[u,a]);return{isDisabled:e.isDisabled??!1,isReadOnly:e.isReadOnly??!1,value:_,setValue:M,selectionMode:d,visibleDuration:a,visibleRange:{start:w,end:A},minValue:o,maxValue:s,focusedDate:x,timeZone:v,validationState:ie,isValueInvalid:N,setFocusedDate(e){j(e)},focusNextDay(){j(x.add({days:1}))},focusPreviousDay(){j(x.subtract({days:1}))},focusNextRow(){a.days?this.focusNextPage():(a.weeks||a.months||a.years)&&j(x.add({weeks:1}))},focusPreviousRow(){a.days?this.focusPreviousPage():(a.weeks||a.months||a.years)&&j(x.subtract({weeks:1}))},focusNextPage(){let e=w.add(P);S(Es(x.add(P),o,s)),T(Cs(Ts(x,e,P,r,o,s),P,r))},focusPreviousPage(){let e=w.subtract(P);S(Es(x.subtract(P),o,s)),T(Cs(Ts(x,e,P,r,o,s),P,r))},focusSectionStart(){a.days?j(w):a.weeks?j(At(x,r)):(a.months||a.years)&&j(Dt(x))},focusSectionEnd(){a.days?j(A):a.weeks?j(jt(x,r)):(a.months||a.years)&&j(Ot(x))},focusNextSection(e){if(!e&&!a.days){j(x.add(As(a)));return}a.days?this.focusNextPage():a.weeks?j(x.add({months:1})):(a.months||a.years)&&j(x.add({years:1}))},focusPreviousSection(e){if(!e&&!a.days){j(x.subtract(As(a)));return}a.days?this.focusPreviousPage():a.weeks?j(x.subtract({months:1})):(a.months||a.years)&&j(x.subtract({years:1}))},selectFocusedDate(){l&&l(x)||this.selectDate(x)},selectDate(t){if(!(e.isDisabled||e.isReadOnly)){if(d===`multiple`&&t!=null){let e=ne(t);if(!e)return;let n=[];Array.isArray(h)?n=h:h!=null&&(n=[h]);let r=n.findIndex(t=>B(t,e)),i=r>=0?n.slice(0,r).concat(n.slice(r+1)):[...n,e];g(i)}else M(t)}},isFocused:E,setFocused:D,isInvalid(e){return xs(e,o,s)},isSelected(e){return!_||this.isCellDisabled(e)||this.isCellUnavailable(e)?!1:Array.isArray(_)?_.some(t=>B(t,e)):B(e,_)},isCellFocused(e){return E&&x&&B(e,x)},isCellDisabled(t){return e.isDisabled||t.compare(w)<0||t.compare(A)>0||this.isInvalid(t)},isCellUnavailable(t){return e.isDateUnavailable?e.isDateUnavailable(t):!1},isPreviousVisibleRangeInvalid(){let e=w.subtract({days:1});return B(e,w)||this.isInvalid(e)},isNextVisibleRangeInvalid(){let e=A.add({days:1});return B(e,A)||this.isInvalid(e)},getDatesInWeek(e,t=w){let n=t.add({weeks:e}),i=[],o=a.days&&a.days<7?a.days:7;if(o===7){n=At(n,r,f);let e=_t(n,r,f);for(let t=0;t0&&(m=`start`)}let h=(0,R.useMemo)(()=>{let t=e.isDateUnavailable;if(t)return e=>t(e,f)},[e.isDateUnavailable,f]),g=(0,R.useCallback)(t=>t&&h&&!e.allowsNonContiguousRanges?{start:Ps(t,h,o,-1),end:Ps(t,h,o,1)}:null,[h,o,e.allowsNonContiguousRanges]),_=(0,R.useMemo)(()=>g(f),[g,f]),v=(0,R.useMemo)(()=>Rt(s,_?.start),[s,_]),y=(0,R.useMemo)(()=>Lt(c,_?.end),[c,_]),b=ks({...l,value:u&&u.start,createCalendar:i,locale:a,visibleDuration:o,minValue:v,maxValue:y,selectionAlignment:e.selectionAlignment||m,isDateUnavailable:h}),x=f?Ms(f,b.focusedDate):u&&Ms(u.start,u.end),S=t=>{if(e.isReadOnly)return;let n=Ds(Es(t,v,y),b.visibleRange.start,h);if(n){if(!f)p(n);else{let e=Ms(f,n);e&&d({start:Ns(e.start,u?.start),end:Ns(e.end,u?.end)}),p(null)}}},[C,w]=(0,R.useState)(!1),T=(0,R.useMemo)(()=>!u||f?!1:h&&(h(u.start)||h(u.end))?!0:xs(u.start,s,c)||xs(u.end,s,c),[h,u,f,s,c]),E=e.isInvalid||e.validationState===`invalid`||T,D=E?`invalid`:null;return{...b,value:u,setValue:d,anchorDate:f,setAnchorDate:p,highlightedRange:x,validationState:D,isValueInvalid:E,selectFocusedDate(){b.isCellUnavailable(b.focusedDate)||S(b.focusedDate)},commitSelection(){S(b.focusedDate)},selectDate:S,highlightDate(e){f&&b.setFocusedDate(e)},isSelected(e){return!!(x&&e.compare(x.start)>=0&&e.compare(x.end)<=0&&!b.isCellDisabled(e)&&!b.isCellUnavailable(e))},isInvalid(e){return b.isInvalid(e)||xs(e,_?.start,_?.end)},isDragging:C,setDragging:w,clearSelection(){p(null),d(null)},focusNearestAvailableDate(e){let t=g(e),n=e=>this.isInvalid(e)||xs(e,t?.start,t?.end),r=e.add({days:1});n(r)&&(r=e.subtract({days:1})),n(r)||(this.setFocusedDate(r),this.setFocused(!0))}}}function Ms(e,t){return!e||!t?null:(t.compare(e)<0&&([e,t]=[t,e]),{start:U(e),end:U(t)})}function Ns(e,t){return e=G(e,t?.calendar||new z),t&&`hour`in t?t.set(e):e}function Ps(e,t,n,r){let i=e.add({days:r}),a=e.subtract(n),o=e.add(n);for(;(r<0?i.compare(a)>=0:i.compare(o)<=0)&&!t(i);)i=i.add({days:r});if(t(i))return i.add({days:-r})}var Fs=(0,R.createContext)(null),Is=(0,R.createContext)(null),Ls=(0,R.createContext)(null),Rs=(0,R.createContext)(null),zs=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,Is);let{locale:n}=F(),r=js({...e,locale:n,createCalendar:e.createCalendar||Kr}),{calendarProps:i,prevButtonProps:o,nextButtonProps:s,errorMessageProps:c,title:l}=bs(e,r,t),u=k({...e,values:{state:r,isDisabled:e.isDisabled||!1,isInvalid:r.isValueInvalid},defaultClassName:`react-aria-RangeCalendar`}),f=I(e,{global:!0});return R.createElement(w.div,{...D(u,f,i),ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":r.isValueInvalid||void 0},R.createElement(x,{values:[[d,{slots:{previous:o,next:s}}],[Be,{"aria-hidden":!0,level:2,children:l}],[Rs,r],[Is,e],[p,{slots:{errorMessage:c}}]]},R.createElement(a,null,R.createElement(`h2`,null,i[`aria-label`])),u.children,R.createElement(a,null,R.createElement(`button`,{"aria-label":s[`aria-label`],disabled:s.isDisabled,onClick:()=>r.focusNextPage(),tabIndex:-1}))))}),Bs=(0,R.createContext)(null),Vs=(0,R.forwardRef)(function(e,t){let n=(0,R.useContext)(Ls),r=(0,R.useContext)(Rs),i=O(Fs),a=O(Is),o=n??r,s=o.visibleRange.start;e.offset&&(s=s.add(e.offset));let c=i?.firstDayOfWeek??a?.firstDayOfWeek,{gridProps:l,headerProps:u,weekDays:d,weeksInMonth:f}=hs({startDate:s,endDate:Ot(s),weekdayStyle:e.weekdayStyle,firstDayOfWeek:c},o),p=I(e,{global:!0});return R.createElement(Bs.Provider,{value:{headerProps:u,weekDays:d,startDate:s,weeksInMonth:f}},R.createElement(w.table,{render:e.render,...D(p,l),ref:t,style:e.style,cellPadding:0,className:e.className??`react-aria-CalendarGrid`},typeof e.children==`function`?R.createElement(R.Fragment,null,R.createElement(Us,null,e=>R.createElement(Gs,null,e)),R.createElement(qs,null,e.children)):e.children))});function Hs(e,t){let{children:n,style:r,className:i}=e,{headerProps:a,weekDays:o}=(0,R.useContext)(Bs),s=I(e,{global:!0});return R.createElement(w.thead,{render:e.render,...D(s,a),ref:t,style:r,className:i??`react-aria-CalendarGridHeader`},R.createElement(`tr`,null,o.map((e,t)=>R.cloneElement(n(e),{key:t}))))}var Us=(0,R.forwardRef)(Hs);function Ws(e,t){let{children:n,style:r,className:i}=e,a=I(e,{global:!0});return R.createElement(w.th,{render:e.render,...a,ref:t,style:r,className:i||`react-aria-CalendarHeaderCell`},n)}var Gs=(0,R.forwardRef)(Ws);function Ks(e,t){let{children:n,style:r,className:i}=e,a=(0,R.useContext)(Ls),o=(0,R.useContext)(Rs),s=a??o,{startDate:c,weeksInMonth:l}=(0,R.useContext)(Bs),u=I(e,{global:!0});return R.createElement(w.tbody,{render:e.render,...u,ref:t,style:r,className:i??`react-aria-CalendarGridBody`},[...Array(l).keys()].map(e=>R.createElement(`tr`,{key:e},s.getDatesInWeek(e,c).map((e,t)=>e?R.cloneElement(n(e),{key:t}):R.createElement(`td`,{key:t})))))}var qs=(0,R.forwardRef)(Ks),Js=(0,R.forwardRef)(function({date:e,...t},n){let r=(0,R.useContext)(Ls),i=(0,R.useContext)(Rs),a=r??i,{startDate:o}=(0,R.useContext)(Bs)??{startDate:a.visibleRange.start},s=a.visibleDuration.days||a.visibleDuration.weeks?!1:!dt(o,e),c=ht(e,a.timeZone),l=(0,R.useRef)(null),{cellProps:u,buttonProps:d,...f}=_s({date:e,isOutsideMonth:s},a,l),{hoverProps:p,isHovered:m}=pe({...t,isDisabled:f.isDisabled||f.isUnavailable}),{focusProps:h,isFocusVisible:g}=P();g&&=f.isFocused;let _=!1,v=!1;`highlightedRange`in a&&a.highlightedRange&&(_=B(e,a.highlightedRange.start),v=B(e,a.highlightedRange.end));let y=k({...t,defaultChildren:f.formattedDate,defaultClassName:`react-aria-CalendarCell`,values:{date:e,isHovered:m,isOutsideMonth:s,isFocusVisible:g,isSelectionStart:_,isSelectionEnd:v,isToday:c,...f}}),b={"data-focused":f.isFocused||void 0,"data-hovered":m||void 0,"data-pressed":f.isPressed||void 0,"data-unavailable":f.isUnavailable||void 0,"data-disabled":f.isDisabled||void 0,"data-focus-visible":g||void 0,"data-outside-visible-range":f.isOutsideVisibleRange||void 0,"data-outside-month":s||void 0,"data-selected":f.isSelected||void 0,"data-selection-start":_||void 0,"data-selection-end":v||void 0,"data-invalid":f.isInvalid||void 0,"data-today":c||void 0},x=I(t,{global:!0});return R.createElement(`td`,{...u,ref:n},R.createElement(w.div,{...D(x,d,h,p,b,y),ref:l}))}),Ys=(0,R.forwardRef)(function(e,t){let{offset:n,format:r,className:i=`react-aria-CalendarHeading`,...a}=e,o=R.useContext(Ls),s=R.useContext(Rs),c=ys({offset:n,format:r},o||s);return R.createElement(qe,{...a,className:i,ref:t},c)});function Xs(e){return e&&e.__esModule?e.default:e}function Zs(e,t,n){let r=h(Xs(zi),`@react-aria/datepicker`),{isInvalid:i,validationErrors:a,validationDetails:o}=t.displayValidation,{labelProps:s,fieldProps:c,descriptionProps:l,errorMessageProps:u}=De({...e,labelElementType:`span`,isInvalid:i,errorMessage:e.errorMessage||a}),d=c[`aria-labelledby`]||c.id,{locale:f}=F(),p=t.formatValue(f,{month:`long`}),m=p?r.format(`selectedRangeDescription`,{startDate:p.start,endDate:p.end}):``,g=Ke(m),_={"aria-label":r.format(`startDate`),"aria-labelledby":d},v={"aria-label":r.format(`endDate`),"aria-labelledby":d},y=le(),b=le(),x=Bi(t,n),S=[g[`aria-describedby`],c[`aria-describedby`]].filter(Boolean).join(` `)||void 0,C=(0,R.useMemo)(()=>de(n,{accept:e=>e.id!==y}),[n,y]),w={[Gi]:C,[Wi]:`presentation`,"aria-describedby":S,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,granularity:e.granularity,shouldForceLeadingZeros:e.shouldForceLeadingZeros,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior},T=I(e),E=(0,R.useRef)(!1),{focusWithinProps:O}=oe({...e,isDisabled:t.isOpen,onBlurWithin:t=>{let n=document.getElementById(b);ne(n,t.relatedTarget)||(E.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{E.current||(E.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}}),k=(0,R.useRef)(xe),A=(0,R.useRef)(xe);return{groupProps:D(T,x,c,g,O,{role:`group`,"aria-disabled":e.isDisabled||null,"aria-describedby":S,onKeyDown(n){t.isOpen||e.onKeyDown&&e.onKeyDown(n)},onKeyUp(n){t.isOpen||e.onKeyUp&&e.onKeyUp(n)}}),labelProps:{...s,onClick:()=>{C.focusFirst()}},buttonProps:{...g,id:y,"aria-haspopup":`dialog`,"aria-label":r.format(`calendar`),"aria-labelledby":`${y} ${d}`,"aria-describedby":S,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:b,"aria-labelledby":`${y} ${d}`},startFieldProps:{..._,...w,value:t.value?.start??null,defaultValue:t.defaultValue?.start,onChange:e=>t.setDateTime(`start`,e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[je]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){k.current=e,t.updateValidation(we(e,A.current))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},endFieldProps:{...v,...w,value:t.value?.end??null,defaultValue:t.defaultValue?.end,onChange:e=>t.setDateTime(`end`,e),name:e.endName,form:e.form,[je]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){A.current=e,t.updateValidation(we(k.current,e))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},descriptionProps:l,errorMessageProps:u,calendarProps:{autoFocus:!0,value:t.dateRange?.start&&t.dateRange.end?t.dateRange:null,onChange:t.setDateRange,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,allowsNonContiguousRanges:e.allowsNonContiguousRanges,defaultFocusedValue:t.dateRange?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:typeof e.errorMessage==`function`?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(` `),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:i,validationErrors:a,validationDetails:o}}function Qs(e){let t=v(e),[n,r]=ce(e.value,e.defaultValue||null,e.onChange),[i]=(0,R.useState)(n),[a,o]=(0,R.useState)(()=>n||{start:null,end:null});n==null&&a.start&&a.end&&(a={start:null,end:null},o(a));let s=n||a,c=e=>{s=e||{start:null,end:null},o(s),$s(s)?r(s):r(null)},[l,u]=Ka(s?.start||s?.end||e.placeholderValue||null,e.granularity),d=l===`hour`||l===`minute`||l===`second`,f=e.shouldCloseOnSelect??!0,[p,m]=(0,R.useState)(null),[h,g]=(0,R.useState)(null);s&&$s(s)&&(p=s,`hour`in s.start&&(h=s));let _=(e,t)=>{c({start:`timeZone`in t.start?t.start.set(U(e.start)):W(e.start,t.start),end:`timeZone`in t.end?t.end.set(U(e.end)):W(e.end,t.end)}),m(null),g(null),D.commitValidation()},y=n=>{let r=typeof f==`function`?f():f;d?$s(n)&&(r||h?.start&&h?.end)?_(n,{start:h?.start||Ua(e.placeholderValue),end:h?.end||Ua(e.placeholderValue)}):m(n):$s(n)?(c(n),D.commitValidation()):m(n),r&&t.setOpen(!1)},b=e=>{$s(p)&&$s(e)?_(p,e):g(e)},x=s?.start?.calendar.identifier===`gregory`&&s.start.era===`BC`||s?.end?.calendar.identifier===`gregory`&&s.end.era===`BC`,S=(0,R.useMemo)(()=>({granularity:l,timeZone:u,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:x}),[l,e.hourCycle,e.shouldForceLeadingZeros,u,e.hideTimeZone,x]),{minValue:C,maxValue:w,isDateUnavailable:T}=e,E=(0,R.useMemo)(()=>za(s,C,w,T?e=>T(e,null):void 0,S),[s,C,w,T,S]),D=Oe({...e,value:n,name:(0,R.useMemo)(()=>[e.startName,e.endName].filter(e=>e!=null),[e.startName,e.endName]),builtinValidation:E}),O=D.displayValidation.isInvalid,k=e.validationState||(O?`invalid`:null);return{...D,value:s,defaultValue:e.defaultValue??i,setValue:c,dateRange:p,timeRange:h,granularity:l,hasTime:d,setDate(e,t){y(e===`start`?{start:t,end:p?.end??null}:{start:p?.start??null,end:t})},setTime(e,t){b(e===`start`?{start:t,end:h?.end??null}:{start:h?.start??null,end:t})},setDateTime(e,t){c(e===`start`?{start:t,end:s?.end??null}:{start:s?.start??null,end:t})},setDateRange:y,setTimeRange:b,...t,setOpen(n){!n&&!(s?.start&&s?.end)&&$s(p)&&d&&_(p,{start:h?.start||Ua(e.placeholderValue),end:h?.end||Ua(e.placeholderValue)}),t.setOpen(n)},validationState:k,isInvalid:O,formatValue(t,n){if(!s||!s.start||!s.end)return null;let r=`timeZone`in s.start?s.start.timeZone:void 0,i=e.granularity||(s.start&&`minute`in s.start?`minute`:`day`),a=`timeZone`in s.end?s.end.timeZone:void 0,o=e.granularity||(s.end&&`minute`in s.end?`minute`:`day`),c=Ha(n,{granularity:i,timeZone:r,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,showEra:s.start.calendar.identifier===`gregory`&&s.start.era===`BC`||s.end.calendar.identifier===`gregory`&&s.end.era===`BC`}),l=s.start.toDate(r||`UTC`),u=s.end.toDate(a||`UTC`),d=new Y(t,c),f;if(r===a&&i===o&&s.start.compare(s.end)!==0){try{let e=d.formatRangeToParts(l,u),t=-1;for(let n=0;nt&&(r+=e[i].value);return{start:n,end:r}}catch{}f=d}else f=new Y(t,Ha(n,{granularity:o,timeZone:a,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:d.format(l),end:f.format(u)}},getDateFormatter(e,t){return new Y(e,Ha({},{...S,...t}))}}}function $s(e){return e?.start!=null&&e.end!=null}var ec=(0,R.createContext)(null),tc=(0,R.createContext)(null),nc=[Se,d,Me,p],rc=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,ec);let{validationBehavior:n}=O(ye)||{},r=e.validationBehavior??n??`native`,i=Qs({...e,validationBehavior:r}),a=(0,R.useRef)(null),[o,s]=A(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:l,startFieldProps:u,endFieldProps:f,buttonProps:m,dialogProps:h,calendarProps:g,descriptionProps:_,errorMessageProps:v,...y}=Zs({...E(e),label:s,validationBehavior:r},i,a),{focusProps:b,isFocused:S,isFocusVisible:C}=P({within:!0}),T=k({...e,values:{state:i,isFocusWithin:S,isFocusVisible:C,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-DateRangePicker`}),ee=I(e,{global:!0});return delete ee.id,R.createElement(x,{values:[[tc,i],[Se,{...c,ref:a,isInvalid:i.isInvalid}],[d,{...m,isPressed:i.isOpen}],[Me,{...l,ref:o,elementType:`span`}],[Is,g],[Ue,i],[We,{trigger:`DateRangePicker`,triggerRef:a,placement:`bottom start`,clearContexts:nc}],[He,h],[oo,{slots:{start:u,end:f}}],[p,{slots:{description:_,errorMessage:v}}],[Te,y]]},R.createElement(w.div,{...D(ee,T,b),ref:t,slot:e.slot||void 0,"data-focus-within":S||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":C||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-open":i.isOpen||void 0}))}),ic=(0,R.createContext)({triggerRef:{current:null}}),ac=({children:e,className:t,onOpenChange:n,...r})=>{let i=R.useMemo(()=>$e(),[]),a=(0,R.useRef)(null),[o,s]=R.useState(!1),c=(0,R.useRef)(!1);(0,R.useEffect)(()=>{if(!o)return;let e=e=>{!e.metaKey&&!e.ctrlKey&&!e.altKey&&(c.current=!0)};return window.addEventListener(`keydown`,e,!0),()=>{window.removeEventListener(`keydown`,e,!0)}},[o]);let l=e=>{s(e),!e&&c.current&&window.requestAnimationFrame(()=>{a.current?.focus()}),c.current=!1,n?.(e)};return(0,X.jsx)(ic,{value:{slots:i,triggerRef:a},children:(0,X.jsx)(rc,{"data-required":Le(r.isRequired),"data-slot":`date-range-picker`,...r,className:N(t,i?.base()),onOpenChange:l,children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})})};ac.displayName=`HeroUI.DateRangePicker`;var oc=({children:e,className:t,ref:n,...r})=>{let{slots:i,triggerRef:a}=(0,R.use)(ic),o=R.useCallback(e=>{a.current=e},[a]),s=j(o,n);return(0,X.jsx)(f,{ref:s,className:N(t,i?.trigger()),"data-slot":`date-range-picker-trigger`,...r,children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})};oc.displayName=`HeroUI.DateRangePicker.Trigger`;var sc=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(ic);return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(r?.triggerIndicator,t),"data-slot":`date-range-picker-trigger-indicator`,...n,children:e||(0,X.jsx)(y,{})})};sc.displayName=`HeroUI.DateRangePicker.TriggerIndicator`;var cc=({children:e=` - `,className:t,...n})=>{let{slots:r}=(0,R.use)(ic);return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(r?.rangeSeparator,t),"data-slot":`date-range-picker-range-separator`,...n,children:e})};cc.displayName=`HeroUI.DateRangePicker.RangeSeparator`;var lc=({children:e,className:t,placement:n=`bottom`,...r})=>{let{slots:i}=(0,R.use)(ic);return(0,X.jsx)(s,{value:{variant:`default`},children:(0,X.jsx)(Je,{...r,className:N(t,i?.popover()),"data-slot":`date-range-picker-popover`,placement:n,children:e})})};lc.displayName=`HeroUI.DateRangePicker.Popover`;var uc=Object.assign(ac,{Root:ac,Trigger:oc,TriggerIndicator:sc,RangeSeparator:cc,Popover:lc});function dc({children:e,className:t,fullWidth:n,...r}){let i=R.useMemo(()=>tt({fullWidth:n}),[n]);return(0,X.jsx)(fo,{"data-required":Le(r.isRequired),"data-slot":`time-field`,...r,className:N(t,i),children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})}var fc=Object.assign(dc,{Root:dc,Group:vo,Input:bo,InputContainer:So,Segment:xo,Prefix:yo,Suffix:Co}),pc=(0,R.createContext)(null);function mc(){let e=(0,R.use)(pc);if(!e)throw Error(`useYearPicker must be used within a or component.`);return e}function hc(){let e=(0,R.use)(Ls),t=(0,R.use)(Rs),n=e??t;if(!n)throw Error(`useCalendarOrRangeState must be used within a or component.`);return n}function gc(e){switch(e){case`buddhist`:return 543;case`ethiopic`:case`ethioaa`:return-8;case`coptic`:return-284;case`hebrew`:return 3760;case`indian`:return-78;case`islamic-civil`:case`islamic-tbla`:case`islamic-umalqura`:return-579;case`persian`:return-600;default:return 0}}function _c(e,t){let n=[];if(!e||!t)return n;let r=kt(e);for(;r.compare(t)<=0;)n.push(r),r=kt(r.add({years:1}));return n}function vc(e,t,n,r=`short`,i=`UTC`){let a=new Intl.DateTimeFormat(t,{weekday:r,timeZone:i}),o=At(e,t,n),s=[],c=o;for(let e=0;e<7;e++){s.push(a.format(c.toDate(i)));let e=c.add({days:1});if(B(c,e))break;c=e}for(;s.length<7;)s.push(``);return s}function yc(e,t){let n=[],r=e;for(let e=0;e<7;e++){n.push(r.compare(t)>0?null:r);let e=r.add({days:1});if(B(r,e)){for(;n.length<7;)n.push(null);return n}r=e}return n}function bc(e,t,n,r){let i=[],a=At(e,n,r);for(i.push(yc(a,t)),a=a.add({weeks:1});a.compare(t)<=0;){i.push(yc(a,t));let e=a.add({weeks:1});if(B(a,e))break;a=e}return i}var xc=R.createContext(null);function Sc(){let e=R.use(xc);if(!e)throw Error(`CalendarYearPicker trigger components must be used within .`);return e}var Cc=({children:e,className:t,onKeyDown:n,onPress:r,...i})=>{let{isYearPickerOpen:a,setIsYearPickerOpen:o}=mc(),s=ys({},hc()),c=R.useMemo(()=>Xe(),[]),l=R.useCallback(()=>{o(!a)},[a,o]),u=e=>{n?.(e),!e.defaultPrevented&&e.key===`Escape`&&a&&(e.preventDefault(),o(!1))},d=R.useMemo(()=>({isOpen:a,monthYear:s,toggle:l}),[l,a,s]),p=R.useMemo(()=>({...d,slots:c}),[c,d]);return(0,X.jsx)(xc,{value:p,children:(0,X.jsx)(f,{"aria-expanded":a,"aria-label":`${s}, year selector`,className:N(t,c.trigger()),"data-open":a||void 0,"data-slot":`calendar-year-picker-trigger`,slot:null,onKeyDown:u,onPress:e=>{r?.(e),l()},...i,children:typeof e==`function`?e(d):e})})};Cc.displayName=`HeroUI.CalendarYearPicker.Trigger`;var wc=({children:e,className:t,format:n,offset:r,...i})=>{let{monthYear:a,slots:o,...s}=Sc(),c=hc(),l=ys({format:n,offset:r},c);return(0,X.jsx)(S.span,{className:L(o.triggerHeading,t),"data-slot":`calendar-year-picker-trigger-heading`,...i,children:typeof e==`function`?e({monthYear:a,...s}):e||l})};wc.displayName=`HeroUI.CalendarYearPicker.TriggerHeading`;var Tc=({children:e,className:t,...n})=>{let{monthYear:r,slots:i,...a}=Sc();return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(i.triggerIndicator,t),"data-slot":`calendar-year-picker-trigger-indicator`,...n,children:typeof e==`function`?e({monthYear:r,...a}):e||(0,X.jsx)(o,{height:`1em`,width:`1em`})})};Tc.displayName=`HeroUI.CalendarYearPicker.TriggerIndicator`;var Ec=R.createContext(null);function Dc(){let e=R.use(Ec);if(!e)throw Error(`CalendarYearPicker components must be used within .`);return e}var Oc=({children:e,className:t,format:n,onKeyDown:r,visibleYears:i,...a})=>{let{calendarGridSlot:o,calendarRef:s,isYearPickerOpen:c,setIsYearPickerOpen:l}=mc(),u=hc(),d=R.useRef(null),f=R.useMemo(()=>Xe(),[]),{"aria-label":p,items:m,onChange:h,value:g}=vs({format:n,visibleYears:R.useMemo(()=>i??(!u.minValue||!u.maxValue?20:_c(u.minValue,u.maxValue).length),[u.maxValue,u.minValue,i])},u),_=m.map(e=>`${e.id}:${e.date.year}`).join(`|`),v=m.map(e=>e.date.year),y=new Map(m.map(e=>[e.date.year,e])),b=m[g]?.date.year??u.focusedDate.year,x=R.useCallback(e=>y.get(e)?.formatted??String(e),[y]),[C,w]=R.useState(b),T=R.useRef(!1);R.useEffect(()=>{let e=d.current;if(!e)return;let t=s.current?.querySelector(`[data-slot='${o}']`);t&&(e.style.top=`${t.offsetTop}px`,e.style.height=`${t.offsetHeight}px`)},[o,s,u.focusedDate]);let E=R.useCallback(e=>{let t=d.current;if(!t)return;let n=t.querySelector(`[data-year='${e}']`);n&&n.focus()},[]);R.useEffect(()=>{let e=c&&!T.current;if(T.current=c,!e||v.length===0)return;let[t]=v;if(t==null)return;let n=v.includes(b)?b:t;w(n);let r=requestAnimationFrame(()=>{E(n)});return()=>{cancelAnimationFrame(r)}},[E,b,c,_,v.length]),R.useEffect(()=>{if(!c||v.length===0)return;let[e]=v;e!=null&&(v.includes(C)||w(e))},[C,c,_,v]);let D=R.useCallback(e=>{let t=y.get(e);t!=null&&(l(!1),h(t.id))},[y,h,l]),O=e=>{if(r?.(e),e.defaultPrevented)return;if(e.key===`Escape`&&c){e.preventDefault(),l(!1);return}if(!c||v.length===0)return;let t=v.indexOf(C);if(t===-1)return;let n=t;switch(e.key){case`ArrowRight`:n=Math.min(t+1,v.length-1);break;case`ArrowLeft`:n=Math.max(t-1,0);break;case`ArrowDown`:n=Math.min(t+3,v.length-1);break;case`ArrowUp`:n=Math.max(t-3,0);break;case`Home`:n=0;break;case`End`:n=v.length-1;break;default:return}if(n!==t){let t=v[n];if(t==null)return;e.preventDefault(),w(t),E(t)}},k=R.useMemo(()=>({activeYear:C,focusedYear:b,getFormattedYear:x,isYearPickerOpen:c,selectYear:D,setActiveYear:w,slots:f,years:v}),[C,b,x,D,c,f,v]);return(0,X.jsx)(Ec,{value:k,children:(0,X.jsx)(S.div,{ref:d,"aria-hidden":!c,"aria-label":p,className:L(f.yearGrid,t),"data-open":c||void 0,"data-slot":`calendar-year-picker-grid`,role:`listbox`,tabIndex:-1,onKeyDown:O,...a,children:e})})};Oc.displayName=`HeroUI.CalendarYearPicker.Grid`;var kc=({children:e})=>{let{focusedYear:t,getFormattedYear:n,isYearPickerOpen:r,selectYear:i,years:a}=Dc(),o=new Date().getFullYear();return(0,X.jsx)(X.Fragment,{children:a.map(a=>{let s=a===t,c={formattedYear:n(a),isCurrentYear:a===o,isOpen:r,isSelected:s,selectYear:()=>i(a),year:a};return(0,X.jsx)(R.Fragment,{children:typeof e==`function`?e(c):(0,X.jsx)(Ac,{year:a})},a)})})};kc.displayName=`HeroUI.CalendarYearPicker.GridBody`;var Ac=({children:e,className:t,excludeFromTabOrder:n,onFocus:r,onPress:i,year:a,...o})=>{let{activeYear:s,focusedYear:c,getFormattedYear:l,isYearPickerOpen:u,selectYear:d,setActiveYear:p,slots:m}=Dc(),h=a===c,g=a===s,_=l(a),v={formattedYear:_,isCurrentYear:a===new Date().getFullYear(),isOpen:u,isSelected:h,selectYear:()=>d(a),year:a};return(0,X.jsx)(f,{"aria-label":_,"aria-selected":h,className:N(t,m.yearCell()),"data-selected":h||void 0,"data-slot":`calendar-year-picker-year-cell`,"data-year":a,excludeFromTabOrder:n??!(u&&g),slot:null,onFocus:e=>{r?.(e),p(a)},onPress:e=>{i?.(e),d(a)},...o,children:typeof e==`function`?e(v):e||_})};Ac.displayName=`HeroUI.CalendarYearPicker.Cell`;function jc({children:e,className:t,"data-slot":n=`calendar-grid-body`,firstDayOfWeek:r,visibleRange:i}){let{locale:a}=F(),o=R.useMemo(()=>bc(i.start,i.end,a,r),[r,a,i.end,i.start]);return(0,X.jsx)(S.tbody,{className:t,"data-slot":n,children:o.map((t,n)=>(0,X.jsx)(`tr`,{children:t.map((t,n)=>t?R.cloneElement(e(t),{key:n}):(0,X.jsx)(`td`,{},n))},n))})}function Mc({children:e,className:t,"data-slot":n=`calendar-grid-header`,firstDayOfWeek:r,timeZone:i=`UTC`,visibleRange:a,weekdayStyle:o=`short`}){let{locale:s}=F(),c=R.useMemo(()=>vc(a.start,s,r,o,i),[r,s,i,a.start,o]);return(0,X.jsx)(S.thead,{"aria-hidden":!0,className:t,"data-slot":n,children:(0,X.jsx)(`tr`,{children:c.map((t,n)=>R.cloneElement(e(t),{key:n}))})})}var Q=(0,R.createContext)({});function Nc({children:e,className:t,defaultYearPickerOpen:n=!1,firstDayOfWeek:r,isYearPickerOpen:i,maxValue:a,minValue:o,onYearPickerOpenChange:s,visibleDuration:c,...l}){let u=c?.weeks!=null,d=c?.days!=null,f=c?.days,{locale:p}=F(),m=R.useMemo(()=>Ze(),[]),h=R.useRef(null),[g,_]=ce(i,n,s),v=R.useMemo(()=>{let e=new Y(p).resolvedOptions().calendar;return Kr(e)},[p]),y=R.useMemo(()=>gc(v.identifier),[v.identifier]),b=o??new q(v,1900+y,1,1),x=a??new q(v,2099+y,12,31);return(0,X.jsx)(pc,{value:{calendarGridSlot:`range-calendar-grid`,isYearPickerOpen:g,setIsYearPickerOpen:_,calendarRef:h},children:(0,X.jsx)(zs,{ref:h,"data-slot":`range-calendar`,firstDayOfWeek:r,maxValue:x,minValue:b,visibleDuration:c,...l,className:N(t,te(m.base(),u&&`range-calendar--week-view`,d&&`range-calendar--day-view`)),children:t=>(0,X.jsx)(Q,{value:{dayView:d&&f!=null?{days:f,firstDayOfWeek:r,timeZone:t.state.timeZone,visibleRange:t.state.visibleRange}:void 0,slots:m},children:typeof e==`function`?e(t):e})})})}Nc.displayName=`HeroUI.RangeCalendar`;var Pc=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(Q);return(0,X.jsx)(S.header,{className:L(r?.header,t),"data-slot":`range-calendar-header`,...n,children:e})};Pc.displayName=`HeroUI.RangeCalendar.Header`;var Fc=({className:e,...t})=>{let{slots:n}=(0,R.use)(Q);return(0,X.jsx)(Ys,{"data-slot":`range-calendar-heading`,...t,className:L(n?.heading,e)})};Fc.displayName=`HeroUI.RangeCalendar.Heading`;var Ic=({children:e,className:t,slot:n,...r})=>{let{slots:i}=(0,R.use)(Q);return(0,X.jsx)(f,{"data-slot":`range-calendar-nav-button`,slot:n,...r,className:N(t,i?.navButton()),children:e||(n===`previous`?(0,X.jsx)(u,{className:i?.navButtonIcon(),"data-slot":`range-calendar-nav-button-icon`}):(0,X.jsx)(o,{className:i?.navButtonIcon(),"data-slot":`range-calendar-nav-button-icon`}))})};Ic.displayName=`HeroUI.RangeCalendar.NavButton`;var Lc=({children:e,className:t,weekdayStyle:n=`short`,...r})=>{let i=(0,R.use)(Q),{dayView:a,slots:o}=i,s=R.useMemo(()=>({...i,dayView:a?{...a,weekdayStyle:n}:void 0}),[a,i,n]);return(0,X.jsx)(Q,{value:s,children:(0,X.jsx)(Vs,{"data-slot":`range-calendar-grid`,weekdayStyle:n,...r,className:L(o?.grid,t),children:e})})};Lc.displayName=`HeroUI.RangeCalendar.Grid`;var Rc=({children:e,className:t,...n})=>{let{dayView:r,slots:i}=(0,R.use)(Q);return r&&r.days>=7&&typeof e==`function`?(0,X.jsx)(Mc,{className:L(i?.gridHeader,t),"data-slot":`range-calendar-grid-header`,firstDayOfWeek:r.firstDayOfWeek,timeZone:r.timeZone,visibleRange:r.visibleRange,weekdayStyle:r.weekdayStyle,children:e}):(0,X.jsx)(Us,{"data-slot":`range-calendar-grid-header`,...n,className:L(i?.gridHeader,t),children:e})};Rc.displayName=`HeroUI.RangeCalendar.GridHeader`;var zc=({children:e,className:t,...n})=>{let{dayView:r,slots:i}=(0,R.use)(Q);return r&&r.days>=7&&typeof e==`function`?(0,X.jsx)(jc,{className:L(i?.gridBody,t),"data-slot":`range-calendar-grid-body`,firstDayOfWeek:r.firstDayOfWeek,visibleRange:r.visibleRange,children:e}):(0,X.jsx)(qs,{"data-slot":`range-calendar-grid-body`,...n,className:L(i?.gridBody,t),children:e})};zc.displayName=`HeroUI.RangeCalendar.GridBody`;var Bc=({className:e,...t})=>{let{slots:n}=(0,R.use)(Q);return(0,X.jsx)(Gs,{"data-slot":`range-calendar-header-cell`,...t,className:L(n?.headerCell,e)})};Bc.displayName=`HeroUI.RangeCalendar.HeaderCell`;var Vc=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(Q);return(0,X.jsx)(Js,{"data-slot":`range-calendar-cell`,...n,className:N(t,r?.cell()),children:t=>{let{formattedDate:n,isDisabled:r,isHovered:i,isPressed:a,isSelectionEnd:o,isSelectionStart:s}=t,c=typeof e==`function`?e(t):e||n;return(0,X.jsx)(`span`,{className:`range-calendar__cell-button`,"data-disabled":Le(r),"data-hovered":Le(i),"data-pressed":Le(a),"data-selected":Le(s||o),"data-slot":`range-calendar-cell-button`,children:c})}})};Vc.displayName=`HeroUI.RangeCalendar.Cell`;var Hc=({className:e,...t})=>{let{slots:n}=(0,R.use)(Q);return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(n?.cellIndicator,e),"data-slot":`range-calendar-cell-indicator`,...t})};Hc.displayName=`HeroUI.RangeCalendar.CellIndicator`;var $=Object.assign(Nc,{Root:Nc,Header:Pc,Heading:Fc,NavButton:Ic,Grid:Lc,GridHeader:Rc,GridBody:zc,HeaderCell:Bc,Cell:Vc,CellIndicator:Hc,YearPickerTrigger:Cc,YearPickerTriggerHeading:wc,YearPickerTriggerIndicator:Tc,YearPickerGrid:Oc,YearPickerGridBody:kc,YearPickerCell:Ac});function Uc(e={}){let t=new URLSearchParams;e.dim?.length&&t.set(`dim`,e.dim.join(`,`)),e.limit!=null&&t.set(`limit`,String(e.limit)),e.hours!=null&&t.set(`hours`,String(e.hours)),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.api_key&&t.set(`api_key`,e.api_key);let n=t.toString()?`?${t}`:``;return Re(`/api/logs/stats${n}`)}function Wc(e={}){let t=new URLSearchParams;e.account&&t.set(`account`,e.account),e.api_key&&t.set(`api_key`,e.api_key),e.status&&t.set(`status`,e.status),e.stream!=null&&t.set(`stream`,e.stream?`1`:`0`),e.error_kind&&t.set(`error_kind`,e.error_kind),e.model&&t.set(`model`,e.model),e.provider&&t.set(`provider`,e.provider),e.id&&t.set(`id`,e.id),e.q&&t.set(`q`,e.q),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString()?`?${t}`:``;return Re(`/api/logs/requests${n}`)}function Gc(e){return Re(`/api/logs/requests/${encodeURIComponent(e)}`)}function Kc(){return Re(`/api/logs/requests`,{method:`DELETE`})}function qc(e={}){let t=new URLSearchParams;e.after!=null&&t.set(`after`,String(e.after)),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset)),e.level&&t.set(`level`,e.level),e.q&&t.set(`q`,e.q),e.account&&t.set(`account`,e.account);let n=t.toString()?`?${t}`:``;return Re(`/api/logs/runtime${n}`)}function Jc(e,t=!1){if(!e)return;let n=e.toDate(Tt());if(Number.isFinite(n.getTime()))return t&&n.setSeconds(59,999),n.toISOString()}function Yc(e){if(!e)return null;let t=Date.parse(e);if(!Number.isFinite(t))return null;try{return W(An(new Date(t).toISOString()))}catch{return null}}function Xc({value:e,onChange:t,ariaLabel:n,fromLabel:r,toLabel:i,className:a}){return(0,X.jsx)(uc,{className:a,granularity:`minute`,hourCycle:24,shouldForceLeadingZeros:!0,value:e,onChange:e=>t(e),"aria-label":n,children:({state:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(To.Group,{className:`w-full min-w-0`,variant:`secondary`,children:[(0,X.jsx)(To.Input,{className:`min-w-0`,slot:`start`,"aria-label":r,children:e=>(0,X.jsx)(To.Segment,{segment:e})}),(0,X.jsx)(uc.RangeSeparator,{}),(0,X.jsx)(To.Input,{className:`min-w-0`,slot:`end`,"aria-label":i,children:e=>(0,X.jsx)(To.Segment,{segment:e})}),(0,X.jsx)(To.Suffix,{children:(0,X.jsx)(uc.Trigger,{children:(0,X.jsx)(uc.TriggerIndicator,{})})})]}),(0,X.jsxs)(uc.Popover,{className:`flex w-[20.5rem] max-w-[calc(100vw-2rem)] flex-col gap-3 p-3`,children:[(0,X.jsxs)($,{"aria-label":n,children:[(0,X.jsxs)($.Header,{children:[(0,X.jsxs)($.YearPickerTrigger,{children:[(0,X.jsx)($.YearPickerTriggerHeading,{}),(0,X.jsx)($.YearPickerTriggerIndicator,{})]}),(0,X.jsx)($.NavButton,{slot:`previous`}),(0,X.jsx)($.NavButton,{slot:`next`})]}),(0,X.jsxs)($.Grid,{children:[(0,X.jsx)($.GridHeader,{children:e=>(0,X.jsx)($.HeaderCell,{children:e})}),(0,X.jsx)($.GridBody,{children:e=>(0,X.jsx)($.Cell,{date:e})})]}),(0,X.jsx)($.YearPickerGrid,{children:(0,X.jsx)($.YearPickerGridBody,{children:({year:e})=>(0,X.jsx)($.YearPickerCell,{year:e})})})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(Ae,{className:`text-xs`,children:r}),(0,X.jsx)(fc,{"aria-label":r,granularity:`minute`,hourCycle:24,value:e.timeRange?.start??null,onChange:t=>e.setTimeRange({start:t,end:e.timeRange?.end}),children:(0,X.jsx)(fc.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,X.jsx)(fc.Input,{children:e=>(0,X.jsx)(fc.Segment,{segment:e})})})})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(Ae,{className:`text-xs`,children:i}),(0,X.jsx)(fc,{"aria-label":i,granularity:`minute`,hourCycle:24,value:e.timeRange?.end??null,onChange:t=>e.setTimeRange({start:e.timeRange?.start,end:t}),children:(0,X.jsx)(fc.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,X.jsx)(fc.Input,{children:e=>(0,X.jsx)(fc.Segment,{segment:e})})})})]})]})]})]})})}export{Gc as a,qc as c,Kc as i,Jc as n,Wc as o,Yc as r,Uc as s,Xc as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/TimeRangePicker-KlLSf1l-.js b/internal/webui/static/assets/TimeRangePicker-KlLSf1l-.js deleted file mode 100644 index c6ecea64..00000000 --- a/internal/webui/static/assets/TimeRangePicker-KlLSf1l-.js +++ /dev/null @@ -1 +0,0 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{A as r,D as i,E as a,H as o,I as s,O as c,Q as l,V as u,X as d,Z as f,a as p,j as m,k as h,ot as g,ut as _,w as v,z as y}from"./useI18n-B77RWTNi.js";import{$ as b,A as x,B as S,Ct as C,F as w,G as T,I as E,J as D,L as O,M as k,N as A,Q as ee,R as te,Y as j,Z as ne,_t as M,a as re,c as N,ct as ie,d as P,dt as ae,f as oe,j as se,k as F,l as ce,lt as le,m as ue,o as de,q as I,s as L,tt as fe,u as pe,w as me,x as he,z as ge}from"./SharedElementTransition-BlCsXfb1.js";import{t as _e}from"./useUpdateEffect-DR9d7F-l.js";import{a as ve,c as ye,d as be,f as xe,g as Se,h as Ce,l as we,m as Te,n as Ee,o as De,p as Oe,r as ke,t as Ae,u as je,v as Me,y as Ne}from"./label-DLoR3Z-C.js";import{n as Pe,r as Fe,t as Ie}from"./useSpinButton-DsBQOQHQ.js";import{t as Le}from"./assertion-BLQtDfw6.js";import{$ as Re,Jt as ze,Kt as Be,Nt as Ve,Qt as He,Xt as Ue,Yt as We,Zt as Ge,_t as Ke,gt as qe,qt as Je}from"./index-CmGY2WQi.js";var R=t(e(),1);function Ye(e,t){let n=(0,R.useRef)(null);return e&&n.current&&t(e,n.current)&&(e=n.current),n.current=e,e}var Xe=ge({slots:{trigger:`calendar-year-picker__trigger`,triggerHeading:`calendar-year-picker__trigger-heading`,triggerIndicator:`calendar-year-picker__trigger-indicator`,yearCell:`calendar-year-picker__year-cell`,yearGrid:`calendar-year-picker__year-grid`}}),Ze=ge({defaultVariants:{},slots:{base:`range-calendar`,cell:`range-calendar__cell`,cellIndicator:`range-calendar__cell-indicator`,grid:`range-calendar__grid`,gridBody:`range-calendar__grid-body`,gridHeader:`range-calendar__grid-header`,gridRow:`range-calendar__grid-row`,header:`range-calendar__header`,headerCell:`range-calendar__header-cell`,heading:`range-calendar__heading`,navButton:`range-calendar__nav-button`,navButtonIcon:`range-calendar__nav-button-icon`},variants:{}}),Qe=ge({base:`date-field`,defaultVariants:{fullWidth:!1},variants:{fullWidth:{false:``,true:`date-field--full-width`}}}),$e=ge({slots:{base:`date-range-picker`,popover:`date-range-picker__popover`,rangeSeparator:`date-range-picker__range-separator`,trigger:`date-range-picker__trigger`,triggerIndicator:`date-range-picker__trigger-indicator`}}),et=ge({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`date-input-group`,input:`date-input-group__input`,inputContainer:`date-input-group__input-container`,prefix:`date-input-group__prefix`,segment:`date-input-group__segment`,suffix:`date-input-group__suffix`},variants:{fullWidth:{false:{},true:{base:`date-input-group--full-width`}},variant:{primary:{base:`date-input-group--primary`},secondary:{base:`date-input-group--secondary`}}}}),tt=ge({base:`time-field`,defaultVariants:{fullWidth:!1},variants:{fullWidth:{false:``,true:`time-field--full-width`}}});function nt(e){let t=Ve({usage:`search`,...e}),n=(0,R.useCallback)((e,n)=>n.length===0||(e=e.normalize(`NFC`),n=n.normalize(`NFC`),t.compare(e.slice(0,n.length),n)===0),[t]),r=(0,R.useCallback)((e,n)=>n.length===0||(e=e.normalize(`NFC`),n=n.normalize(`NFC`),t.compare(e.slice(-n.length),n)===0),[t]),i=(0,R.useCallback)((e,n)=>{if(n.length===0)return!0;e=e.normalize(`NFC`),n=n.normalize(`NFC`);let r=0,i=n.length;for(;r+i<=e.length;r++){let a=e.slice(r,r+i);if(t.compare(n,a)===0)return!0}return!1},[t]);return(0,R.useMemo)(()=>({startsWith:n,endsWith:r,contains:i}),[n,r,i])}function rt(e,t){return e-t*Math.floor(e/t)}var it=1721426;function at(e,t,n,r){t=st(e,t);let i=t-1,a=-2;return n<=2?a=0:ot(t)&&(a=-1),1721425+365*i+Math.floor(i/4)-Math.floor(i/100)+Math.floor(i/400)+Math.floor((367*n-362)/12+a+r)}function ot(e){return e%4==0&&(e%100!=0||e%400==0)}function st(e,t){return e===`BC`?1-t:t}function ct(e){let t=`AD`;return e<=0&&(t=`BC`,e=1-e),[t,e]}var lt={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]},z=class{fromJulianDay(e){let t=e,n=t-it,r=Math.floor(n/146097),i=rt(n,146097),a=Math.floor(i/36524),o=rt(i,36524),s=Math.floor(o/1461),c=rt(o,1461),l=Math.floor(c/365),[u,d]=ct(r*400+a*100+s*4+l+ +(a!==4&&l!==4)),f=t-at(u,d,1,1),p=2;t=0?e:t:e||t}function zt(e){return e=G(e,new z),Bt(st(e.era,e.year),e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Bt(e,t,n,r,i,a,o){let s=new Date;return s.setUTCHours(r,i,a,o),s.setUTCFullYear(e,t-1,n),s.getTime()}function Vt(e,t){if(t===`UTC`)return 0;if(e>0&&t===Tt()&&!Et())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:r,day:i,hour:a,minute:o,second:s}=Ut(e,t);return Bt(n,r,i,a,o,s,0)-Math.floor(e/1e3)*1e3}var Ht=new Map;function Ut(e,t){let n=Ht.get(t);n||(n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,hour12:!1,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}),Ht.set(t,n));let r=n.formatToParts(new Date(e)),i={};for(let e of r)e.type!==`literal`&&(i[e.type]=e.value);return{year:i.era===`BC`||i.era===`B`?-i.year+1:+i.year,month:+i.month,day:+i.day,hour:i.hour===`24`?0:+i.hour,minute:+i.minute,second:+i.second}}var Wt=864e5;function Gt(e,t,n,r){return(n===r?[n]:[n,r]).filter(n=>Kt(e,t,n))}function Kt(e,t,n){let r=Ut(n,t);return e.year===r.year&&e.month===r.month&&e.day===r.day&&e.hour===r.hour&&e.minute===r.minute&&e.second===r.second}function V(e,t,n=`compatible`){let r=W(e);if(t===`UTC`)return zt(r);if(t===Tt()&&n===`compatible`&&!Et()){r=G(r,new z);let e=new Date,t=st(r.era,r.year);return e.setFullYear(t,r.month-1,r.day),e.setHours(r.hour,r.minute,r.second,r.millisecond),e.getTime()}let i=zt(r),a=Vt(i-Wt,t),o=Vt(i+Wt,t),s=Gt(r,t,i-a,i-o);if(s.length===1)return s[0];if(s.length>1)switch(n){case`compatible`:case`earlier`:return s[0];case`later`:return s[s.length-1];case`reject`:throw RangeError(`Multiple possible absolute times found`)}switch(n){case`earlier`:return Math.min(i-a,i-o);case`compatible`:case`later`:return Math.max(i-a,i-o);case`reject`:throw RangeError(`No such absolute time found`)}}function qt(e,t,n=`compatible`){return new Date(V(e,t,n))}function H(e,t){let n=Vt(e,t),r=new Date(e+n),i=r.getUTCFullYear(),a=r.getUTCMonth()+1,o=r.getUTCDate(),s=r.getUTCHours(),c=r.getUTCMinutes(),l=r.getUTCSeconds(),u=r.getUTCMilliseconds();return new zn(i<1?`BC`:`AD`,i<1?-i+1:i,a,o,t,n,s,c,l,u)}function U(e){return new q(e.calendar,e.era,e.year,e.month,e.day)}function W(e,t){let n=0,r=0,i=0,a=0;if(`timeZone`in e)({hour:n,minute:r,second:i,millisecond:a}=e);else if(`hour`in e&&!t)return e;return t&&({hour:n,minute:r,second:i,millisecond:a}=t),new Rn(e.calendar,e.era,e.year,e.month,e.day,n,r,i,a)}function Jt(e){return new Ln(e.hour,e.minute,e.second,e.millisecond)}function G(e,t){if(mt(e.calendar,t))return e;let n=t.fromJulianDay(e.calendar.toJulianDay(e)),r=e.copy();return r.calendar=t,r.era=n.era,r.year=n.year,r.month=n.month,r.day=n.day,on(r),r}function Yt(e,t,n){return e instanceof zn?e.timeZone===t?e:Zt(e,t):H(V(e,t,n),t)}function Xt(e){let t=zt(e)-e.offset;return new Date(t)}function Zt(e,t){return G(H(zt(e)-e.offset,t),e.calendar)}function Qt(e){return Zt(e,Tt())}var $t=36e5;function en(e,t){let n=e.copy(),r=`hour`in n?mn(n,t):0;tn(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,nn(n),an(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=r,rn(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let i=n.calendar.getYearsInEra(n);if(n.year>i){let e=n.calendar.isInverseEra?.(n);n.year=i,n.month=e?1:n.calendar.getMonthsInYear(n),n.day=e?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let a=n.calendar.getMonthsInYear(n);return n.month>a&&(n.month=a,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function tn(e,t){e.calendar.isInverseEra?.(e)&&(t=-t),e.year+=t}function nn(e){for(;e.month<1;)tn(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,tn(e,1)}function rn(e){for(;e.day<1;)e.month--,nn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,nn(e)}function an(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function on(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),an(e)}function sn(e){let t={};for(let n in e)typeof e[n]==`number`&&(t[n]=-e[n]);return t}function cn(e,t){return en(e,sn(t))}function ln(e,t){let n=e.copy();return t.era!=null&&(n.era=t.era),t.year!=null&&(n.year=t.year),t.month!=null&&(n.month=t.month),t.day!=null&&(n.day=t.day),on(n),n}function un(e,t){let n=e.copy();return t.hour!=null&&(n.hour=t.hour),t.minute!=null&&(n.minute=t.minute),t.second!=null&&(n.second=t.second),t.millisecond!=null&&(n.millisecond=t.millisecond),fn(n),n}function dn(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=pn(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=pn(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=pn(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=pn(e.hour,24),t}function fn(e){e.millisecond=Math.max(0,Math.min(e.millisecond,999)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function pn(e,t){let n=e%t;return n<0&&(n+=t),n}function mn(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,dn(e)}function hn(e,t){let n=e.copy();return mn(n,t),n}function gn(e,t){return hn(e,sn(t))}function _n(e,t,n,r){let i=e.copy();switch(t){case`era`:{let t=e.calendar.getEras(),a=t.indexOf(e.era);if(a<0)throw Error(`Invalid era: `+e.era);a=yn(a,n,0,t.length-1,r?.round),i.era=t[a],on(i);break}case`year`:i.calendar.isInverseEra?.(i)&&(n=-n),i.year=yn(e.year,n,-1/0,9999,r?.round),i.year===-1/0&&(i.year=1),i.calendar.balanceYearMonth&&i.calendar.balanceYearMonth(i,e);break;case`month`:i.month=yn(e.month,n,1,e.calendar.getMonthsInYear(e),r?.round);break;case`day`:i.day=yn(e.day,n,1,e.calendar.getDaysInMonth(e),r?.round);break;default:throw Error(`Unsupported field `+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(i),on(i),i}function vn(e,t,n,r){let i=e.copy();switch(t){case`hour`:{let t=e.hour,a=0,o=23;if(r?.hourCycle===12){let e=t>=12;a=e?12:0,o=e?23:11}i.hour=yn(t,n,a,o,r?.round);break}case`minute`:i.minute=yn(e.minute,n,0,59,r?.round);break;case`second`:i.second=yn(e.second,n,0,59,r?.round);break;case`millisecond`:i.millisecond=yn(e.millisecond,n,0,999,r?.round);break;default:throw Error(`Unsupported field `+t)}return i}function yn(e,t,n,r,i=!1){if(i){e+=Math.sign(t),e0?Math.ceil(e/i)*i:Math.floor(e/i)*i,e>r&&(e=n)}else e+=t,er&&(e=n+(e-r-1));return e}function bn(e,t){let n;return n=t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0?V(en(W(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days}),e.timeZone):zt(e)-e.offset,n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5,G(H(n,e.timeZone),e.calendar)}function xn(e,t){return bn(e,sn(t))}function Sn(e,t,n,r){switch(t){case`hour`:{let t=0,i=23;if(r?.hourCycle===12){let n=e.hour>=12;t=n?12:0,i=n?23:11}let a=W(e),o=G(un(a,{hour:t}),new z),s=[V(o,e.timeZone,`earlier`),V(o,e.timeZone,`later`)].filter(t=>H(t,e.timeZone).day===o.day)[0],c=G(un(a,{hour:i}),new z),l=[V(c,e.timeZone,`earlier`),V(c,e.timeZone,`later`)].filter(t=>H(t,e.timeZone).day===c.day).pop(),u=zt(e)-e.offset,d=Math.floor(u/$t),f=u%$t;return u=yn(d,n,Math.floor(s/$t),Math.floor(l/$t),r?.round)*$t+f,G(H(u,e.timeZone),e.calendar)}case`minute`:case`second`:case`millisecond`:return vn(e,t,n,r);case`era`:case`year`:case`month`:case`day`:return G(H(V(_n(W(e),t,n,r),e.timeZone),e.timeZone),e.calendar);default:throw Error(`Unsupported field `+t)}}function Cn(e,t,n){let r=W(e),i=un(ln(r,t),t);return i.compare(r)===0?e:G(H(V(i,e.timeZone,n),e.timeZone),e.calendar)}var wn=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Tn=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/,En=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Dn(e){let t=e.match(wn);if(!t)throw En.test(e)?Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):Error(`Invalid ISO 8601 date string: `+e);let n=new q(K(t[1],0,9999),K(t[2],1,12),1);return n.day=K(t[3],1,n.calendar.getDaysInMonth(n)),n}function On(e){let t=e.match(Tn);if(!t)throw En.test(e)?Error(`Invalid ISO 8601 date time string: ${e}. Use parseAbsolute() instead.`):Error(`Invalid ISO 8601 date time string: `+e);let n=K(t[1],-9999,9999),r=new Rn(n<1?`BC`:`AD`,n<1?-n+1:n,K(t[2],1,12),1,t[4]?K(t[4],0,23):0,t[5]?K(t[5],0,59):0,t[6]?K(t[6],0,59):0,t[7]?K(t[7],0,1/0)*1e3:0);return r.day=K(t[3],0,r.calendar.getDaysInMonth(r)),r}function kn(e,t){let n=e.match(En);if(!n)throw Error(`Invalid ISO 8601 date time string: `+e);let r=K(n[1],-9999,9999),i=new zn(r<1?`BC`:`AD`,r<1?-r+1:r,K(n[2],1,12),1,t,0,n[4]?K(n[4],0,23):0,n[5]?K(n[5],0,59):0,n[6]?K(n[6],0,59):0,n[7]?K(n[7],0,1/0)*1e3:0);return i.day=K(n[3],0,i.calendar.getDaysInMonth(i)),n[8]&&(i.offset=K(n[8],-23,23)*36e5+K(n[9]??`0`,0,59)*6e4),Zt(i,t)}function An(e){return kn(e,Tt())}function K(e,t,n){let r=Number(e);if(rn)throw RangeError(`Value out of range: ${t} <= ${r} <= ${n}`);return r}function jn(e){return`${String(e.hour).padStart(2,`0`)}:${String(e.minute).padStart(2,`0`)}:${String(e.second).padStart(2,`0`)}${e.millisecond?String(e.millisecond/1e3).slice(1):``}`}function Mn(e){let t=G(e,new z),n;return n=t.era===`BC`?t.year===1?`0000`:`-`+String(Math.abs(1-t.year)).padStart(6,`00`):String(t.year).padStart(4,`0`),`${n}-${String(t.month).padStart(2,`0`)}-${String(t.day).padStart(2,`0`)}`}function Nn(e){return`${Mn(e)}T${jn(e)}`}function Pn(e){let t=Math.sign(e)<0?`-`:`+`;e=Math.abs(e);let n=Math.floor(e/36e5),r=Math.floor(e%36e5/6e4),i=Math.floor(e%36e5%6e4/1e3),a=`${t}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`;return i!==0&&(a+=`:${String(i).padStart(2,`0`)}`),a}function Fn(e){return`${Nn(e)}${Pn(e.offset)}[${e.timeZone}]`}function In(e){let t=typeof e[0]==`object`?e.shift():new z,n;if(typeof e[0]==`string`)n=e.shift();else{let e=t.getEras();n=e[e.length-1]}let r=e.shift(),i=e.shift(),a=e.shift();return[t,n,r,i,a]}var q=class e{constructor(...e){let[t,n,r,i,a]=In(e);this.calendar=t,this.era=n,this.year=r,this.month=i,this.day=a,on(this)}copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day):new e(this.calendar,this.year,this.month,this.day)}add(e){return en(this,e)}subtract(e){return cn(this,e)}set(e){return ln(this,e)}cycle(e,t,n){return _n(this,e,t,n)}toDate(e){return qt(this,e)}toString(){return Mn(this)}compare(e){return bt(this,e)}},Ln=class e{constructor(e=0,t=0,n=0,r=0){this.hour=e,this.minute=t,this.second=n,this.millisecond=r,fn(this)}copy(){return new e(this.hour,this.minute,this.second,this.millisecond)}add(e){return hn(this,e)}subtract(e){return gn(this,e)}set(e){return un(this,e)}cycle(e,t,n){return vn(this,e,t,n)}toString(){return jn(this)}compare(e){return xt(this,e)}},Rn=class e{constructor(...e){let[t,n,r,i,a]=In(e);this.calendar=t,this.era=n,this.year=r,this.month=i,this.day=a,this.hour=e.shift()||0,this.minute=e.shift()||0,this.second=e.shift()||0,this.millisecond=e.shift()||0,on(this)}copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new e(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(e){return en(this,e)}subtract(e){return cn(this,e)}set(e){return ln(un(this,e),e)}cycle(e,t,n){switch(e){case`era`:case`year`:case`month`:case`day`:return _n(this,e,t,n);default:return vn(this,e,t,n)}}toDate(e,t){return qt(this,e,t)}toString(){return Nn(this)}compare(e){let t=bt(this,e);return t===0?xt(this,W(e)):t}},zn=class e{constructor(...e){let[t,n,r,i,a]=In(e),o=e.shift(),s=e.shift();this.calendar=t,this.era=n,this.year=r,this.month=i,this.day=a,this.timeZone=o,this.offset=s,this.hour=e.shift()||0,this.minute=e.shift()||0,this.second=e.shift()||0,this.millisecond=e.shift()||0,on(this)}copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new e(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(e){return bn(this,e)}subtract(e){return xn(this,e)}set(e,t){return Cn(this,e,t)}cycle(e,t,n){return Sn(this,e,t,n)}toDate(){return Xt(this)}toString(){return Fn(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(e){return this.toDate().getTime()-Yt(e,this.timeZone).toDate().getTime()}},Bn=[[1868,9,8],[1912,7,30],[1926,12,25],[1989,1,8],[2019,5,1]],Vn=[[1912,7,29],[1926,12,24],[1989,1,7],[2019,4,30]],Hn=[1867,1911,1925,1988,2018],Un=[`meiji`,`taisho`,`showa`,`heisei`,`reiwa`];function Wn(e){let t=Bn.findIndex(([t,n,r])=>e.year=0){let[,n,r]=Bn[t];e.month=Math.max(n,e.month),e.month===n&&(e.day=Math.max(r,e.day))}}getEras(){return Un}getYearsInEra(e){let t=Un.indexOf(e.era),n=Bn[t],r=Bn[t+1];if(r==null)return 9999-n[0]+1;let i=r[0]-n[0];return(e.month0?[`minguo`,t]:[`before_minguo`,1-t]}var er=class extends z{fromJulianDay(e){let t=super.fromJulianDay(e),[n,r]=$n(st(t.era,t.year));return new q(this,n,r,t.month,t.day)}toJulianDay(e){return super.toJulianDay(tr(e))}getEras(){return[`before_minguo`,`minguo`]}balanceDate(e){let[t,n]=$n(Qn(e));e.era=t,e.year=n}isInverseEra(e){return e.era===`before_minguo`}getDaysInMonth(e){return super.getDaysInMonth(tr(e))}getYearsInEra(e){return e.era===`before_minguo`?9999:8088}constructor(...e){super(...e),this.identifier=`roc`}};function tr(e){let[t,n]=ct(Qn(e));return new q(t,n,e.month,e.day)}var nr=1948320,rr=[0,31,62,93,124,155,186,216,246,276,306,336],ir=class{fromJulianDay(e){let t=e-nr,n=1+Math.floor((33*t+3)/12053),r=t-(365*(n-1)+Math.floor((8*n+21)/33)),i=Math.floor(r<216?r/31:(r-6)/30),a=r-rr[i]+1;return new q(this,n,i+1,a)}toJulianDay(e){let t=1948319+365*(e.year-1)+Math.floor((8*e.year+21)/33);return t+=rr[e.month-1],t+=e.day,t}getMonthsInYear(){return 12}getDaysInMonth(e){return e.month<=6?31:e.month<=11||rt(25*e.year+11,33)<8?30:29}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getEras(){return[`AP`]}getYearsInEra(){return 9377}constructor(){this.identifier=`persian`}},ar=78,or=80,sr=class extends z{fromJulianDay(e){let t=super.fromJulianDay(e),n=t.year-ar,r=e-at(t.era,t.year,1,1),i;r=8&&(i+=(e.month-7)*30),i+=e.day-1,i)}getDaysInMonth(e){return e.month===1&&ot(e.year+ar)||e.month>=2&&e.month<=6?31:30}getYearsInEra(){return 9919}getEras(){return[`saka`]}balanceDate(){}constructor(...e){super(...e),this.identifier=`indian`}},cr=1948440,lr=1948439,J=1300,ur=1600,dr=460322;function fr(e,t,n,r){return r+Math.ceil(29.5*(n-1))+(t-1)*354+Math.floor((3+11*t)/30)+e-1}function pr(e,t,n){let r=Math.floor((30*(n-t)+10646)/10631),i=Math.min(12,Math.ceil((n-(29+fr(t,r,1,1)))/29.5)+1);return new q(e,r,i,n-fr(t,r,i,1)+1)}function mr(e){return(14+11*e)%30<11}var hr=class{fromJulianDay(e){return pr(this,cr,e)}toJulianDay(e){return fr(cr,e.year,e.month,e.day)}getDaysInMonth(e){let t=29+e.month%2;return e.month===12&&mr(e.year)&&t++,t}getMonthsInYear(){return 12}getDaysInYear(e){return mr(e.year)?355:354}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 30}getYearsInEra(){return 9665}getEras(){return[`AH`]}constructor(){this.identifier=`islamic-civil`}},gr=class extends hr{fromJulianDay(e){return pr(this,lr,e)}toJulianDay(e){return fr(lr,e.year,e.month,e.day)}constructor(...e){super(...e),this.identifier=`islamic-tbla`}},_r=`qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=`,vr,yr;function br(e){return dr+yr[e-J]}function xr(e,t){let n=e-J,r=1<<11-(t-1);return(vr[n]&r)===0?29:30}function Sr(e,t){let n=br(e);for(let r=1;re.charCodeAt(0)).buffer),!yr){yr=new Uint32Array(301);let e=0;for(let t=J;t<=ur;t++){yr[t-J]=e;for(let n=1;n<=12;n++)e+=xr(t,n)}}}fromJulianDay(e){let t=e-cr,n=br(J),r=br(ur);if(tr)return super.fromJulianDay(e);{let e=1299,n=1,r=1;for(;r>0;){e++,r=t-br(e)+1;let i=Cr(e);if(r===i){n=12;break}if(rt;)r-=t,n++,t=xr(e,n);break}}return new q(this,e,n,t-Sr(e,n)+1)}}toJulianDay(e){return e.yearur?super.toJulianDay(e):cr+Sr(e.year,e.month)+(e.day-1)}getDaysInMonth(e){return e.yearur?super.getDaysInMonth(e):xr(e.year,e.month)}getDaysInYear(e){return e.yearur?super.getDaysInYear(e):Cr(e.year)}},Tr=347997,Er=25920,Dr=765433;function Or(e){return rt(e*7+1,19)<7}function kr(e){let t=Math.floor((235*e-234)/19),n=12084+13753*t,r=t*29+Math.floor(n/25920);return rt(3*(r+1),7)<3&&(r+=1),r}function Ar(e){let t=kr(e-1),n=kr(e);return kr(e+1)-n===356?2:+(n-t===382)}function jr(e){return kr(e)+Ar(e)}function Mr(e){return jr(e+1)-jr(e)}function Nr(e){let t=Mr(e);switch(t>380&&(t-=30),t){case 353:return 0;case 354:return 1;case 355:return 2}}function Pr(e,t){if(t>=6&&!Or(e)&&t++,t===4||t===7||t===9||t===11||t===13)return 29;let n=Nr(e);return t===2?n===2?30:29:t===3?n===0?29:30:t===6?Or(e)?30:0:30}var Fr=class{fromJulianDay(e){let t=e-Tr,n=t*Er/Dr,r=Math.floor((19*n+234)/235)+1,i=jr(r),a=Math.floor(t-i);for(;a<1;)r--,i=jr(r),a=Math.floor(t-i);let o=1,s=0;for(;s6?e.month--:!Or(t.year)&&Or(e.year)&&t.month>6&&e.month++)}constructor(){this.identifier=`hebrew`}},Ir=1723856,Lr=1824665,Rr=5500;function zr(e,t,n,r){return e+365*t+Math.floor(t/4)+30*(n-1)+r-1}function Br(e,t){let n=Math.floor(4*(t-e)/1461),r=1+Math.floor((t-zr(e,n,1,1))/30);return[n,r,t+1-zr(e,n,r,1)]}function Vr(e){return Math.floor(e%4/3)}function Hr(e,t){return t%13==0?Vr(e)+5:30}var Ur=class{fromJulianDay(e){let[t,n,r]=Br(Ir,e),i=`AM`;return t<=0&&(i=`AA`,t+=Rr),new q(this,i,t,n,r)}toJulianDay(e){let t=e.year;return e.era===`AA`&&(t-=Rr),zr(Ir,t,e.month,e.day)}getDaysInMonth(e){return Hr(e.year,e.month)}getMonthsInYear(){return 13}getDaysInYear(e){return 365+Vr(e.year)}getMaximumMonthsInYear(){return 13}getMaximumDaysInMonth(){return 30}getYearsInEra(e){return e.era===`AA`?9999:9991}getEras(){return[`AA`,`AM`]}constructor(){this.identifier=`ethiopic`}},Wr=class extends Ur{fromJulianDay(e){let[t,n,r]=Br(Ir,e);return t+=Rr,new q(this,`AA`,t,n,r)}getEras(){return[`AA`]}getYearsInEra(){return 9999}constructor(...e){super(...e),this.identifier=`ethioaa`}},Gr=class extends Ur{fromJulianDay(e){let[t,n,r]=Br(Lr,e),i=`CE`;return t<=0&&(i=`BCE`,t=1-t),new q(this,i,t,n,r)}toJulianDay(e){let t=e.year;return e.era===`BCE`&&(t=1-t),zr(Lr,t,e.month,e.day)}getDaysInMonth(e){let t=e.year;return e.era===`BCE`&&(t=1-t),Hr(t,e.month)}isInverseEra(e){return e.era===`BCE`}balanceDate(e){e.year<=0&&(e.era=e.era===`BCE`?`CE`:`BCE`,e.year=1-e.year)}getEras(){return[`BCE`,`CE`]}getYearsInEra(e){return e.era===`BCE`?9999:9715}constructor(...e){super(...e),this.identifier=`coptic`}};function Kr(e){switch(e){case`buddhist`:return new Yn;case`ethiopic`:return new Ur;case`ethioaa`:return new Wr;case`coptic`:return new Gr;case`hebrew`:return new Fr;case`indian`:return new sr;case`islamic-civil`:return new hr;case`islamic-tbla`:return new gr;case`islamic-umalqura`:return new wr;case`japanese`:return new Kn;case`persian`:return new ir;case`roc`:return new er;default:return new z}}var qr=new Map,Y=class{constructor(e,t={}){this.formatter=Yr(e,t),this.options=t}format(e){return this.formatter.format(e)}formatToParts(e){return this.formatter.formatToParts(e)}formatRange(e,t){if(typeof this.formatter.formatRange==`function`)return this.formatter.formatRange(e,t);if(t= start date`);return`${this.formatter.format(e)} \u{2013} ${this.formatter.format(t)}`}formatRangeToParts(e,t){if(typeof this.formatter.formatRangeToParts==`function`)return this.formatter.formatRangeToParts(e,t);if(t= start date`);let n=this.formatter.formatToParts(e),r=this.formatter.formatToParts(t);return[...n.map(e=>({...e,source:`startRange`})),{type:`literal`,value:` – `,source:`shared`},...r.map(e=>({...e,source:`endRange`}))]}resolvedOptions(){let e=this.formatter.resolvedOptions();return $r()&&(this.resolvedHourCycle||=ei(e.locale,this.options),e.hourCycle=this.resolvedHourCycle,e.hour12=this.resolvedHourCycle===`h11`||this.resolvedHourCycle===`h12`),e.calendar===`ethiopic-amete-alem`&&(e.calendar=`ethioaa`),e}},Jr={true:{ja:`h11`},false:{}};function Yr(e,t={}){if(typeof t.hour12==`boolean`&&Zr()){t={...t};let n=Jr[String(t.hour12)][e.split(`-`)[0]],r=t.hour12?`h12`:`h23`;t.hourCycle=n??r,delete t.hour12}let n=e+(t?Object.entries(t).sort((e,t)=>e[0]e.type===`hour`).value,10),i=parseInt(n.formatToParts(new Date(2020,2,3,23)).find(e=>e.type===`hour`).value,10);if(r===0&&i===23)return`h23`;if(r===24&&i===23)return`h24`;if(r===0&&i===11)return`h11`;if(r===12&&i===11)return`h12`;throw Error(`Unexpected hour cycle result`)}var X=n(),ti=[`day`,`month`,`year`],ni={hour:1,minute:2,second:3};function ri(e,t){let{autoComplete:n,isDisabled:r,name:a}=e,{visuallyHiddenProps:o}=i({style:{position:`fixed`,top:0,left:0}}),s=60;t.granularity===`second`?s=1:t.granularity===`hour`&&(s=3600);let c=``;t.value&&(c=t.granularity===`day`?U(t.value).toString():W(`timeZone`in t.value?Qt(t.value):t.value).toString());let l=t.granularity===`day`?`date`:`datetime-local`,u=[`hour`,`minute`,`second`],d=0;return u.includes(t.granularity)&&(d=ni[t.granularity],u=u.slice(0,d)),{containerProps:{...o,"aria-hidden":!0,"data-react-aria-prevent-focus":!0,"data-a11y-ignore":`aria-hidden-focus`},inputProps:{tabIndex:-1,autoComplete:n,disabled:r,type:l,form:``,name:a,step:s,value:c,onChange:e=>{let n=fe(e).value.toString();if(n)try{let e=On(n);if(t.granularity===`day`&&(e=Dn(n)),`setSegment`in t)for(let n in e)ti.includes(n)&&t.setSegment(n,e[n]),u.includes(n)&&t.setSegment(n,e[n]);t.setValue(e)}catch{}}}}}function ii(e){let{state:t}=e,{containerProps:n,inputProps:r}=ri({...e},t);return R.createElement(`div`,{...n,"data-testid":`hidden-dateinput-container`},R.createElement(`input`,r))}var ai={};ai={calendar:`التقويم`,day:`يوم`,dayPeriod:`ص/م`,endDate:`تاريخ الانتهاء`,era:`العصر`,hour:`الساعات`,minute:`الدقائق`,month:`الشهر`,second:`الثواني`,selectedDateDescription:e=>`\u{62A}\u{627}\u{631}\u{64A}\u{62E} \u{645}\u{62D}\u{62F}\u{62F}: ${e.date}`,selectedRangeDescription:e=>`\u{627}\u{644}\u{645}\u{62F}\u{649} \u{627}\u{644}\u{632}\u{645}\u{646}\u{64A} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}: ${e.startDate} \u{625}\u{644}\u{649} ${e.endDate}`,selectedTimeDescription:e=>`\u{627}\u{644}\u{648}\u{642}\u{62A} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}: ${e.time}`,startDate:`تاريخ البدء`,timeZoneName:`التوقيت`,weekday:`اليوم`,year:`السنة`};var oi={};oi={calendar:`Календар`,day:`ден`,dayPeriod:`пр.об./сл.об.`,endDate:`Крайна дата`,era:`ера`,hour:`час`,minute:`минута`,month:`месец`,second:`секунда`,selectedDateDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.startDate} \u{434}\u{43E} ${e.endDate}`,selectedTimeDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{43E} \u{432}\u{440}\u{435}\u{43C}\u{435}: ${e.time}`,startDate:`Начална дата`,timeZoneName:`часова зона`,weekday:`ден от седмицата`,year:`година`};var si={};si={calendar:`Kalendář`,day:`den`,dayPeriod:`část dne`,endDate:`Konečné datum`,era:`letopočet`,hour:`hodina`,minute:`minuta`,month:`měsíc`,second:`sekunda`,selectedDateDescription:e=>`Vybran\xe9 datum: ${e.date}`,selectedRangeDescription:e=>`Vybran\xe9 obdob\xed: ${e.startDate} a\u{17E} ${e.endDate}`,selectedTimeDescription:e=>`Vybran\xfd \u{10D}as: ${e.time}`,startDate:`Počáteční datum`,timeZoneName:`časové pásmo`,weekday:`den v týdnu`,year:`rok`};var ci={};ci={calendar:`Kalender`,day:`dag`,dayPeriod:`AM/PM`,endDate:`Slutdato`,era:`æra`,hour:`time`,minute:`minut`,month:`måned`,second:`sekund`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt interval: ${e.startDate} til ${e.endDate}`,selectedTimeDescription:e=>`Valgt tidspunkt: ${e.time}`,startDate:`Startdato`,timeZoneName:`tidszone`,weekday:`ugedag`,year:`år`};var li={};li={calendar:`Kalender`,day:`Tag`,dayPeriod:`Tageshälfte`,endDate:`Enddatum`,era:`Epoche`,hour:`Stunde`,minute:`Minute`,month:`Monat`,second:`Sekunde`,selectedDateDescription:e=>`Ausgew\xe4hltes Datum: ${e.date}`,selectedRangeDescription:e=>`Ausgew\xe4hlter Bereich: ${e.startDate} bis ${e.endDate}`,selectedTimeDescription:e=>`Ausgew\xe4hlte Zeit: ${e.time}`,startDate:`Startdatum`,timeZoneName:`Zeitzone`,weekday:`Wochentag`,year:`Jahr`};var ui={};ui={calendar:`Ημερολόγιο`,day:`ημέρα`,dayPeriod:`π.μ./μ.μ.`,endDate:`Ημερομηνία λήξης`,era:`περίοδος`,hour:`ώρα`,minute:`λεπτό`,month:`μήνας`,second:`δευτερόλεπτο`,selectedDateDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3B7} \u{3B7}\u{3BC}\u{3B5}\u{3C1}\u{3BF}\u{3BC}\u{3B7}\u{3BD}\u{3AF}\u{3B1}: ${e.date}`,selectedRangeDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3BF} \u{3B5}\u{3CD}\u{3C1}\u{3BF}\u{3C2}: ${e.startDate} \u{3AD}\u{3C9}\u{3C2} ${e.endDate}`,selectedTimeDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3B7} \u{3CE}\u{3C1}\u{3B1}: ${e.time}`,startDate:`Ημερομηνία έναρξης`,timeZoneName:`ζώνη ώρας`,weekday:`καθημερινή`,year:`έτος`};var di={};di={era:`era`,year:`year`,month:`month`,day:`day`,hour:`hour`,minute:`minute`,second:`second`,dayPeriod:`AM/PM`,calendar:`Calendar`,startDate:`Start Date`,endDate:`End Date`,weekday:`day of the week`,timeZoneName:`time zone`,selectedDateDescription:e=>`Selected Date: ${e.date}`,selectedRangeDescription:e=>`Selected Range: ${e.startDate} to ${e.endDate}`,selectedTimeDescription:e=>`Selected Time: ${e.time}`};var fi={};fi={calendar:`Calendario`,day:`día`,dayPeriod:`a.\xA0m./p.\xA0m.`,endDate:`Fecha final`,era:`era`,hour:`hora`,minute:`minuto`,month:`mes`,second:`segundo`,selectedDateDescription:e=>`Fecha seleccionada: ${e.date}`,selectedRangeDescription:e=>`Rango seleccionado: ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Hora seleccionada: ${e.time}`,startDate:`Fecha de inicio`,timeZoneName:`zona horaria`,weekday:`día de la semana`,year:`año`};var pi={};pi={calendar:`Kalender`,day:`päev`,dayPeriod:`enne/pärast lõunat`,endDate:`Lõppkuupäev`,era:`ajastu`,hour:`tund`,minute:`minut`,month:`kuu`,second:`sekund`,selectedDateDescription:e=>`Valitud kuup\xe4ev: ${e.date}`,selectedRangeDescription:e=>`Valitud vahemik: ${e.startDate} kuni ${e.endDate}`,selectedTimeDescription:e=>`Valitud aeg: ${e.time}`,startDate:`Alguskuupäev`,timeZoneName:`ajavöönd`,weekday:`nädalapäev`,year:`aasta`};var mi={};mi={calendar:`Kalenteri`,day:`päivä`,dayPeriod:`vuorokaudenaika`,endDate:`Päättymispäivä`,era:`aikakausi`,hour:`tunti`,minute:`minuutti`,month:`kuukausi`,second:`sekunti`,selectedDateDescription:e=>`Valittu p\xe4iv\xe4m\xe4\xe4r\xe4: ${e.date}`,selectedRangeDescription:e=>`Valittu aikav\xe4li: ${e.startDate} \u{2013} ${e.endDate}`,selectedTimeDescription:e=>`Valittu aika: ${e.time}`,startDate:`Alkamispäivä`,timeZoneName:`aikavyöhyke`,weekday:`viikonpäivä`,year:`vuosi`};var hi={};hi={calendar:`Calendrier`,day:`jour`,dayPeriod:`cadran`,endDate:`Date de fin`,era:`ère`,hour:`heure`,minute:`minute`,month:`mois`,second:`seconde`,selectedDateDescription:e=>`Date s\xe9lectionn\xe9e\xa0: ${e.date}`,selectedRangeDescription:e=>`Plage s\xe9lectionn\xe9e\xa0: ${e.startDate} au ${e.endDate}`,selectedTimeDescription:e=>`Heure choisie\xa0: ${e.time}`,startDate:`Date de début`,timeZoneName:`fuseau horaire`,weekday:`jour de la semaine`,year:`année`};var gi={};gi={calendar:`לוח שנה`,day:`יום`,dayPeriod:`לפנה״צ/אחה״צ`,endDate:`תאריך סיום`,era:`תקופה`,hour:`שעה`,minute:`דקה`,month:`חודש`,second:`שנייה`,selectedDateDescription:e=>`\u{5EA}\u{5D0}\u{5E8}\u{5D9}\u{5DA} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.date}`,selectedRangeDescription:e=>`\u{5D8}\u{5D5}\u{5D5}\u{5D7} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.startDate} \u{5E2}\u{5D3} ${e.endDate}`,selectedTimeDescription:e=>`\u{5D6}\u{5DE}\u{5DF} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.time}`,startDate:`תאריך התחלה`,timeZoneName:`אזור זמן`,weekday:`יום בשבוע`,year:`שנה`};var _i={};_i={calendar:`Kalendar`,day:`dan`,dayPeriod:`AM/PM`,endDate:`Datum završetka`,era:`era`,hour:`sat`,minute:`minuta`,month:`mjesec`,second:`sekunda`,selectedDateDescription:e=>`Odabrani datum: ${e.date}`,selectedRangeDescription:e=>`Odabrani raspon: ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Odabrano vrijeme: ${e.time}`,startDate:`Datum početka`,timeZoneName:`vremenska zona`,weekday:`dan u tjednu`,year:`godina`};var vi={};vi={calendar:`Naptár`,day:`nap`,dayPeriod:`napszak`,endDate:`Befejező dátum`,era:`éra`,hour:`óra`,minute:`perc`,month:`hónap`,second:`másodperc`,selectedDateDescription:e=>`Kijel\xf6lt d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Kijel\xf6lt tartom\xe1ny: ${e.startDate}\u{2013}${e.endDate}`,selectedTimeDescription:e=>`Kijel\xf6lt id\u{151}: ${e.time}`,startDate:`Kezdő dátum`,timeZoneName:`időzóna`,weekday:`hét napja`,year:`év`};var yi={};yi={calendar:`Calendario`,day:`giorno`,dayPeriod:`AM/PM`,endDate:`Data finale`,era:`era`,hour:`ora`,minute:`minuto`,month:`mese`,second:`secondo`,selectedDateDescription:e=>`Data selezionata: ${e.date}`,selectedRangeDescription:e=>`Intervallo selezionato: da ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Ora selezionata: ${e.time}`,startDate:`Data iniziale`,timeZoneName:`fuso orario`,weekday:`giorno della settimana`,year:`anno`};var bi={};bi={calendar:`カレンダー`,day:`日`,dayPeriod:`午前/午後`,endDate:`終了日`,era:`時代`,hour:`時`,minute:`分`,month:`月`,second:`秒`,selectedDateDescription:e=>`\u{9078}\u{629E}\u{3057}\u{305F}\u{65E5}\u{4ED8} : ${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{629E}\u{7BC4}\u{56F2} : ${e.startDate} \u{304B}\u{3089} ${e.endDate}`,selectedTimeDescription:e=>`\u{9078}\u{629E}\u{3057}\u{305F}\u{6642}\u{9593} : ${e.time}`,startDate:`開始日`,timeZoneName:`タイムゾーン`,weekday:`曜日`,year:`年`};var xi={};xi={calendar:`달력`,day:`일`,dayPeriod:`오전/오후`,endDate:`종료일`,era:`연호`,hour:`시`,minute:`분`,month:`월`,second:`초`,selectedDateDescription:e=>`\u{C120}\u{D0DD} \u{C77C}\u{C790}: ${e.date}`,selectedRangeDescription:e=>`\u{C120}\u{D0DD} \u{BC94}\u{C704}: ${e.startDate} ~ ${e.endDate}`,selectedTimeDescription:e=>`\u{C120}\u{D0DD} \u{C2DC}\u{AC04}: ${e.time}`,startDate:`시작일`,timeZoneName:`시간대`,weekday:`요일`,year:`년`};var Si={};Si={calendar:`Kalendorius`,day:`diena`,dayPeriod:`iki pietų / po pietų`,endDate:`Pabaigos data`,era:`era`,hour:`valanda`,minute:`minutė`,month:`mėnuo`,second:`sekundė`,selectedDateDescription:e=>`Pasirinkta data: ${e.date}`,selectedRangeDescription:e=>`Pasirinktas intervalas: nuo ${e.startDate} iki ${e.endDate}`,selectedTimeDescription:e=>`Pasirinktas laikas: ${e.time}`,startDate:`Pradžios data`,timeZoneName:`laiko juosta`,weekday:`savaitės diena`,year:`metai`};var Ci={};Ci={calendar:`Kalendārs`,day:`diena`,dayPeriod:`priekšpusdienā/pēcpusdienā`,endDate:`Beigu datums`,era:`ēra`,hour:`stundas`,minute:`minūtes`,month:`mēnesis`,second:`sekundes`,selectedDateDescription:e=>`Atlas\u{12B}tais datums: ${e.date}`,selectedRangeDescription:e=>`Atlas\u{12B}tais diapazons: no ${e.startDate} l\u{12B}dz ${e.endDate}`,selectedTimeDescription:e=>`Atlas\u{12B}tais laiks: ${e.time}`,startDate:`Sākuma datums`,timeZoneName:`laika josla`,weekday:`nedēļas diena`,year:`gads`};var wi={};wi={calendar:`Kalender`,day:`dag`,dayPeriod:`a.m./p.m.`,endDate:`Sluttdato`,era:`tidsalder`,hour:`time`,minute:`minutt`,month:`måned`,second:`sekund`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt omr\xe5de: ${e.startDate} til ${e.endDate}`,selectedTimeDescription:e=>`Valgt tid: ${e.time}`,startDate:`Startdato`,timeZoneName:`tidssone`,weekday:`ukedag`,year:`år`};var Ti={};Ti={calendar:`Kalender`,day:`dag`,dayPeriod:`a.m./p.m.`,endDate:`Einddatum`,era:`tijdperk`,hour:`uur`,minute:`minuut`,month:`maand`,second:`seconde`,selectedDateDescription:e=>`Geselecteerde datum: ${e.date}`,selectedRangeDescription:e=>`Geselecteerd bereik: ${e.startDate} tot ${e.endDate}`,selectedTimeDescription:e=>`Geselecteerde tijd: ${e.time}`,startDate:`Startdatum`,timeZoneName:`tijdzone`,weekday:`dag van de week`,year:`jaar`};var Ei={};Ei={calendar:`Kalendarz`,day:`dzień`,dayPeriod:`rano / po południu / wieczorem`,endDate:`Data końcowa`,era:`era`,hour:`godzina`,minute:`minuta`,month:`miesiąc`,second:`sekunda`,selectedDateDescription:e=>`Wybrana data: ${e.date}`,selectedRangeDescription:e=>`Wybrany zakres: ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Wybrany czas: ${e.time}`,startDate:`Data początkowa`,timeZoneName:`strefa czasowa`,weekday:`dzień tygodnia`,year:`rok`};var Di={};Di={calendar:`Calendário`,day:`dia`,dayPeriod:`AM/PM`,endDate:`Data final`,era:`era`,hour:`hora`,minute:`minuto`,month:`mês`,second:`segundo`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Hora selecionada: ${e.time}`,startDate:`Data inicial`,timeZoneName:`fuso horário`,weekday:`dia da semana`,year:`ano`};var Oi={};Oi={calendar:`Calendário`,day:`dia`,dayPeriod:`am/pm`,endDate:`Data de Término`,era:`era`,hour:`hora`,minute:`minuto`,month:`mês`,second:`segundo`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Hora selecionada: ${e.time}`,startDate:`Data de Início`,timeZoneName:`fuso horário`,weekday:`dia da semana`,year:`ano`};var ki={};ki={calendar:`Calendar`,day:`zi`,dayPeriod:`a.m/p.m.`,endDate:`Dată final`,era:`eră`,hour:`oră`,minute:`minut`,month:`lună`,second:`secundă`,selectedDateDescription:e=>`Dat\u{103} selectat\u{103}: ${e.date}`,selectedRangeDescription:e=>`Interval selectat: de la ${e.startDate} p\xe2n\u{103} la ${e.endDate}`,selectedTimeDescription:e=>`Ora selectat\u{103}: ${e.time}`,startDate:`Dată început`,timeZoneName:`fus orar`,weekday:`ziua din săptămână`,year:`an`};var Ai={};Ai={calendar:`Календарь`,day:`день`,dayPeriod:`AM/PM`,endDate:`Дата окончания`,era:`эра`,hour:`час`,minute:`минута`,month:`месяц`,second:`секунда`,selectedDateDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{430}\u{44F} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{44B}\u{439} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: \u{441} ${e.startDate} \u{43F}\u{43E} ${e.endDate}`,selectedTimeDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{43E}\u{435} \u{432}\u{440}\u{435}\u{43C}\u{44F}: ${e.time}`,startDate:`Дата начала`,timeZoneName:`часовой пояс`,weekday:`день недели`,year:`год`};var ji={};ji={calendar:`Kalendár`,day:`deň`,dayPeriod:`AM/PM`,endDate:`Dátum ukončenia`,era:`letopočet`,hour:`hodina`,minute:`minúta`,month:`mesiac`,second:`sekunda`,selectedDateDescription:e=>`Vybrat\xfd d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Vybrat\xfd rozsah: od ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Vybrat\xfd \u{10D}as: ${e.time}`,startDate:`Dátum začatia`,timeZoneName:`časové pásmo`,weekday:`deň týždňa`,year:`rok`};var Mi={};Mi={calendar:`Koledar`,day:`dan`,dayPeriod:`dop/pop`,endDate:`Datum konca`,era:`doba`,hour:`ura`,minute:`minuta`,month:`mesec`,second:`sekunda`,selectedDateDescription:e=>`Izbrani datum: ${e.date}`,selectedRangeDescription:e=>`Izbrano obmo\u{10D}je: ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Izbrani \u{10D}as: ${e.time}`,startDate:`Datum začetka`,timeZoneName:`časovni pas`,weekday:`dan v tednu`,year:`leto`};var Ni={};Ni={calendar:`Kalendar`,day:`дан`,dayPeriod:`пре подне/по подне`,endDate:`Datum završetka`,era:`ера`,hour:`сат`,minute:`минут`,month:`месец`,second:`секунд`,selectedDateDescription:e=>`Izabrani datum: ${e.date}`,selectedRangeDescription:e=>`Izabrani opseg: od ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Izabrano vreme: ${e.time}`,startDate:`Datum početka`,timeZoneName:`временска зона`,weekday:`дан у недељи`,year:`година`};var Pi={};Pi={calendar:`Kalender`,day:`dag`,dayPeriod:`fm/em`,endDate:`Slutdatum`,era:`era`,hour:`timme`,minute:`minut`,month:`månad`,second:`sekund`,selectedDateDescription:e=>`Valt datum: ${e.date}`,selectedRangeDescription:e=>`Valt intervall: ${e.startDate} till ${e.endDate}`,selectedTimeDescription:e=>`Vald tid: ${e.time}`,startDate:`Startdatum`,timeZoneName:`tidszon`,weekday:`veckodag`,year:`år`};var Fi={};Fi={calendar:`Takvim`,day:`gün`,dayPeriod:`ÖÖ/ÖS`,endDate:`Bitiş Tarihi`,era:`çağ`,hour:`saat`,minute:`dakika`,month:`ay`,second:`saniye`,selectedDateDescription:e=>`Se\xe7ilen Tarih: ${e.date}`,selectedRangeDescription:e=>`Se\xe7ilen Aral\u{131}k: ${e.startDate} - ${e.endDate}`,selectedTimeDescription:e=>`Se\xe7ilen Zaman: ${e.time}`,startDate:`Başlangıç Tarihi`,timeZoneName:`saat dilimi`,weekday:`haftanın günü`,year:`yıl`};var Ii={};Ii={calendar:`Календар`,day:`день`,dayPeriod:`дп/пп`,endDate:`Дата завершення`,era:`ера`,hour:`година`,minute:`хвилина`,month:`місяць`,second:`секунда`,selectedDateDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{438}\u{439} \u{434}\u{456}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.startDate} \u{2014} ${e.endDate}`,selectedTimeDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{438}\u{439} \u{447}\u{430}\u{441}: ${e.time}`,startDate:`Дата початку`,timeZoneName:`часовий пояс`,weekday:`день тижня`,year:`рік`};var Li={};Li={calendar:`日历`,day:`日`,dayPeriod:`上午/下午`,endDate:`结束日期`,era:`纪元`,hour:`小时`,minute:`分钟`,month:`月`,second:`秒`,selectedDateDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{8303}\u{56F4}\u{FF1A}${e.startDate} \u{81F3} ${e.endDate}`,selectedTimeDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{65F6}\u{95F4}\u{FF1A}${e.time}`,startDate:`开始日期`,timeZoneName:`时区`,weekday:`工作日`,year:`年`};var Ri={};Ri={calendar:`日曆`,day:`日`,dayPeriod:`上午/下午`,endDate:`結束日期`,era:`纪元`,hour:`小时`,minute:`分钟`,month:`月`,second:`秒`,selectedDateDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{7BC4}\u{570D}\u{FF1A}${e.startDate} \u{81F3} ${e.endDate}`,selectedTimeDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{6642}\u{9593}\u{FF1A}${e.time}`,startDate:`開始日期`,timeZoneName:`时区`,weekday:`工作日`,year:`年`};var zi={};zi={"ar-AE":ai,"bg-BG":oi,"cs-CZ":si,"da-DK":ci,"de-DE":li,"el-GR":ui,"en-US":di,"es-ES":fi,"et-EE":pi,"fi-FI":mi,"fr-FR":hi,"he-IL":gi,"hr-HR":_i,"hu-HU":vi,"it-IT":yi,"ja-JP":bi,"ko-KR":xi,"lt-LT":Si,"lv-LV":Ci,"nb-NO":wi,"nl-NL":Ti,"pl-PL":Ei,"pt-BR":Di,"pt-PT":Oi,"ro-RO":ki,"ru-RU":Ai,"sk-SK":ji,"sl-SI":Mi,"sr-SP":Ni,"sv-SE":Pi,"tr-TR":Fi,"uk-UA":Ii,"zh-CN":Li,"zh-TW":Ri};function Bi(e,t,n){let{direction:r}=F(),i=(0,R.useMemo)(()=>de(t),[t]),{keyboardProps:a}=he({shortcuts:{"Alt+ArrowDown":()=>{if(`setOpen`in e){e.setOpen(!0);return}return!1},"Alt+ArrowUp":()=>{if(`setOpen`in e){e.setOpen(!0);return}return!1},ArrowLeft:e=>{if(n)return!1;if(r===`rtl`){if(t.current){let n=fe(e),r=Vi(t.current,n.getBoundingClientRect().left,-1);if(r){r.focus();return}}}else{i.focusPrevious();return}return!1},ArrowRight:e=>{if(n)return!1;if(r===`rtl`){if(t.current){let n=fe(e),r=Vi(t.current,n.getBoundingClientRect().left,1);if(r){r.focus();return}}}else{i.focusNext();return}return!1}},allowRepeats:!0}),o=()=>{if(!t.current)return;let e=window.event?fe(window.event):null,n=re(t.current,{tabbable:!0});if(e&&=(n.currentNode=e,n.previousNode()),!e){let t;do t=n.lastChild(),t&&(e=t);while(t)}for(;e?.hasAttribute(`data-placeholder`);){let t=n.previousNode();if(t&&t.hasAttribute(`data-placeholder`))e=t;else break}e&&e.focus()},{pressProps:s}=ue({preventFocusOnPress:!0,allowTextSelectionOnPress:!0,onPressStart(e){e.pointerType===`mouse`&&o()},onPress(e){(e.pointerType===`touch`||e.pointerType===`pen`)&&o()}});return D(s,a)}function Vi(e,t,n){let r=re(e,{tabbable:!0}),i=r.nextNode(),a=null,o=1/0;for(;i;){let e=i.getBoundingClientRect().left-t,s=Math.abs(e);Math.sign(e)===n&&s{t.confirmPlaceholder(),t.value!==u.current&&t.commitValidation(),e.onBlur?.(n)},onFocusWithinChange:e.onFocusChange}),f=h(Hi(zi),`@react-aria/datepicker`),p=t.maxGranularity===`hour`?`selectedTimeDescription`:`selectedDateDescription`,m=t.maxGranularity===`hour`?`time`:`date`,g=t.value?f.format(p,{[m]:t.formatValue({month:`long`})}):``,_=Ge(g),v=e.__reactAriaDateFieldRole===`presentation`?s[`aria-describedby`]:[_[`aria-describedby`],s[`aria-describedby`]].filter(Boolean).join(` `)||void 0,y=e[Gi],b=(0,R.useMemo)(()=>y||de(n),[y,n]),x=Bi(t,n,e[Wi]===`presentation`);Ui.set(t,{ariaLabel:e[`aria-label`],ariaLabelledBy:[o.id,e[`aria-labelledby`]].filter(Boolean).join(` `)||void 0,ariaDescribedBy:v,focusManager:b});let S=(0,R.useRef)(e.autoFocus),C;C=e.__reactAriaDateFieldRole===`presentation`?{role:`presentation`}:D(s,{role:`group`,"aria-disabled":e.isDisabled||void 0,"aria-describedby":v}),(0,R.useEffect)(()=>{S.current&&b.focusFirst(),S.current=!1},[b]),Ne(e.inputRef,t.defaultValue,t.setValue),ve({...e,focus(){b.focusFirst()}},t,e.inputRef);let w={type:`hidden`,name:e.name,form:e.form,value:t.value?.toString()||``,disabled:e.isDisabled};e.validationBehavior===`native`&&(w.type=`text`,w.hidden=!0,w.required=e.isRequired,w.onChange=()=>{});let T=I(e);return{labelProps:{...o,onClick:()=>{b.focusFirst()}},fieldProps:D(T,C,x,d,{onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,style:{unicodeBidi:`isolate`}}),inputProps:w,descriptionProps:c,errorMessageProps:l,isInvalid:r,validationErrors:i,validationDetails:a}}function qi(e,t,n){let r=Ki(e,t,n);return r.inputProps.value=t.timeValue?.toString()||``,r}function Z(e){e=Ye(e??{},Ji);let{locale:t}=F();return(0,R.useMemo)(()=>new Y(t,e),[t,e])}function Ji(e,t){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(t[r]!==e[r])return!1;return!0}function Yi(e){return e&&e.__esModule?e.default:e}function Xi(){let{locale:e}=F(),t=c(Yi(zi),`@react-aria/datepicker`);return(0,R.useMemo)(()=>{try{return new Intl.DisplayNames(e,{type:`dateTimeField`})}catch{return new Zi(e,t)}},[e,t])}var Zi=class{constructor(e,t){this.locale=e,this.dictionary=t}of(e){return this.dictionary.getStringForLocale(e,this.locale)}};function Qi(e,t,n){let r=(0,R.useRef)(``),{locale:i,direction:a}=F(),o=Xi(),{ariaLabel:s,ariaLabelledBy:c,ariaDescribedBy:l,focusManager:u}=Ui.get(t),d=e.isPlaceholder?``:e.text,f=(0,R.useMemo)(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),p=Z({month:`long`,timeZone:f.timeZone}),m=Z({hour:`numeric`,hour12:f.hour12,timeZone:f.timeZone});if(e.type===`month`&&!e.isPlaceholder){let e=p.format(t.dateValue);d=e===d?e:`${d} \u{2013} ${e}`}else e.type===`hour`&&!e.isPlaceholder&&(d=m.format(t.dateValue));let{spinButtonProps:h}=Ie({value:e.value??void 0,textValue:d,minValue:e.minValue,maxValue:e.maxValue,isDisabled:t.isDisabled,isReadOnly:t.isReadOnly||!e.isEditable,isRequired:t.isRequired,onIncrement:()=>{r.current=``,t.increment(e.type)},onDecrement:()=>{r.current=``,t.decrement(e.type)},onIncrementPage:()=>{r.current=``,t.incrementPage(e.type)},onDecrementPage:()=>{r.current=``,t.decrementPage(e.type)},onIncrementToMax:()=>{r.current=``,t.incrementToMax(e.type)},onDecrementToMin:()=>{r.current=``,t.decrementToMin(e.type)}}),v=(0,R.useMemo)(()=>new Pe(i,{maximumFractionDigits:0}),[i]),y=()=>{if(e.text===e.placeholder&&u.focusPrevious(),v.isValidPartialNumber(e.text)&&!t.isReadOnly&&!e.isPlaceholder){let n=e.text.slice(0,-1),i=v.parse(n);n=i===0?``:n,n.length===0||i===0?t.clearSegment(e.type):t.setSegment(e.type,i),r.current=n}else(e.type===`dayPeriod`||e.type===`era`)&&t.clearSegment(e.type)},{keyboardProps:x}=he({shortcuts:{Backspace:()=>{y()},Delete:()=>{y()},"Mod+a":()=>{}},allowRepeats:!0}),{startsWith:S}=nt({sensitivity:`base`}),w=Z({hour:`numeric`,hour12:!0}),T=(0,R.useMemo)(()=>{let e=new Date;return e.setHours(0),w.formatToParts(e).find(e=>e.type===`dayPeriod`).value},[w]),E=(0,R.useMemo)(()=>{let e=new Date;return e.setHours(12),w.formatToParts(e).find(e=>e.type===`dayPeriod`).value},[w]),O=Z({year:`numeric`,era:`narrow`,timeZone:`UTC`}),k=(0,R.useMemo)(()=>{if(e.type!==`era`)return[];let n=G(new q(1,1,1),t.calendar),r=t.calendar.getEras().map(e=>{let t=n.set({year:1,month:1,day:1,era:e}).toDate(`UTC`);return{era:e,formatted:O.formatToParts(t).find(e=>e.type===`era`).value}}),i=$i(r.map(e=>e.formatted));if(i)for(let e of r)e.formatted=e.formatted.slice(i);return r},[O,t.calendar,e.type]),A=n=>{if(t.isDisabled||t.isReadOnly)return;let i=r.current+n;switch(e.type){case`dayPeriod`:if(S(T,n))t.setSegment(`dayPeriod`,0);else if(S(E,n))t.setSegment(`dayPeriod`,1);else break;u.focusNext();break;case`era`:{let e=k.find(e=>S(e.formatted,n));e&&(t.setSegment(`era`,e.era),u.focusNext());break}case`day`:case`hour`:case`minute`:case`second`:case`month`:case`year`:{if(!v.isValidPartialNumber(i))return;let a=v.parse(i),o=a;if(e.maxValue!==void 0&&a>e.maxValue&&(o=v.parse(n)),isNaN(a))return;t.setSegment(e.type,o),e.maxValue!==void 0&&(Number(a+`0`)>e.maxValue||i.length>=String(e.maxValue).length)?(r.current=``,u.focusNext()):r.current=i;break}}},ee=()=>{r.current=``,n.current&&Ue(n.current,{containingElement:He(n.current)}),window.getSelection()?.collapse(n.current)},te=(0,R.useRef)(typeof document<`u`?document:null);g(te,`selectionchange`,()=>{let e=window.getSelection();e?.anchorNode&&ne(n.current,e?.anchorNode)&&b()===n.current&&e.collapse(n.current)});let j=(0,R.useRef)(``);g(n,`beforeinput`,r=>{if(n.current)switch(r.preventDefault(),r.inputType){case`deleteContentBackward`:case`deleteContentForward`:v.isValidPartialNumber(e.text)&&!t.isReadOnly&&y();break;case`insertCompositionText`:j.current=n.current.textContent,n.current.textContent=n.current.textContent;break;default:r.data!=null&&A(r.data)}}),g(n,`input`,e=>{let{inputType:t,data:r}=e;t===`insertCompositionText`&&(n.current&&(n.current.textContent=j.current),r!=null&&(S(T,r)||S(E,r))&&A(r))}),ae(()=>{let e=n.current;return()=>{b()===e&&(u.focusPrevious()||u.focusNext())}},[n,u]);let M=C()||e.type===`timeZoneName`?{role:`textbox`,"aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e!==(0,R.useMemo)(()=>t.segments.find(e=>e.isEditable),[t.segments])&&!t.isInvalid&&(l=void 0);let re=le(),N=!t.isDisabled&&!t.isReadOnly&&e.isEditable,ie=e.type===`literal`?``:o.of(e.type),P=_({"aria-label":`${ie}${s?`, ${s}`:``}${c?`, `:``}`,"aria-labelledby":c});if(e.type===`literal`)return{segmentProps:{"aria-hidden":!0}};let oe={caretColor:`transparent`};if(a===`rtl`){oe.unicodeBidi=`embed`;let t=f[e.type];(t===`numeric`||t===`2-digit`)&&(oe.direction=`ltr`)}return{segmentProps:D(h,P,{id:re,...M,...x,"aria-invalid":t.isInvalid?`true`:void 0,"aria-describedby":l,"aria-readonly":t.isReadOnly||!e.isEditable?`true`:void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:N,suppressContentEditableWarning:N,spellCheck:N?`false`:void 0,autoCorrect:N?`off`:void 0,enterKeyHint:N?`next`:void 0,inputMode:t.isDisabled||e.type===`dayPeriod`||e.type===`era`||!N?void 0:`numeric`,tabIndex:t.isDisabled?void 0:0,onFocus:ee,style:oe,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}function $i(e){e.sort();let t=e[0],n=e[e.length-1];for(let e=0;e`\u{64A}\u{62C}\u{628} \u{623}\u{646} \u{62A}\u{643}\u{648}\u{646} \u{627}\u{644}\u{642}\u{64A}\u{645}\u{629} ${e.maxValue} \u{623}\u{648} \u{642}\u{628}\u{644} \u{630}\u{644}\u{643}.`,rangeReversed:`تاريخ البدء يجب أن يكون قبل تاريخ الانتهاء.`,rangeUnderflow:e=>`\u{64A}\u{62C}\u{628} \u{623}\u{646} \u{62A}\u{643}\u{648}\u{646} \u{627}\u{644}\u{642}\u{64A}\u{645}\u{629} ${e.minValue} \u{623}\u{648} \u{628}\u{639}\u{62F} \u{630}\u{644}\u{643}.`,unavailableDate:`البيانات المحددة غير متاحة.`};var ta={};ta={rangeOverflow:e=>`\u{421}\u{442}\u{43E}\u{439}\u{43D}\u{43E}\u{441}\u{442}\u{442}\u{430} \u{442}\u{440}\u{44F}\u{431}\u{432}\u{430} \u{434}\u{430} \u{435} ${e.maxValue} \u{438}\u{43B}\u{438} \u{43F}\u{43E}-\u{440}\u{430}\u{43D}\u{43D}\u{430}.`,rangeReversed:`Началната дата трябва да е преди крайната.`,rangeUnderflow:e=>`\u{421}\u{442}\u{43E}\u{439}\u{43D}\u{43E}\u{441}\u{442}\u{442}\u{430} \u{442}\u{440}\u{44F}\u{431}\u{432}\u{430} \u{434}\u{430} \u{435} ${e.minValue} \u{438}\u{43B}\u{438} \u{43F}\u{43E}-\u{43A}\u{44A}\u{441}\u{43D}\u{43E}.`,unavailableDate:`Избраната дата не е налична.`};var na={};na={rangeOverflow:e=>`Hodnota mus\xed b\xfdt ${e.maxValue} nebo d\u{159}\xedv\u{11B}j\u{161}\xed.`,rangeReversed:`Datum zahájení musí předcházet datu ukončení.`,rangeUnderflow:e=>`Hodnota mus\xed b\xfdt ${e.minValue} nebo pozd\u{11B}j\u{161}\xed.`,unavailableDate:`Vybrané datum není k dispozici.`};var ra={};ra={rangeOverflow:e=>`V\xe6rdien skal v\xe6re ${e.maxValue} eller tidligere.`,rangeReversed:`Startdatoen skal være før slutdatoen.`,rangeUnderflow:e=>`V\xe6rdien skal v\xe6re ${e.minValue} eller nyere.`,unavailableDate:`Den valgte dato er ikke tilgængelig.`};var ia={};ia={rangeOverflow:e=>`Der Wert muss ${e.maxValue} oder fr\xfcher sein.`,rangeReversed:`Das Startdatum muss vor dem Enddatum liegen.`,rangeUnderflow:e=>`Der Wert muss ${e.minValue} oder sp\xe4ter sein.`,unavailableDate:`Das ausgewählte Datum ist nicht verfügbar.`};var aa={};aa={rangeOverflow:e=>`\u{397} \u{3C4}\u{3B9}\u{3BC}\u{3AE} \u{3C0}\u{3C1}\u{3AD}\u{3C0}\u{3B5}\u{3B9} \u{3BD}\u{3B1} \u{3B5}\u{3AF}\u{3BD}\u{3B1}\u{3B9} ${e.maxValue} \u{3AE} \u{3C0}\u{3B1}\u{3BB}\u{3B1}\u{3B9}\u{3CC}\u{3C4}\u{3B5}\u{3C1}\u{3B7}.`,rangeReversed:`Η ημερομηνία έναρξης πρέπει να είναι πριν από την ημερομηνία λήξης.`,rangeUnderflow:e=>`\u{397} \u{3C4}\u{3B9}\u{3BC}\u{3AE} \u{3C0}\u{3C1}\u{3AD}\u{3C0}\u{3B5}\u{3B9} \u{3BD}\u{3B1} \u{3B5}\u{3AF}\u{3BD}\u{3B1}\u{3B9} ${e.minValue} \u{3AE} \u{3BC}\u{3B5}\u{3C4}\u{3B1}\u{3B3}\u{3B5}\u{3BD}\u{3AD}\u{3C3}\u{3C4}\u{3B5}\u{3C1}\u{3B7}.`,unavailableDate:`Η επιλεγμένη ημερομηνία δεν είναι διαθέσιμη.`};var oa={};oa={rangeUnderflow:e=>`Value must be ${e.minValue} or later.`,rangeOverflow:e=>`Value must be ${e.maxValue} or earlier.`,rangeReversed:`Start date must be before end date.`,unavailableDate:`Selected date unavailable.`};var sa={};sa={rangeOverflow:e=>`El valor debe ser ${e.maxValue} o anterior.`,rangeReversed:`La fecha de inicio debe ser anterior a la fecha de finalización.`,rangeUnderflow:e=>`El valor debe ser ${e.minValue} o posterior.`,unavailableDate:`Fecha seleccionada no disponible.`};var ca={};ca={rangeOverflow:e=>`V\xe4\xe4rtus peab olema ${e.maxValue} v\xf5i varasem.`,rangeReversed:`Alguskuupäev peab olema enne lõppkuupäeva.`,rangeUnderflow:e=>`V\xe4\xe4rtus peab olema ${e.minValue} v\xf5i hilisem.`,unavailableDate:`Valitud kuupäev pole saadaval.`};var la={};la={rangeOverflow:e=>`Arvon on oltava ${e.maxValue} tai sit\xe4 aikaisempi.`,rangeReversed:`Aloituspäivän on oltava ennen lopetuspäivää.`,rangeUnderflow:e=>`Arvon on oltava ${e.minValue} tai sit\xe4 my\xf6h\xe4isempi.`,unavailableDate:`Valittu päivämäärä ei ole käytettävissä.`};var ua={};ua={rangeOverflow:e=>`La valeur doit \xeatre ${e.maxValue} ou ant\xe9rieure.`,rangeReversed:`La date de début doit être antérieure à la date de fin.`,rangeUnderflow:e=>`La valeur doit \xeatre ${e.minValue} ou ult\xe9rieure.`,unavailableDate:`La date sélectionnée n’est pas disponible.`};var da={};da={rangeOverflow:e=>`\u{5D4}\u{5E2}\u{5E8}\u{5DA} \u{5D7}\u{5D9}\u{5D9}\u{5D1} \u{5DC}\u{5D4}\u{5D9}\u{5D5}\u{5EA} ${e.maxValue} \u{5D0}\u{5D5} \u{5DE}\u{5D5}\u{5E7}\u{5D3}\u{5DD} \u{5D9}\u{5D5}\u{5EA}\u{5E8}.`,rangeReversed:`תאריך ההתחלה חייב להיות לפני תאריך הסיום.`,rangeUnderflow:e=>`\u{5D4}\u{5E2}\u{5E8}\u{5DA} \u{5D7}\u{5D9}\u{5D9}\u{5D1} \u{5DC}\u{5D4}\u{5D9}\u{5D5}\u{5EA} ${e.minValue} \u{5D0}\u{5D5} \u{5DE}\u{5D0}\u{5D5}\u{5D7}\u{5E8} \u{5D9}\u{5D5}\u{5EA}\u{5E8}.`,unavailableDate:`התאריך הנבחר אינו זמין.`};var fa={};fa={rangeOverflow:e=>`Vrijednost mora biti ${e.maxValue} ili ranije.`,rangeReversed:`Datum početka mora biti prije datuma završetka.`,rangeUnderflow:e=>`Vrijednost mora biti ${e.minValue} ili kasnije.`,unavailableDate:`Odabrani datum nije dostupan.`};var pa={};pa={rangeOverflow:e=>`Az \xe9rt\xe9knek ${e.maxValue} vagy kor\xe1bbinak kell lennie.`,rangeReversed:`A kezdő dátumnak a befejező dátumnál korábbinak kell lennie.`,rangeUnderflow:e=>`Az \xe9rt\xe9knek ${e.minValue} vagy k\xe9s\u{151}bbinek kell lennie.`,unavailableDate:`A kiválasztott dátum nem érhető el.`};var ma={};ma={rangeOverflow:e=>`Il valore deve essere ${e.maxValue} o precedente.`,rangeReversed:`La data di inizio deve essere antecedente alla data di fine.`,rangeUnderflow:e=>`Il valore deve essere ${e.minValue} o successivo.`,unavailableDate:`Data selezionata non disponibile.`};var ha={};ha={rangeOverflow:e=>`\u{5024}\u{306F} ${e.maxValue} \u{4EE5}\u{4E0B}\u{306B}\u{3059}\u{308B}\u{5FC5}\u{8981}\u{304C}\u{3042}\u{308A}\u{307E}\u{3059}\u{3002}`,rangeReversed:`開始日は終了日より前にする必要があります。`,rangeUnderflow:e=>`\u{5024}\u{306F} ${e.minValue} \u{4EE5}\u{4E0A}\u{306B}\u{3059}\u{308B}\u{5FC5}\u{8981}\u{304C}\u{3042}\u{308A}\u{307E}\u{3059}\u{3002}`,unavailableDate:`選択した日付は使用できません。`};var ga={};ga={rangeOverflow:e=>`\u{AC12}\u{C740} ${e.maxValue} \u{C774}\u{C804}\u{C774}\u{C5B4}\u{C57C} \u{D569}\u{B2C8}\u{B2E4}.`,rangeReversed:`시작일은 종료일 이전이어야 합니다.`,rangeUnderflow:e=>`\u{AC12}\u{C740} ${e.minValue} \u{C774}\u{D6C4}\u{C5EC}\u{C57C} \u{D569}\u{B2C8}\u{B2E4}.`,unavailableDate:`선택한 날짜를 사용할 수 없습니다.`};var _a={};_a={rangeOverflow:e=>`Reik\u{161}m\u{117} turi b\u{16B}ti ${e.maxValue} arba ankstesn\u{117}.`,rangeReversed:`Pradžios data turi būti ankstesnė nei pabaigos data.`,rangeUnderflow:e=>`Reik\u{161}m\u{117} turi b\u{16B}ti ${e.minValue} arba naujesn\u{117}.`,unavailableDate:`Pasirinkta data nepasiekiama.`};var va={};va={rangeOverflow:e=>`V\u{113}rt\u{12B}bai ir j\u{101}b\u{16B}t ${e.maxValue} vai agr\u{101}kai.`,rangeReversed:`Sākuma datumam ir jābūt pirms beigu datuma.`,rangeUnderflow:e=>`V\u{113}rt\u{12B}bai ir j\u{101}b\u{16B}t ${e.minValue} vai v\u{113}l\u{101}kai.`,unavailableDate:`Atlasītais datums nav pieejams.`};var ya={};ya={rangeOverflow:e=>`Verdien m\xe5 v\xe6re ${e.maxValue} eller tidligere.`,rangeReversed:`Startdatoen må være før sluttdatoen.`,rangeUnderflow:e=>`Verdien m\xe5 v\xe6re ${e.minValue} eller senere.`,unavailableDate:`Valgt dato utilgjengelig.`};var ba={};ba={rangeOverflow:e=>`Waarde moet ${e.maxValue} of eerder zijn.`,rangeReversed:`De startdatum moet voor de einddatum liggen.`,rangeUnderflow:e=>`Waarde moet ${e.minValue} of later zijn.`,unavailableDate:`Geselecteerde datum niet beschikbaar.`};var xa={};xa={rangeOverflow:e=>`Warto\u{15B}\u{107} musi mie\u{107} warto\u{15B}\u{107} ${e.maxValue} lub wcze\u{15B}niejsz\u{105}.`,rangeReversed:`Data rozpoczęcia musi być wcześniejsza niż data zakończenia.`,rangeUnderflow:e=>`Warto\u{15B}\u{107} musi mie\u{107} warto\u{15B}\u{107} ${e.minValue} lub p\xf3\u{17A}niejsz\u{105}.`,unavailableDate:`Wybrana data jest niedostępna.`};var Sa={};Sa={rangeOverflow:e=>`O valor deve ser ${e.maxValue} ou anterior.`,rangeReversed:`A data inicial deve ser anterior à data final.`,rangeUnderflow:e=>`O valor deve ser ${e.minValue} ou posterior.`,unavailableDate:`Data selecionada indisponível.`};var Ca={};Ca={rangeOverflow:e=>`O valor tem de ser ${e.maxValue} ou anterior.`,rangeReversed:`A data de início deve ser anterior à data de fim.`,rangeUnderflow:e=>`O valor tem de ser ${e.minValue} ou posterior.`,unavailableDate:`Data selecionada indisponível.`};var wa={};wa={rangeOverflow:e=>`Valoarea trebuie s\u{103} fie ${e.maxValue} sau anterioar\u{103}.`,rangeReversed:`Data de început trebuie să fie anterioară datei de sfârșit.`,rangeUnderflow:e=>`Valoarea trebuie s\u{103} fie ${e.minValue} sau ulterioar\u{103}.`,unavailableDate:`Data selectată nu este disponibilă.`};var Ta={};Ta={rangeOverflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{438}\u{435} \u{434}\u{43E}\u{43B}\u{436}\u{43D}\u{43E} \u{431}\u{44B}\u{442}\u{44C} \u{43D}\u{435} \u{43F}\u{43E}\u{437}\u{436}\u{435} ${e.maxValue}.`,rangeReversed:`Дата начала должна предшествовать дате окончания.`,rangeUnderflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{438}\u{435} \u{434}\u{43E}\u{43B}\u{436}\u{43D}\u{43E} \u{431}\u{44B}\u{442}\u{44C} \u{43D}\u{435} \u{440}\u{430}\u{43D}\u{44C}\u{448}\u{435} ${e.minValue}.`,unavailableDate:`Выбранная дата недоступна.`};var Ea={};Ea={rangeOverflow:e=>`Hodnota mus\xed by\u{165} ${e.maxValue} alebo skor\u{161}ia.`,rangeReversed:`Dátum začiatku musí byť skorší ako dátum konca.`,rangeUnderflow:e=>`Hodnota mus\xed by\u{165} ${e.minValue} alebo neskor\u{161}ia.`,unavailableDate:`Vybratý dátum je nedostupný.`};var Da={};Da={rangeOverflow:e=>`Vrednost mora biti ${e.maxValue} ali starej\u{161}a.`,rangeReversed:`Začetni datum mora biti pred končnim datumom.`,rangeUnderflow:e=>`Vrednost mora biti ${e.minValue} ali novej\u{161}a.`,unavailableDate:`Izbrani datum ni na voljo.`};var Oa={};Oa={rangeOverflow:e=>`Vrednost mora da bude ${e.maxValue} ili starija.`,rangeReversed:`Datum početka mora biti pre datuma završetka.`,rangeUnderflow:e=>`Vrednost mora da bude ${e.minValue} ili novija.`,unavailableDate:`Izabrani datum nije dostupan.`};var ka={};ka={rangeOverflow:e=>`V\xe4rdet m\xe5ste vara ${e.maxValue} eller tidigare.`,rangeReversed:`Startdatumet måste vara före slutdatumet.`,rangeUnderflow:e=>`V\xe4rdet m\xe5ste vara ${e.minValue} eller senare.`,unavailableDate:`Det valda datumet är inte tillgängligt.`};var Aa={};Aa={rangeOverflow:e=>`De\u{11F}er, ${e.maxValue} veya \xf6ncesi olmal\u{131}d\u{131}r.`,rangeReversed:`Başlangıç tarihi bitiş tarihinden önce olmalıdır.`,rangeUnderflow:e=>`De\u{11F}er, ${e.minValue} veya sonras\u{131} olmal\u{131}d\u{131}r.`,unavailableDate:`Seçilen tarih kullanılamıyor.`};var ja={};ja={rangeOverflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{43D}\u{44F} \u{43C}\u{430}\u{454} \u{431}\u{443}\u{442}\u{438} \u{43D}\u{435} \u{43F}\u{456}\u{437}\u{43D}\u{456}\u{448}\u{435} ${e.maxValue}.`,rangeReversed:`Дата початку має передувати даті завершення.`,rangeUnderflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{43D}\u{44F} \u{43C}\u{430}\u{454} \u{431}\u{443}\u{442}\u{438} \u{43D}\u{435} \u{440}\u{430}\u{43D}\u{456}\u{448}\u{435} ${e.minValue}.`,unavailableDate:`Вибрана дата недоступна.`};var Ma={};Ma={rangeOverflow:e=>`\u{503C}\u{5FC5}\u{987B}\u{662F} ${e.maxValue} \u{6216}\u{66F4}\u{65E9}\u{65E5}\u{671F}\u{3002}`,rangeReversed:`开始日期必须早于结束日期。`,rangeUnderflow:e=>`\u{503C}\u{5FC5}\u{987B}\u{662F} ${e.minValue} \u{6216}\u{66F4}\u{665A}\u{65E5}\u{671F}\u{3002}`,unavailableDate:`所选日期不可用。`};var Na={};Na={rangeOverflow:e=>`\u{503C}\u{5FC5}\u{9808}\u{662F} ${e.maxValue} \u{6216}\u{66F4}\u{65E9}\u{3002}`,rangeReversed:`開始日期必須在結束日期之前。`,rangeUnderflow:e=>`\u{503C}\u{5FC5}\u{9808}\u{662F} ${e.minValue} \u{6216}\u{66F4}\u{665A}\u{3002}`,unavailableDate:`所選日期無法使用。`};var Pa={};Pa={"ar-AE":ea,"bg-BG":ta,"cs-CZ":na,"da-DK":ra,"de-DE":ia,"el-GR":aa,"en-US":oa,"es-ES":sa,"et-EE":ca,"fi-FI":la,"fr-FR":ua,"he-IL":da,"hr-HR":fa,"hu-HU":pa,"it-IT":ma,"ja-JP":ha,"ko-KR":ga,"lt-LT":_a,"lv-LV":va,"nb-NO":ya,"nl-NL":ba,"pl-PL":xa,"pt-BR":Sa,"pt-PT":Ca,"ro-RO":wa,"ru-RU":Ta,"sk-SK":Ea,"sl-SI":Da,"sr-SP":Oa,"sv-SE":ka,"tr-TR":Aa,"uk-UA":ja,"zh-CN":Ma,"zh-TW":Na};function Fa(e){return e&&e.__esModule?e.default:e}var Ia=new m(Fa(Pa));function La(){let e=typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return e}function Ra(e,t,n,i,a){let o=e!=null&&n!=null&&e.compare(n)>0,s=e!=null&&t!=null&&e.compare(t)<0,c=e!=null&&i?.(e)||!1,l=o||s||c,u=[];if(l){let e=La(),i=m.getGlobalDictionaryForPackage(`@react-stately/datepicker`)||Ia,l=new r(e,i),d=new Y(e,Ha({},a)),f=d.resolvedOptions().timeZone;s&&t!=null&&u.push(l.format(`rangeUnderflow`,{minValue:d.format(t.toDate(f))})),o&&n!=null&&u.push(l.format(`rangeOverflow`,{maxValue:d.format(n.toDate(f))})),c&&u.push(l.format(`unavailableDate`))}return{isInvalid:l,validationErrors:u,validationDetails:{badInput:c,customError:!1,patternMismatch:!1,rangeOverflow:o,rangeUnderflow:s,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!l}}}function za(e,t,n,r,i){let a=Ra(e?.start??null,t,n,r,i),o=Ra(e?.end??null,t,n,r,i),s=we(a,o);if(e?.end!=null&&e.start!=null&&e.end.compare(e.start)<0){let e=m.getGlobalDictionaryForPackage(`@react-stately/datepicker`)||Ia;s=we(s,{isInvalid:!0,validationErrors:[e.getStringForLocale(`rangeReversed`,La())],validationDetails:{...be,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})}return s}var Ba={year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`},Va={year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`};function Ha(e,t){e={...t.shouldForceLeadingZeros?Va:Ba,...e};let n=t.granularity||`minute`,r=Object.keys(e),i=r.indexOf(t.maxGranularity??`year`);i<0&&(i=0);let a=r.indexOf(n);if(a<0&&(a=2),i>a)throw Error(`maxGranularity must be greater than granularity`);let o=r.slice(i,a+1).reduce((t,n)=>(t[n]=e[n],t),{});return t.hourCycle!=null&&(o.hour12=t.hourCycle===12),o.timeZone=t.timeZone||`UTC`,(n===`hour`||n===`minute`||n===`second`)&&t.timeZone&&!t.hideTimeZone&&(o.timeZoneName=`short`),t.showEra&&i===0&&(o.era=`short`),o}function Ua(e){return e&&`hour`in e?e:new Ln}function Wa(e,t){if(e===null)return null;if(e)return G(e,t)}function Ga(e,t,n,r){if(e)return Wa(e,n);let i=G(vt(r??Tt()).set({hour:0,minute:0,second:0,millisecond:0}),n);return t===`year`||t===`month`||t===`day`?U(i):r?i:W(i)}function Ka(e,t){let n=e&&`timeZone`in e?e.timeZone:void 0,r=e&&`minute`in e?`minute`:`day`;if(e&&t&&!(t in e))throw Error(`Invalid granularity `+t+` for value `+e.toString());let[i,a]=(0,R.useState)([r,n]);e&&(i[0]!==r||i[1]!==n)&&a([r,n]),t||=e?r:i[0];let o=e?n:i[1];return[t,o]}var qa=new m({ach:{year:`mwaka`,month:`dwe`,day:`nino`},af:{year:`jjjj`,month:`mm`,day:`dd`},am:{year:`ዓዓዓዓ`,month:`ሚሜ`,day:`ቀቀ`},an:{year:`aaaa`,month:`mm`,day:`dd`},ar:{year:`سنة`,month:`شهر`,day:`يوم`},ast:{year:`aaaa`,month:`mm`,day:`dd`},az:{year:`iiii`,month:`aa`,day:`gg`},be:{year:`гггг`,month:`мм`,day:`дд`},bg:{year:`гггг`,month:`мм`,day:`дд`},bn:{year:`yyyy`,month:`মিমি`,day:`dd`},br:{year:`bbbb`,month:`mm`,day:`dd`},bs:{year:`gggg`,month:`mm`,day:`dd`},ca:{year:`aaaa`,month:`mm`,day:`dd`},cak:{year:`jjjj`,month:`ii`,day:`q'q'`},ckb:{year:`ساڵ`,month:`مانگ`,day:`ڕۆژ`},cs:{year:`rrrr`,month:`mm`,day:`dd`},cy:{year:`bbbb`,month:`mm`,day:`dd`},da:{year:`åååå`,month:`mm`,day:`dd`},de:{year:`jjjj`,month:`mm`,day:`tt`},dsb:{year:`llll`,month:`mm`,day:`źź`},el:{year:`εεεε`,month:`μμ`,day:`ηη`},en:{year:`yyyy`,month:`mm`,day:`dd`},eo:{year:`jjjj`,month:`mm`,day:`tt`},es:{year:`aaaa`,month:`mm`,day:`dd`},et:{year:`aaaa`,month:`kk`,day:`pp`},eu:{year:`uuuu`,month:`hh`,day:`ee`},fa:{year:`سال`,month:`ماه`,day:`روز`},ff:{year:`hhhh`,month:`ll`,day:`ññ`},fi:{year:`vvvv`,month:`kk`,day:`pp`},fr:{year:`aaaa`,month:`mm`,day:`jj`},fy:{year:`jjjj`,month:`mm`,day:`dd`},ga:{year:`bbbb`,month:`mm`,day:`ll`},gd:{year:`bbbb`,month:`mm`,day:`ll`},gl:{year:`aaaa`,month:`mm`,day:`dd`},he:{year:`שנה`,month:`חודש`,day:`יום`},hr:{year:`gggg`,month:`mm`,day:`dd`},hsb:{year:`llll`,month:`mm`,day:`dd`},hu:{year:`éééé`,month:`hh`,day:`nn`},ia:{year:`aaaa`,month:`mm`,day:`dd`},id:{year:`tttt`,month:`bb`,day:`hh`},is:{year:`áááá`,month:`mm`,day:`dd`},it:{year:`aaaa`,month:`mm`,day:`gg`},ja:{year:`年`,month:`月`,day:`日`},ka:{year:`წწწწ`,month:`თთ`,day:`რრ`},kk:{year:`жжжж`,month:`аа`,day:`кк`},kn:{year:`ವವವವ`,month:`ಮಿಮೀ`,day:`ದಿದಿ`},ko:{year:`연도`,month:`월`,day:`일`},lb:{year:`jjjj`,month:`mm`,day:`dd`},lo:{year:`ປປປປ`,month:`ດດ`,day:`ວວ`},lt:{year:`mmmm`,month:`mm`,day:`dd`},lv:{year:`gggg`,month:`mm`,day:`dd`},meh:{year:`aaaa`,month:`mm`,day:`dd`},ml:{year:`വർഷം`,month:`മാസം`,day:`തീയതി`},ms:{year:`tttt`,month:`mm`,day:`hh`},nb:{year:`åååå`,month:`mm`,day:`dd`},nl:{year:`jjjj`,month:`mm`,day:`dd`},nn:{year:`åååå`,month:`mm`,day:`dd`},no:{year:`åååå`,month:`mm`,day:`dd`},oc:{year:`aaaa`,month:`mm`,day:`jj`},pl:{year:`rrrr`,month:`mm`,day:`dd`},pt:{year:`aaaa`,month:`mm`,day:`dd`},rm:{year:`oooo`,month:`mm`,day:`dd`},ro:{year:`aaaa`,month:`ll`,day:`zz`},ru:{year:`гггг`,month:`мм`,day:`дд`},sc:{year:`aaaa`,month:`mm`,day:`dd`},scn:{year:`aaaa`,month:`mm`,day:`jj`},sk:{year:`rrrr`,month:`mm`,day:`dd`},sl:{year:`llll`,month:`mm`,day:`dd`},sr:{year:`гггг`,month:`мм`,day:`дд`},"sr-Latn":{year:`gggg`,month:`mm`,day:`dd`},sv:{year:`åååå`,month:`mm`,day:`dd`},szl:{year:`rrrr`,month:`mm`,day:`dd`},tg:{year:`сссс`,month:`мм`,day:`рр`},th:{year:`ปปปป`,month:`ดด`,day:`วว`},tr:{year:`yyyy`,month:`aa`,day:`gg`},uk:{year:`рррр`,month:`мм`,day:`дд`},"zh-CN":{year:`年`,month:`月`,day:`日`},"zh-TW":{year:`年`,month:`月`,day:`日`}},`en`);function Ja(e,t,n){return e===`era`||e===`dayPeriod`?t:e===`year`||e===`month`||e===`day`?qa.getStringForLocale(e,n):`––`}var Ya=class e{constructor(e,t,n){if(this.era=n?.era??null,this.calendar=e,this.year=n?.year??null,this.month=n?.month??null,this.day=n?.day??null,this.hour=n?.hour??null,this.hourCycle=t,this.dayPeriod=null,this.minute=n?.minute??null,this.second=n?.second??null,this.millisecond=n?.millisecond??null,this.offset=`offset`in(n??{})?n.offset:null,this.hour!=null){let[e,n]=Za(this.hour,t);this.dayPeriod=e,this.hour=n}}copy(){let t=new e(this.calendar,this.hourCycle);return t.era=this.era,t.year=this.year,t.month=this.month,t.day=this.day,t.hour=this.hour,t.dayPeriod=this.dayPeriod,t.minute=this.minute,t.second=this.second,t.millisecond=this.millisecond,t.offset=this.offset,t}isComplete(e){return e.every(e=>this[e]!=null)}validate(e,t){return t.every(t=>{if((t===`hour`||t===`dayPeriod`)&&`hour`in e){let[t,n]=Za(e.hour,this.hourCycle);return this.dayPeriod===t&&this.hour===n}return this[t]===e[t]})}isCleared(e){return e.every(e=>this[e]===null)}set(e,t,n){let r=this.copy();return r[e]=t,e===`hour`&&r.dayPeriod==null&&`hour`in n&&(r.dayPeriod=Za(n.hour,this.hourCycle)[0]),e===`year`&&r.era==null&&(r.era=n.era),e!==`second`&&e!==`literal`&&e!==`timeZoneName`&&(r.offset=null),r}clear(e){let t=this.copy();return t[e]=null,e===`year`&&(t.era=null),t.offset=null,t}cycle(e,t,n,r){let i=this.copy();if(i[e]==null&&e!==`dayPeriod`&&e!==`era`){if(e===`hour`&&`hour`in n){let[e,t]=Za(n.hour,this.hourCycle);i.dayPeriod=e,i.hour=t}else i[e]=n[e];return e===`year`&&i.era==null&&(i.era=n.era),i}switch(e){case`era`:{let e=this.calendar.getEras(),n=e.indexOf(i.era);n=Xa(n,t,0,e.length-1),i.era=e[n];break}case`year`:{let r=new q(this.calendar,this.era??n.era,this.year??n.year,this.month??1,this.day??1);r=r.cycle(e,t,{round:e===`year`}),i.era=r.era,i.year=r.year;break}case`month`:i.month=Xa(i.month??1,t,1,this.calendar.getMaximumMonthsInYear());break;case`day`:i.day=Xa(i.day??1,t,1,this.calendar.getMaximumDaysInMonth());break;case`hour`:{let e=r.some(e=>[`year`,`month`,`day`].includes(e));if(`timeZone`in n&&(!e||i.year!=null&&i.month!=null&&i.day!=null)){let e=this.toValue(n);e=e.cycle(`hour`,t,{hourCycle:this.hourCycle===`h12`?12:24,round:!1});let[r,a]=Za(e.hour,this.hourCycle);i.hour=a,i.dayPeriod=r,i.offset=e.offset}else{let e=i.hour??0,r=this.getSegmentLimits(`hour`);i.hour=Xa(e,t,r.minValue,r.maxValue),i.dayPeriod==null&&`hour`in n&&(i.dayPeriod=Za(n.hour,this.hourCycle)[0])}break}case`dayPeriod`:i.dayPeriod=Xa(i.dayPeriod??0,t,0,1);break;case`minute`:i.minute=Xa(i.minute??0,t,0,59,!0);break;case`second`:i.second=Xa(i.second??0,t,0,59,!0)}return i}toValue(e){if(`hour`in e){let t=this.hour;t==null?(this.hourCycle===`h12`||this.hourCycle===`h11`)&&(t=this.dayPeriod===1?12:0):t=Qa(t,this.dayPeriod??0,this.hourCycle);let n=e.set({era:this.era??e.era,year:this.year??e.year,month:this.month??e.month,day:this.day??e.day,hour:t??e.hour,minute:this.minute??e.minute,second:this.second??e.second,millisecond:this.millisecond??e.millisecond});return`offset`in n&&this.offset!=null&&n.offset!==this.offset&&(n=n.add({milliseconds:n.offset-this.offset})),n}return e.set({era:this.era??e.era,year:this.year??e.year,month:this.month??e.month,day:this.day??e.day})}getSegmentLimits(e){switch(e){case`era`:{let e=this.calendar.getEras();return{value:this.era==null?e.length-1:e.indexOf(this.era),minValue:0,maxValue:e.length-1}}case`year`:return{value:this.year,minValue:1,maxValue:9999};case`month`:return{value:this.month,minValue:1,maxValue:this.calendar.getMaximumMonthsInYear()};case`day`:return{value:this.day,minValue:1,maxValue:this.calendar.getMaximumDaysInMonth()};case`dayPeriod`:return{value:this.dayPeriod,minValue:0,maxValue:1};case`hour`:{let e=0,t=23;return this.hourCycle===`h12`?(e=1,t=12):this.hourCycle===`h11`&&(e=0,t=11),{value:this.hour,minValue:e,maxValue:t}}case`minute`:return{value:this.minute,minValue:0,maxValue:59};case`second`:return{value:this.second,minValue:0,maxValue:59}}}};function Xa(e,t,n,r,i=!1){if(i){e+=Math.sign(t),e0?Math.ceil(e/i)*i:Math.floor(e/i)*i,e>r&&(e=n)}else e+=t,er&&(e=n+(e-r-1));return e}function Za(e,t){let n=+(e>=12);switch(t){case`h11`:e>=12&&(e-=12);break;case`h12`:e===0?e=12:e>12&&(e-=12);break;case`h23`:n=null;break;case`h24`:e+=1,n=null}return[n,e]}function Qa(e,t,n){switch(n){case`h11`:t===1&&(e+=12);break;case`h12`:e===12&&(e=0),t===1&&(e+=12);break;case`h24`:--e}return e}var $a={year:!0,month:!0,day:!0,hour:!0,minute:!0,second:!0,dayPeriod:!0,era:!0},eo={year:5,month:2,day:7,hour:2,minute:15,second:15},to={dayperiod:`dayPeriod`,relatedYear:`year`,yearName:`literal`,unknown:`literal`};function no(e){let{locale:t,createCalendar:n,hideTimeZone:r,isDisabled:i=!1,isReadOnly:a=!1,isRequired:o=!1,minValue:s,maxValue:c,isDateUnavailable:l}=e,u=e.value||e.defaultValue||e.placeholderValue||null,[d,f]=Ka(u,e.granularity),p=f||`UTC`;if(u&&!(d in u))throw Error(`Invalid granularity `+d+` for value `+u.toString());let[m,h]=(0,R.useMemo)(()=>{let r=new Y(t,{dateStyle:`short`,timeStyle:`short`,hour12:e.hourCycle==null?void 0:e.hourCycle===12}).resolvedOptions();return[n(r.calendar),r.hourCycle]},[t,e.hourCycle,n]),[g,_]=ce(e.value,e.defaultValue??null,e.onChange),[v]=(0,R.useState)(g),y=(0,R.useMemo)(()=>Wa(g,m)??null,[g,m]),[b,x]=(0,R.useState)(()=>new Ya(m,h,y)),S=m.identifier===`gregory`&&b.era===`BC`,C=(0,R.useMemo)(()=>({granularity:d,maxGranularity:e.maxGranularity??`year`,timeZone:f,hideTimeZone:r,hourCycle:e.hourCycle,showEra:S,shouldForceLeadingZeros:e.shouldForceLeadingZeros}),[e.maxGranularity,d,e.hourCycle,e.shouldForceLeadingZeros,f,r,S]),w=(0,R.useMemo)(()=>Ha({},C),[C]),T=(0,R.useMemo)(()=>new Y(t,w),[t,w]),E=(0,R.useMemo)(()=>T.resolvedOptions(),[T]),D=(0,R.useMemo)(()=>Ga(e.placeholderValue,d,m,f),[e.placeholderValue,d,m,f]),O=(0,R.useMemo)(()=>{let t=h===`h11`||h===`h12`,n=[`era`,`year`,`month`,`day`,`hour`,...t?[`dayPeriod`]:[],`minute`,`second`],r=n.indexOf(e.maxGranularity||`era`),i=n.indexOf(d===`hour`&&t?`dayPeriod`:d);return n.slice(r,i+1)},[e.maxGranularity,d,h]),[k,A]=(0,R.useState)(y),[ee,te]=(0,R.useState)(m),[j,ne]=(0,R.useState)(h);(y!==k||h!==j||!mt(m,ee))&&(b=new Ya(m,h,y),A(y),te(m),ne(h),x(b));let M=t=>{if(!(e.isDisabled||e.isReadOnly)){if(t==null||t instanceof Ya&&t.isCleared(O))x(new Ya(m,h,y)),_(null);else if(!(t instanceof Ya))t=G(t,u?.calendar||new z),x(new Ya(m,h,y)),_(t);else{if(t.isComplete(O)){let e=t.toValue(y??D);if(t.validate(e,O)){let t=G(e,u?.calendar||new z);if(!g||t.compare(g)!==0){x(new Ya(m,h,y)),_(t);return}}}x(t)}}},re=(0,R.useMemo)(()=>b.toValue(y??D).toDate(p),[b,p,y,D]),N=(0,R.useMemo)(()=>ro(re,b,T,E,m,t,d),[re,T,E,b,m,t,d]),ie=(e,t)=>{M(b.cycle(e,t,D,O))},P=(0,R.useMemo)(()=>Ra(g,s,c,l,C),[g,s,c,l,C]),ae=Oe({...e,value:g,builtinValidation:P}),oe=ae.displayValidation.isInvalid,se=e.validationState||(oe?`invalid`:null);return{...ae,value:y,defaultValue:e.defaultValue??v,dateValue:re,calendar:m,setValue:M,segments:N,dateFormatter:T,validationState:se,isInvalid:oe,granularity:d,maxGranularity:e.maxGranularity??`year`,isDisabled:i,isReadOnly:a,isRequired:o,increment(e){ie(e,1)},decrement(e){ie(e,-1)},incrementPage(e){ie(e,eo[e]||1)},decrementPage(e){ie(e,-(eo[e]||1))},incrementToMax(e){let t=e===`hour`&&h===`h12`?11:b.getSegmentLimits(e).maxValue;M(b.set(e,t,D))},decrementToMin(e){let t=e===`hour`&&h===`h12`?12:b.getSegmentLimits(e).minValue;M(b.set(e,t,D))},setSegment(e,t){M(b.set(e,t,D))},confirmPlaceholder(){if(!(e.isDisabled||e.isReadOnly)&&b.isComplete(O)){let e=G(b.toValue(y??D),u?.calendar||new z);(!g||e.compare(g)!==0)&&_(e),x(new Ya(m,h,y))}},clearSegment(e){let t=b;e!==`timeZoneName`&&e!==`literal`&&(t=b.clear(e)),M(t)},formatValue(e){if(!y)return``;let n=Ha(e,C);return new Y(t,n).format(re)},getDateFormatter(e,t){return new Y(e,Ha({},{...C,...t}))}}}function ro(e,t,n,r,i,a,o){let s=[`hour`,`minute`,`second`],c=n.formatToParts(e),l=new Fe(a,{useGrouping:!1}),u=new Fe(a,{useGrouping:!1,minimumIntegerDigits:2});for(let e of c)if(e.type===`year`||e.type===`month`||e.type===`day`||e.type===`hour`){let n=t[e.type]??0;e.value=r[e.type]===`2-digit`?u.format(n):l.format(n)}let d=[];for(let e of c){let n=to[e.type]||e.type,r=$a[n];n===`era`&&i.getEras().length===1&&(r=!1);let c=$a[n]&&t[e.type]==null,l=$a[n]?Ja(n,e.value,a):null,u={type:n,text:c?l:e.value,...t.getSegmentLimits(n),isPlaceholder:c,placeholder:l,isEditable:r};n===`hour`?(d.push({type:`literal`,text:`⁦`,isPlaceholder:!1,placeholder:``,isEditable:!1}),d.push(u),n===o&&d.push({type:`literal`,text:`⁩`,isPlaceholder:!1,placeholder:``,isEditable:!1})):s.includes(n)&&n===o?(d.push(u),d.push({type:`literal`,text:`⁩`,isPlaceholder:!1,placeholder:``,isEditable:!1})):d.push(u)}return d}function io(e){let{placeholderValue:t=new Ln,minValue:n,maxValue:r,defaultValue:i,granularity:a,validate:o}=e,[s,c]=ce(e.value,i??null,e.onChange),l=s||t,u=l&&`day`in l?l:void 0,d=i&&`timeZone`in i?i.timeZone:void 0,f=(0,R.useMemo)(()=>{let e=l&&`timeZone`in l?l.timeZone:void 0;return(e||d)&&t?Yt(ao(t),e||d):ao(t)},[t,l,d]),p=(0,R.useMemo)(()=>ao(n,u),[n,u]),m=(0,R.useMemo)(()=>ao(r,u),[r,u]),h=(0,R.useMemo)(()=>s&&`day`in s?Jt(s):s,[s]),g=(0,R.useMemo)(()=>s==null?null:ao(s),[s]),_=(0,R.useMemo)(()=>i==null?null:ao(i),[i]),v=e=>{c(u||d?e:e&&Jt(e))};return{...no({...e,value:g,defaultValue:_,minValue:p,maxValue:m,onChange:v,granularity:a||`minute`,maxGranularity:`hour`,placeholderValue:f??void 0,createCalendar:()=>new z,validate:(0,R.useCallback)(()=>o?.(s),[o,s])}),timeValue:h}}function ao(e,t=yt(Tt())){return e?`day`in e?e:W(t,e):null}var oo=(0,R.createContext)(null),so=(0,R.createContext)(null),co=(0,R.createContext)(null),lo=(0,R.createContext)(null),uo=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,oo);let{validationBehavior:n}=O(ye)||{},r=e.validationBehavior??n??`native`,{locale:i}=F(),a=no({...e,locale:i,createCalendar:Kr,validationBehavior:r}),o=(0,R.useRef)(null),[s,c]=A(!e[`aria-label`]&&!e[`aria-labelledby`]),l=(0,R.useRef)(null),{labelProps:u,fieldProps:d,inputProps:f,descriptionProps:m,errorMessageProps:h,...g}=Ki({...E(e),label:c,inputRef:l,validationBehavior:r},a,o),_=k({...E(e),values:{state:a,isInvalid:a.isInvalid,isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:e.isRequired||!1},defaultClassName:`react-aria-DateField`}),v=I(e,{global:!0});return delete v.id,R.createElement(x,{values:[[co,a],[Se,{...d,ref:o,isInvalid:a.isInvalid,isDisabled:a.isDisabled}],[Ee,{...f,ref:l}],[Me,{...u,ref:s,elementType:`span`}],[p,{slots:{description:m,errorMessage:h}}],[Te,g]]},R.createElement(w.div,{...v,..._,ref:t,slot:e.slot||void 0,"data-invalid":a.isInvalid||void 0,"data-disabled":a.isDisabled||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":e.isRequired||void 0}),R.createElement(ii,{autoComplete:e.autoComplete,name:e.name,isDisabled:e.isDisabled,state:a}))}),fo=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,so);let{validationBehavior:n}=O(ye)||{},r=e.validationBehavior??n??`native`,{locale:i}=F(),a=io({...e,locale:i,validationBehavior:r}),o=(0,R.useRef)(null),[s,c]=A(!e[`aria-label`]&&!e[`aria-labelledby`]),l=(0,R.useRef)(null),{labelProps:u,fieldProps:d,inputProps:f,descriptionProps:m,errorMessageProps:h,...g}=qi({...E(e),label:c,inputRef:l,validationBehavior:r},a,o),_=k({...e,values:{state:a,isInvalid:a.isInvalid,isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TimeField`}),v=I(e,{global:!0});return delete v.id,R.createElement(x,{values:[[lo,a],[Se,{...d,ref:o,isInvalid:a.isInvalid,isDisabled:a.isDisabled}],[Ee,{...f,ref:l}],[Me,{...u,ref:s,elementType:`span`}],[p,{slots:{description:m,errorMessage:h}}],[Te,g]]},R.createElement(w.div,{...v,..._,ref:t,slot:e.slot||void 0,"data-invalid":a.isInvalid||void 0,"data-disabled":a.isDisabled||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":e.isRequired||void 0}))}),po=(0,R.forwardRef)(function(e,t){let n=(0,R.useContext)(co),r=(0,R.useContext)(lo);return n||r?R.createElement(ho,{...e,ref:t}):R.createElement(mo,{...e,ref:t})}),mo=(0,R.forwardRef)((e,t)=>{let[n,r]=se({slot:e.slot},t,oo),{locale:i}=F(),a=no({...n,locale:i,createCalendar:Kr}),o=(0,R.useRef)(null),{fieldProps:s,inputProps:c}=Ki({...n,inputRef:o},a,r);return R.createElement(x,{values:[[co,a],[Ee,{...c,ref:o}],[Se,{...s,ref:r,isInvalid:a.isInvalid,isDisabled:a.isDisabled}]]},R.createElement(ho,e))}),ho=(0,R.forwardRef)((e,t)=>{let{className:n,children:r}=e,i=(0,R.useContext)(co),a=(0,R.useContext)(lo),o=i??a;return R.createElement(R.Fragment,null,R.createElement(Ce,{...e,ref:t,slot:e.slot||void 0,className:n??`react-aria-DateInput`,isReadOnly:o.isReadOnly,isInvalid:o.isInvalid,isDisabled:o.isDisabled},o.segments.map((e,t)=>(0,R.cloneElement)(r(e),{key:t}))),R.createElement(ke,{className:``}))}),go=(0,R.forwardRef)(function({segment:e,...t},n){let r=(0,R.useContext)(co),i=(0,R.useContext)(lo),a=r??i,o=T(n),{segmentProps:s}=Qi(e,a,o),{focusProps:c,isFocused:l,isFocusVisible:u}=P(),{hoverProps:d,isHovered:f}=pe({...t,isDisabled:a.isDisabled||e.type===`literal`}),p=k({...t,values:{...e,isReadOnly:a.isReadOnly,isInvalid:a.isInvalid,isDisabled:a.isDisabled,isHovered:f,isFocused:l,isFocusVisible:u},defaultChildren:e.text,defaultClassName:`react-aria-DateSegment`});return R.createElement(w.span,{...D(I(t,{global:!0}),s,c,d),...p,style:s.style,ref:o,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":a.isInvalid||void 0,"data-readonly":a.isReadOnly||void 0,"data-disabled":a.isDisabled||void 0,"data-type":e.type,"data-hovered":f||void 0,"data-focused":l||void 0,"data-focus-visible":u||void 0})}),_o=(0,R.createContext)({}),vo=({children:e,className:t,fullWidth:n,variant:r,...i})=>{let a=R.useMemo(()=>et({fullWidth:n,variant:r}),[n,r]);return(0,X.jsx)(_o,{value:{slots:a},children:(0,X.jsx)(Ce,{className:N(t,a?.base()),"data-slot":`date-input-group`,...i,children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})})},yo=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(S.div,{className:L(r?.prefix,t),"data-slot":`date-input-group-prefix`,...n,children:e})},bo=({className:e,...t})=>{let{slots:n}=(0,R.use)(_o);return(0,X.jsx)(po,{className:N(e,n?.input()),"data-slot":`date-input-group-input`,...t})},xo=({className:e,segment:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(go,{className:L(r?.segment,e),"data-slot":`date-input-group-segment`,segment:t,...n})},So=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(S.div,{className:L(r?.inputContainer,t),"data-slot":`date-input-group-input-container`,...n,children:e})},Co=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(S.div,{className:L(r?.suffix,t),"data-slot":`date-input-group-suffix`,...n,children:e})};function wo({children:e,className:t,fullWidth:n,...r}){let i=R.useMemo(()=>Qe({fullWidth:n}),[n]);return(0,X.jsx)(uo,{"data-required":Le(r.isRequired),"data-slot":`date-field`,...r,className:N(t,i),children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})}var To=Object.assign(wo,{Root:wo,Group:vo,Input:bo,InputContainer:So,Segment:xo,Prefix:yo,Suffix:Co}),Eo={};Eo={dateRange:e=>`${e.startDate} \u{625}\u{644}\u{649} ${e.endDate}`,dateSelected:e=>`${e.date} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}`,finishRangeSelectionPrompt:`انقر لإنهاء عملية تحديد نطاق التاريخ`,maximumDate:`آخر تاريخ متاح`,minimumDate:`أول تاريخ متاح`,next:`التالي`,previous:`السابق`,selectedDateDescription:e=>`\u{62A}\u{627}\u{631}\u{64A}\u{62E} \u{645}\u{62D}\u{62F}\u{62F}: ${e.date}`,selectedRangeDescription:e=>`\u{627}\u{644}\u{645}\u{62F}\u{649} \u{627}\u{644}\u{632}\u{645}\u{646}\u{64A} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}: ${e.dateRange}`,startRangeSelectionPrompt:`انقر لبدء عملية تحديد نطاق التاريخ`,todayDate:e=>`\u{627}\u{644}\u{64A}\u{648}\u{645}\u{60C} ${e.date}`,todayDateSelected:e=>`\u{627}\u{644}\u{64A}\u{648}\u{645}\u{60C} ${e.date} \u{645}\u{62D}\u{62F}\u{62F}`};var Do={};Do={dateRange:e=>`${e.startDate} \u{434}\u{43E} ${e.endDate}`,dateSelected:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{43E} \u{435} ${e.date}`,finishRangeSelectionPrompt:`Натиснете, за да довършите избора на времеви интервал`,maximumDate:`Последна налична дата`,minimumDate:`Първа налична дата`,next:`Напред`,previous:`Назад`,selectedDateDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.dateRange}`,startRangeSelectionPrompt:`Натиснете, за да пристъпите към избора на времеви интервал`,todayDate:e=>`\u{414}\u{43D}\u{435}\u{441}, ${e.date}`,todayDateSelected:e=>`\u{414}\u{43D}\u{435}\u{441}, ${e.date} \u{441}\u{430} \u{438}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{438}`};var Oo={};Oo={dateRange:e=>`${e.startDate} a\u{17E} ${e.endDate}`,dateSelected:e=>`Vybr\xe1no ${e.date}`,finishRangeSelectionPrompt:`Kliknutím dokončíte výběr rozsahu dat`,maximumDate:`Poslední dostupné datum`,minimumDate:`První dostupné datum`,next:`Další`,previous:`Předchozí`,selectedDateDescription:e=>`Vybran\xe9 datum: ${e.date}`,selectedRangeDescription:e=>`Vybran\xe9 obdob\xed: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknutím zahájíte výběr rozsahu dat`,todayDate:e=>`Dnes, ${e.date}`,todayDateSelected:e=>`Dnes, vybr\xe1no ${e.date}`};var ko={};ko={dateRange:e=>`${e.startDate} til ${e.endDate}`,dateSelected:e=>`${e.date} valgt`,finishRangeSelectionPrompt:`Klik for at fuldføre valg af datoområde`,maximumDate:`Sidste ledige dato`,minimumDate:`Første ledige dato`,next:`Næste`,previous:`Forrige`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt interval: ${e.dateRange}`,startRangeSelectionPrompt:`Klik for at starte valg af datoområde`,todayDate:e=>`I dag, ${e.date}`,todayDateSelected:e=>`I dag, ${e.date} valgt`};var Ao={};Ao={dateRange:e=>`${e.startDate} bis ${e.endDate}`,dateSelected:e=>`${e.date} ausgew\xe4hlt`,finishRangeSelectionPrompt:`Klicken, um die Auswahl des Datumsbereichs zu beenden`,maximumDate:`Letztes verfügbares Datum`,minimumDate:`Erstes verfügbares Datum`,next:`Weiter`,previous:`Zurück`,selectedDateDescription:e=>`Ausgew\xe4hltes Datum: ${e.date}`,selectedRangeDescription:e=>`Ausgew\xe4hlter Bereich: ${e.dateRange}`,startRangeSelectionPrompt:`Klicken, um die Auswahl des Datumsbereichs zu beginnen`,todayDate:e=>`Heute, ${e.date}`,todayDateSelected:e=>`Heute, ${e.date} ausgew\xe4hlt`};var jo={};jo={dateRange:e=>`${e.startDate} \u{3AD}\u{3C9}\u{3C2} ${e.endDate}`,dateSelected:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3B8}\u{3B7}\u{3BA}\u{3B5} ${e.date}`,finishRangeSelectionPrompt:`Κάντε κλικ για να ολοκληρώσετε την επιλογή εύρους ημερομηνιών`,maximumDate:`Τελευταία διαθέσιμη ημερομηνία`,minimumDate:`Πρώτη διαθέσιμη ημερομηνία`,next:`Επόμενο`,previous:`Προηγούμενο`,selectedDateDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3B7} \u{3B7}\u{3BC}\u{3B5}\u{3C1}\u{3BF}\u{3BC}\u{3B7}\u{3BD}\u{3AF}\u{3B1}: ${e.date}`,selectedRangeDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3BF} \u{3B5}\u{3CD}\u{3C1}\u{3BF}\u{3C2}: ${e.dateRange}`,startRangeSelectionPrompt:`Κάντε κλικ για να ξεκινήσετε την επιλογή εύρους ημερομηνιών`,todayDate:e=>`\u{3A3}\u{3AE}\u{3BC}\u{3B5}\u{3C1}\u{3B1}, ${e.date}`,todayDateSelected:e=>`\u{3A3}\u{3AE}\u{3BC}\u{3B5}\u{3C1}\u{3B1}, \u{3B5}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3C4}\u{3B7}\u{3BA}\u{3B5} ${e.date}`};var Mo={};Mo={previous:`Previous`,next:`Next`,selectedDateDescription:e=>`Selected Date: ${e.date}`,selectedRangeDescription:e=>`Selected Range: ${e.dateRange}`,todayDate:e=>`Today, ${e.date}`,todayDateSelected:e=>`Today, ${e.date} selected`,dateSelected:e=>`${e.date} selected`,startRangeSelectionPrompt:`Click to start selecting date range`,finishRangeSelectionPrompt:`Click to finish selecting date range`,minimumDate:`First available date`,maximumDate:`Last available date`,dateRange:e=>`${e.startDate} to ${e.endDate}`};var No={};No={dateRange:e=>`${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} seleccionado`,finishRangeSelectionPrompt:`Haga clic para terminar de seleccionar rango de fechas`,maximumDate:`Última fecha disponible`,minimumDate:`Primera fecha disponible`,next:`Siguiente`,previous:`Anterior`,selectedDateDescription:e=>`Fecha seleccionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo seleccionado: ${e.dateRange}`,startRangeSelectionPrompt:`Haga clic para comenzar a seleccionar un rango de fechas`,todayDate:e=>`Hoy, ${e.date}`,todayDateSelected:e=>`Hoy, ${e.date} seleccionado`};var Po={};Po={dateRange:e=>`${e.startDate} kuni ${e.endDate}`,dateSelected:e=>`${e.date} valitud`,finishRangeSelectionPrompt:`Klõpsake kuupäevavahemiku valimise lõpetamiseks`,maximumDate:`Viimane saadaolev kuupäev`,minimumDate:`Esimene saadaolev kuupäev`,next:`Järgmine`,previous:`Eelmine`,selectedDateDescription:e=>`Valitud kuup\xe4ev: ${e.date}`,selectedRangeDescription:e=>`Valitud vahemik: ${e.dateRange}`,startRangeSelectionPrompt:`Klõpsake kuupäevavahemiku valimiseks`,todayDate:e=>`T\xe4na, ${e.date}`,todayDateSelected:e=>`T\xe4na, ${e.date} valitud`};var Fo={};Fo={dateRange:e=>`${e.startDate} \u{2013} ${e.endDate}`,dateSelected:e=>`${e.date} valittu`,finishRangeSelectionPrompt:`Lopeta päivämääräalueen valinta napsauttamalla tätä.`,maximumDate:`Viimeinen varattavissa oleva päivämäärä`,minimumDate:`Ensimmäinen varattavissa oleva päivämäärä`,next:`Seuraava`,previous:`Edellinen`,selectedDateDescription:e=>`Valittu p\xe4iv\xe4m\xe4\xe4r\xe4: ${e.date}`,selectedRangeDescription:e=>`Valittu aikav\xe4li: ${e.dateRange}`,startRangeSelectionPrompt:`Aloita päivämääräalueen valinta napsauttamalla tätä.`,todayDate:e=>`T\xe4n\xe4\xe4n, ${e.date}`,todayDateSelected:e=>`T\xe4n\xe4\xe4n, ${e.date} valittu`};var Io={};Io={dateRange:e=>`${e.startDate} \xe0 ${e.endDate}`,dateSelected:e=>`${e.date} s\xe9lectionn\xe9`,finishRangeSelectionPrompt:`Cliquer pour finir de sélectionner la plage de dates`,maximumDate:`Dernière date disponible`,minimumDate:`Première date disponible`,next:`Suivant`,previous:`Précédent`,selectedDateDescription:e=>`Date s\xe9lectionn\xe9e\xa0: ${e.date}`,selectedRangeDescription:e=>`Plage s\xe9lectionn\xe9e\xa0: ${e.dateRange}`,startRangeSelectionPrompt:`Cliquer pour commencer à sélectionner la plage de dates`,todayDate:e=>`Aujourd'hui, ${e.date}`,todayDateSelected:e=>`Aujourd\u{2019}hui, ${e.date} s\xe9lectionn\xe9`};var Lo={};Lo={dateRange:e=>`${e.startDate} \u{5E2}\u{5D3} ${e.endDate}`,dateSelected:e=>`${e.date} \u{5E0}\u{5D1}\u{5D7}\u{5E8}`,finishRangeSelectionPrompt:`חץ כדי לסיים את בחירת טווח התאריכים`,maximumDate:`תאריך פנוי אחרון`,minimumDate:`תאריך פנוי ראשון`,next:`הבא`,previous:`הקודם`,selectedDateDescription:e=>`\u{5EA}\u{5D0}\u{5E8}\u{5D9}\u{5DA} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.date}`,selectedRangeDescription:e=>`\u{5D8}\u{5D5}\u{5D5}\u{5D7} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.dateRange}`,startRangeSelectionPrompt:`לחץ כדי להתחיל בבחירת טווח התאריכים`,todayDate:e=>`\u{5D4}\u{5D9}\u{5D5}\u{5DD}, ${e.date}`,todayDateSelected:e=>`\u{5D4}\u{5D9}\u{5D5}\u{5DD}, ${e.date} \u{5E0}\u{5D1}\u{5D7}\u{5E8}`};var Ro={};Ro={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`${e.date} odabran`,finishRangeSelectionPrompt:`Kliknite da dovršite raspon odabranih datuma`,maximumDate:`Posljednji raspoloživi datum`,minimumDate:`Prvi raspoloživi datum`,next:`Sljedeći`,previous:`Prethodni`,selectedDateDescription:e=>`Odabrani datum: ${e.date}`,selectedRangeDescription:e=>`Odabrani raspon: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknite da započnete raspon odabranih datuma`,todayDate:e=>`Danas, ${e.date}`,todayDateSelected:e=>`Danas, odabran ${e.date}`};var zo={};zo={dateRange:e=>`${e.startDate}\u{2013}${e.endDate}`,dateSelected:e=>`${e.date} kiv\xe1lasztva`,finishRangeSelectionPrompt:`Kattintson a dátumtartomány kijelölésének befejezéséhez`,maximumDate:`Utolsó elérhető dátum`,minimumDate:`Az első elérhető dátum`,next:`Következő`,previous:`Előző`,selectedDateDescription:e=>`Kijel\xf6lt d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Kijel\xf6lt tartom\xe1ny: ${e.dateRange}`,startRangeSelectionPrompt:`Kattintson a dátumtartomány kijelölésének indításához`,todayDate:e=>`Ma, ${e.date}`,todayDateSelected:e=>`Ma, ${e.date} kijel\xf6lve`};var Bo={};Bo={dateRange:e=>`Da ${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} selezionata`,finishRangeSelectionPrompt:`Fai clic per completare la selezione dell’intervallo di date`,maximumDate:`Ultima data disponibile`,minimumDate:`Prima data disponibile`,next:`Successivo`,previous:`Precedente`,selectedDateDescription:e=>`Data selezionata: ${e.date}`,selectedRangeDescription:e=>`Intervallo selezionato: ${e.dateRange}`,startRangeSelectionPrompt:`Fai clic per selezionare l’intervallo di date`,todayDate:e=>`Oggi, ${e.date}`,todayDateSelected:e=>`Oggi, ${e.date} selezionata`};var Vo={};Vo={dateRange:e=>`${e.startDate} \u{304B}\u{3089} ${e.endDate}`,dateSelected:e=>`${e.date} \u{3092}\u{9078}\u{629E}`,finishRangeSelectionPrompt:`クリックして日付範囲の選択を終了`,maximumDate:`最終利用可能日`,minimumDate:`最初の利用可能日`,next:`次へ`,previous:`前へ`,selectedDateDescription:e=>`\u{9078}\u{629E}\u{3057}\u{305F}\u{65E5}\u{4ED8} : ${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{629E}\u{7BC4}\u{56F2} : ${e.dateRange}`,startRangeSelectionPrompt:`クリックして日付範囲の選択を開始`,todayDate:e=>`\u{672C}\u{65E5}\u{3001}${e.date}`,todayDateSelected:e=>`\u{672C}\u{65E5}\u{3001}${e.date} \u{3092}\u{9078}\u{629E}`};var Ho={};Ho={dateRange:e=>`${e.startDate} ~ ${e.endDate}`,dateSelected:e=>`${e.date} \u{C120}\u{D0DD}\u{B428}`,finishRangeSelectionPrompt:`날짜 범위 선택을 완료하려면 클릭하십시오.`,maximumDate:`마지막으로 사용 가능한 일자`,minimumDate:`처음으로 사용 가능한 일자`,next:`다음`,previous:`이전`,selectedDateDescription:e=>`\u{C120}\u{D0DD} \u{C77C}\u{C790}: ${e.date}`,selectedRangeDescription:e=>`\u{C120}\u{D0DD} \u{BC94}\u{C704}: ${e.dateRange}`,startRangeSelectionPrompt:`날짜 범위 선택을 시작하려면 클릭하십시오.`,todayDate:e=>`\u{C624}\u{B298}, ${e.date}`,todayDateSelected:e=>`\u{C624}\u{B298}, ${e.date} \u{C120}\u{D0DD}\u{B428}`};var Uo={};Uo={dateRange:e=>`Nuo ${e.startDate} iki ${e.endDate}`,dateSelected:e=>`Pasirinkta ${e.date}`,finishRangeSelectionPrompt:`Spustelėkite, kad baigtumėte pasirinkti datų intervalą`,maximumDate:`Paskutinė galima data`,minimumDate:`Pirmoji galima data`,next:`Paskesnis`,previous:`Ankstesnis`,selectedDateDescription:e=>`Pasirinkta data: ${e.date}`,selectedRangeDescription:e=>`Pasirinktas intervalas: ${e.dateRange}`,startRangeSelectionPrompt:`Spustelėkite, kad pradėtumėte pasirinkti datų intervalą`,todayDate:e=>`\u{160}iandien, ${e.date}`,todayDateSelected:e=>`\u{160}iandien, pasirinkta ${e.date}`};var Wo={};Wo={dateRange:e=>`No ${e.startDate} l\u{12B}dz ${e.endDate}`,dateSelected:e=>`Atlas\u{12B}ts: ${e.date}`,finishRangeSelectionPrompt:`Noklikšķiniet, lai pabeigtu datumu diapazona atlasi`,maximumDate:`Pēdējais pieejamais datums`,minimumDate:`Pirmais pieejamais datums`,next:`Tālāk`,previous:`Atpakaļ`,selectedDateDescription:e=>`Atlas\u{12B}tais datums: ${e.date}`,selectedRangeDescription:e=>`Atlas\u{12B}tais diapazons: ${e.dateRange}`,startRangeSelectionPrompt:`Noklikšķiniet, lai sāktu datumu diapazona atlasi`,todayDate:e=>`\u{160}odien, ${e.date}`,todayDateSelected:e=>`Atlas\u{12B}ta \u{161}odiena, ${e.date}`};var Go={};Go={dateRange:e=>`${e.startDate} til ${e.endDate}`,dateSelected:e=>`${e.date} valgt`,finishRangeSelectionPrompt:`Klikk for å fullføre valg av datoområde`,maximumDate:`Siste tilgjengelige dato`,minimumDate:`Første tilgjengelige dato`,next:`Neste`,previous:`Forrige`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt omr\xe5de: ${e.dateRange}`,startRangeSelectionPrompt:`Klikk for å starte valg av datoområde`,todayDate:e=>`I dag, ${e.date}`,todayDateSelected:e=>`I dag, ${e.date} valgt`};var Ko={};Ko={dateRange:e=>`${e.startDate} tot ${e.endDate}`,dateSelected:e=>`${e.date} geselecteerd`,finishRangeSelectionPrompt:`Klik om de selectie van het datumbereik te voltooien`,maximumDate:`Laatste beschikbare datum`,minimumDate:`Eerste beschikbare datum`,next:`Volgende`,previous:`Vorige`,selectedDateDescription:e=>`Geselecteerde datum: ${e.date}`,selectedRangeDescription:e=>`Geselecteerd bereik: ${e.dateRange}`,startRangeSelectionPrompt:`Klik om het datumbereik te selecteren`,todayDate:e=>`Vandaag, ${e.date}`,todayDateSelected:e=>`Vandaag, ${e.date} geselecteerd`};var qo={};qo={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`Wybrano ${e.date}`,finishRangeSelectionPrompt:`Kliknij, aby zakończyć wybór zakresu dat`,maximumDate:`Ostatnia dostępna data`,minimumDate:`Pierwsza dostępna data`,next:`Dalej`,previous:`Wstecz`,selectedDateDescription:e=>`Wybrana data: ${e.date}`,selectedRangeDescription:e=>`Wybrany zakres: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknij, aby rozpocząć wybór zakresu dat`,todayDate:e=>`Dzisiaj, ${e.date}`,todayDateSelected:e=>`Dzisiaj wybrano ${e.date}`};var Jo={};Jo={dateRange:e=>`${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} selecionado`,finishRangeSelectionPrompt:`Clique para concluir a seleção do intervalo de datas`,maximumDate:`Última data disponível`,minimumDate:`Primeira data disponível`,next:`Próximo`,previous:`Anterior`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.dateRange}`,startRangeSelectionPrompt:`Clique para iniciar a seleção do intervalo de datas`,todayDate:e=>`Hoje, ${e.date}`,todayDateSelected:e=>`Hoje, ${e.date} selecionado`};var Yo={};Yo={dateRange:e=>`${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} selecionado`,finishRangeSelectionPrompt:`Clique para terminar de selecionar o intervalo de datas`,maximumDate:`Última data disponível`,minimumDate:`Primeira data disponível`,next:`Próximo`,previous:`Anterior`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.dateRange}`,startRangeSelectionPrompt:`Clique para começar a selecionar o intervalo de datas`,todayDate:e=>`Hoje, ${e.date}`,todayDateSelected:e=>`Hoje, ${e.date} selecionado`};var Xo={};Xo={dateRange:e=>`De la ${e.startDate} p\xe2n\u{103} la ${e.endDate}`,dateSelected:e=>`${e.date} selectat\u{103}`,finishRangeSelectionPrompt:`Apăsaţi pentru a finaliza selecţia razei pentru dată`,maximumDate:`Ultima dată disponibilă`,minimumDate:`Prima dată disponibilă`,next:`Următorul`,previous:`Înainte`,selectedDateDescription:e=>`Dat\u{103} selectat\u{103}: ${e.date}`,selectedRangeDescription:e=>`Interval selectat: ${e.dateRange}`,startRangeSelectionPrompt:`Apăsaţi pentru a începe selecţia razei pentru dată`,todayDate:e=>`Ast\u{103}zi, ${e.date}`,todayDateSelected:e=>`Azi, ${e.date} selectat\u{103}`};var Zo={};Zo={dateRange:e=>`\u{421} ${e.startDate} \u{43F}\u{43E} ${e.endDate}`,dateSelected:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`,finishRangeSelectionPrompt:`Щелкните, чтобы завершить выбор диапазона дат`,maximumDate:`Последняя доступная дата`,minimumDate:`Первая доступная дата`,next:`Далее`,previous:`Назад`,selectedDateDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{430}\u{44F} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{44B}\u{439} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.dateRange}`,startRangeSelectionPrompt:`Щелкните, чтобы начать выбор диапазона дат`,todayDate:e=>`\u{421}\u{435}\u{433}\u{43E}\u{434}\u{43D}\u{44F}, ${e.date}`,todayDateSelected:e=>`\u{421}\u{435}\u{433}\u{43E}\u{434}\u{43D}\u{44F}, \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`};var Qo={};Qo={dateRange:e=>`Od ${e.startDate} do ${e.endDate}`,dateSelected:e=>`Vybrat\xfd d\xe1tum ${e.date}`,finishRangeSelectionPrompt:`Kliknutím dokončíte výber rozsahu dátumov`,maximumDate:`Posledný dostupný dátum`,minimumDate:`Prvý dostupný dátum`,next:`Nasledujúce`,previous:`Predchádzajúce`,selectedDateDescription:e=>`Vybrat\xfd d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Vybrat\xfd rozsah: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknutím spustíte výber rozsahu dátumov`,todayDate:e=>`Dnes ${e.date}`,todayDateSelected:e=>`Vybrat\xfd dne\u{161}n\xfd d\xe1tum ${e.date}`};var $o={};$o={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`${e.date} izbrano`,finishRangeSelectionPrompt:`Kliknite za dokončanje izbire datumskega obsega`,maximumDate:`Zadnji razpoložljivi datum`,minimumDate:`Prvi razpoložljivi datum`,next:`Naprej`,previous:`Nazaj`,selectedDateDescription:e=>`Izbrani datum: ${e.date}`,selectedRangeDescription:e=>`Izbrano obmo\u{10D}je: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknite za začetek izbire datumskega obsega`,todayDate:e=>`Danes, ${e.date}`,todayDateSelected:e=>`Danes, ${e.date} izbrano`};var es={};es={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`${e.date} izabran`,finishRangeSelectionPrompt:`Kliknite da dovršite opseg izabranih datuma`,maximumDate:`Zadnji raspoloživi datum`,minimumDate:`Prvi raspoloživi datum`,next:`Sledeći`,previous:`Prethodni`,selectedDateDescription:e=>`Izabrani datum: ${e.date}`,selectedRangeDescription:e=>`Izabrani period: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknite da započnete opseg izabranih datuma`,todayDate:e=>`Danas, ${e.date}`,todayDateSelected:e=>`Danas, izabran ${e.date}`};var ts={};ts={dateRange:e=>`${e.startDate} till ${e.endDate}`,dateSelected:e=>`${e.date} har valts`,finishRangeSelectionPrompt:`Klicka för att avsluta val av datumintervall`,maximumDate:`Sista tillgängliga datum`,minimumDate:`Första tillgängliga datum`,next:`Nästa`,previous:`Föregående`,selectedDateDescription:e=>`Valt datum: ${e.date}`,selectedRangeDescription:e=>`Valt intervall: ${e.dateRange}`,startRangeSelectionPrompt:`Klicka för att välja datumintervall`,todayDate:e=>`Idag, ${e.date}`,todayDateSelected:e=>`Idag, ${e.date} har valts`};var ns={};ns={dateRange:e=>`${e.startDate} - ${e.endDate}`,dateSelected:e=>`${e.date} se\xe7ildi`,finishRangeSelectionPrompt:`Tarih aralığı seçimini tamamlamak için tıklayın`,maximumDate:`Son müsait tarih`,minimumDate:`İlk müsait tarih`,next:`Sonraki`,previous:`Önceki`,selectedDateDescription:e=>`Se\xe7ilen Tarih: ${e.date}`,selectedRangeDescription:e=>`Se\xe7ilen Aral\u{131}k: ${e.dateRange}`,startRangeSelectionPrompt:`Tarih aralığı seçimini başlatmak için tıklayın`,todayDate:e=>`Bug\xfcn, ${e.date}`,todayDateSelected:e=>`Bug\xfcn, ${e.date} se\xe7ildi`};var rs={};rs={dateRange:e=>`${e.startDate} \u{2014} ${e.endDate}`,dateSelected:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`,finishRangeSelectionPrompt:`Натисніть, щоб завершити вибір діапазону дат`,maximumDate:`Остання доступна дата`,minimumDate:`Перша доступна дата`,next:`Наступний`,previous:`Попередній`,selectedDateDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{438}\u{439} \u{434}\u{456}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.dateRange}`,startRangeSelectionPrompt:`Натисніть, щоб почати вибір діапазону дат`,todayDate:e=>`\u{421}\u{44C}\u{43E}\u{433}\u{43E}\u{434}\u{43D}\u{456}, ${e.date}`,todayDateSelected:e=>`\u{421}\u{44C}\u{43E}\u{433}\u{43E}\u{434}\u{43D}\u{456}, \u{432}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`};var is={};is={dateRange:e=>`${e.startDate} \u{81F3} ${e.endDate}`,dateSelected:e=>`\u{5DF2}\u{9009}\u{62E9} ${e.date}`,finishRangeSelectionPrompt:`单击以完成选择日期范围`,maximumDate:`最后一个可用日期`,minimumDate:`第一个可用日期`,next:`下一页`,previous:`上一页`,selectedDateDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{8303}\u{56F4}\u{FF1A}${e.dateRange}`,startRangeSelectionPrompt:`单击以开始选择日期范围`,todayDate:e=>`\u{4ECA}\u{5929}\u{FF0C}\u{5373} ${e.date}`,todayDateSelected:e=>`\u{5DF2}\u{9009}\u{62E9}\u{4ECA}\u{5929}\u{FF0C}\u{5373} ${e.date}`};var as={};as={dateRange:e=>`${e.startDate} \u{81F3} ${e.endDate}`,dateSelected:e=>`\u{5DF2}\u{9078}\u{53D6} ${e.date}`,finishRangeSelectionPrompt:`按一下以完成選取日期範圍`,maximumDate:`最後一個可用日期`,minimumDate:`第一個可用日期`,next:`下一頁`,previous:`上一頁`,selectedDateDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{7BC4}\u{570D}\u{FF1A}${e.dateRange}`,startRangeSelectionPrompt:`按一下以開始選取日期範圍`,todayDate:e=>`\u{4ECA}\u{5929}\u{FF0C}${e.date}`,todayDateSelected:e=>`\u{5DF2}\u{9078}\u{53D6}\u{4ECA}\u{5929}\u{FF0C}${e.date}`};var os={};os={"ar-AE":Eo,"bg-BG":Do,"cs-CZ":Oo,"da-DK":ko,"de-DE":Ao,"el-GR":jo,"en-US":Mo,"es-ES":No,"et-EE":Po,"fi-FI":Fo,"fr-FR":Io,"he-IL":Lo,"hr-HR":Ro,"hu-HU":zo,"it-IT":Bo,"ja-JP":Vo,"ko-KR":Ho,"lt-LT":Uo,"lv-LV":Wo,"nb-NO":Go,"nl-NL":Ko,"pl-PL":qo,"pt-BR":Jo,"pt-PT":Yo,"ro-RO":Xo,"ru-RU":Zo,"sk-SK":Qo,"sl-SI":$o,"sr-SP":es,"sv-SE":ts,"tr-TR":ns,"uk-UA":rs,"zh-CN":is,"zh-TW":as};function ss(e){return e&&e.__esModule?e.default:e}var cs=new WeakMap;function ls(e){return e?.calendar.identifier===`gregory`&&e.era===`BC`?`short`:void 0}function us(e){let t=h(ss(os),`@react-aria/calendar`),n,r;`highlightedRange`in e?{start:n,end:r}=e.highlightedRange||{}:(n=Array.isArray(e.value)?e.value[0]:e.value??void 0,r=Array.isArray(e.value)?e.value.at(-1):e.value??void 0);let i=Z({weekday:`long`,month:`long`,year:`numeric`,day:`numeric`,era:ls(n)||ls(r),timeZone:e.timeZone}),{locale:a}=F(),o=(0,R.useMemo)(()=>new Intl.ListFormat(a),[a]),s=`anchorDate`in e?e.anchorDate:null;return(0,R.useMemo)(()=>{if(!s&&n&&r){if(B(n,r)){let r=i.format(n.toDate(e.timeZone));return t.format(`selectedDateDescription`,{date:r})}if(`highlightedRange`in e){let a=fs(i,t,n,r,e.timeZone);return t.format(`selectedRangeDescription`,{dateRange:a})}if(Array.isArray(e.value)){let n=e.value.map(t=>i.format(t.toDate(e.timeZone))),r=o.format(n);return t.format(`selectedDateDescription`,{date:r})}}return``},[n,r,s,e,t,i,o])}function ds(e,t,n,r){let i=h(ss(os),`@react-aria/calendar`),a=ls(e)||ls(t),o=Z({month:`long`,year:`numeric`,era:a,calendar:e.calendar.identifier,timeZone:n}),s=Z({month:`long`,year:`numeric`,day:`numeric`,era:a,calendar:e.calendar.identifier,timeZone:n});return(0,R.useMemo)(()=>{if(B(e,Dt(e))){let a=e,s=t;if(e.calendar.getFormattableMonth&&(a=e.calendar.getFormattableMonth(e)),t.calendar.getFormattableMonth&&(s=t.calendar.getFormattableMonth(t)),B(t,Ot(e)))return o.format(a.toDate(n));if(B(t,Ot(t)))return r?fs(o,i,a,s,n):o.formatRange(a.toDate(n),s.toDate(n))}return r?fs(s,i,e,t,n):s.formatRange(e.toDate(n),t.toDate(n))},[e,t,o,s,i,n,r])}function fs(e,t,n,r,i){let a=e.formatRangeToParts(n.toDate(i),r.toDate(i)),o=-1;for(let e=0;eo&&(c+=a[e].value);return t.format(`dateRange`,{startDate:s,endDate:c})}function ps(e){return e&&e.__esModule?e.default:e}function ms(e,t){let n=h(ps(os),`@react-aria/calendar`),r=I(e),i=ds(t.visibleRange.start,t.visibleRange.end,t.timeZone,!1),a=ds(t.visibleRange.start,t.visibleRange.end,t.timeZone,!0);_e(()=>{t.isFocused||l(a)},[a]);let o=us(t);_e(()=>{o&&l(o,`polite`,4e3)},[o]);let s=ie([!!e.errorMessage,e.isInvalid,e.validationState]);cs.set(t,{ariaLabel:e[`aria-label`],ariaLabelledBy:e[`aria-labelledby`],errorMessageId:s,selectedDateDescription:o});let[c,u]=(0,R.useState)(!1),d=e.isDisabled||t.isNextVisibleRangeInvalid();d&&c&&(u(!1),t.setFocused(!0));let[f,p]=(0,R.useState)(!1),m=e.isDisabled||t.isPreviousVisibleRangeInvalid();m&&f&&(p(!1),t.setFocused(!0));let g=_({id:e.id,"aria-label":[e[`aria-label`],a].filter(Boolean).join(`, `),"aria-labelledby":e[`aria-labelledby`]});return{calendarProps:D(r,g,{role:`application`,"aria-details":e[`aria-details`]||void 0,"aria-describedby":e[`aria-describedby`]||void 0}),nextButtonProps:{onPress:()=>t.focusNextPage(),"aria-label":n.format(`next`),isDisabled:d,onFocusChange:u},prevButtonProps:{onPress:()=>t.focusPreviousPage(),"aria-label":n.format(`previous`),isDisabled:m,onFocusChange:p},errorMessageProps:{id:s},title:i}}function hs(e,t){let{startDate:n=t.visibleRange.start,endDate:r=t.visibleRange.end,firstDayOfWeek:i}=e,{direction:a}=F(),{keyboardProps:o}=he({shortcuts:{End:()=>{t.focusSectionEnd()},Home:()=>{t.focusSectionStart()},Escape:()=>(`setAnchorDate`in t&&t.setAnchorDate(null),!1)}}),{keyboardProps:s}=he({shortcuts:{Enter:()=>{t.selectFocusedDate()}," ":()=>{t.selectFocusedDate()},PageUp:()=>{t.focusPreviousSection()},"Shift+PageUp":()=>{t.focusPreviousSection(!0)},PageDown:()=>{t.focusNextSection()},"Shift+PageDown":()=>{t.focusNextSection(!0)},ArrowLeft:()=>{a===`rtl`?t.focusNextDay():t.focusPreviousDay()},ArrowUp:()=>{t.focusPreviousRow()},ArrowRight:()=>{a===`rtl`?t.focusPreviousDay():t.focusNextDay()},ArrowDown:()=>{t.focusNextRow()}},allowRepeats:!0}),c=ds(n,r,t.timeZone,!0),{ariaLabel:l,ariaLabelledBy:u}=cs.get(t),d=_({"aria-label":[l,c].filter(Boolean).join(`, `),"aria-labelledby":u}),f=Z({weekday:e.weekdayStyle||`narrow`,timeZone:t.timeZone}),{locale:p}=F(),m=(0,R.useMemo)(()=>{let e=t.visibleDuration.days&&t.visibleDuration.days<7,r=e?n:At(yt(t.timeZone),p,i),a=e?t.visibleDuration.days:7;return[...Array(a).keys()].map(e=>{let n=r.add({days:e}).toDate(t.timeZone);return f.format(n)})},[p,t.timeZone,f,i,n,t.visibleDuration.days]),h=t.getWeeksInMonth(n);return{gridProps:D(d,{role:`grid`,"aria-readonly":t.isReadOnly||void 0,"aria-disabled":t.isDisabled||void 0,"aria-multiselectable":`highlightedRange`in t||t.selectionMode===`multiple`||void 0,onFocus:()=>t.setFocused(!0),onBlur:()=>t.setFocused(!1)},o,s),headerProps:{"aria-hidden":!0},weekDays:m,weeksInMonth:h}}function gs(e){return e&&e.__esModule?e.default:e}function _s(e,t,n){let{date:r,isDisabled:i}=e,{errorMessageId:a,selectedDateDescription:o}=cs.get(t),s=h(gs(os),`@react-aria/calendar`),c=Z({weekday:`long`,day:`numeric`,month:`long`,year:`numeric`,era:ls(r),timeZone:t.timeZone}),l=t.isCellFocused(r)&&!e.isOutsideMonth;i=i||t.isCellDisabled(r)||!!e.isOutsideMonth;let u=t.isCellUnavailable(r),d=!i&&!u,f=t.isSelected(r)&&d,p=!1;t.isValueInvalid&&(`highlightedRange`in t?p=!t.anchorDate&&t.highlightedRange!=null&&r.compare(t.highlightedRange.start)>=0&&r.compare(t.highlightedRange.end)<=0:Array.isArray(t.value)?p=t.value.some(e=>B(e,r)):t.value&&(p=B(t.value,r))),p&&!i&&(f=!0),r=Ye(r,pt);let m=(0,R.useMemo)(()=>r.toDate(t.timeZone),[r,t.timeZone]),g=ht(r,t.timeZone),_=(0,R.useMemo)(()=>{let e=``;return`highlightedRange`in t&&t.value&&!t.anchorDate&&(B(r,t.value.start)||B(r,t.value.end))&&(e=o+`, `),e+=c.format(m),g?e=s.format(f?`todayDateSelected`:`todayDate`,{date:e}):f&&(e=s.format(`dateSelected`,{date:e})),t.minValue&&B(r,t.minValue)?e+=`, `+s.format(`minimumDate`):t.maxValue&&B(r,t.maxValue)&&(e+=`, `+s.format(`maximumDate`)),e},[c,m,s,f,g,r,t,o]),v=``;`anchorDate`in t&&l&&!t.isReadOnly&&d&&(v=t.anchorDate?s.format(`finishRangeSelectionPrompt`):s.format(`startRangeSelectionPrompt`));let y=Ge(v),x=(0,R.useRef)(!1),S=(0,R.useRef)(!1),C=(0,R.useRef)(void 0),{pressProps:w,isPressed:T}=ue({shouldCancelOnPointerExit:`anchorDate`in t&&!!t.anchorDate,preventFocusOnPress:!0,isDisabled:!d||t.isReadOnly,onPressStart(e){if(t.isReadOnly){t.setFocusedDate(r),t.setFocused(!0);return}if(`highlightedRange`in t&&!t.anchorDate&&(e.pointerType===`mouse`||e.pointerType===`touch`)){if(t.highlightedRange&&!p){if(B(r,t.highlightedRange.start)){t.setAnchorDate(t.highlightedRange.end),t.setFocusedDate(r),t.setFocused(!0),t.setDragging(!0),S.current=!0;return}if(B(r,t.highlightedRange.end)){t.setAnchorDate(t.highlightedRange.start),t.setFocusedDate(r),t.setFocused(!0),t.setDragging(!0),S.current=!0;return}}let n=()=>{t.setDragging(!0),C.current=void 0,t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0),x.current=!0};e.pointerType===`touch`?C.current=setTimeout(n,200):n()}},onPressEnd(){S.current=!1,x.current=!1,clearTimeout(C.current),C.current=void 0},onPress(){!(`anchorDate`in t)&&!t.isReadOnly&&(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0))},onPressUp(e){t.isReadOnly||(`anchorDate`in t&&C.current&&(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0)),`anchorDate`in t&&(S.current?t.setAnchorDate(r):t.anchorDate&&!x.current?(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0)):e.pointerType===`keyboard`&&!t.anchorDate?(t.selectDate(r),t.focusNearestAvailableDate(r)):e.pointerType===`virtual`&&(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0))))}}),E;i||(E=B(r,t.focusedDate)?0:-1),(0,R.useEffect)(()=>{l&&n.current&&(M(n.current),me()!==`pointer`&&b()===n.current&&Ue(n.current,{containingElement:He(n.current)}))},[l,n]);let O=Z({day:`numeric`,timeZone:t.timeZone,calendar:r.calendar.identifier}),k=(0,R.useMemo)(()=>O.formatToParts(m).find(e=>e.type===`day`).value,[O,m]);return{cellProps:{role:`gridcell`,"aria-disabled":!d||void 0,"aria-selected":f||void 0,"aria-invalid":p||void 0},buttonProps:D(w,{onFocus(){i||(t.setFocusedDate(r),t.setFocused(!0))},tabIndex:E,role:`button`,"aria-disabled":!d||void 0,"aria-label":_,"aria-invalid":p||void 0,"aria-describedby":[p?a:void 0,y[`aria-describedby`]].filter(Boolean).join(` `)||void 0,onPointerEnter(e){`highlightDate`in t&&(e.pointerType!==`touch`||t.isDragging)&&d&&t.highlightDate(r)},onPointerDown(e){let t=fe(e);t instanceof HTMLElement&&`releasePointerCapture`in t&&(`hasPointerCapture`in t?t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId):t.releasePointerCapture(e.pointerId))},onContextMenu(e){e.preventDefault()}}),isPressed:T,isFocused:l,isSelected:f,isDisabled:i,isUnavailable:u,isOutsideVisibleRange:r.compare(t.visibleRange.start)<0||r.compare(t.visibleRange.end)>0,isInvalid:p,formattedDate:k}}function vs(e,t){let n=Z({year:e.format?.year||`numeric`,era:e.format?.era||(t.focusedDate.calendar.identifier===`gregory`&&t.focusedDate.era===`BC`?`short`:void 0),calendar:t.focusedDate.calendar.identifier,timeZone:t.timeZone}),r=e.visibleYears||20,i=t.focusedDate.subtract({years:Math.floor(r/2)}),a=t.focusedDate.add({years:Math.ceil(r/2)-1});t.maxValue&&a.compare(t.maxValue)>0&&(a=U(t.maxValue),i=a.subtract({years:r-1})),t.minValue&&i.compare(t.minValue)<0&&(i=U(t.minValue),a=i.add({years:r-1}),t.maxValue&&a.compare(t.maxValue)>0&&(a=U(t.maxValue)));let o=[],s=i,c=0;for(;s.compare(a)<=0;)ft(s,t.focusedDate)&&(c=o.length),o.push({id:o.length,date:s,formatted:n.format(s.toDate(t.timeZone))}),s=s.add({years:1});let{locale:l}=F();return{"aria-label":(0,R.useMemo)(()=>new Intl.DisplayNames(l,{type:`dateTimeField`}).of(`year`),[l]),value:c,onChange:e=>{e!=null&&t.setFocusedDate(o[e].date)},items:o}}function ys(e,t){let n=(0,R.useMemo)(()=>{let n=t.visibleRange.start;return e.offset&&(n=n.add(e.offset)),n},[t.visibleRange.start,e.offset]),r=t.visibleDuration.days||t.visibleDuration.weeks,i=Z({day:e.format?.day||(r?`numeric`:void 0),month:e.format?.month||`long`,year:e.format?.year||`numeric`,era:e.format?.era||n&&n.calendar.identifier===`gregory`&&n.era===`BC`?`short`:void 0,calendar:t.visibleRange?.start.calendar.identifier,timeZone:t.timeZone});return(0,R.useMemo)(()=>{if(r)return i.formatRange(n.toDate(t.timeZone),t.visibleRange.end.toDate(t.timeZone));let e=n.calendar.getFormattableMonth?n.calendar.getFormattableMonth(n):n;return i.format(e.toDate(t.timeZone))},[i,r,n,t.timeZone,t.visibleRange.end])}function bs(e,t,n){let{commitBehavior:r=`select`,...i}=e,a=ms(i,t),o=(0,R.useRef)(!1),s=(0,R.useRef)(typeof window<`u`?window:null);g(s,`pointerdown`,e=>{o.current=e.width===0&&e.height===0});let c={clear:()=>t.clearSelection(),reset:()=>t.setAnchorDate(null),select:()=>t.commitSelection()};return g(s,`pointerup`,e=>{if(o.current){o.current=!1;return}if(t.setDragging(!1),!t.anchorDate)return;let i=e.target;n.current&&ee(n.current)&&(!ne(n.current,i)||!i.closest(`button, [role="button"]`))&&c[r]()}),a.calendarProps.onBlur=e=>{n.current&&(!e.relatedTarget||!ne(n.current,e.relatedTarget))&&t.anchorDate&&c[r]()},g(n,`touchmove`,e=>{t.isDragging&&e.preventDefault()},{passive:!1,capture:!0}),a}function xs(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function Ss(e,t,n,r,i){let a={};for(let e in t)a[e]=Math.floor(t[e]/2),a[e]>0&&t[e]%2==0&&a[e]--;return Ts(e,Cs(e,t,n).subtract(a),t,n,r,i)}function Cs(e,t,n,r,i){let a=e;return t.years?a=kt(e):t.months?a=Dt(e):(t.weeks||t.days&&t.days>7)&&(a=At(e,n)),Ts(e,a,t,n,r,i)}function ws(e,t,n,r,i){let a={...t};return a.days?a.days--:a.weeks?a.weeks--:a.months?a.months--:a.years&&a.years--,Ts(e,Cs(e,t,n).subtract(a),t,n,r,i)}function Ts(e,t,n,r,i,a){if(i&&e.compare(i)>=0){let e=Rt(t,Cs(U(i),n,r));e&&(t=e)}if(a&&e.compare(a)<=0){let e=Lt(t,ws(U(a),n,r));e&&(t=e)}return t}function Es(e,t,n){if(t){let n=Rt(e,U(t));n&&(e=n)}if(n){let t=Lt(e,U(n));t&&(e=t)}return e}function Ds(e,t,n){if(!n)return e;for(;e.compare(t)>=0&&n(e);)e=e.subtract({days:1});return e.compare(t)>=0?e:null}function Os(e,t){return e===t||e.days===t.days&&e.weeks===t.weeks&&e.months===t.months&&e.years===t.years}function ks(e){let t=(0,R.useMemo)(()=>new Y(e.locale),[e.locale]),n=(0,R.useMemo)(()=>t.resolvedOptions(),[t]),{locale:r,createCalendar:i,visibleDuration:a={months:1},minValue:o,maxValue:s,selectionAlignment:c,isDateUnavailable:l,pageBehavior:u=`visible`,selectionMode:d=`single`,firstDayOfWeek:f,weeksInMonth:p}=e,m=(0,R.useMemo)(()=>i(n.calendar),[i,n.calendar]),[h,g]=ce(e.value,e.defaultValue??null,e.onChange),_=(0,R.useMemo)(()=>Array.isArray(h)?h.map(e=>G(U(e),m)):h?G(U(h),m):null,[h,m]),v=(0,R.useMemo)(()=>{let e=Array.isArray(h)?h[0]:h;return e&&`timeZone`in e?e.timeZone:n.timeZone},[h,n.timeZone]),y=(0,R.useMemo)(()=>e.focusedValue?Es(G(U(e.focusedValue),m),o,s):void 0,[e.focusedValue,m,o,s]),b=(0,R.useMemo)(()=>e.defaultFocusedValue?Es(G(U(e.defaultFocusedValue),m),o,s):Es(_?Array.isArray(_)?_[0]:_:G(yt(v),m),o,s),[e.defaultFocusedValue,_,v,m,o,s]),[x,S]=ce(y,b,e.onFocusChange),C=()=>{switch(c){case`start`:return Cs(x,a,r,o,s);case`end`:return ws(x,a,r,o,s);default:return Ss(x,a,r,o,s)}},[w,T]=(0,R.useState)(C),[E,D]=(0,R.useState)(e.autoFocus||!1),[O,k]=(0,R.useState)(a);Os(a,O)||(k(a),T(C()));let A=(0,R.useMemo)(()=>{let e={...a};return e.days?e.days--:e.days=-1,w.add(e)},[w,a]),[ee,te]=(0,R.useState)(m);if(!mt(m,ee)){let e=G(x,m);T(Ss(e,a,r,o,s)),S(e),te(m)}xs(x,o,s)?S(Es(x,o,s)):x.compare(w)<0?T(ws(x,a,r,o,s)):x.compare(A)>0&&T(Cs(x,a,r,o,s));function j(e){e=Es(e,o,s),S(e)}function ne(e){let t=Ds(Es(e,o,s),w,l);if(!t)return null;let n=Array.isArray(h)?h[0]:h,r=G(t,n?.calendar||new z);return n&&`hour`in n?n.set(r):r}function M(t){if(!e.isDisabled&&!e.isReadOnly){if(t===null){g(d===`multiple`?[]:null);return}if(Array.isArray(t))g(t.map(ne).filter(Boolean));else{let e=ne(t);e&&g(e)}}}let re=(0,R.useMemo)(()=>_?Array.isArray(_)?_.some(e=>l?.(e)||xs(e,o,s)):l?.(_)||xs(_,o,s):!1,[_,l,o,s]),N=e.isInvalid||e.validationState===`invalid`||re,ie=N?`invalid`:null,P=(0,R.useMemo)(()=>u===`visible`?a:As(a),[u,a]);return{isDisabled:e.isDisabled??!1,isReadOnly:e.isReadOnly??!1,value:_,setValue:M,selectionMode:d,visibleDuration:a,visibleRange:{start:w,end:A},minValue:o,maxValue:s,focusedDate:x,timeZone:v,validationState:ie,isValueInvalid:N,setFocusedDate(e){j(e)},focusNextDay(){j(x.add({days:1}))},focusPreviousDay(){j(x.subtract({days:1}))},focusNextRow(){a.days?this.focusNextPage():(a.weeks||a.months||a.years)&&j(x.add({weeks:1}))},focusPreviousRow(){a.days?this.focusPreviousPage():(a.weeks||a.months||a.years)&&j(x.subtract({weeks:1}))},focusNextPage(){let e=w.add(P);S(Es(x.add(P),o,s)),T(Cs(Ts(x,e,P,r,o,s),P,r))},focusPreviousPage(){let e=w.subtract(P);S(Es(x.subtract(P),o,s)),T(Cs(Ts(x,e,P,r,o,s),P,r))},focusSectionStart(){a.days?j(w):a.weeks?j(At(x,r)):(a.months||a.years)&&j(Dt(x))},focusSectionEnd(){a.days?j(A):a.weeks?j(jt(x,r)):(a.months||a.years)&&j(Ot(x))},focusNextSection(e){if(!e&&!a.days){j(x.add(As(a)));return}a.days?this.focusNextPage():a.weeks?j(x.add({months:1})):(a.months||a.years)&&j(x.add({years:1}))},focusPreviousSection(e){if(!e&&!a.days){j(x.subtract(As(a)));return}a.days?this.focusPreviousPage():a.weeks?j(x.subtract({months:1})):(a.months||a.years)&&j(x.subtract({years:1}))},selectFocusedDate(){l&&l(x)||this.selectDate(x)},selectDate(t){if(!(e.isDisabled||e.isReadOnly)){if(d===`multiple`&&t!=null){let e=ne(t);if(!e)return;let n=[];Array.isArray(h)?n=h:h!=null&&(n=[h]);let r=n.findIndex(t=>B(t,e)),i=r>=0?n.slice(0,r).concat(n.slice(r+1)):[...n,e];g(i)}else M(t)}},isFocused:E,setFocused:D,isInvalid(e){return xs(e,o,s)},isSelected(e){return!_||this.isCellDisabled(e)||this.isCellUnavailable(e)?!1:Array.isArray(_)?_.some(t=>B(t,e)):B(e,_)},isCellFocused(e){return E&&x&&B(e,x)},isCellDisabled(t){return e.isDisabled||t.compare(w)<0||t.compare(A)>0||this.isInvalid(t)},isCellUnavailable(t){return e.isDateUnavailable?e.isDateUnavailable(t):!1},isPreviousVisibleRangeInvalid(){let e=w.subtract({days:1});return B(e,w)||this.isInvalid(e)},isNextVisibleRangeInvalid(){let e=A.add({days:1});return B(e,A)||this.isInvalid(e)},getDatesInWeek(e,t=w){let n=t.add({weeks:e}),i=[],o=a.days&&a.days<7?a.days:7;if(o===7){n=At(n,r,f);let e=_t(n,r,f);for(let t=0;t0&&(m=`start`)}let h=(0,R.useMemo)(()=>{let t=e.isDateUnavailable;if(t)return e=>t(e,f)},[e.isDateUnavailable,f]),g=(0,R.useCallback)(t=>t&&h&&!e.allowsNonContiguousRanges?{start:Ps(t,h,o,-1),end:Ps(t,h,o,1)}:null,[h,o,e.allowsNonContiguousRanges]),_=(0,R.useMemo)(()=>g(f),[g,f]),v=(0,R.useMemo)(()=>Rt(s,_?.start),[s,_]),y=(0,R.useMemo)(()=>Lt(c,_?.end),[c,_]),b=ks({...l,value:u&&u.start,createCalendar:i,locale:a,visibleDuration:o,minValue:v,maxValue:y,selectionAlignment:e.selectionAlignment||m,isDateUnavailable:h}),x=f?Ms(f,b.focusedDate):u&&Ms(u.start,u.end),S=t=>{if(e.isReadOnly)return;let n=Ds(Es(t,v,y),b.visibleRange.start,h);if(n){if(!f)p(n);else{let e=Ms(f,n);e&&d({start:Ns(e.start,u?.start),end:Ns(e.end,u?.end)}),p(null)}}},[C,w]=(0,R.useState)(!1),T=(0,R.useMemo)(()=>!u||f?!1:h&&(h(u.start)||h(u.end))?!0:xs(u.start,s,c)||xs(u.end,s,c),[h,u,f,s,c]),E=e.isInvalid||e.validationState===`invalid`||T,D=E?`invalid`:null;return{...b,value:u,setValue:d,anchorDate:f,setAnchorDate:p,highlightedRange:x,validationState:D,isValueInvalid:E,selectFocusedDate(){b.isCellUnavailable(b.focusedDate)||S(b.focusedDate)},commitSelection(){S(b.focusedDate)},selectDate:S,highlightDate(e){f&&b.setFocusedDate(e)},isSelected(e){return!!(x&&e.compare(x.start)>=0&&e.compare(x.end)<=0&&!b.isCellDisabled(e)&&!b.isCellUnavailable(e))},isInvalid(e){return b.isInvalid(e)||xs(e,_?.start,_?.end)},isDragging:C,setDragging:w,clearSelection(){p(null),d(null)},focusNearestAvailableDate(e){let t=g(e),n=e=>this.isInvalid(e)||xs(e,t?.start,t?.end),r=e.add({days:1});n(r)&&(r=e.subtract({days:1})),n(r)||(this.setFocusedDate(r),this.setFocused(!0))}}}function Ms(e,t){return!e||!t?null:(t.compare(e)<0&&([e,t]=[t,e]),{start:U(e),end:U(t)})}function Ns(e,t){return e=G(e,t?.calendar||new z),t&&`hour`in t?t.set(e):e}function Ps(e,t,n,r){let i=e.add({days:r}),a=e.subtract(n),o=e.add(n);for(;(r<0?i.compare(a)>=0:i.compare(o)<=0)&&!t(i);)i=i.add({days:r});if(t(i))return i.add({days:-r})}var Fs=(0,R.createContext)(null),Is=(0,R.createContext)(null),Ls=(0,R.createContext)(null),Rs=(0,R.createContext)(null),zs=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,Is);let{locale:n}=F(),r=js({...e,locale:n,createCalendar:e.createCalendar||Kr}),{calendarProps:i,prevButtonProps:o,nextButtonProps:s,errorMessageProps:c,title:l}=bs(e,r,t),u=k({...e,values:{state:r,isDisabled:e.isDisabled||!1,isInvalid:r.isValueInvalid},defaultClassName:`react-aria-RangeCalendar`}),f=I(e,{global:!0});return R.createElement(w.div,{...D(u,f,i),ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":r.isValueInvalid||void 0},R.createElement(x,{values:[[d,{slots:{previous:o,next:s}}],[We,{"aria-hidden":!0,level:2,children:l}],[Rs,r],[Is,e],[p,{slots:{errorMessage:c}}]]},R.createElement(a,null,R.createElement(`h2`,null,i[`aria-label`])),u.children,R.createElement(a,null,R.createElement(`button`,{"aria-label":s[`aria-label`],disabled:s.isDisabled,onClick:()=>r.focusNextPage(),tabIndex:-1}))))}),Bs=(0,R.createContext)(null),Vs=(0,R.forwardRef)(function(e,t){let n=(0,R.useContext)(Ls),r=(0,R.useContext)(Rs),i=O(Fs),a=O(Is),o=n??r,s=o.visibleRange.start;e.offset&&(s=s.add(e.offset));let c=i?.firstDayOfWeek??a?.firstDayOfWeek,{gridProps:l,headerProps:u,weekDays:d,weeksInMonth:f}=hs({startDate:s,endDate:Ot(s),weekdayStyle:e.weekdayStyle,firstDayOfWeek:c},o),p=I(e,{global:!0});return R.createElement(Bs.Provider,{value:{headerProps:u,weekDays:d,startDate:s,weeksInMonth:f}},R.createElement(w.table,{render:e.render,...D(p,l),ref:t,style:e.style,cellPadding:0,className:e.className??`react-aria-CalendarGrid`},typeof e.children==`function`?R.createElement(R.Fragment,null,R.createElement(Us,null,e=>R.createElement(Gs,null,e)),R.createElement(qs,null,e.children)):e.children))});function Hs(e,t){let{children:n,style:r,className:i}=e,{headerProps:a,weekDays:o}=(0,R.useContext)(Bs),s=I(e,{global:!0});return R.createElement(w.thead,{render:e.render,...D(s,a),ref:t,style:r,className:i??`react-aria-CalendarGridHeader`},R.createElement(`tr`,null,o.map((e,t)=>R.cloneElement(n(e),{key:t}))))}var Us=(0,R.forwardRef)(Hs);function Ws(e,t){let{children:n,style:r,className:i}=e,a=I(e,{global:!0});return R.createElement(w.th,{render:e.render,...a,ref:t,style:r,className:i||`react-aria-CalendarHeaderCell`},n)}var Gs=(0,R.forwardRef)(Ws);function Ks(e,t){let{children:n,style:r,className:i}=e,a=(0,R.useContext)(Ls),o=(0,R.useContext)(Rs),s=a??o,{startDate:c,weeksInMonth:l}=(0,R.useContext)(Bs),u=I(e,{global:!0});return R.createElement(w.tbody,{render:e.render,...u,ref:t,style:r,className:i??`react-aria-CalendarGridBody`},[...Array(l).keys()].map(e=>R.createElement(`tr`,{key:e},s.getDatesInWeek(e,c).map((e,t)=>e?R.cloneElement(n(e),{key:t}):R.createElement(`td`,{key:t})))))}var qs=(0,R.forwardRef)(Ks),Js=(0,R.forwardRef)(function({date:e,...t},n){let r=(0,R.useContext)(Ls),i=(0,R.useContext)(Rs),a=r??i,{startDate:o}=(0,R.useContext)(Bs)??{startDate:a.visibleRange.start},s=a.visibleDuration.days||a.visibleDuration.weeks?!1:!dt(o,e),c=ht(e,a.timeZone),l=(0,R.useRef)(null),{cellProps:u,buttonProps:d,...f}=_s({date:e,isOutsideMonth:s},a,l),{hoverProps:p,isHovered:m}=pe({...t,isDisabled:f.isDisabled||f.isUnavailable}),{focusProps:h,isFocusVisible:g}=P();g&&=f.isFocused;let _=!1,v=!1;`highlightedRange`in a&&a.highlightedRange&&(_=B(e,a.highlightedRange.start),v=B(e,a.highlightedRange.end));let y=k({...t,defaultChildren:f.formattedDate,defaultClassName:`react-aria-CalendarCell`,values:{date:e,isHovered:m,isOutsideMonth:s,isFocusVisible:g,isSelectionStart:_,isSelectionEnd:v,isToday:c,...f}}),b={"data-focused":f.isFocused||void 0,"data-hovered":m||void 0,"data-pressed":f.isPressed||void 0,"data-unavailable":f.isUnavailable||void 0,"data-disabled":f.isDisabled||void 0,"data-focus-visible":g||void 0,"data-outside-visible-range":f.isOutsideVisibleRange||void 0,"data-outside-month":s||void 0,"data-selected":f.isSelected||void 0,"data-selection-start":_||void 0,"data-selection-end":v||void 0,"data-invalid":f.isInvalid||void 0,"data-today":c||void 0},x=I(t,{global:!0});return R.createElement(`td`,{...u,ref:n},R.createElement(w.div,{...D(x,d,h,p,b,y),ref:l}))}),Ys=(0,R.forwardRef)(function(e,t){let{offset:n,format:r,className:i=`react-aria-CalendarHeading`,...a}=e,o=R.useContext(Ls),s=R.useContext(Rs),c=ys({offset:n,format:r},o||s);return R.createElement(ze,{...a,className:i,ref:t},c)});function Xs(e){return e&&e.__esModule?e.default:e}function Zs(e,t,n){let r=h(Xs(zi),`@react-aria/datepicker`),{isInvalid:i,validationErrors:a,validationDetails:o}=t.displayValidation,{labelProps:s,fieldProps:c,descriptionProps:l,errorMessageProps:u}=De({...e,labelElementType:`span`,isInvalid:i,errorMessage:e.errorMessage||a}),d=c[`aria-labelledby`]||c.id,{locale:f}=F(),p=t.formatValue(f,{month:`long`}),m=p?r.format(`selectedRangeDescription`,{startDate:p.start,endDate:p.end}):``,g=Ge(m),_={"aria-label":r.format(`startDate`),"aria-labelledby":d},v={"aria-label":r.format(`endDate`),"aria-labelledby":d},y=le(),b=le(),x=Bi(t,n),S=[g[`aria-describedby`],c[`aria-describedby`]].filter(Boolean).join(` `)||void 0,C=(0,R.useMemo)(()=>de(n,{accept:e=>e.id!==y}),[n,y]),w={[Gi]:C,[Wi]:`presentation`,"aria-describedby":S,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,granularity:e.granularity,shouldForceLeadingZeros:e.shouldForceLeadingZeros,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior},T=I(e),E=(0,R.useRef)(!1),{focusWithinProps:O}=oe({...e,isDisabled:t.isOpen,onBlurWithin:t=>{let n=document.getElementById(b);ne(n,t.relatedTarget)||(E.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{E.current||(E.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}}),k=(0,R.useRef)(xe),A=(0,R.useRef)(xe);return{groupProps:D(T,x,c,g,O,{role:`group`,"aria-disabled":e.isDisabled||null,"aria-describedby":S,onKeyDown(n){t.isOpen||e.onKeyDown&&e.onKeyDown(n)},onKeyUp(n){t.isOpen||e.onKeyUp&&e.onKeyUp(n)}}),labelProps:{...s,onClick:()=>{C.focusFirst()}},buttonProps:{...g,id:y,"aria-haspopup":`dialog`,"aria-label":r.format(`calendar`),"aria-labelledby":`${y} ${d}`,"aria-describedby":S,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:b,"aria-labelledby":`${y} ${d}`},startFieldProps:{..._,...w,value:t.value?.start??null,defaultValue:t.defaultValue?.start,onChange:e=>t.setDateTime(`start`,e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[je]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){k.current=e,t.updateValidation(we(e,A.current))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},endFieldProps:{...v,...w,value:t.value?.end??null,defaultValue:t.defaultValue?.end,onChange:e=>t.setDateTime(`end`,e),name:e.endName,form:e.form,[je]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){A.current=e,t.updateValidation(we(k.current,e))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},descriptionProps:l,errorMessageProps:u,calendarProps:{autoFocus:!0,value:t.dateRange?.start&&t.dateRange.end?t.dateRange:null,onChange:t.setDateRange,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,allowsNonContiguousRanges:e.allowsNonContiguousRanges,defaultFocusedValue:t.dateRange?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:typeof e.errorMessage==`function`?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(` `),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:i,validationErrors:a,validationDetails:o}}function Qs(e){let t=v(e),[n,r]=ce(e.value,e.defaultValue||null,e.onChange),[i]=(0,R.useState)(n),[a,o]=(0,R.useState)(()=>n||{start:null,end:null});n==null&&a.start&&a.end&&(a={start:null,end:null},o(a));let s=n||a,c=e=>{s=e||{start:null,end:null},o(s),$s(s)?r(s):r(null)},[l,u]=Ka(s?.start||s?.end||e.placeholderValue||null,e.granularity),d=l===`hour`||l===`minute`||l===`second`,f=e.shouldCloseOnSelect??!0,[p,m]=(0,R.useState)(null),[h,g]=(0,R.useState)(null);s&&$s(s)&&(p=s,`hour`in s.start&&(h=s));let _=(e,t)=>{c({start:`timeZone`in t.start?t.start.set(U(e.start)):W(e.start,t.start),end:`timeZone`in t.end?t.end.set(U(e.end)):W(e.end,t.end)}),m(null),g(null),D.commitValidation()},y=n=>{let r=typeof f==`function`?f():f;d?$s(n)&&(r||h?.start&&h?.end)?_(n,{start:h?.start||Ua(e.placeholderValue),end:h?.end||Ua(e.placeholderValue)}):m(n):$s(n)?(c(n),D.commitValidation()):m(n),r&&t.setOpen(!1)},b=e=>{$s(p)&&$s(e)?_(p,e):g(e)},x=s?.start?.calendar.identifier===`gregory`&&s.start.era===`BC`||s?.end?.calendar.identifier===`gregory`&&s.end.era===`BC`,S=(0,R.useMemo)(()=>({granularity:l,timeZone:u,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:x}),[l,e.hourCycle,e.shouldForceLeadingZeros,u,e.hideTimeZone,x]),{minValue:C,maxValue:w,isDateUnavailable:T}=e,E=(0,R.useMemo)(()=>za(s,C,w,T?e=>T(e,null):void 0,S),[s,C,w,T,S]),D=Oe({...e,value:n,name:(0,R.useMemo)(()=>[e.startName,e.endName].filter(e=>e!=null),[e.startName,e.endName]),builtinValidation:E}),O=D.displayValidation.isInvalid,k=e.validationState||(O?`invalid`:null);return{...D,value:s,defaultValue:e.defaultValue??i,setValue:c,dateRange:p,timeRange:h,granularity:l,hasTime:d,setDate(e,t){y(e===`start`?{start:t,end:p?.end??null}:{start:p?.start??null,end:t})},setTime(e,t){b(e===`start`?{start:t,end:h?.end??null}:{start:h?.start??null,end:t})},setDateTime(e,t){c(e===`start`?{start:t,end:s?.end??null}:{start:s?.start??null,end:t})},setDateRange:y,setTimeRange:b,...t,setOpen(n){!n&&!(s?.start&&s?.end)&&$s(p)&&d&&_(p,{start:h?.start||Ua(e.placeholderValue),end:h?.end||Ua(e.placeholderValue)}),t.setOpen(n)},validationState:k,isInvalid:O,formatValue(t,n){if(!s||!s.start||!s.end)return null;let r=`timeZone`in s.start?s.start.timeZone:void 0,i=e.granularity||(s.start&&`minute`in s.start?`minute`:`day`),a=`timeZone`in s.end?s.end.timeZone:void 0,o=e.granularity||(s.end&&`minute`in s.end?`minute`:`day`),c=Ha(n,{granularity:i,timeZone:r,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,showEra:s.start.calendar.identifier===`gregory`&&s.start.era===`BC`||s.end.calendar.identifier===`gregory`&&s.end.era===`BC`}),l=s.start.toDate(r||`UTC`),u=s.end.toDate(a||`UTC`),d=new Y(t,c),f;if(r===a&&i===o&&s.start.compare(s.end)!==0){try{let e=d.formatRangeToParts(l,u),t=-1;for(let n=0;nt&&(r+=e[i].value);return{start:n,end:r}}catch{}f=d}else f=new Y(t,Ha(n,{granularity:o,timeZone:a,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:d.format(l),end:f.format(u)}},getDateFormatter(e,t){return new Y(e,Ha({},{...S,...t}))}}}function $s(e){return e?.start!=null&&e.end!=null}var ec=(0,R.createContext)(null),tc=(0,R.createContext)(null),nc=[Se,d,Me,p],rc=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,ec);let{validationBehavior:n}=O(ye)||{},r=e.validationBehavior??n??`native`,i=Qs({...e,validationBehavior:r}),a=(0,R.useRef)(null),[o,s]=A(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:l,startFieldProps:u,endFieldProps:f,buttonProps:m,dialogProps:h,calendarProps:g,descriptionProps:_,errorMessageProps:v,...y}=Zs({...E(e),label:s,validationBehavior:r},i,a),{focusProps:b,isFocused:S,isFocusVisible:C}=P({within:!0}),T=k({...e,values:{state:i,isFocusWithin:S,isFocusVisible:C,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-DateRangePicker`}),ee=I(e,{global:!0});return delete ee.id,R.createElement(x,{values:[[tc,i],[Se,{...c,ref:a,isInvalid:i.isInvalid}],[d,{...m,isPressed:i.isOpen}],[Me,{...l,ref:o,elementType:`span`}],[Is,g],[Ke,i],[Je,{trigger:`DateRangePicker`,triggerRef:a,placement:`bottom start`,clearContexts:nc}],[qe,h],[oo,{slots:{start:u,end:f}}],[p,{slots:{description:_,errorMessage:v}}],[Te,y]]},R.createElement(w.div,{...D(ee,T,b),ref:t,slot:e.slot||void 0,"data-focus-within":S||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":C||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-open":i.isOpen||void 0}))}),ic=(0,R.createContext)({triggerRef:{current:null}}),ac=({children:e,className:t,onOpenChange:n,...r})=>{let i=R.useMemo(()=>$e(),[]),a=(0,R.useRef)(null),[o,s]=R.useState(!1),c=(0,R.useRef)(!1);(0,R.useEffect)(()=>{if(!o)return;let e=e=>{!e.metaKey&&!e.ctrlKey&&!e.altKey&&(c.current=!0)};return window.addEventListener(`keydown`,e,!0),()=>{window.removeEventListener(`keydown`,e,!0)}},[o]);let l=e=>{s(e),!e&&c.current&&window.requestAnimationFrame(()=>{a.current?.focus()}),c.current=!1,n?.(e)};return(0,X.jsx)(ic,{value:{slots:i,triggerRef:a},children:(0,X.jsx)(rc,{"data-required":Le(r.isRequired),"data-slot":`date-range-picker`,...r,className:N(t,i?.base()),onOpenChange:l,children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})})};ac.displayName=`HeroUI.DateRangePicker`;var oc=({children:e,className:t,ref:n,...r})=>{let{slots:i,triggerRef:a}=(0,R.use)(ic),o=R.useCallback(e=>{a.current=e},[a]),s=j(o,n);return(0,X.jsx)(f,{ref:s,className:N(t,i?.trigger()),"data-slot":`date-range-picker-trigger`,...r,children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})};oc.displayName=`HeroUI.DateRangePicker.Trigger`;var sc=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(ic);return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(r?.triggerIndicator,t),"data-slot":`date-range-picker-trigger-indicator`,...n,children:e||(0,X.jsx)(y,{})})};sc.displayName=`HeroUI.DateRangePicker.TriggerIndicator`;var cc=({children:e=` - `,className:t,...n})=>{let{slots:r}=(0,R.use)(ic);return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(r?.rangeSeparator,t),"data-slot":`date-range-picker-range-separator`,...n,children:e})};cc.displayName=`HeroUI.DateRangePicker.RangeSeparator`;var lc=({children:e,className:t,placement:n=`bottom`,...r})=>{let{slots:i}=(0,R.use)(ic);return(0,X.jsx)(s,{value:{variant:`default`},children:(0,X.jsx)(Be,{...r,className:N(t,i?.popover()),"data-slot":`date-range-picker-popover`,placement:n,children:e})})};lc.displayName=`HeroUI.DateRangePicker.Popover`;var uc=Object.assign(ac,{Root:ac,Trigger:oc,TriggerIndicator:sc,RangeSeparator:cc,Popover:lc});function dc({children:e,className:t,fullWidth:n,...r}){let i=R.useMemo(()=>tt({fullWidth:n}),[n]);return(0,X.jsx)(fo,{"data-required":Le(r.isRequired),"data-slot":`time-field`,...r,className:N(t,i),children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})}var fc=Object.assign(dc,{Root:dc,Group:vo,Input:bo,InputContainer:So,Segment:xo,Prefix:yo,Suffix:Co}),pc=(0,R.createContext)(null);function mc(){let e=(0,R.use)(pc);if(!e)throw Error(`useYearPicker must be used within a or component.`);return e}function hc(){let e=(0,R.use)(Ls),t=(0,R.use)(Rs),n=e??t;if(!n)throw Error(`useCalendarOrRangeState must be used within a or component.`);return n}function gc(e){switch(e){case`buddhist`:return 543;case`ethiopic`:case`ethioaa`:return-8;case`coptic`:return-284;case`hebrew`:return 3760;case`indian`:return-78;case`islamic-civil`:case`islamic-tbla`:case`islamic-umalqura`:return-579;case`persian`:return-600;default:return 0}}function _c(e,t){let n=[];if(!e||!t)return n;let r=kt(e);for(;r.compare(t)<=0;)n.push(r),r=kt(r.add({years:1}));return n}function vc(e,t,n,r=`short`,i=`UTC`){let a=new Intl.DateTimeFormat(t,{weekday:r,timeZone:i}),o=At(e,t,n),s=[],c=o;for(let e=0;e<7;e++){s.push(a.format(c.toDate(i)));let e=c.add({days:1});if(B(c,e))break;c=e}for(;s.length<7;)s.push(``);return s}function yc(e,t){let n=[],r=e;for(let e=0;e<7;e++){n.push(r.compare(t)>0?null:r);let e=r.add({days:1});if(B(r,e)){for(;n.length<7;)n.push(null);return n}r=e}return n}function bc(e,t,n,r){let i=[],a=At(e,n,r);for(i.push(yc(a,t)),a=a.add({weeks:1});a.compare(t)<=0;){i.push(yc(a,t));let e=a.add({weeks:1});if(B(a,e))break;a=e}return i}var xc=R.createContext(null);function Sc(){let e=R.use(xc);if(!e)throw Error(`CalendarYearPicker trigger components must be used within .`);return e}var Cc=({children:e,className:t,onKeyDown:n,onPress:r,...i})=>{let{isYearPickerOpen:a,setIsYearPickerOpen:o}=mc(),s=ys({},hc()),c=R.useMemo(()=>Xe(),[]),l=R.useCallback(()=>{o(!a)},[a,o]),u=e=>{n?.(e),!e.defaultPrevented&&e.key===`Escape`&&a&&(e.preventDefault(),o(!1))},d=R.useMemo(()=>({isOpen:a,monthYear:s,toggle:l}),[l,a,s]),p=R.useMemo(()=>({...d,slots:c}),[c,d]);return(0,X.jsx)(xc,{value:p,children:(0,X.jsx)(f,{"aria-expanded":a,"aria-label":`${s}, year selector`,className:N(t,c.trigger()),"data-open":a||void 0,"data-slot":`calendar-year-picker-trigger`,slot:null,onKeyDown:u,onPress:e=>{r?.(e),l()},...i,children:typeof e==`function`?e(d):e})})};Cc.displayName=`HeroUI.CalendarYearPicker.Trigger`;var wc=({children:e,className:t,format:n,offset:r,...i})=>{let{monthYear:a,slots:o,...s}=Sc(),c=hc(),l=ys({format:n,offset:r},c);return(0,X.jsx)(S.span,{className:L(o.triggerHeading,t),"data-slot":`calendar-year-picker-trigger-heading`,...i,children:typeof e==`function`?e({monthYear:a,...s}):e||l})};wc.displayName=`HeroUI.CalendarYearPicker.TriggerHeading`;var Tc=({children:e,className:t,...n})=>{let{monthYear:r,slots:i,...a}=Sc();return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(i.triggerIndicator,t),"data-slot":`calendar-year-picker-trigger-indicator`,...n,children:typeof e==`function`?e({monthYear:r,...a}):e||(0,X.jsx)(o,{height:`1em`,width:`1em`})})};Tc.displayName=`HeroUI.CalendarYearPicker.TriggerIndicator`;var Ec=R.createContext(null);function Dc(){let e=R.use(Ec);if(!e)throw Error(`CalendarYearPicker components must be used within .`);return e}var Oc=({children:e,className:t,format:n,onKeyDown:r,visibleYears:i,...a})=>{let{calendarGridSlot:o,calendarRef:s,isYearPickerOpen:c,setIsYearPickerOpen:l}=mc(),u=hc(),d=R.useRef(null),f=R.useMemo(()=>Xe(),[]),{"aria-label":p,items:m,onChange:h,value:g}=vs({format:n,visibleYears:R.useMemo(()=>i??(!u.minValue||!u.maxValue?20:_c(u.minValue,u.maxValue).length),[u.maxValue,u.minValue,i])},u),_=m.map(e=>`${e.id}:${e.date.year}`).join(`|`),v=m.map(e=>e.date.year),y=new Map(m.map(e=>[e.date.year,e])),b=m[g]?.date.year??u.focusedDate.year,x=R.useCallback(e=>y.get(e)?.formatted??String(e),[y]),[C,w]=R.useState(b),T=R.useRef(!1);R.useEffect(()=>{let e=d.current;if(!e)return;let t=s.current?.querySelector(`[data-slot='${o}']`);t&&(e.style.top=`${t.offsetTop}px`,e.style.height=`${t.offsetHeight}px`)},[o,s,u.focusedDate]);let E=R.useCallback(e=>{let t=d.current;if(!t)return;let n=t.querySelector(`[data-year='${e}']`);n&&n.focus()},[]);R.useEffect(()=>{let e=c&&!T.current;if(T.current=c,!e||v.length===0)return;let[t]=v;if(t==null)return;let n=v.includes(b)?b:t;w(n);let r=requestAnimationFrame(()=>{E(n)});return()=>{cancelAnimationFrame(r)}},[E,b,c,_,v.length]),R.useEffect(()=>{if(!c||v.length===0)return;let[e]=v;e!=null&&(v.includes(C)||w(e))},[C,c,_,v]);let D=R.useCallback(e=>{let t=y.get(e);t!=null&&(l(!1),h(t.id))},[y,h,l]),O=e=>{if(r?.(e),e.defaultPrevented)return;if(e.key===`Escape`&&c){e.preventDefault(),l(!1);return}if(!c||v.length===0)return;let t=v.indexOf(C);if(t===-1)return;let n=t;switch(e.key){case`ArrowRight`:n=Math.min(t+1,v.length-1);break;case`ArrowLeft`:n=Math.max(t-1,0);break;case`ArrowDown`:n=Math.min(t+3,v.length-1);break;case`ArrowUp`:n=Math.max(t-3,0);break;case`Home`:n=0;break;case`End`:n=v.length-1;break;default:return}if(n!==t){let t=v[n];if(t==null)return;e.preventDefault(),w(t),E(t)}},k=R.useMemo(()=>({activeYear:C,focusedYear:b,getFormattedYear:x,isYearPickerOpen:c,selectYear:D,setActiveYear:w,slots:f,years:v}),[C,b,x,D,c,f,v]);return(0,X.jsx)(Ec,{value:k,children:(0,X.jsx)(S.div,{ref:d,"aria-hidden":!c,"aria-label":p,className:L(f.yearGrid,t),"data-open":c||void 0,"data-slot":`calendar-year-picker-grid`,role:`listbox`,tabIndex:-1,onKeyDown:O,...a,children:e})})};Oc.displayName=`HeroUI.CalendarYearPicker.Grid`;var kc=({children:e})=>{let{focusedYear:t,getFormattedYear:n,isYearPickerOpen:r,selectYear:i,years:a}=Dc(),o=new Date().getFullYear();return(0,X.jsx)(X.Fragment,{children:a.map(a=>{let s=a===t,c={formattedYear:n(a),isCurrentYear:a===o,isOpen:r,isSelected:s,selectYear:()=>i(a),year:a};return(0,X.jsx)(R.Fragment,{children:typeof e==`function`?e(c):(0,X.jsx)(Ac,{year:a})},a)})})};kc.displayName=`HeroUI.CalendarYearPicker.GridBody`;var Ac=({children:e,className:t,excludeFromTabOrder:n,onFocus:r,onPress:i,year:a,...o})=>{let{activeYear:s,focusedYear:c,getFormattedYear:l,isYearPickerOpen:u,selectYear:d,setActiveYear:p,slots:m}=Dc(),h=a===c,g=a===s,_=l(a),v={formattedYear:_,isCurrentYear:a===new Date().getFullYear(),isOpen:u,isSelected:h,selectYear:()=>d(a),year:a};return(0,X.jsx)(f,{"aria-label":_,"aria-selected":h,className:N(t,m.yearCell()),"data-selected":h||void 0,"data-slot":`calendar-year-picker-year-cell`,"data-year":a,excludeFromTabOrder:n??!(u&&g),slot:null,onFocus:e=>{r?.(e),p(a)},onPress:e=>{i?.(e),d(a)},...o,children:typeof e==`function`?e(v):e||_})};Ac.displayName=`HeroUI.CalendarYearPicker.Cell`;function jc({children:e,className:t,"data-slot":n=`calendar-grid-body`,firstDayOfWeek:r,visibleRange:i}){let{locale:a}=F(),o=R.useMemo(()=>bc(i.start,i.end,a,r),[r,a,i.end,i.start]);return(0,X.jsx)(S.tbody,{className:t,"data-slot":n,children:o.map((t,n)=>(0,X.jsx)(`tr`,{children:t.map((t,n)=>t?R.cloneElement(e(t),{key:n}):(0,X.jsx)(`td`,{},n))},n))})}function Mc({children:e,className:t,"data-slot":n=`calendar-grid-header`,firstDayOfWeek:r,timeZone:i=`UTC`,visibleRange:a,weekdayStyle:o=`short`}){let{locale:s}=F(),c=R.useMemo(()=>vc(a.start,s,r,o,i),[r,s,i,a.start,o]);return(0,X.jsx)(S.thead,{"aria-hidden":!0,className:t,"data-slot":n,children:(0,X.jsx)(`tr`,{children:c.map((t,n)=>R.cloneElement(e(t),{key:n}))})})}var Q=(0,R.createContext)({});function Nc({children:e,className:t,defaultYearPickerOpen:n=!1,firstDayOfWeek:r,isYearPickerOpen:i,maxValue:a,minValue:o,onYearPickerOpenChange:s,visibleDuration:c,...l}){let u=c?.weeks!=null,d=c?.days!=null,f=c?.days,{locale:p}=F(),m=R.useMemo(()=>Ze(),[]),h=R.useRef(null),[g,_]=ce(i,n,s),v=R.useMemo(()=>{let e=new Y(p).resolvedOptions().calendar;return Kr(e)},[p]),y=R.useMemo(()=>gc(v.identifier),[v.identifier]),b=o??new q(v,1900+y,1,1),x=a??new q(v,2099+y,12,31);return(0,X.jsx)(pc,{value:{calendarGridSlot:`range-calendar-grid`,isYearPickerOpen:g,setIsYearPickerOpen:_,calendarRef:h},children:(0,X.jsx)(zs,{ref:h,"data-slot":`range-calendar`,firstDayOfWeek:r,maxValue:x,minValue:b,visibleDuration:c,...l,className:N(t,te(m.base(),u&&`range-calendar--week-view`,d&&`range-calendar--day-view`)),children:t=>(0,X.jsx)(Q,{value:{dayView:d&&f!=null?{days:f,firstDayOfWeek:r,timeZone:t.state.timeZone,visibleRange:t.state.visibleRange}:void 0,slots:m},children:typeof e==`function`?e(t):e})})})}Nc.displayName=`HeroUI.RangeCalendar`;var Pc=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(Q);return(0,X.jsx)(S.header,{className:L(r?.header,t),"data-slot":`range-calendar-header`,...n,children:e})};Pc.displayName=`HeroUI.RangeCalendar.Header`;var Fc=({className:e,...t})=>{let{slots:n}=(0,R.use)(Q);return(0,X.jsx)(Ys,{"data-slot":`range-calendar-heading`,...t,className:L(n?.heading,e)})};Fc.displayName=`HeroUI.RangeCalendar.Heading`;var Ic=({children:e,className:t,slot:n,...r})=>{let{slots:i}=(0,R.use)(Q);return(0,X.jsx)(f,{"data-slot":`range-calendar-nav-button`,slot:n,...r,className:N(t,i?.navButton()),children:e||(n===`previous`?(0,X.jsx)(u,{className:i?.navButtonIcon(),"data-slot":`range-calendar-nav-button-icon`}):(0,X.jsx)(o,{className:i?.navButtonIcon(),"data-slot":`range-calendar-nav-button-icon`}))})};Ic.displayName=`HeroUI.RangeCalendar.NavButton`;var Lc=({children:e,className:t,weekdayStyle:n=`short`,...r})=>{let i=(0,R.use)(Q),{dayView:a,slots:o}=i,s=R.useMemo(()=>({...i,dayView:a?{...a,weekdayStyle:n}:void 0}),[a,i,n]);return(0,X.jsx)(Q,{value:s,children:(0,X.jsx)(Vs,{"data-slot":`range-calendar-grid`,weekdayStyle:n,...r,className:L(o?.grid,t),children:e})})};Lc.displayName=`HeroUI.RangeCalendar.Grid`;var Rc=({children:e,className:t,...n})=>{let{dayView:r,slots:i}=(0,R.use)(Q);return r&&r.days>=7&&typeof e==`function`?(0,X.jsx)(Mc,{className:L(i?.gridHeader,t),"data-slot":`range-calendar-grid-header`,firstDayOfWeek:r.firstDayOfWeek,timeZone:r.timeZone,visibleRange:r.visibleRange,weekdayStyle:r.weekdayStyle,children:e}):(0,X.jsx)(Us,{"data-slot":`range-calendar-grid-header`,...n,className:L(i?.gridHeader,t),children:e})};Rc.displayName=`HeroUI.RangeCalendar.GridHeader`;var zc=({children:e,className:t,...n})=>{let{dayView:r,slots:i}=(0,R.use)(Q);return r&&r.days>=7&&typeof e==`function`?(0,X.jsx)(jc,{className:L(i?.gridBody,t),"data-slot":`range-calendar-grid-body`,firstDayOfWeek:r.firstDayOfWeek,visibleRange:r.visibleRange,children:e}):(0,X.jsx)(qs,{"data-slot":`range-calendar-grid-body`,...n,className:L(i?.gridBody,t),children:e})};zc.displayName=`HeroUI.RangeCalendar.GridBody`;var Bc=({className:e,...t})=>{let{slots:n}=(0,R.use)(Q);return(0,X.jsx)(Gs,{"data-slot":`range-calendar-header-cell`,...t,className:L(n?.headerCell,e)})};Bc.displayName=`HeroUI.RangeCalendar.HeaderCell`;var Vc=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(Q);return(0,X.jsx)(Js,{"data-slot":`range-calendar-cell`,...n,className:N(t,r?.cell()),children:t=>{let{formattedDate:n,isDisabled:r,isHovered:i,isPressed:a,isSelectionEnd:o,isSelectionStart:s}=t,c=typeof e==`function`?e(t):e||n;return(0,X.jsx)(`span`,{className:`range-calendar__cell-button`,"data-disabled":Le(r),"data-hovered":Le(i),"data-pressed":Le(a),"data-selected":Le(s||o),"data-slot":`range-calendar-cell-button`,children:c})}})};Vc.displayName=`HeroUI.RangeCalendar.Cell`;var Hc=({className:e,...t})=>{let{slots:n}=(0,R.use)(Q);return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(n?.cellIndicator,e),"data-slot":`range-calendar-cell-indicator`,...t})};Hc.displayName=`HeroUI.RangeCalendar.CellIndicator`;var $=Object.assign(Nc,{Root:Nc,Header:Pc,Heading:Fc,NavButton:Ic,Grid:Lc,GridHeader:Rc,GridBody:zc,HeaderCell:Bc,Cell:Vc,CellIndicator:Hc,YearPickerTrigger:Cc,YearPickerTriggerHeading:wc,YearPickerTriggerIndicator:Tc,YearPickerGrid:Oc,YearPickerGridBody:kc,YearPickerCell:Ac});function Uc(e={}){let t=new URLSearchParams;e.dim?.length&&t.set(`dim`,e.dim.join(`,`)),e.limit!=null&&t.set(`limit`,String(e.limit)),e.hours!=null&&t.set(`hours`,String(e.hours)),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.api_key&&t.set(`api_key`,e.api_key);let n=t.toString()?`?${t}`:``;return Re(`/api/logs/stats${n}`)}function Wc(e={}){let t=new URLSearchParams;e.account&&t.set(`account`,e.account),e.api_key&&t.set(`api_key`,e.api_key),e.status&&t.set(`status`,e.status),e.stream!=null&&t.set(`stream`,e.stream?`1`:`0`),e.error_kind&&t.set(`error_kind`,e.error_kind),e.model&&t.set(`model`,e.model),e.provider&&t.set(`provider`,e.provider),e.id&&t.set(`id`,e.id),e.q&&t.set(`q`,e.q),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString()?`?${t}`:``;return Re(`/api/logs/requests${n}`)}function Gc(e){return Re(`/api/logs/requests/${encodeURIComponent(e)}`)}function Kc(){return Re(`/api/logs/requests`,{method:`DELETE`})}function qc(e={}){let t=new URLSearchParams;e.after!=null&&t.set(`after`,String(e.after)),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset)),e.level&&t.set(`level`,e.level),e.q&&t.set(`q`,e.q),e.account&&t.set(`account`,e.account);let n=t.toString()?`?${t}`:``;return Re(`/api/logs/runtime${n}`)}function Jc(e,t=!1){if(!e)return;let n=e.toDate(Tt());if(Number.isFinite(n.getTime()))return t&&n.setSeconds(59,999),n.toISOString()}function Yc(e){if(!e)return null;let t=Date.parse(e);if(!Number.isFinite(t))return null;try{return W(An(new Date(t).toISOString()))}catch{return null}}function Xc({value:e,onChange:t,ariaLabel:n,fromLabel:r,toLabel:i,className:a}){return(0,X.jsx)(uc,{className:a,granularity:`minute`,hourCycle:24,shouldForceLeadingZeros:!0,value:e,onChange:e=>t(e),"aria-label":n,children:({state:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(To.Group,{className:`w-full min-w-0`,variant:`secondary`,children:[(0,X.jsx)(To.Input,{className:`min-w-0`,slot:`start`,"aria-label":r,children:e=>(0,X.jsx)(To.Segment,{segment:e})}),(0,X.jsx)(uc.RangeSeparator,{}),(0,X.jsx)(To.Input,{className:`min-w-0`,slot:`end`,"aria-label":i,children:e=>(0,X.jsx)(To.Segment,{segment:e})}),(0,X.jsx)(To.Suffix,{children:(0,X.jsx)(uc.Trigger,{children:(0,X.jsx)(uc.TriggerIndicator,{})})})]}),(0,X.jsxs)(uc.Popover,{className:`flex w-[20.5rem] max-w-[calc(100vw-2rem)] flex-col gap-3 p-3`,children:[(0,X.jsxs)($,{"aria-label":n,children:[(0,X.jsxs)($.Header,{children:[(0,X.jsxs)($.YearPickerTrigger,{children:[(0,X.jsx)($.YearPickerTriggerHeading,{}),(0,X.jsx)($.YearPickerTriggerIndicator,{})]}),(0,X.jsx)($.NavButton,{slot:`previous`}),(0,X.jsx)($.NavButton,{slot:`next`})]}),(0,X.jsxs)($.Grid,{children:[(0,X.jsx)($.GridHeader,{children:e=>(0,X.jsx)($.HeaderCell,{children:e})}),(0,X.jsx)($.GridBody,{children:e=>(0,X.jsx)($.Cell,{date:e})})]}),(0,X.jsx)($.YearPickerGrid,{children:(0,X.jsx)($.YearPickerGridBody,{children:({year:e})=>(0,X.jsx)($.YearPickerCell,{year:e})})})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(Ae,{className:`text-xs`,children:r}),(0,X.jsx)(fc,{"aria-label":r,granularity:`minute`,hourCycle:24,value:e.timeRange?.start??null,onChange:t=>e.setTimeRange({start:t,end:e.timeRange?.end}),children:(0,X.jsx)(fc.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,X.jsx)(fc.Input,{children:e=>(0,X.jsx)(fc.Segment,{segment:e})})})})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(Ae,{className:`text-xs`,children:i}),(0,X.jsx)(fc,{"aria-label":i,granularity:`minute`,hourCycle:24,value:e.timeRange?.end??null,onChange:t=>e.setTimeRange({start:e.timeRange?.start,end:t}),children:(0,X.jsx)(fc.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,X.jsx)(fc.Input,{children:e=>(0,X.jsx)(fc.Segment,{segment:e})})})})]})]})]})]})})}export{Gc as a,qc as c,Kc as i,Jc as n,Wc as o,Yc as r,Uc as s,Xc as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/TrafficChart-BdqUGU1Q.js b/internal/webui/static/assets/TrafficChart-B9w8pS55.js similarity index 99% rename from internal/webui/static/assets/TrafficChart-BdqUGU1Q.js rename to internal/webui/static/assets/TrafficChart-B9w8pS55.js index 1b2bf4e6..6a5ffb8e 100644 --- a/internal/webui/static/assets/TrafficChart-BdqUGU1Q.js +++ b/internal/webui/static/assets/TrafficChart-B9w8pS55.js @@ -1 +1 @@ -import{a as e,c as t,n,r}from"./shim-mfK0Rmj6.js";import{r as i}from"./gsap-C3sDxib7.js";import{A as a,An as o,At as s,Bt as c,Ct as l,D as u,E as d,En as f,Et as p,F as m,Ft as h,I as g,Kt as _,Ln as v,M as y,Mt as b,N as x,O as S,P as C,Pt as w,Rn as T,Rt as E,Sn as D,St as O,T as k,Tn as A,U as j,V as M,Wt as N,a as ee,b as P,c as te,it as F,j as ne,jn as re,k as ie,mt as ae,n as oe,nt as I,o as se,ot as ce,pt as le,r as ue,s as de,y as fe,yt as pe,zn as me,zt as L}from"./AreaChart-B0YOdVBx.js";import{n as he,t as ge}from"./CartesianGrid-BJyfpdDb.js";import{t as _e}from"./XAxis-DLQkFqxC.js";import{t as ve}from"./ReferenceArea-CiIBWWEY.js";import{t as ye}from"./FilterToggle-Bygki2HF.js";import{i as R,s as z}from"./format-B6SmebW-.js";import{t as be}from"./OverviewPage-C6NTQijS.js";var B=t(e()),xe=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function V(){return V=Object.assign?Object.assign.bind():function(e){for(var t=1;te+t,0);if(!i)return H(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[...Ee(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function Oe(e,t,n){return e?De(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):H(t,n)}function ke(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=Se(e,xe),a=r??!1,o;if(t!=null){var s=i.pathRef;o=Oe(n,we(s?.current??null),t)}else n!=null&&(o=String(n));return B.createElement(pe,V({},i,{connectNulls:a,strokeDasharray:o}))}function Ae(e){var t=(0,B.useRef)(0),n=(0,B.useRef)(0),r=(0,B.useRef)(!1),i=(0,B.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,B.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(re(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 je=[`children`];function Me(e,t){if(e==null)return{};var n,r,i=Ne(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function Fe(e){var t=e.children,n=Me(e,je);return B.createElement(Pe.Provider,{value:n},t)}var U=(e,t,n,r)=>I(e,`xAxis`,t,r),W=(e,t,n,r)=>F(e,`xAxis`,t,r),G=(e,t,n,r)=>I(e,`yAxis`,n,r),K=(e,t,n,r)=>F(e,`yAxis`,n,r),Ie=N([l,U,G,W,K],(e,t,n,r,i)=>c(e,`xAxis`)?w(t,r,!1):w(n,i,!1)),Le=(e,t,n,r,i)=>i;function Re(e){return e.type===`line`}var ze=N([ce,Le],(e,t)=>e.filter(Re).find(e=>e.id===t)),Be=N([l,U,G,W,K,ze,Ie,ae],(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 ot({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),Ve=[`id`],He=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],Ue=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?t/n:0}var Z={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=Ye(e),r=[];for(var i of e)if(i.status===`matched`)r.push(X(X({},i.next),{},{x:A(i.prev.x,i.next.x,t),y:A(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(X(X({},i.next),{},{x:A(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(X(X({},i.prev),{},{x:A(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:a,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:ke,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:le.line,type:`linear`},Xe=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:E(n,t),payload:e}]},Ze=B.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,s=e.name,c=e.hide,l=e.unit,u=e.formatter,d=e.tooltipType,f=e.id,p={dataDefinedOnItem:n,getPosition:o,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:E(s,t),hide:c,type:d,color:r,unit:l,formatter:u,graphicalItemId:f}};return B.createElement(y,{tooltipEntrySettings:p})});function Qe(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=J(r,Ve),c=me(s);return B.createElement(k,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function $e(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,B.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return X(X({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return B.createElement(m,{value:t?i:void 0},n)}function et(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=J(i,He),g=X(X({},T(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 B.createElement(B.Fragment,null,r?.length>1&&B.createElement(x,{option:p,DefaultShape:Z.shape,shapeProps:g}),B.createElement(Qe,{points:r,clipPathId:t,props:i}))}function tt(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=Je(r.current),m=ie(n.onAnimationStart,n.onAnimationEnd),h=m.isAnimating,_=m.handleAnimationStart,v=m.handleAnimationEnd,y=!h,b=Ae(a),x=(0,B.useCallback)(e=>e>0&&p>0,[p]);return B.createElement($e,{points:a,showLabels:y},n.children,B.createElement(S,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:_,onAnimationEnd:v,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:x,layout:f},(e,i,a)=>{var o=h||i<1,s=o?b(i,p):null;return B.createElement(et,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),B.createElement(g,{label:n.label}))}function nt(e){var t=e.clipPathId,n=e.props,r=(0,B.useRef)(null),i=(0,B.useRef)(null);return B.createElement(tt,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var rt=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:L(e.payload,t)}),it=class extends B.Component{render(){var e=this.props,t=e.hide,n=e.dot,i=e.points,a=e.className,o=e.xAxisId,s=e.yAxisId,c=e.top,l=e.left,u=e.width,d=e.height,f=e.id,p=e.needClip,m=e.zIndex;if(t)return null;var h=r(`recharts-line`,a),g=f,_=se(n),y=_.r,b=_.strokeWidth,x=C(n),S=y*2+b,w=p?`url(#clipPath-${x?``:`dots-`}${g})`:void 0;return B.createElement(j,{zIndex:m},B.createElement(v,{className:h},p&&B.createElement(`defs`,null,B.createElement(de,{clipPathId:g,xAxisId:o,yAxisId:s}),!x&&B.createElement(`clipPath`,{id:`clipPath-dots-${g}`},B.createElement(`rect`,{x:l-S/2,y:c-S/2,width:u+S,height:d+S}))),B.createElement(Fe,{xAxisId:o,yAxisId:s,data:i,dataPointFormatter:rt,errorBarOffset:0},B.createElement(nt,{props:this.props,clipPathId:g}))),B.createElement(fe,{activeDot:this.props.activeDot,points:i,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:w}))}};function at(e){var t=D(e,Z),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,m=t.xAxisId,h=t.yAxisId,g=t.id,v=J(t,Ue),y=te(m,h).needClip,x=P(),S=p(),C=b(),w=_(e=>Be(e,m,h,C,g));if(S!==`horizontal`&&S!==`vertical`||w==null||x==null)return null;var T=x.height,E=x.width,O=x.x,k=x.y;return B.createElement(it,q({},v,{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:m,yAxisId:h,points:w,layout:S,height:T,width:E,left:O,top:k,needClip:y}))}function ot(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=L(e,o);if(t===`horizontal`)return{x:h({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(f(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=f(l)?null:n.scale.map(l),d=h({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 st(e){var t=D(e,Z),n=b();return B.createElement(u,{id:t.id,type:`line`},e=>B.createElement(B.Fragment,null,B.createElement(ne,{legendPayload:Xe(t)}),B.createElement(Ze,{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}),B.createElement(d,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),B.createElement(at,q({},t,{id:e}))))}var Q=B.memo(st,O);Q.displayName=`Line`;var ct=[`axis`],lt=(0,B.forwardRef)((e,t)=>B.createElement(oe,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:ct,tooltipPayloadSearcher:M,categoricalChartProps:e,ref:t})),ut={metric:24,title:18,section:15,body:13,xs:12,caption:12},$=n();function dt(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 ft(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 pt(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 mt({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:dt(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]})]})}var ht=(0,B.memo)(function({series:e,lang:t,emptyLabel:n,okLabel:r,errorLabel:a,onSelectRange:o,selectHint:c,labels:l,initialMetric:u=`requests`}){let[d,f]=(0,B.useState)(u),[p,m]=(0,B.useState)(null),[h,g]=(0,B.useState)(null),_=(0,B.useRef)(!1),v=(0,B.useRef)(null),y=(0,B.useMemo)(()=>e.map(pt),[e]),b=y[0],x=y[y.length-1],S=(b&&x?Date.parse(x.at)-Date.parse(b.at):0)>1728e5,C=l??{requests:`Requests`,tokens:`Tokens`,latency:`p95 latency`,input:`input`,output:`output`,cacheRead:`cache read`,p50:`p50`,p95:`p95`,total:`total`},w=d===`tokens`?[{key:`inputTokens`,label:C.input,color:`var(--foreground)`,area:!0,width:1.5,opacity:.75},{key:`outputTokens`,label:C.output,color:`var(--success)`,area:!0,width:1.5},{key:`cacheTokens`,label:C.cacheRead,color:`var(--muted)`,width:1.25,opacity:.8}]:d===`latency`?[{key:`p95`,label:C.p95,color:`var(--warning)`,area:!0,width:1.75},{key:`p50`,label:C.p50,color:`var(--muted)`,width:1.25,opacity:.85}]:[{key:`okCount`,label:r,color:`var(--success)`,area:!0,width:1.75},{key:`errorCount`,label:a,color:`var(--danger)`,area:!0,width:1.25,opacity:.7}],T=e=>e==null?`—`:d===`latency`?z(e):R(e),E=d===`requests`?e=>e.requests:d===`tokens`?e=>e.inputTokens+e.outputTokens:void 0,D=y.flatMap(e=>w.map(t=>Number(e[t.key]??0))),O=d===`requests`?Math.max(0,...y.map(e=>e.requests)):Math.max(0,...D),k=ft(O),A=y.some(e=>e.requests>0),j=y.map(e=>`${e.at}:${e.requests}:${e.error}`).join(`|`);(0,B.useLayoutEffect)(()=>{let e=v.current;if(!e||!A||_.current)return;let t=!1,n=null,r=i.context(()=>{let r=i.matchMedia(),a=()=>{let t=i.utils.toArray(`.recharts-area-area`,e),n=i.utils.toArray(`.recharts-line-curve`,e);return!t.length&&!n.length?!1:(r.add(`(prefers-reduced-motion: reduce)`,()=>{i.set(n,{clearProps:`strokeDashoffset,strokeDasharray`}),i.set(t,{clearProps:`autoAlpha`})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{i.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:.45,ease:`power2.out`,stagger:.05}),n.forEach((e,t)=>{let n=e.getTotalLength();i.fromTo(e,{strokeDasharray:n,strokeDashoffset:n},{strokeDashoffset:0,duration:.7,delay:t*.05,ease:`power2.out`})})}),!0)};if(a()){t=!0,_.current=!0;return}n=new MutationObserver(()=>{t||a()&&(t=!0,_.current=!0,n?.disconnect())}),n.observe(e,{childList:!0,subtree:!0})},e);return()=>{n?.disconnect(),r.revert()}},[A,j]);let M=y.length>1?Date.parse(y[1].at)-Date.parse(y[0].at):36e5,N=()=>{if(p&&h&&o){let e=Date.parse(p),t=Date.parse(h);if(Number.isFinite(e)&&Number.isFinite(t)){let n=Math.min(e,t),r=Math.max(e,t)+M;o(new Date(n).toISOString(),new Date(r).toISOString())}}m(null),g(null)},P=e=>{let t=e?.activeLabel;return t==null?null:String(t)};return!e.length||!A?(0,$.jsx)(be,{emptyLabel:n}):(0,$.jsxs)(`div`,{ref:v,className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex justify-end`,children:(0,$.jsx)(ye,{value:d,onChange:e=>f(e),ariaLabel:C.requests,options:[{id:`requests`,label:C.requests},{id:`tokens`,label:C.tokens},{id:`latency`,label:C.latency}]})}),(0,$.jsx)(`div`,{className:`h-56 w-full`,children:(0,$.jsx)(s,{width:`100%`,height:`100%`,children:(0,$.jsxs)(lt,{data:y,margin:{top:8,right:8,bottom:0,left:0},style:o?{cursor:`crosshair`,userSelect:`none`}:void 0,onMouseDown:o?e=>{let t=P(e);t&&(m(t),g(t))}:void 0,onMouseMove:o?e=>{if(!p)return;let t=P(e);t&&g(t)}:void 0,onMouseUp:o?N:void 0,onMouseLeave:o?()=>{m(null),g(null)}:void 0,children:[(0,$.jsx)(`defs`,{children:w.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)(ge,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,$.jsx)(_e,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>dt(e,S,t)}),(0,$.jsx)(ue,{width:d===`latency`?44:36,domain:[0,k],tickLine:!1,axisLine:!1,allowDecimals:!1,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>d===`latency`?z(e):R(e)}),(0,$.jsx)(he,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,$.jsx)(mt,{daily:S,lang:t,specs:w,format:T,totalLabel:C.total,total:E})}),w.filter(e=>e.area).map(e=>(0,$.jsx)(ee,{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)}`)),w.map(e=>(0,$.jsx)(Q,{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)}`)),p&&h?(0,$.jsx)(ve,{x1:p,x2:h,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:w.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:[o&&c?(0,$.jsx)(`span`,{children:c}):null,(0,$.jsxs)(`span`,{className:`mono`,children:[T(O),` peak`]})]})]})]})});export{ht as TrafficChart}; \ No newline at end of file +import{a as e,c as t,n,r}from"./shim-mfK0Rmj6.js";import{r as i}from"./gsap-C3sDxib7.js";import{A as a,An as o,At as s,Bt as c,Ct as l,D as u,E as d,En as f,Et as p,F as m,Ft as h,I as g,Kt as _,Ln as v,M as y,Mt as b,N as x,O as S,P as C,Pt as w,Rn as T,Rt as E,Sn as D,St as O,T as k,Tn as A,U as j,V as M,Wt as N,a as ee,b as P,c as te,it as F,j as ne,jn as re,k as ie,mt as ae,n as oe,nt as I,o as se,ot as ce,pt as le,r as ue,s as de,y as fe,yt as pe,zn as me,zt as L}from"./AreaChart-B0YOdVBx.js";import{n as he,t as ge}from"./CartesianGrid-BJyfpdDb.js";import{t as _e}from"./XAxis-DLQkFqxC.js";import{t as ve}from"./ReferenceArea-CiIBWWEY.js";import{t as ye}from"./FilterToggle-nA-ZS4oO.js";import{i as R,s as z}from"./format-B6SmebW-.js";import{t as be}from"./OverviewPage-B0hJjjae.js";var B=t(e()),xe=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function V(){return V=Object.assign?Object.assign.bind():function(e){for(var t=1;te+t,0);if(!i)return H(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[...Ee(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function Oe(e,t,n){return e?De(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):H(t,n)}function ke(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=Se(e,xe),a=r??!1,o;if(t!=null){var s=i.pathRef;o=Oe(n,we(s?.current??null),t)}else n!=null&&(o=String(n));return B.createElement(pe,V({},i,{connectNulls:a,strokeDasharray:o}))}function Ae(e){var t=(0,B.useRef)(0),n=(0,B.useRef)(0),r=(0,B.useRef)(!1),i=(0,B.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,B.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(re(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 je=[`children`];function Me(e,t){if(e==null)return{};var n,r,i=Ne(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function Fe(e){var t=e.children,n=Me(e,je);return B.createElement(Pe.Provider,{value:n},t)}var U=(e,t,n,r)=>I(e,`xAxis`,t,r),W=(e,t,n,r)=>F(e,`xAxis`,t,r),G=(e,t,n,r)=>I(e,`yAxis`,n,r),K=(e,t,n,r)=>F(e,`yAxis`,n,r),Ie=N([l,U,G,W,K],(e,t,n,r,i)=>c(e,`xAxis`)?w(t,r,!1):w(n,i,!1)),Le=(e,t,n,r,i)=>i;function Re(e){return e.type===`line`}var ze=N([ce,Le],(e,t)=>e.filter(Re).find(e=>e.id===t)),Be=N([l,U,G,W,K,ze,Ie,ae],(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 ot({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),Ve=[`id`],He=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],Ue=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?t/n:0}var Z={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=Ye(e),r=[];for(var i of e)if(i.status===`matched`)r.push(X(X({},i.next),{},{x:A(i.prev.x,i.next.x,t),y:A(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(X(X({},i.next),{},{x:A(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(X(X({},i.prev),{},{x:A(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:a,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:ke,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:le.line,type:`linear`},Xe=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:E(n,t),payload:e}]},Ze=B.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,s=e.name,c=e.hide,l=e.unit,u=e.formatter,d=e.tooltipType,f=e.id,p={dataDefinedOnItem:n,getPosition:o,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:E(s,t),hide:c,type:d,color:r,unit:l,formatter:u,graphicalItemId:f}};return B.createElement(y,{tooltipEntrySettings:p})});function Qe(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=J(r,Ve),c=me(s);return B.createElement(k,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function $e(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,B.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return X(X({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return B.createElement(m,{value:t?i:void 0},n)}function et(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=J(i,He),g=X(X({},T(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 B.createElement(B.Fragment,null,r?.length>1&&B.createElement(x,{option:p,DefaultShape:Z.shape,shapeProps:g}),B.createElement(Qe,{points:r,clipPathId:t,props:i}))}function tt(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=Je(r.current),m=ie(n.onAnimationStart,n.onAnimationEnd),h=m.isAnimating,_=m.handleAnimationStart,v=m.handleAnimationEnd,y=!h,b=Ae(a),x=(0,B.useCallback)(e=>e>0&&p>0,[p]);return B.createElement($e,{points:a,showLabels:y},n.children,B.createElement(S,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:_,onAnimationEnd:v,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:x,layout:f},(e,i,a)=>{var o=h||i<1,s=o?b(i,p):null;return B.createElement(et,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),B.createElement(g,{label:n.label}))}function nt(e){var t=e.clipPathId,n=e.props,r=(0,B.useRef)(null),i=(0,B.useRef)(null);return B.createElement(tt,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var rt=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:L(e.payload,t)}),it=class extends B.Component{render(){var e=this.props,t=e.hide,n=e.dot,i=e.points,a=e.className,o=e.xAxisId,s=e.yAxisId,c=e.top,l=e.left,u=e.width,d=e.height,f=e.id,p=e.needClip,m=e.zIndex;if(t)return null;var h=r(`recharts-line`,a),g=f,_=se(n),y=_.r,b=_.strokeWidth,x=C(n),S=y*2+b,w=p?`url(#clipPath-${x?``:`dots-`}${g})`:void 0;return B.createElement(j,{zIndex:m},B.createElement(v,{className:h},p&&B.createElement(`defs`,null,B.createElement(de,{clipPathId:g,xAxisId:o,yAxisId:s}),!x&&B.createElement(`clipPath`,{id:`clipPath-dots-${g}`},B.createElement(`rect`,{x:l-S/2,y:c-S/2,width:u+S,height:d+S}))),B.createElement(Fe,{xAxisId:o,yAxisId:s,data:i,dataPointFormatter:rt,errorBarOffset:0},B.createElement(nt,{props:this.props,clipPathId:g}))),B.createElement(fe,{activeDot:this.props.activeDot,points:i,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:w}))}};function at(e){var t=D(e,Z),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,m=t.xAxisId,h=t.yAxisId,g=t.id,v=J(t,Ue),y=te(m,h).needClip,x=P(),S=p(),C=b(),w=_(e=>Be(e,m,h,C,g));if(S!==`horizontal`&&S!==`vertical`||w==null||x==null)return null;var T=x.height,E=x.width,O=x.x,k=x.y;return B.createElement(it,q({},v,{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:m,yAxisId:h,points:w,layout:S,height:T,width:E,left:O,top:k,needClip:y}))}function ot(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=L(e,o);if(t===`horizontal`)return{x:h({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(f(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=f(l)?null:n.scale.map(l),d=h({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 st(e){var t=D(e,Z),n=b();return B.createElement(u,{id:t.id,type:`line`},e=>B.createElement(B.Fragment,null,B.createElement(ne,{legendPayload:Xe(t)}),B.createElement(Ze,{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}),B.createElement(d,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),B.createElement(at,q({},t,{id:e}))))}var Q=B.memo(st,O);Q.displayName=`Line`;var ct=[`axis`],lt=(0,B.forwardRef)((e,t)=>B.createElement(oe,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:ct,tooltipPayloadSearcher:M,categoricalChartProps:e,ref:t})),ut={metric:24,title:18,section:15,body:13,xs:12,caption:12},$=n();function dt(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 ft(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 pt(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 mt({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:dt(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]})]})}var ht=(0,B.memo)(function({series:e,lang:t,emptyLabel:n,okLabel:r,errorLabel:a,onSelectRange:o,selectHint:c,labels:l,initialMetric:u=`requests`}){let[d,f]=(0,B.useState)(u),[p,m]=(0,B.useState)(null),[h,g]=(0,B.useState)(null),_=(0,B.useRef)(!1),v=(0,B.useRef)(null),y=(0,B.useMemo)(()=>e.map(pt),[e]),b=y[0],x=y[y.length-1],S=(b&&x?Date.parse(x.at)-Date.parse(b.at):0)>1728e5,C=l??{requests:`Requests`,tokens:`Tokens`,latency:`p95 latency`,input:`input`,output:`output`,cacheRead:`cache read`,p50:`p50`,p95:`p95`,total:`total`},w=d===`tokens`?[{key:`inputTokens`,label:C.input,color:`var(--foreground)`,area:!0,width:1.5,opacity:.75},{key:`outputTokens`,label:C.output,color:`var(--success)`,area:!0,width:1.5},{key:`cacheTokens`,label:C.cacheRead,color:`var(--muted)`,width:1.25,opacity:.8}]:d===`latency`?[{key:`p95`,label:C.p95,color:`var(--warning)`,area:!0,width:1.75},{key:`p50`,label:C.p50,color:`var(--muted)`,width:1.25,opacity:.85}]:[{key:`okCount`,label:r,color:`var(--success)`,area:!0,width:1.75},{key:`errorCount`,label:a,color:`var(--danger)`,area:!0,width:1.25,opacity:.7}],T=e=>e==null?`—`:d===`latency`?z(e):R(e),E=d===`requests`?e=>e.requests:d===`tokens`?e=>e.inputTokens+e.outputTokens:void 0,D=y.flatMap(e=>w.map(t=>Number(e[t.key]??0))),O=d===`requests`?Math.max(0,...y.map(e=>e.requests)):Math.max(0,...D),k=ft(O),A=y.some(e=>e.requests>0),j=y.map(e=>`${e.at}:${e.requests}:${e.error}`).join(`|`);(0,B.useLayoutEffect)(()=>{let e=v.current;if(!e||!A||_.current)return;let t=!1,n=null,r=i.context(()=>{let r=i.matchMedia(),a=()=>{let t=i.utils.toArray(`.recharts-area-area`,e),n=i.utils.toArray(`.recharts-line-curve`,e);return!t.length&&!n.length?!1:(r.add(`(prefers-reduced-motion: reduce)`,()=>{i.set(n,{clearProps:`strokeDashoffset,strokeDasharray`}),i.set(t,{clearProps:`autoAlpha`})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{i.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:.45,ease:`power2.out`,stagger:.05}),n.forEach((e,t)=>{let n=e.getTotalLength();i.fromTo(e,{strokeDasharray:n,strokeDashoffset:n},{strokeDashoffset:0,duration:.7,delay:t*.05,ease:`power2.out`})})}),!0)};if(a()){t=!0,_.current=!0;return}n=new MutationObserver(()=>{t||a()&&(t=!0,_.current=!0,n?.disconnect())}),n.observe(e,{childList:!0,subtree:!0})},e);return()=>{n?.disconnect(),r.revert()}},[A,j]);let M=y.length>1?Date.parse(y[1].at)-Date.parse(y[0].at):36e5,N=()=>{if(p&&h&&o){let e=Date.parse(p),t=Date.parse(h);if(Number.isFinite(e)&&Number.isFinite(t)){let n=Math.min(e,t),r=Math.max(e,t)+M;o(new Date(n).toISOString(),new Date(r).toISOString())}}m(null),g(null)},P=e=>{let t=e?.activeLabel;return t==null?null:String(t)};return!e.length||!A?(0,$.jsx)(be,{emptyLabel:n}):(0,$.jsxs)(`div`,{ref:v,className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex justify-end`,children:(0,$.jsx)(ye,{value:d,onChange:e=>f(e),ariaLabel:C.requests,options:[{id:`requests`,label:C.requests},{id:`tokens`,label:C.tokens},{id:`latency`,label:C.latency}]})}),(0,$.jsx)(`div`,{className:`h-56 w-full`,children:(0,$.jsx)(s,{width:`100%`,height:`100%`,children:(0,$.jsxs)(lt,{data:y,margin:{top:8,right:8,bottom:0,left:0},style:o?{cursor:`crosshair`,userSelect:`none`}:void 0,onMouseDown:o?e=>{let t=P(e);t&&(m(t),g(t))}:void 0,onMouseMove:o?e=>{if(!p)return;let t=P(e);t&&g(t)}:void 0,onMouseUp:o?N:void 0,onMouseLeave:o?()=>{m(null),g(null)}:void 0,children:[(0,$.jsx)(`defs`,{children:w.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)(ge,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,$.jsx)(_e,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>dt(e,S,t)}),(0,$.jsx)(ue,{width:d===`latency`?44:36,domain:[0,k],tickLine:!1,axisLine:!1,allowDecimals:!1,tick:{fill:`var(--muted)`,fontSize:ut.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>d===`latency`?z(e):R(e)}),(0,$.jsx)(he,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,$.jsx)(mt,{daily:S,lang:t,specs:w,format:T,totalLabel:C.total,total:E})}),w.filter(e=>e.area).map(e=>(0,$.jsx)(ee,{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)}`)),w.map(e=>(0,$.jsx)(Q,{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)}`)),p&&h?(0,$.jsx)(ve,{x1:p,x2:h,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:w.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:[o&&c?(0,$.jsx)(`span`,{children:c}):null,(0,$.jsxs)(`span`,{className:`mono`,children:[T(O),` peak`]})]})]})]})});export{ht as TrafficChart}; \ No newline at end of file diff --git a/internal/webui/static/assets/TrashSimple.es-1c4RHqtF.js b/internal/webui/static/assets/TrashSimple.es-a96yoz9-.js similarity index 96% rename from internal/webui/static/assets/TrashSimple.es-1c4RHqtF.js rename to internal/webui/static/assets/TrashSimple.es-a96yoz9-.js index c7deea4b..0b30e884 100644 --- a/internal/webui/static/assets/TrashSimple.es-1c4RHqtF.js +++ b/internal/webui/static/assets/TrashSimple.es-a96yoz9-.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-B77RWTNi.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM188,204H68V72H188ZM76,20A12,12,0,0,1,88,8h80a12,12,0,0,1,0,24H88A12,12,0,0,1,76,20Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M216,48H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM192,208H64V64H192ZM80,24a8,8,0,0,1,8-8h80a8,8,0,0,1,0,16H88A8,8,0,0,1,80,24Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,56a8,8,0,0,1-8,8h-8V208a16,16,0,0,1-16,16H64a16,16,0,0,1-16-16V64H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,56ZM88,32h80a8,8,0,0,0,0-16H88a8,8,0,0,0,0,16Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM82,24a6,6,0,0,1,6-6h80a6,6,0,0,1,0,12H88A6,6,0,0,1,82,24Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,48H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM192,208H64V64H192ZM80,24a8,8,0,0,1,8-8h80a8,8,0,0,1,0,16H88A8,8,0,0,1,80,24Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM84,24a4,4,0,0,1,4-4h80a4,4,0,0,1,0,8H88A4,4,0,0,1,84,24Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`TrashSimpleIcon`;var o=a;export{o as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-DAGWWg9N.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM188,204H68V72H188ZM76,20A12,12,0,0,1,88,8h80a12,12,0,0,1,0,24H88A12,12,0,0,1,76,20Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M216,48H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM192,208H64V64H192ZM80,24a8,8,0,0,1,8-8h80a8,8,0,0,1,0,16H88A8,8,0,0,1,80,24Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,56a8,8,0,0,1-8,8h-8V208a16,16,0,0,1-16,16H64a16,16,0,0,1-16-16V64H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,56ZM88,32h80a8,8,0,0,0,0-16H88a8,8,0,0,0,0,16Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM82,24a6,6,0,0,1,6-6h80a6,6,0,0,1,0,12H88A6,6,0,0,1,82,24Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,48H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM192,208H64V64H192ZM80,24a8,8,0,0,1,8-8h80a8,8,0,0,1,0,16H88A8,8,0,0,1,80,24Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM84,24a4,4,0,0,1,4-4h80a4,4,0,0,1,0,8H88A4,4,0,0,1,84,24Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`TrashSimpleIcon`;var o=a;export{o as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/UpdateControls-B_y4QTcu.js b/internal/webui/static/assets/UpdateControls-Cd_MTxBw.js similarity index 97% rename from internal/webui/static/assets/UpdateControls-B_y4QTcu.js rename to internal/webui/static/assets/UpdateControls-Cd_MTxBw.js index 6afdd11c..4e02b1b7 100644 --- a/internal/webui/static/assets/UpdateControls-B_y4QTcu.js +++ b/internal/webui/static/assets/UpdateControls-Cd_MTxBw.js @@ -1,4 +1,4 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,r as i}from"./useI18n-B77RWTNi.js";import{gn as a}from"./index-CmGY2WQi.js";var o=t(e(),1),s=/^(#{1,3})\s+(english|en|中文|chinese|zh|zh-cn|zh-hans)\s*$/i,c=/`([^`]+)`|\*\*([^*]+)\*\*|\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,l=new Set([`中文`,`chinese`,`zh`,`zh-cn`,`zh-hans`]),u=new Set([`english`,`en`]);function d(e,t){let n=e.trim().toLowerCase();return t===`zh`?l.has(n):u.has(n)}function f(e){let t=e.split(/\r?\n/),n=[];return t.forEach((e,t)=>{let r=s.exec(e.trim());r&&n.push({index:t,title:r[2]})}),n.length?n.map((e,r)=>{let i=e.index+1,a=r+1{let r=s.exec(e.trim());r&&n.push({index:t,title:r[2]})}),n.length?n.map((e,r)=>{let i=e.index+1,a=r+1d(e,t));return i?i[1].trim():r[0]?.[1]?.trim()||n}function m(e){let t=[],n=0;for(let r of e.matchAll(c)){let i=r.index??0;i>n&&t.push({type:`text`,value:e.slice(n,i)}),r[1]==null?r[2]==null?r[3]!=null&&r[4]!=null&&t.push({type:`link`,value:r[3],href:r[4]}):t.push({type:`strong`,value:r[2]}):t.push({type:`code`,value:r[1]}),n=i+r[0].length}return nm(e),[e]);return(0,_.jsx)(_.Fragment,{children:t.map((e,t)=>(0,_.jsx)(y,{node:e},`${e.type}-${t}`))})}function y({node:e}){return e.type===`code`?(0,_.jsx)(`code`,{children:e.value}):e.type===`strong`?(0,_.jsx)(`strong`,{children:e.value}):e.type===`link`?(0,_.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,children:e.value}):e.value}function b({markdown:e,emptyLabel:t}){let n=(0,o.useMemo)(()=>g(e),[e]);return!e.trim()||!n.length?(0,_.jsx)(`p`,{className:`release-notes__empty`,children:t}):(0,_.jsx)(`div`,{className:`release-notes`,children:n.map((e,t)=>{if(e.type===`heading`){let n=e.level===2?`h3`:`h4`;return(0,_.jsx)(n,{children:(0,_.jsx)(v,{text:e.text})},`h-${t}`)}return e.type===`list`?(0,_.jsx)(`ul`,{children:e.items.map((e,n)=>(0,_.jsx)(`li`,{children:(0,_.jsx)(v,{text:e})},`i-${t}-${n}`))},`l-${t}`):(0,_.jsx)(`p`,{children:(0,_.jsx)(v,{text:e.text})},`p-${t}`)})})}function x({update:e}){let{t}=r(),{info:n,submitting:o,reloadIn:s,elapsed:c,readyToApply:l,busy:u,justUpdated:d,targetVersion:f,newerThanPrepared:p,updateStateText:m,canPrepare:h,canApply:g,canCancel:v,primaryLabel:y,statusHint:b,prepareUpdate:x,confirmUpdate:S,cancelPreparedUpdate:C}=e;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`grid overflow-hidden rounded-lg bg-surface-secondary sm:grid-cols-[1fr_auto_1fr]`,children:[(0,_.jsxs)(`div`,{className:`p-4`,children:[(0,_.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:t(`currentVersion`)}),(0,_.jsx)(`div`,{className:`mono mt-2 text-section font-semibold`,children:n?.current_version||`—`})]}),(0,_.jsx)(`div`,{className:`hidden items-center border-x border-separator px-4 text-muted sm:flex`,children:(0,_.jsx)(a,{size:18})}),(0,_.jsxs)(`div`,{className:`border-t border-separator p-4 sm:border-t-0`,children:[(0,_.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:t(`latestVersion`)}),(0,_.jsx)(`div`,{className:`mono mt-2 text-section font-semibold`,children:n?.next_version||`—`})]})]}),(0,_.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-end gap-3`,children:[v?(0,_.jsx)(i,{size:`sm`,variant:`ghost`,isDisabled:o,onPress:()=>void C(),children:t(l?`discardPreparedImage`:`cancelUpdate`)}):null,(0,_.jsxs)(i,{isDisabled:!h&&!g||s!=null,isPending:o||u||s!=null,onPress:()=>void(g?S():x()),children:[(0,_.jsx)(a,{size:16}),y]})]}),!n?.agent?.available&&!u?(0,_.jsx)(`p`,{className:`mt-3 text-right text-caption text-muted`,children:t(`updateUnavailableHint`)}):null,n?.agent?.available&&!n.agent.staged_update&&!u?(0,_.jsx)(`p`,{className:`mt-3 text-right text-caption text-muted`,children:t(`updateLegacyOneShotHint`)}):null,l||u||s!=null||d?(0,_.jsxs)(`div`,{className:`mt-4 rounded-lg border px-3 py-3 border-separator bg-surface-secondary`,role:`status`,"aria-live":`polite`,children:[m?(0,_.jsxs)(`p`,{className:`text-caption font-medium text-foreground`,children:[m,f?` · ${f}`:``,c?` · ${t(`updateElapsed`,{seconds:c})}`:``]}):null,(0,_.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:b}),p?(0,_.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-warning`,children:t(`updateNewerReleaseHint`,{latest:n?.next_version||``})}):null,n?.update?.error||n?.agent?.error?(0,_.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-danger`,children:n?.update?.error||n?.agent?.error}):null]}):null]})}export{b as n,p as r,x as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/UsagePage-BWNcC3KJ.js b/internal/webui/static/assets/UsagePage-BWNcC3KJ.js deleted file mode 100644 index 7ae3eefd..00000000 --- a/internal/webui/static/assets/UsagePage-BWNcC3KJ.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CostChart-DMfp1L5p.js","assets/shim-mfK0Rmj6.js","assets/AreaChart-B0YOdVBx.js","assets/CartesianGrid-BJyfpdDb.js","assets/XAxis-DLQkFqxC.js","assets/format-B6SmebW-.js"])))=>i.map(i=>d[i]); -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,pt as i,r as a}from"./useI18n-B77RWTNi.js";import{s as o}from"./TimeRangePicker-KlLSf1l-.js";import{t as s}from"./accordion-IDhFN4Ix.js";import{t as c}from"./PageAlert-r7ZVsH9h.js";import{n as l,t as u}from"./useApiKeyOptions-3wTJgKia.js";import{n as d}from"./useToggle-BRoRhkOA.js";import{t as f}from"./EmptyPanel-Bs-jQMvG.js";import{n as p,t as m}from"./tabs-BShFVox8.js";import{t as h}from"./table-CRVB37zZ.js";import{$ as g,I as ee,Sn as _,at as v,bn as y,fn as te,hn as b,mn as x,nn as S,p as C,xn as w}from"./index-CmGY2WQi.js";import{t as T}from"./FilterToggle-Bygki2HF.js";import{c as E,i as D,o as O,r as k,s as A,u as j}from"./format-B6SmebW-.js";import{t as M}from"./ProviderMark-IiAZTaQS.js";import{t as N}from"./provider-gHnttGKq.js";import{a as P}from"./account-BJHim5bc.js";import{i as ne,n as re,r as ie,t as ae}from"./logsLink-BKfeKxl0.js";var F=t(e(),1),I=new Map([[`bold`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M234.36,170A12,12,0,0,1,230,186.37l-96,56a12,12,0,0,1-12.1,0l-96-56a12,12,0,0,1,12.09-20.74l90,52.48L218,165.63A12,12,0,0,1,234.36,170ZM218,117.63,128,170.11,38.05,117.63A12,12,0,0,0,26,138.37l96,56a12,12,0,0,0,12.1,0l96-56A12,12,0,0,0,218,117.63ZM20,80a12,12,0,0,1,6-10.37l96-56a12.06,12.06,0,0,1,12.1,0l96,56a12,12,0,0,1,0,20.74l-96,56a12,12,0,0,1-12.1,0l-96-56A12,12,0,0,1,20,80Zm35.82,0L128,122.11,200.18,80,128,37.89Z`}))],[`duotone`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M224,80l-96,56L32,80l96-56Z`,opacity:`0.2`}),F.createElement(`path`,{d:`M230.91,172A8,8,0,0,1,228,182.91l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,36,169.09l92,53.65,92-53.65A8,8,0,0,1,230.91,172ZM220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09ZM24,80a8,8,0,0,1,4-6.91l96-56a8,8,0,0,1,8.06,0l96,56a8,8,0,0,1,0,13.82l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,24,80Zm23.88,0L128,126.74,208.12,80,128,33.26Z`}))],[`fill`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M220,169.09l-92,53.65L36,169.09A8,8,0,0,0,28,182.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,169.09Z`}),F.createElement(`path`,{d:`M220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09Z`}),F.createElement(`path`,{d:`M28,86.91l96,56a8,8,0,0,0,8.06,0l96-56a8,8,0,0,0,0-13.82l-96-56a8,8,0,0,0-8.06,0l-96,56a8,8,0,0,0,0,13.82Z`}))],[`light`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M229.18,173a6,6,0,0,1-2.16,8.2l-96,56a6,6,0,0,1-6,0l-96-56a6,6,0,0,1,6-10.36l93,54.23,93-54.23A6,6,0,0,1,229.18,173ZM221,122.82l-93,54.23L35,122.82a6,6,0,0,0-6,10.36l96,56a6,6,0,0,0,6,0l96-56a6,6,0,0,0-6-10.36ZM26,80a6,6,0,0,1,3-5.18l96-56a6,6,0,0,1,6,0l96,56a6,6,0,0,1,0,10.36l-96,56a6,6,0,0,1-6,0l-96-56A6,6,0,0,1,26,80Zm17.91,0L128,129.05,212.09,80,128,31Z`}))],[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M230.91,172A8,8,0,0,1,228,182.91l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,36,169.09l92,53.65,92-53.65A8,8,0,0,1,230.91,172ZM220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09ZM24,80a8,8,0,0,1,4-6.91l96-56a8,8,0,0,1,8.06,0l96,56a8,8,0,0,1,0,13.82l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,24,80Zm23.88,0L128,126.74,208.12,80,128,33.26Z`}))],[`thin`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M227.45,174a4,4,0,0,1-1.44,5.48l-96,56a4,4,0,0,1-4,0l-96-56a4,4,0,0,1,4-6.92l94,54.83,94-54.83A4,4,0,0,1,227.45,174ZM222,124.54l-94,54.83L34,124.54a4,4,0,0,0-4,6.92l96,56a4,4,0,0,0,4,0l96-56a4,4,0,0,0-4-6.92ZM28,80a4,4,0,0,1,2-3.46l96-56a4,4,0,0,1,4,0l96,56a4,4,0,0,1,0,6.92l-96,56a4,4,0,0,1-4,0l-96-56A4,4,0,0,1,28,80Zm11.94,0L128,131.37,216.06,80,128,28.63Z`}))]]),L=F.forwardRef((e,t)=>F.createElement(i,{ref:t,...e,weights:I}));L.displayName=`StackIcon`;var oe=L,R=n(),z=864e5,se=8;function B(e){return`var(--chart-${e%se+1})`}function V(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function H(e){return e<10?`0${e}`:String(e)}function U(e){let t=new Date(e);return`${t.getFullYear()}-${H(t.getMonth()+1)}-${H(t.getDate())}`}function ce({accounts:e,t}){let[n,r]=(0,F.useState)(!1),{buckets:i,rows:o,todayStart:s,maxTotal:c}=(0,F.useMemo)(()=>{let t=V(new Date),n=new Map;e.forEach((e,t)=>n.set(e.id,B(t)));let r=new Map,i=[];for(let a of e){let e=a.quota?.packages??[],o=n.get(a.id)||B(0),s=a.name||a.id,c=e.filter(e=>(e.remain??0)>0&&(e.ends_at??0)>0),l=0,u=0,d=0,f=0;for(let e of c){let n=e.ends_at*1e3,i=e.remain??0;d+=i;let c=V(new Date(n)),u=c{let e=new Date(c);return{day:p,label:`${e.getMonth()+1}/${e.getDate()}`,ts:c,segments:[],total:0}})(),r.set(p,m));let h=m.segments.find(e=>e.id===a.id);h?h.remain+=i:m.segments.push({id:a.id,name:s,color:o,remain:i}),m.total+=i}if(l){let e=U(V(new Date(l)));for(let t of c)U(V(new Date(t.ends_at*1e3)))===e&&(u+=t.remain??0)}let p=l?Math.max(0,Math.round((V(new Date(l))-t)/z)):-1;i.push({id:a.id,name:s,color:o,remain:d,expiredRemain:f,soonest:l?Math.floor(l/1e3):0,soonestRemain:u,daysLeft:p,dailyBurn:l?u/Math.max(p,1):0,packs:c.length})}i.sort((e,t)=>e.soonest&&t.soonest?e.soonest-t.soonest:e.soonest?-1:t.soonest?1:t.remain-e.remain);let a=[...r.values()].sort((e,t)=>e.ts-t.ts);return{buckets:a,rows:i,todayStart:t,maxTotal:a.reduce((e,t)=>Math.max(e,t.total),0)}},[e]);if(!o.some(e=>e.packs>0))return null;let l=n?i:i.slice(0,8);return(0,R.jsxs)(d,{className:`overflow-hidden p-0`,"data-gsap-reveal":!0,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-4 py-4 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:px-5`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h3`,{className:`font-semibold`,children:t(`expiryDistTitle`)}),(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`expiryDistHint`)})]}),i.length>8?(0,R.jsx)(a,{size:`sm`,variant:`ghost`,onPress:()=>r(e=>!e),children:n?t(`expiryDistCollapse`):t(`expiryDistExpand`,{n:i.length})}):null]}),(0,R.jsxs)(`div`,{className:`space-y-4 p-4 sm:space-y-3 sm:p-5`,children:[(0,R.jsx)(`div`,{className:`space-y-2.5 sm:space-y-1.5`,children:l.map(e=>{let n=e.ts===s,r=c>0?e.total/c*100:0;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:grid sm:grid-cols-[52px_minmax(0,1fr)_auto] sm:items-center sm:gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 sm:contents`,children:[(0,R.jsx)(`span`,{className:`mono text-caption ${e.day===`__expired__`?`font-semibold text-danger`:n?`font-semibold text-foreground`:`text-muted`}`,children:e.day===`__expired__`?t(`expiryDistExpired`):e.label}),(0,R.jsx)(`span`,{className:`mono text-caption text-foreground sm:hidden`,children:P(e.total)})]}),(0,R.jsx)(`div`,{className:`h-2.5 w-full rounded-full bg-surface-tertiary`,role:`img`,"aria-label":`${e.day} ${t(`expiryDistDayTotal`,{n:P(e.total)})}`,title:e.day,children:(0,R.jsx)(`div`,{className:`flex h-full items-stretch overflow-hidden rounded-full`,style:{width:`${r}%`},children:e.segments.map(t=>(0,R.jsx)(`span`,{style:{width:`${t.remain/e.total*100}%`,backgroundColor:t.color},title:`${t.name} · ${P(t.remain)}`},t.id))})}),(0,R.jsx)(`span`,{className:`mono hidden text-caption text-foreground sm:inline`,children:P(e.total)})]},e.day)})}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1.5 pt-1`,children:o.filter(e=>e.remain>0).map(e=>(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-caption text-muted`,children:[(0,R.jsx)(`i`,{className:`size-2 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,R.jsx)(`span`,{className:`max-w-[120px] truncate`,children:e.name})]},e.id))}),(0,R.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:o.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null,a=e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`,o=e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`;return(0,R.jsxs)(`article`,{className:`space-y-3 py-3.5`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,R.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,R.jsx)(`span`,{className:`truncate text-body font-medium text-foreground`,children:e.name})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:[(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColSoonest`)}),(0,R.jsx)(`div`,{className:`mono text-body text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})]}),(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaysLeft`)}),(0,R.jsx)(`div`,{className:`mono text-body ${a}`,children:o})]}),(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColBatch`)}),(0,R.jsx)(`div`,{className:`mono text-body text-foreground`,children:P(e.soonestRemain)})]}),(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaily`)}),(0,R.jsx)(`div`,{className:`mono text-body text-foreground`,children:e.soonest?P(e.dailyBurn):`—`})]})]})]},e.id)})}),(0,R.jsx)(h,{"aria-label":t(`expiryDistTitle`),className:`hidden md:block`,children:(0,R.jsx)(h.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,R.jsxs)(h.Content,{className:`min-w-[32rem]`,children:[(0,R.jsxs)(h.Header,{children:[(0,R.jsx)(h.Column,{isRowHeader:!0,children:t(`expiryDistColAccount`)}),(0,R.jsx)(h.Column,{children:(0,R.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColSoonest`)})}),(0,R.jsx)(h.Column,{children:(0,R.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaysLeft`)})}),(0,R.jsx)(h.Column,{children:(0,R.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColBatch`)})}),(0,R.jsx)(h.Column,{children:(0,R.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaily`)})})]}),(0,R.jsx)(h.Body,{children:o.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null;return(0,R.jsxs)(h.Row,{children:[(0,R.jsx)(h.Cell,{children:(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,R.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,R.jsx)(`span`,{className:`max-w-[150px] truncate text-foreground`,children:e.name})]})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`div`,{className:`mono text-center text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`div`,{className:`mono text-center ${e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`}`,children:e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`div`,{className:`mono text-center text-foreground`,children:P(e.soonestRemain)})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`div`,{className:`mono text-center text-foreground`,children:e.soonest?P(e.dailyBurn):`—`})})]},e.id)})})]})})}),(0,R.jsx)(`p`,{className:`text-caption text-muted`,children:t(`expiryDistFoot`)})]})]})}function W(){return g(`/api/usage/pricing`)}function G(e={}){let t=new URLSearchParams;e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.api_key&&t.set(`api_key`,e.api_key);let n=t.toString()?`?${t}`:``;return g(`/api/usage/cost${n}`)}var K=(0,F.lazy)(()=>_(()=>import(`./CostChart-DMfp1L5p.js`).then(e=>({default:e.CostChart})),__vite__mapDeps([0,1,2,3,4,5])));function q(){let e=new Date;return e.setHours(0,0,0,0),e.toISOString()}var J={window:{from:``,to:``,hours:24},currency:`CNY`,models:[],totals:{id:`total`,label:``,vendor:``,currency:`CNY`,requests:0,cache_hit:0,cache_miss:0,output:0,total_tokens:0,cost:0,cost_off_peak:0,cost_peak:0,peak_requests:0,credits:0,priced:!1},series:[]};function Y(e,t){if(!t)return`0%`;let n=e/t*100;return`${n>=10?n.toFixed(0):n.toFixed(1)}%`}function le({apiKeyFilter:e=``}){let{t,lang:n}=r(),[i,o]=(0,F.useState)(`today`),[l,u]=(0,F.useState)(`credits`),[p,m]=(0,F.useState)(null),[g,ee]=(0,F.useState)(null),[_,y]=(0,F.useState)(!0),[te,x]=(0,F.useState)(``);(0,F.useEffect)(()=>{let e=!1;return W().then(t=>{e||ee(t)}).catch(()=>{}),()=>{e=!0}},[]);let S=(0,F.useCallback)(async()=>{y(!0);try{let t=await G({...i===`all`?{}:i===`today`?{from:q()}:{from:new Date(Date.now()-Number(i)*3600*1e3).toISOString(),to:new Date().toISOString()},api_key:e||void 0});m(t),x(``)}catch(e){m(null),x(e instanceof Error?e.message:String(e))}finally{y(!1)}},[i,e]);(0,F.useEffect)(()=>{S()},[S]);let w=p??J,E=w.totals,A=E.requests>0&&w.models.length>0,M=w.models.filter(e=>e.priced),N=E.cost>0,P=[{label:t(`usageCredits`),value:O(E.credits),detail:t(`usageCreditsHint`)},{label:t(`usageTotalTokens`),value:D(E.total_tokens),detail:`${D(E.cache_hit)} / ${D(E.cache_miss)} / ${D(E.output)} ${t(`usageTokenSplitNote`)}`},{label:t(`usageRequests`),value:String(E.requests),detail:t(`usageModelCount`,{count:w.models.length})},{label:t(`usageCacheHitRate`),value:Y(E.cache_hit,E.cache_hit+E.cache_miss),detail:D(E.cache_hit)}],ne=l===`credits`?O(E.credits):l===`tokens`?D(E.total_tokens):k(E.cost);return(0,R.jsxs)(`div`,{className:`space-y-6`,children:[(0,R.jsxs)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-2`,children:[(0,R.jsx)(T,{value:i,onChange:e=>o(e),ariaLabel:t(`usageWindow`),options:[{id:`today`,label:t(`statsWindowToday`)},{id:`24`,label:t(`usageWindow24h`)},{id:`168`,label:t(`usageWindow7d`)},{id:`all`,label:t(`usageWindowTotal`)}]}),(0,R.jsxs)(a,{size:`sm`,variant:`secondary`,onPress:()=>void S(),isDisabled:_,children:[(0,R.jsx)(b,{size:14}),t(`refresh`)]})]}),te?(0,R.jsx)(c,{title:t(`failedStats`,{msg:te})}):null,(0,R.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-4`,children:P.map(e=>(0,R.jsxs)(d,{className:`gap-0 p-4`,children:[(0,R.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,R.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:_?(0,R.jsx)(C,{className:`h-5 w-16`}):e.value}),(0,R.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:_?(0,R.jsx)(C,{className:`h-3 w-24`}):e.detail||`\xA0`})]},e.label))}),(0,R.jsxs)(d,{className:`overflow-hidden p-0`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageChartTitle`)}),(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageChartHint`)})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,R.jsx)(T,{value:l,onChange:e=>u(e),ariaLabel:t(`usageChartMetric`),options:[{id:`credits`,label:t(`usageColCredits`)},{id:`tokens`,label:t(`usageColTokens`)}]}),(0,R.jsx)(v,{size:`sm`,variant:`soft`,color:`default`,children:ne})]})]}),(0,R.jsx)(`div`,{className:`p-5`,children:_?(0,R.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,R.jsx)(C,{className:`h-56 w-full`})}):A?(0,R.jsx)(F.Suspense,{fallback:(0,R.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,R.jsx)(C,{className:`h-56 w-full`})}),children:(0,R.jsx)(K,{series:w.series,models:w.models,lang:n,emptyLabel:t(`usageChartEmpty`),totalLabel:t(`usageTotals`),metric:l})}):(0,R.jsx)(f,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})})]}),(0,R.jsxs)(d,{className:`overflow-hidden p-0`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageBreakdownTitle`)}),(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageBreakdownHint`)})]})}),_?(0,R.jsx)(`div`,{className:`space-y-3 p-5`,children:[0,1,2].map(e=>(0,R.jsx)(C,{className:`h-9 w-full`},e))}):A?(0,R.jsx)(h,{children:(0,R.jsx)(h.ScrollContainer,{children:(0,R.jsxs)(h.Content,{"aria-label":t(`usageBreakdownTitle`),children:[(0,R.jsxs)(h.Header,{children:[(0,R.jsx)(h.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,R.jsx)(h.Column,{children:t(`usageColRequests`)}),(0,R.jsx)(h.Column,{children:t(`usageColInputHit`)}),(0,R.jsx)(h.Column,{children:t(`usageColInputMiss`)}),(0,R.jsx)(h.Column,{children:t(`usageColOutput`)}),(0,R.jsx)(h.Column,{children:t(`usageColTokens`)}),(0,R.jsx)(h.Column,{children:t(`usageColCredits`)})]}),(0,R.jsxs)(h.Body,{children:[w.models.map(e=>(0,R.jsxs)(h.Row,{children:[(0,R.jsxs)(h.Cell,{children:[(0,R.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,R.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`mono text-xs`,children:e.requests})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`mono text-xs`,children:D(e.cache_hit)})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`mono text-xs`,children:D(e.cache_miss)})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`mono text-xs`,children:D(e.output)})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`mono text-xs`,children:D(e.total_tokens)})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`mono text-xs font-semibold`,children:O(e.credits)})})]},e.id)),(0,R.jsxs)(h.Row,{children:[(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`mono text-xs font-semibold`,children:E.requests})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`mono text-xs font-semibold`,children:D(E.cache_hit)})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`mono text-xs font-semibold`,children:D(E.cache_miss)})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`mono text-xs font-semibold`,children:D(E.output)})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`mono text-xs font-semibold`,children:D(E.total_tokens)})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`mono text-xs font-semibold`,children:O(E.credits)})})]})]})]})})}):(0,R.jsx)(f,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})]}),(0,R.jsx)(s,{className:`rounded-xl bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:[],children:(0,R.jsxs)(s.Item,{id:`deepseek-estimate`,children:[(0,R.jsx)(s.Heading,{children:(0,R.jsxs)(s.Trigger,{className:`items-center gap-3 px-5 py-4 text-left`,children:[(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block font-semibold tracking-[-0.015em]`,children:t(`usageEstimateTitle`)}),(0,R.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted`,children:t(`usageEstimateHint`)})]}),N?(0,R.jsx)(v,{size:`sm`,variant:`soft`,color:`default`,children:k(E.cost)}):null,(0,R.jsx)(s.Indicator,{})]})}),(0,R.jsx)(s.Panel,{children:(0,R.jsxs)(s.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,R.jsx)(`p`,{className:`text-xs leading-6 text-muted`,children:t(`usageRenderNote`)}),N?(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,R.jsx)(`h4`,{className:`text-sm font-medium`,children:t(`usageEstimateChartTitle`)}),(0,R.jsx)(v,{size:`sm`,variant:`soft`,color:`default`,children:k(E.cost)})]}),(0,R.jsx)(F.Suspense,{fallback:(0,R.jsx)(C,{className:`h-56 w-full`}),children:(0,R.jsx)(K,{series:w.series,models:M.length?M:w.models,lang:n,emptyLabel:t(`usageEstimateChartEmpty`),totalLabel:t(`usageTotals`),metric:`cost`})})]}):null,M.length?(0,R.jsx)(h,{children:(0,R.jsx)(h.ScrollContainer,{children:(0,R.jsxs)(h.Content,{"aria-label":t(`usageEstimateTitle`),children:[(0,R.jsxs)(h.Header,{children:[(0,R.jsx)(h.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,R.jsx)(h.Column,{children:t(`usageColSplit`)}),(0,R.jsx)(h.Column,{children:t(`usageColCost`)})]}),(0,R.jsxs)(h.Body,{children:[M.map(e=>(0,R.jsxs)(h.Row,{children:[(0,R.jsxs)(h.Cell,{children:[(0,R.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,R.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,R.jsx)(h.Cell,{children:(0,R.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[k(e.cost_peak),` / `,k(e.cost_off_peak)]})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`mono text-sm font-semibold`,children:k(e.cost)})})]},e.id)),(0,R.jsxs)(h.Row,{children:[(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,R.jsx)(h.Cell,{children:(0,R.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[k(E.cost_peak),` / `,k(E.cost_off_peak)]})}),(0,R.jsx)(h.Cell,{children:(0,R.jsx)(`span`,{className:`mono text-sm font-semibold`,children:k(E.cost)})})]})]})]})})}):(0,R.jsx)(`p`,{className:`text-xs text-muted`,children:t(`usageEstimateChartEmpty`)}),(0,R.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h4`,{className:`mb-2 text-sm font-medium`,children:t(`usagePriceTitle`)}),(0,R.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:t(`usagePeakNote`)}),(0,R.jsxs)(`div`,{className:`divide-y divide-separator rounded-lg bg-background`,children:[(g?.models??[]).map(e=>(0,R.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,R.jsx)(`span`,{className:`mono text-[10px] text-muted`,children:e.currency})]}),(0,R.jsx)(`div`,{className:`mono mt-1 text-[10px] text-muted`,children:e.id}),(0,R.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 text-[11px]`,children:[(0,R.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,R.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandOff`)}),(0,R.jsxs)(`div`,{className:`mono mt-0.5`,children:[j(e.off_peak.cache_hit),` · `,j(e.off_peak.cache_miss),` · `,j(e.off_peak.output)]}),(0,R.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]}),(0,R.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,R.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandPeak`)}),(0,R.jsxs)(`div`,{className:`mono mt-0.5`,children:[j(e.peak.cache_hit),` · `,j(e.peak.cache_miss),` · `,j(e.peak.output)]}),(0,R.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]})]})]},e.id)),g?.models?.length?null:(0,R.jsx)(`div`,{className:`px-4 py-6 text-sm text-muted`,children:t(`usageEmpty`)})]})]}),(0,R.jsxs)(`div`,{className:`space-y-3 text-xs leading-6 text-muted`,children:[(0,R.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:t(`usageNoteTitle`)}),(0,R.jsx)(`p`,{children:t(`usageRetentionHint`)}),(0,R.jsx)(`p`,{children:t(`usagePeakNote`)}),w.unpriced?.length?(0,R.jsx)(`p`,{children:t(`usageUnpricedHint`,{models:w.unpriced.join(`, `)})}):null,g?.note?(0,R.jsx)(`p`,{className:`mono text-[10px]`,children:g.note}):null]})]})]})})]})})]})}var ue=500,X={model:`model`,account:`account`,provider:`provider`};function de(e,t,n){let r=e.prompt_tokens??0,i=e.completion_tokens??0,a=e.key===`(unknown)`||e.key===`(unassigned)`||!e.key;return{key:e.key,label:n,count:e.count,success:e.count?e.ok/e.count:0,p95:e.latency_p95_ms??null,tokens:r+i,prompt:r,completion:i,credits:e.credits??0,cache_write:e.cache_write_tokens??0,cache_read:e.cache_read_tokens??0,filter:a?void 0:{[X[t]]:e.key}}}function fe(e,t,n){let r=n===`ascending`?1:-1;return[...e].sort((e,n)=>{if(t===`label`)return r*e.label.localeCompare(n.label);let i=e[t],a=n[t];return i==null&&a==null?0:i==null?1:a==null?-1:r*(i-a)||e.label.localeCompare(n.label)})}function pe(e){return e?e>=1e3?D(e):String(Math.round(e*100)/100):`0`}function me(){let{t:e}=r(),t=y(),[n,i]=w(),[a,s]=(0,F.useState)(`stats`),[f,g]=(0,F.useState)(`model`),[_,v]=(0,F.useState)(`today`),[b,T]=(0,F.useState)(null),[O,k]=(0,F.useState)(null),[j,P]=(0,F.useState)(!0),[I,L]=(0,F.useState)(``),[z,se]=(0,F.useState)([]),[B,V]=(0,F.useState)(`count`),[H,U]=(0,F.useState)(`descending`),[W,G]=(0,F.useState)(()=>new URLSearchParams(window.location.search).get(`api_key`)??``),{options:K}=u(),q=(0,F.useRef)(0),J=n.toString(),Y=(0,F.useRef)(J);(0,F.useEffect)(()=>{J!==Y.current&&(Y.current=J,G(new URLSearchParams(J).get(`api_key`)??``))},[J]);let X=W?`api_key=${encodeURIComponent(W)}`:``;(0,F.useEffect)(()=>{X!==Y.current&&(Y.current=X,i(X,{replace:!0}))},[X,i]),(0,F.useEffect)(()=>{let e=!1;return ee(!1).then(t=>{e||se(t.data||[])}).catch(()=>{}),()=>{e=!0}},[]);let me=b?.start?.toString()??``,he=b?.end?.toString()??``;(0,F.useEffect)(()=>{let e=ne(_,b);if(!e){P(!1);return}let t=++q.current;o({...e,dim:[f],limit:ue,api_key:W||void 0}).then(e=>{t===q.current&&(k(e),L(``))}).catch(e=>{t===q.current&&(k(null),L(e instanceof Error?e.message:String(e)))}).finally(()=>{t===q.current&&P(!1)})},[f,_,me,he,W]);let Z=(0,F.useMemo)(()=>{let t=new Map(z.map(e=>[e.id,e.name||e.id]));return fe(((f===`model`?O?.models:f===`account`?O?.accounts:O?.providers)??[]).map(n=>{let r=n.key===`(unknown)`?e(`statsUnknown`):n.key===`(unassigned)`?e(`statsUnassigned`):f===`account`?t.get(n.key)||n.key:f===`provider`?N(n.key,e):n.key;return de(n,f,r)}),B,H)},[O,f,z,B,H,e]),Q=O?.totals,$=O?.tokens;function ge(e){if(!O||!e.filter)return;let n={...e.filter,api_key:W||void 0};t(ae(n,O.window.from,O.window.to))}let _e=[{id:`label`,label:e(f===`model`?`logsColModel`:f===`account`?`logsColAccount`:`logsColProvider`)},{id:`count`,label:e(`usageColRequests`),numeric:!0},{id:`success`,label:e(`usageColSuccess`),numeric:!0},{id:`p95`,label:e(`statsLatencyP95`),numeric:!0},{id:`tokens`,label:e(`usageColTokens`),numeric:!0},{id:`cache_write`,label:e(`usageColCacheWrite`),numeric:!0},{id:`credits`,label:e(`usageColCredits`),numeric:!0}],ve=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-1`,children:(0,R.jsx)(re,{value:_,onChange:v,custom:b,onCustomChange:T,onBusy:()=>P(!0),t:e})}),I?(0,R.jsx)(c,{title:e(`failedStats`,{msg:I})}):null,(0,R.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-5`,children:[[e(`usageColRequests`),Q?D(Q.requests):`—`,e(`statsWindowHint`,{window:e(ie[_])})],[e(`usageColSuccess`),Q?E(Q.success_rate):`—`,Q?`${Q.ok} / ${Q.requests}`:``],[e(`usageColTokens`),$?D($.total):`—`,$?`${D($.prompt)} / ${D($.completion)}`:``],[e(`usageColCacheWrite`),$?D($.cache_write??0):`—`,$?`${e(`chartCacheRead`)} ${D($.cache_read)}`:``],[e(`usageColCredits`),Q?pe(Q.credits??0):`—`,``]].map(([e,t,n])=>(0,R.jsxs)(d,{className:`gap-0 p-4`,children:[(0,R.jsx)(`div`,{className:`text-body text-muted`,children:e}),(0,R.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:j?(0,R.jsx)(C,{className:`h-5 w-16`}):t}),(0,R.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:j?(0,R.jsx)(C,{className:`h-3 w-24`}):n||`\xA0`})]},e))}),(0,R.jsxs)(d,{className:`overflow-hidden p-0`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-5 py-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between`,children:[(0,R.jsx)(m,{selectedKey:f,onSelectionChange:e=>{P(!0),g(String(e))},children:(0,R.jsx)(m.ListContainer,{className:`w-fit`,children:(0,R.jsxs)(m.List,{"aria-label":e(`usageTitle`),children:[(0,R.jsxs)(p,{id:`model`,className:`gap-1.5 whitespace-nowrap`,children:[(0,R.jsx)(m.Indicator,{className:`transition-none`}),(0,R.jsx)(te,{size:14}),e(`usageByModel`)]}),(0,R.jsxs)(p,{id:`account`,className:`gap-1.5 whitespace-nowrap`,children:[(0,R.jsx)(m.Indicator,{className:`transition-none`}),(0,R.jsx)(S,{size:14}),e(`usageByAccount`)]}),(0,R.jsxs)(p,{id:`provider`,className:`gap-1.5 whitespace-nowrap`,children:[(0,R.jsx)(m.Indicator,{className:`transition-none`}),(0,R.jsx)(oe,{size:14}),e(`usageByProvider`)]})]})})}),(0,R.jsx)(`span`,{className:`mono text-caption text-muted`,children:j?``:e(`usageRowCount`,{count:Z.length})})]}),j?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,"aria-busy":`true`,children:Array.from({length:4},(e,t)=>(0,R.jsxs)(`div`,{className:`space-y-3 px-5 py-4`,children:[(0,R.jsx)(C,{className:`h-4 w-40`}),(0,R.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:Array.from({length:4},(e,t)=>(0,R.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,R.jsx)(C,{className:`h-3 w-12`}),(0,R.jsx)(C,{className:`h-4 w-16`})]},t))})]},t))}),(0,R.jsx)(`div`,{className:`hidden divide-y divide-separator md:block`,"aria-busy":`true`,children:Array.from({length:6},(e,t)=>(0,R.jsxs)(`div`,{className:`flex items-center gap-6 px-5 py-3.5`,children:[(0,R.jsx)(C,{className:`h-4 w-40`}),(0,R.jsx)(`div`,{className:`flex-1`}),Array.from({length:6},(e,t)=>(0,R.jsx)(C,{className:`h-4 w-14`},t))]},t))})]}):Z.length===0?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-10 text-body text-muted`,children:[(0,R.jsx)(x,{size:16}),e(`usageEmpty`)]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:Z.map(t=>{let n=!!(t.filter&&O),r=[{label:e(`usageColRequests`),value:String(t.count)},{label:e(`usageColSuccess`),value:E(t.success),tone:t.success<.9?`text-warning`:void 0},{label:e(`statsLatencyP95`),value:A(t.p95)},{label:e(`usageColTokens`),value:D(t.tokens),sub:`${D(t.prompt)} / ${D(t.completion)}`},{label:e(`usageColCacheWrite`),value:D(t.cache_write)},{label:e(`usageColCredits`),value:pe(t.credits)}];return(0,R.jsxs)(`article`,{className:`space-y-3 px-5 py-4 ${n?`cursor-pointer`:``}`,onClick:n?()=>ge(t):void 0,onKeyDown:n?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ge(t))}:void 0,role:n?`button`:void 0,tabIndex:n?0:void 0,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[f===`provider`&&t.filter?(0,R.jsx)(M,{provider:t.key,size:14}):null,(0,R.jsx)(`span`,{className:`truncate text-body font-medium`,children:t.label})]}),f===`account`&&t.label!==t.key?(0,R.jsx)(`div`,{className:`mono truncate text-caption text-muted`,children:t.key}):null,(0,R.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:r.map(e=>(0,R.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,R.jsx)(`div`,{className:`text-caption text-muted`,children:e.label}),(0,R.jsx)(`div`,{className:`mono text-body ${e.tone??`text-foreground`}`,children:e.value}),`sub`in e&&e.sub?(0,R.jsx)(`div`,{className:`mono text-caption text-muted`,children:e.sub}):null]},e.label))})]},t.key)})}),(0,R.jsx)(h,{className:`usage-table hidden md:block`,children:(0,R.jsx)(h.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,R.jsxs)(h.Content,{"aria-label":e(`usageTitle`),className:`min-w-[48rem]`,sortDescriptor:{column:B,direction:H},onSortChange:e=>{V(String(e.column)),U(e.direction)},children:[(0,R.jsx)(h.Header,{children:_e.map(e=>(0,R.jsx)(h.Column,{id:e.id,allowsSorting:!0,isRowHeader:e.id===`label`,className:e.numeric?`text-right`:void 0,children:({sortDirection:t})=>(0,R.jsx)(h.SortableColumnHeader,{sortDirection:t,className:e.numeric?`justify-end`:void 0,children:e.label})},e.id))}),(0,R.jsx)(h.Body,{children:Z.map(e=>(0,R.jsxs)(h.Row,{id:e.key,className:e.filter&&O?`cursor-pointer`:void 0,onAction:e.filter&&O?()=>ge(e):void 0,children:[(0,R.jsx)(h.Cell,{children:(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[f===`provider`&&e.filter?(0,R.jsx)(M,{provider:e.key,size:14}):null,(0,R.jsx)(`span`,{className:`truncate text-body font-medium`,children:e.label}),f===`account`&&e.label!==e.key?(0,R.jsx)(`span`,{className:`mono truncate text-caption text-muted`,children:e.key}):null]})}),(0,R.jsx)(h.Cell,{className:`mono text-right text-body`,children:e.count}),(0,R.jsx)(h.Cell,{className:`mono text-right text-body`,children:(0,R.jsx)(`span`,{className:e.success<.9?`text-warning`:void 0,children:E(e.success)})}),(0,R.jsx)(h.Cell,{className:`mono text-right text-body`,children:A(e.p95)}),(0,R.jsxs)(h.Cell,{className:`text-right`,children:[(0,R.jsx)(`div`,{className:`mono text-body`,children:D(e.tokens)}),(0,R.jsxs)(`div`,{className:`mono text-caption text-muted`,children:[D(e.prompt),` / `,D(e.completion)]})]}),(0,R.jsx)(h.Cell,{className:`mono text-right text-body`,children:D(e.cache_write)}),(0,R.jsx)(h.Cell,{className:`mono text-right text-body`,children:pe(e.credits)})]},e.key))})]})})})]})]}),(0,R.jsx)(ce,{accounts:z,t:e})]});return(0,R.jsxs)(`div`,{className:`space-y-6 sm:space-y-6`,children:[(0,R.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-3 pb-1`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`usageTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(a===`cost`?`usageCostLead`:`usageLead`)})]}),(0,R.jsx)(l,{ariaLabel:e(`logsColApiKey`),value:W,onChange:e=>{P(!0),G(e)},options:K,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)})]}),(0,R.jsxs)(m,{selectedKey:a,onSelectionChange:e=>s(String(e)),children:[(0,R.jsx)(m.ListContainer,{className:`w-fit`,children:(0,R.jsxs)(m.List,{"aria-label":e(`usageTitle`),children:[(0,R.jsxs)(p,{id:`stats`,className:`gap-1.5 whitespace-nowrap`,children:[(0,R.jsx)(m.Indicator,{className:`transition-none`}),e(`usageStatsTab`)]}),(0,R.jsxs)(p,{id:`cost`,className:`gap-1.5 whitespace-nowrap`,children:[(0,R.jsx)(m.Indicator,{className:`transition-none`}),e(`usageCostTab`)]})]})}),(0,R.jsx)(m.Panel,{id:`stats`,className:`space-y-6 pt-5`,children:ve}),(0,R.jsx)(m.Panel,{id:`cost`,className:`pt-5`,children:(0,R.jsx)(le,{apiKeyFilter:W})})]})]})}export{me as UsagePage}; \ No newline at end of file diff --git a/internal/webui/static/assets/UsagePage-CZLd1kJx.js b/internal/webui/static/assets/UsagePage-CZLd1kJx.js new file mode 100644 index 00000000..06aedc57 --- /dev/null +++ b/internal/webui/static/assets/UsagePage-CZLd1kJx.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CostChart-DMfp1L5p.js","assets/shim-mfK0Rmj6.js","assets/AreaChart-B0YOdVBx.js","assets/CartesianGrid-BJyfpdDb.js","assets/XAxis-DLQkFqxC.js","assets/format-B6SmebW-.js"])))=>i.map(i=>d[i]); +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,pt as i,r as a}from"./useI18n-DAGWWg9N.js";import{s as o}from"./TimeRangePicker-BqBfH6td.js";import{t as s}from"./accordion-CX4F9HFo.js";import{t as c}from"./PageAlert-BTp9jdUz.js";import{n as l,t as u}from"./useApiKeyOptions-mwmshhJ6.js";import{n as d}from"./useToggle-Zi1rbfHX.js";import{t as f}from"./EmptyPanel-Bs-jQMvG.js";import{n as p,t as m}from"./tabs-CvBWSueW.js";import{t as h}from"./table-CocoYVkm.js";import{D as g,u as ee}from"./overview-DcWoRgOQ.js";import{Bt as _,Ht as v,M as y,Wt as te,Xt as b,Yt as x,Zt as S,kt as C,m as w}from"./index-BYut8qRj.js";import{t as T}from"./FilterToggle-nA-ZS4oO.js";import{c as E,i as D,o as O,r as k,s as A,u as j}from"./format-B6SmebW-.js";import{t as M}from"./ProviderMark-IiAZTaQS.js";import{t as N}from"./provider-gHnttGKq.js";import{a as P}from"./account-BJHim5bc.js";import{i as ne,n as re,r as ie,t as ae}from"./logsLink-Dske8Q7n.js";var F=t(e(),1),oe=new Map([[`bold`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M234.36,170A12,12,0,0,1,230,186.37l-96,56a12,12,0,0,1-12.1,0l-96-56a12,12,0,0,1,12.09-20.74l90,52.48L218,165.63A12,12,0,0,1,234.36,170ZM218,117.63,128,170.11,38.05,117.63A12,12,0,0,0,26,138.37l96,56a12,12,0,0,0,12.1,0l96-56A12,12,0,0,0,218,117.63ZM20,80a12,12,0,0,1,6-10.37l96-56a12.06,12.06,0,0,1,12.1,0l96,56a12,12,0,0,1,0,20.74l-96,56a12,12,0,0,1-12.1,0l-96-56A12,12,0,0,1,20,80Zm35.82,0L128,122.11,200.18,80,128,37.89Z`}))],[`duotone`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M224,80l-96,56L32,80l96-56Z`,opacity:`0.2`}),F.createElement(`path`,{d:`M230.91,172A8,8,0,0,1,228,182.91l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,36,169.09l92,53.65,92-53.65A8,8,0,0,1,230.91,172ZM220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09ZM24,80a8,8,0,0,1,4-6.91l96-56a8,8,0,0,1,8.06,0l96,56a8,8,0,0,1,0,13.82l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,24,80Zm23.88,0L128,126.74,208.12,80,128,33.26Z`}))],[`fill`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M220,169.09l-92,53.65L36,169.09A8,8,0,0,0,28,182.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,169.09Z`}),F.createElement(`path`,{d:`M220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09Z`}),F.createElement(`path`,{d:`M28,86.91l96,56a8,8,0,0,0,8.06,0l96-56a8,8,0,0,0,0-13.82l-96-56a8,8,0,0,0-8.06,0l-96,56a8,8,0,0,0,0,13.82Z`}))],[`light`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M229.18,173a6,6,0,0,1-2.16,8.2l-96,56a6,6,0,0,1-6,0l-96-56a6,6,0,0,1,6-10.36l93,54.23,93-54.23A6,6,0,0,1,229.18,173ZM221,122.82l-93,54.23L35,122.82a6,6,0,0,0-6,10.36l96,56a6,6,0,0,0,6,0l96-56a6,6,0,0,0-6-10.36ZM26,80a6,6,0,0,1,3-5.18l96-56a6,6,0,0,1,6,0l96,56a6,6,0,0,1,0,10.36l-96,56a6,6,0,0,1-6,0l-96-56A6,6,0,0,1,26,80Zm17.91,0L128,129.05,212.09,80,128,31Z`}))],[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M230.91,172A8,8,0,0,1,228,182.91l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,36,169.09l92,53.65,92-53.65A8,8,0,0,1,230.91,172ZM220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09ZM24,80a8,8,0,0,1,4-6.91l96-56a8,8,0,0,1,8.06,0l96,56a8,8,0,0,1,0,13.82l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,24,80Zm23.88,0L128,126.74,208.12,80,128,33.26Z`}))],[`thin`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M227.45,174a4,4,0,0,1-1.44,5.48l-96,56a4,4,0,0,1-4,0l-96-56a4,4,0,0,1,4-6.92l94,54.83,94-54.83A4,4,0,0,1,227.45,174ZM222,124.54l-94,54.83L34,124.54a4,4,0,0,0-4,6.92l96,56a4,4,0,0,0,4,0l96-56a4,4,0,0,0-4-6.92ZM28,80a4,4,0,0,1,2-3.46l96-56a4,4,0,0,1,4,0l96,56a4,4,0,0,1,0,6.92l-96,56a4,4,0,0,1-4,0l-96-56A4,4,0,0,1,28,80Zm11.94,0L128,131.37,216.06,80,128,28.63Z`}))]]),I=F.forwardRef((e,t)=>F.createElement(i,{ref:t,...e,weights:oe}));I.displayName=`StackIcon`;var se=I,L=n(),R=864e5,ce=8;function z(e){return`var(--chart-${e%ce+1})`}function B(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function V(e){return e<10?`0${e}`:String(e)}function H(e){let t=new Date(e);return`${t.getFullYear()}-${V(t.getMonth()+1)}-${V(t.getDate())}`}function le({accounts:e,t}){let[n,r]=(0,F.useState)(!1),{buckets:i,rows:o,todayStart:s,maxTotal:c}=(0,F.useMemo)(()=>{let t=B(new Date),n=new Map;e.forEach((e,t)=>n.set(e.id,z(t)));let r=new Map,i=[];for(let a of e){let e=a.quota?.packages??[],o=n.get(a.id)||z(0),s=a.name||a.id,c=e.filter(e=>(e.remain??0)>0&&(e.ends_at??0)>0),l=0,u=0,d=0,f=0;for(let e of c){let n=e.ends_at*1e3,i=e.remain??0;d+=i;let c=B(new Date(n)),u=c{let e=new Date(c);return{day:p,label:`${e.getMonth()+1}/${e.getDate()}`,ts:c,segments:[],total:0}})(),r.set(p,m));let h=m.segments.find(e=>e.id===a.id);h?h.remain+=i:m.segments.push({id:a.id,name:s,color:o,remain:i}),m.total+=i}if(l){let e=H(B(new Date(l)));for(let t of c)H(B(new Date(t.ends_at*1e3)))===e&&(u+=t.remain??0)}let p=l?Math.max(0,Math.round((B(new Date(l))-t)/R)):-1;i.push({id:a.id,name:s,color:o,remain:d,expiredRemain:f,soonest:l?Math.floor(l/1e3):0,soonestRemain:u,daysLeft:p,dailyBurn:l?u/Math.max(p,1):0,packs:c.length})}i.sort((e,t)=>e.soonest&&t.soonest?e.soonest-t.soonest:e.soonest?-1:t.soonest?1:t.remain-e.remain);let a=[...r.values()].sort((e,t)=>e.ts-t.ts);return{buckets:a,rows:i,todayStart:t,maxTotal:a.reduce((e,t)=>Math.max(e,t.total),0)}},[e]);if(!o.some(e=>e.packs>0))return null;let l=n?i:i.slice(0,8);return(0,L.jsxs)(d,{className:`overflow-hidden p-0`,"data-gsap-reveal":!0,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-4 py-4 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:px-5`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`h3`,{className:`font-semibold`,children:t(`expiryDistTitle`)}),(0,L.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`expiryDistHint`)})]}),i.length>8?(0,L.jsx)(a,{size:`sm`,variant:`ghost`,onPress:()=>r(e=>!e),children:n?t(`expiryDistCollapse`):t(`expiryDistExpand`,{n:i.length})}):null]}),(0,L.jsxs)(`div`,{className:`space-y-4 p-4 sm:space-y-3 sm:p-5`,children:[(0,L.jsx)(`div`,{className:`space-y-2.5 sm:space-y-1.5`,children:l.map(e=>{let n=e.ts===s,r=c>0?e.total/c*100:0;return(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:grid sm:grid-cols-[52px_minmax(0,1fr)_auto] sm:items-center sm:gap-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 sm:contents`,children:[(0,L.jsx)(`span`,{className:`mono text-caption ${e.day===`__expired__`?`font-semibold text-danger`:n?`font-semibold text-foreground`:`text-muted`}`,children:e.day===`__expired__`?t(`expiryDistExpired`):e.label}),(0,L.jsx)(`span`,{className:`mono text-caption text-foreground sm:hidden`,children:P(e.total)})]}),(0,L.jsx)(`div`,{className:`h-2.5 w-full rounded-full bg-surface-tertiary`,role:`img`,"aria-label":`${e.day} ${t(`expiryDistDayTotal`,{n:P(e.total)})}`,title:e.day,children:(0,L.jsx)(`div`,{className:`flex h-full items-stretch overflow-hidden rounded-full`,style:{width:`${r}%`},children:e.segments.map(t=>(0,L.jsx)(`span`,{style:{width:`${t.remain/e.total*100}%`,backgroundColor:t.color},title:`${t.name} · ${P(t.remain)}`},t.id))})}),(0,L.jsx)(`span`,{className:`mono hidden text-caption text-foreground sm:inline`,children:P(e.total)})]},e.day)})}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1.5 pt-1`,children:o.filter(e=>e.remain>0).map(e=>(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-caption text-muted`,children:[(0,L.jsx)(`i`,{className:`size-2 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,L.jsx)(`span`,{className:`max-w-[120px] truncate`,children:e.name})]},e.id))}),(0,L.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:o.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null,a=e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`,o=e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`;return(0,L.jsxs)(`article`,{className:`space-y-3 py-3.5`,children:[(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,L.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,L.jsx)(`span`,{className:`truncate text-body font-medium text-foreground`,children:e.name})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:[(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColSoonest`)}),(0,L.jsx)(`div`,{className:`mono text-body text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})]}),(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaysLeft`)}),(0,L.jsx)(`div`,{className:`mono text-body ${a}`,children:o})]}),(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColBatch`)}),(0,L.jsx)(`div`,{className:`mono text-body text-foreground`,children:P(e.soonestRemain)})]}),(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaily`)}),(0,L.jsx)(`div`,{className:`mono text-body text-foreground`,children:e.soonest?P(e.dailyBurn):`—`})]})]})]},e.id)})}),(0,L.jsx)(h,{"aria-label":t(`expiryDistTitle`),className:`hidden md:block`,children:(0,L.jsx)(h.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,L.jsxs)(h.Content,{className:`min-w-[32rem]`,children:[(0,L.jsxs)(h.Header,{children:[(0,L.jsx)(h.Column,{isRowHeader:!0,children:t(`expiryDistColAccount`)}),(0,L.jsx)(h.Column,{children:(0,L.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColSoonest`)})}),(0,L.jsx)(h.Column,{children:(0,L.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaysLeft`)})}),(0,L.jsx)(h.Column,{children:(0,L.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColBatch`)})}),(0,L.jsx)(h.Column,{children:(0,L.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaily`)})})]}),(0,L.jsx)(h.Body,{children:o.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null;return(0,L.jsxs)(h.Row,{children:[(0,L.jsx)(h.Cell,{children:(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,L.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,L.jsx)(`span`,{className:`max-w-[150px] truncate text-foreground`,children:e.name})]})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`div`,{className:`mono text-center text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`div`,{className:`mono text-center ${e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`}`,children:e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`div`,{className:`mono text-center text-foreground`,children:P(e.soonestRemain)})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`div`,{className:`mono text-center text-foreground`,children:e.soonest?P(e.dailyBurn):`—`})})]},e.id)})})]})})}),(0,L.jsx)(`p`,{className:`text-caption text-muted`,children:t(`expiryDistFoot`)})]})]})}function U(){return g(`/api/usage/pricing`)}function W(e={}){let t=new URLSearchParams;e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.api_key&&t.set(`api_key`,e.api_key);let n=t.toString()?`?${t}`:``;return g(`/api/usage/cost${n}`)}var G=(0,F.lazy)(()=>S(()=>import(`./CostChart-DMfp1L5p.js`).then(e=>({default:e.CostChart})),__vite__mapDeps([0,1,2,3,4,5])));function K(){let e=new Date;return e.setHours(0,0,0,0),e.toISOString()}var q={window:{from:``,to:``,hours:24},currency:`CNY`,models:[],totals:{id:`total`,label:``,vendor:``,currency:`CNY`,requests:0,cache_hit:0,cache_miss:0,output:0,total_tokens:0,cost:0,cost_off_peak:0,cost_peak:0,peak_requests:0,credits:0,priced:!1},series:[]};function J(e,t){if(!t)return`0%`;let n=e/t*100;return`${n>=10?n.toFixed(0):n.toFixed(1)}%`}function ue({apiKeyFilter:e=``}){let{t,lang:n}=r(),[i,o]=(0,F.useState)(`today`),[l,u]=(0,F.useState)(`credits`),[p,m]=(0,F.useState)(null),[g,ee]=(0,F.useState)(null),[_,v]=(0,F.useState)(!0),[b,x]=(0,F.useState)(``);(0,F.useEffect)(()=>{let e=!1;return U().then(t=>{e||ee(t)}).catch(()=>{}),()=>{e=!0}},[]);let S=(0,F.useCallback)(async()=>{v(!0);try{let t=await W({...i===`all`?{}:i===`today`?{from:K()}:{from:new Date(Date.now()-Number(i)*3600*1e3).toISOString(),to:new Date().toISOString()},api_key:e||void 0});m(t),x(``)}catch(e){m(null),x(e instanceof Error?e.message:String(e))}finally{v(!1)}},[i,e]);(0,F.useEffect)(()=>{S()},[S]);let C=p??q,E=C.totals,A=E.requests>0&&C.models.length>0,M=C.models.filter(e=>e.priced),N=E.cost>0,P=[{label:t(`usageCredits`),value:O(E.credits),detail:t(`usageCreditsHint`)},{label:t(`usageTotalTokens`),value:D(E.total_tokens),detail:`${D(E.cache_hit)} / ${D(E.cache_miss)} / ${D(E.output)} ${t(`usageTokenSplitNote`)}`},{label:t(`usageRequests`),value:String(E.requests),detail:t(`usageModelCount`,{count:C.models.length})},{label:t(`usageCacheHitRate`),value:J(E.cache_hit,E.cache_hit+E.cache_miss),detail:D(E.cache_hit)}],ne=l===`credits`?O(E.credits):l===`tokens`?D(E.total_tokens):k(E.cost);return(0,L.jsxs)(`div`,{className:`space-y-6`,children:[(0,L.jsxs)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-2`,children:[(0,L.jsx)(T,{value:i,onChange:e=>o(e),ariaLabel:t(`usageWindow`),options:[{id:`today`,label:t(`statsWindowToday`)},{id:`24`,label:t(`usageWindow24h`)},{id:`168`,label:t(`usageWindow7d`)},{id:`all`,label:t(`usageWindowTotal`)}]}),(0,L.jsxs)(a,{size:`sm`,variant:`secondary`,onPress:()=>void S(),isDisabled:_,children:[(0,L.jsx)(te,{size:14}),t(`refresh`)]})]}),b?(0,L.jsx)(c,{title:t(`failedStats`,{msg:b})}):null,(0,L.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-4`,children:P.map(e=>(0,L.jsxs)(d,{className:`gap-0 p-4`,children:[(0,L.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,L.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:_?(0,L.jsx)(w,{className:`h-5 w-16`}):e.value}),(0,L.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:_?(0,L.jsx)(w,{className:`h-3 w-24`}):e.detail||`\xA0`})]},e.label))}),(0,L.jsxs)(d,{className:`overflow-hidden p-0`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageChartTitle`)}),(0,L.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageChartHint`)})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,L.jsx)(T,{value:l,onChange:e=>u(e),ariaLabel:t(`usageChartMetric`),options:[{id:`credits`,label:t(`usageColCredits`)},{id:`tokens`,label:t(`usageColTokens`)}]}),(0,L.jsx)(y,{size:`sm`,variant:`soft`,color:`default`,children:ne})]})]}),(0,L.jsx)(`div`,{className:`p-5`,children:_?(0,L.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,L.jsx)(w,{className:`h-56 w-full`})}):A?(0,L.jsx)(F.Suspense,{fallback:(0,L.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,L.jsx)(w,{className:`h-56 w-full`})}),children:(0,L.jsx)(G,{series:C.series,models:C.models,lang:n,emptyLabel:t(`usageChartEmpty`),totalLabel:t(`usageTotals`),metric:l})}):(0,L.jsx)(f,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})})]}),(0,L.jsxs)(d,{className:`overflow-hidden p-0`,children:[(0,L.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageBreakdownTitle`)}),(0,L.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageBreakdownHint`)})]})}),_?(0,L.jsx)(`div`,{className:`space-y-3 p-5`,children:[0,1,2].map(e=>(0,L.jsx)(w,{className:`h-9 w-full`},e))}):A?(0,L.jsx)(h,{children:(0,L.jsx)(h.ScrollContainer,{children:(0,L.jsxs)(h.Content,{"aria-label":t(`usageBreakdownTitle`),children:[(0,L.jsxs)(h.Header,{children:[(0,L.jsx)(h.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,L.jsx)(h.Column,{children:t(`usageColRequests`)}),(0,L.jsx)(h.Column,{children:t(`usageColInputHit`)}),(0,L.jsx)(h.Column,{children:t(`usageColInputMiss`)}),(0,L.jsx)(h.Column,{children:t(`usageColOutput`)}),(0,L.jsx)(h.Column,{children:t(`usageColTokens`)}),(0,L.jsx)(h.Column,{children:t(`usageColCredits`)})]}),(0,L.jsxs)(h.Body,{children:[C.models.map(e=>(0,L.jsxs)(h.Row,{children:[(0,L.jsxs)(h.Cell,{children:[(0,L.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,L.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`mono text-xs`,children:e.requests})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`mono text-xs`,children:D(e.cache_hit)})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`mono text-xs`,children:D(e.cache_miss)})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`mono text-xs`,children:D(e.output)})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`mono text-xs`,children:D(e.total_tokens)})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`mono text-xs font-semibold`,children:O(e.credits)})})]},e.id)),(0,L.jsxs)(h.Row,{children:[(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`mono text-xs font-semibold`,children:E.requests})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`mono text-xs font-semibold`,children:D(E.cache_hit)})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`mono text-xs font-semibold`,children:D(E.cache_miss)})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`mono text-xs font-semibold`,children:D(E.output)})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`mono text-xs font-semibold`,children:D(E.total_tokens)})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`mono text-xs font-semibold`,children:O(E.credits)})})]})]})]})})}):(0,L.jsx)(f,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})]}),(0,L.jsx)(s,{className:`rounded-xl bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:[],children:(0,L.jsxs)(s.Item,{id:`deepseek-estimate`,children:[(0,L.jsx)(s.Heading,{children:(0,L.jsxs)(s.Trigger,{className:`items-center gap-3 px-5 py-4 text-left`,children:[(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`span`,{className:`block font-semibold tracking-[-0.015em]`,children:t(`usageEstimateTitle`)}),(0,L.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted`,children:t(`usageEstimateHint`)})]}),N?(0,L.jsx)(y,{size:`sm`,variant:`soft`,color:`default`,children:k(E.cost)}):null,(0,L.jsx)(s.Indicator,{})]})}),(0,L.jsx)(s.Panel,{children:(0,L.jsxs)(s.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,L.jsx)(`p`,{className:`text-xs leading-6 text-muted`,children:t(`usageRenderNote`)}),N?(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,L.jsx)(`h4`,{className:`text-sm font-medium`,children:t(`usageEstimateChartTitle`)}),(0,L.jsx)(y,{size:`sm`,variant:`soft`,color:`default`,children:k(E.cost)})]}),(0,L.jsx)(F.Suspense,{fallback:(0,L.jsx)(w,{className:`h-56 w-full`}),children:(0,L.jsx)(G,{series:C.series,models:M.length?M:C.models,lang:n,emptyLabel:t(`usageEstimateChartEmpty`),totalLabel:t(`usageTotals`),metric:`cost`})})]}):null,M.length?(0,L.jsx)(h,{children:(0,L.jsx)(h.ScrollContainer,{children:(0,L.jsxs)(h.Content,{"aria-label":t(`usageEstimateTitle`),children:[(0,L.jsxs)(h.Header,{children:[(0,L.jsx)(h.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,L.jsx)(h.Column,{children:t(`usageColSplit`)}),(0,L.jsx)(h.Column,{children:t(`usageColCost`)})]}),(0,L.jsxs)(h.Body,{children:[M.map(e=>(0,L.jsxs)(h.Row,{children:[(0,L.jsxs)(h.Cell,{children:[(0,L.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,L.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,L.jsx)(h.Cell,{children:(0,L.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[k(e.cost_peak),` / `,k(e.cost_off_peak)]})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`mono text-sm font-semibold`,children:k(e.cost)})})]},e.id)),(0,L.jsxs)(h.Row,{children:[(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,L.jsx)(h.Cell,{children:(0,L.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[k(E.cost_peak),` / `,k(E.cost_off_peak)]})}),(0,L.jsx)(h.Cell,{children:(0,L.jsx)(`span`,{className:`mono text-sm font-semibold`,children:k(E.cost)})})]})]})]})})}):(0,L.jsx)(`p`,{className:`text-xs text-muted`,children:t(`usageEstimateChartEmpty`)}),(0,L.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h4`,{className:`mb-2 text-sm font-medium`,children:t(`usagePriceTitle`)}),(0,L.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:t(`usagePeakNote`)}),(0,L.jsxs)(`div`,{className:`divide-y divide-separator rounded-lg bg-background`,children:[(g?.models??[]).map(e=>(0,L.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,L.jsx)(`span`,{className:`mono text-[10px] text-muted`,children:e.currency})]}),(0,L.jsx)(`div`,{className:`mono mt-1 text-[10px] text-muted`,children:e.id}),(0,L.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 text-[11px]`,children:[(0,L.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,L.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandOff`)}),(0,L.jsxs)(`div`,{className:`mono mt-0.5`,children:[j(e.off_peak.cache_hit),` · `,j(e.off_peak.cache_miss),` · `,j(e.off_peak.output)]}),(0,L.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]}),(0,L.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,L.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandPeak`)}),(0,L.jsxs)(`div`,{className:`mono mt-0.5`,children:[j(e.peak.cache_hit),` · `,j(e.peak.cache_miss),` · `,j(e.peak.output)]}),(0,L.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]})]})]},e.id)),g?.models?.length?null:(0,L.jsx)(`div`,{className:`px-4 py-6 text-sm text-muted`,children:t(`usageEmpty`)})]})]}),(0,L.jsxs)(`div`,{className:`space-y-3 text-xs leading-6 text-muted`,children:[(0,L.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:t(`usageNoteTitle`)}),(0,L.jsx)(`p`,{children:t(`usageRetentionHint`)}),(0,L.jsx)(`p`,{children:t(`usagePeakNote`)}),C.unpriced?.length?(0,L.jsx)(`p`,{children:t(`usageUnpricedHint`,{models:C.unpriced.join(`, `)})}):null,g?.note?(0,L.jsx)(`p`,{className:`mono text-[10px]`,children:g.note}):null]})]})]})})]})})]})}var de=500,Y={model:`model`,account:`account`,provider:`provider`};function fe(e,t,n){let r=e.prompt_tokens??0,i=e.completion_tokens??0,a=e.key===`(unknown)`||e.key===`(unassigned)`||!e.key;return{key:e.key,label:n,count:e.count,success:e.count?e.ok/e.count:0,p95:e.latency_p95_ms??null,tokens:r+i,prompt:r,completion:i,credits:e.credits??0,cache_write:e.cache_write_tokens??0,cache_read:e.cache_read_tokens??0,filter:a?void 0:{[Y[t]]:e.key}}}function pe(e,t,n){let r=n===`ascending`?1:-1;return[...e].sort((e,n)=>{if(t===`label`)return r*e.label.localeCompare(n.label);let i=e[t],a=n[t];return i==null&&a==null?0:i==null?1:a==null?-1:r*(i-a)||e.label.localeCompare(n.label)})}function X(e){return e?e>=1e3?D(e):String(Math.round(e*100)/100):`0`}function me(){let{t:e}=r(),t=x(),[n,i]=b(),[a,s]=(0,F.useState)(`stats`),[f,g]=(0,F.useState)(`model`),[y,te]=(0,F.useState)(`today`),[S,T]=(0,F.useState)(null),[O,k]=(0,F.useState)(null),[j,P]=(0,F.useState)(!0),[oe,I]=(0,F.useState)(``),[R,ce]=(0,F.useState)([]),[z,B]=(0,F.useState)(`count`),[V,H]=(0,F.useState)(`descending`),[U,W]=(0,F.useState)(()=>new URLSearchParams(window.location.search).get(`api_key`)??``),{options:G}=u(),K=(0,F.useRef)(0),q=n.toString(),J=(0,F.useRef)(q);(0,F.useEffect)(()=>{q!==J.current&&(J.current=q,W(new URLSearchParams(q).get(`api_key`)??``))},[q]);let Y=U?`api_key=${encodeURIComponent(U)}`:``;(0,F.useEffect)(()=>{Y!==J.current&&(J.current=Y,i(Y,{replace:!0}))},[Y,i]),(0,F.useEffect)(()=>{let e=!1;return ee(!1).then(t=>{e||ce(t.data||[])}).catch(()=>{}),()=>{e=!0}},[]);let me=S?.start?.toString()??``,he=S?.end?.toString()??``;(0,F.useEffect)(()=>{let e=ne(y,S);if(!e){P(!1);return}let t=++K.current;o({...e,dim:[f],limit:de,api_key:U||void 0}).then(e=>{t===K.current&&(k(e),I(``))}).catch(e=>{t===K.current&&(k(null),I(e instanceof Error?e.message:String(e)))}).finally(()=>{t===K.current&&P(!1)})},[f,y,me,he,U]);let Z=(0,F.useMemo)(()=>{let t=new Map(R.map(e=>[e.id,e.name||e.id]));return pe(((f===`model`?O?.models:f===`account`?O?.accounts:O?.providers)??[]).map(n=>{let r=n.key===`(unknown)`?e(`statsUnknown`):n.key===`(unassigned)`?e(`statsUnassigned`):f===`account`?t.get(n.key)||n.key:f===`provider`?N(n.key,e):n.key;return fe(n,f,r)}),z,V)},[O,f,R,z,V,e]),Q=O?.totals,$=O?.tokens;function ge(e){if(!O||!e.filter)return;let n={...e.filter,api_key:U||void 0};t(ae(n,O.window.from,O.window.to))}let _e=[{id:`label`,label:e(f===`model`?`logsColModel`:f===`account`?`logsColAccount`:`logsColProvider`)},{id:`count`,label:e(`usageColRequests`),numeric:!0},{id:`success`,label:e(`usageColSuccess`),numeric:!0},{id:`p95`,label:e(`statsLatencyP95`),numeric:!0},{id:`tokens`,label:e(`usageColTokens`),numeric:!0},{id:`cache_write`,label:e(`usageColCacheWrite`),numeric:!0},{id:`credits`,label:e(`usageColCredits`),numeric:!0}],ve=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-1`,children:(0,L.jsx)(re,{value:y,onChange:te,custom:S,onCustomChange:T,onBusy:()=>P(!0),t:e})}),oe?(0,L.jsx)(c,{title:e(`failedStats`,{msg:oe})}):null,(0,L.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-5`,children:[[e(`usageColRequests`),Q?D(Q.requests):`—`,e(`statsWindowHint`,{window:e(ie[y])})],[e(`usageColSuccess`),Q?E(Q.success_rate):`—`,Q?`${Q.ok} / ${Q.requests}`:``],[e(`usageColTokens`),$?D($.total):`—`,$?`${D($.prompt)} / ${D($.completion)}`:``],[e(`usageColCacheWrite`),$?D($.cache_write??0):`—`,$?`${e(`chartCacheRead`)} ${D($.cache_read)}`:``],[e(`usageColCredits`),Q?X(Q.credits??0):`—`,``]].map(([e,t,n])=>(0,L.jsxs)(d,{className:`gap-0 p-4`,children:[(0,L.jsx)(`div`,{className:`text-body text-muted`,children:e}),(0,L.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:j?(0,L.jsx)(w,{className:`h-5 w-16`}):t}),(0,L.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:j?(0,L.jsx)(w,{className:`h-3 w-24`}):n||`\xA0`})]},e))}),(0,L.jsxs)(d,{className:`overflow-hidden p-0`,children:[(0,L.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-5 py-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between`,children:[(0,L.jsx)(m,{selectedKey:f,onSelectionChange:e=>{P(!0),g(String(e))},children:(0,L.jsx)(m.ListContainer,{className:`w-fit`,children:(0,L.jsxs)(m.List,{"aria-label":e(`usageTitle`),children:[(0,L.jsxs)(p,{id:`model`,className:`gap-1.5 whitespace-nowrap`,children:[(0,L.jsx)(m.Indicator,{className:`transition-none`}),(0,L.jsx)(_,{size:14}),e(`usageByModel`)]}),(0,L.jsxs)(p,{id:`account`,className:`gap-1.5 whitespace-nowrap`,children:[(0,L.jsx)(m.Indicator,{className:`transition-none`}),(0,L.jsx)(C,{size:14}),e(`usageByAccount`)]}),(0,L.jsxs)(p,{id:`provider`,className:`gap-1.5 whitespace-nowrap`,children:[(0,L.jsx)(m.Indicator,{className:`transition-none`}),(0,L.jsx)(se,{size:14}),e(`usageByProvider`)]})]})})}),(0,L.jsx)(`span`,{className:`mono text-caption text-muted`,children:j?``:e(`usageRowCount`,{count:Z.length})})]}),j?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,"aria-busy":`true`,children:Array.from({length:4},(e,t)=>(0,L.jsxs)(`div`,{className:`space-y-3 px-5 py-4`,children:[(0,L.jsx)(w,{className:`h-4 w-40`}),(0,L.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:Array.from({length:4},(e,t)=>(0,L.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,L.jsx)(w,{className:`h-3 w-12`}),(0,L.jsx)(w,{className:`h-4 w-16`})]},t))})]},t))}),(0,L.jsx)(`div`,{className:`hidden divide-y divide-separator md:block`,"aria-busy":`true`,children:Array.from({length:6},(e,t)=>(0,L.jsxs)(`div`,{className:`flex items-center gap-6 px-5 py-3.5`,children:[(0,L.jsx)(w,{className:`h-4 w-40`}),(0,L.jsx)(`div`,{className:`flex-1`}),Array.from({length:6},(e,t)=>(0,L.jsx)(w,{className:`h-4 w-14`},t))]},t))})]}):Z.length===0?(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-10 text-body text-muted`,children:[(0,L.jsx)(v,{size:16}),e(`usageEmpty`)]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:Z.map(t=>{let n=!!(t.filter&&O),r=[{label:e(`usageColRequests`),value:String(t.count)},{label:e(`usageColSuccess`),value:E(t.success),tone:t.success<.9?`text-warning`:void 0},{label:e(`statsLatencyP95`),value:A(t.p95)},{label:e(`usageColTokens`),value:D(t.tokens),sub:`${D(t.prompt)} / ${D(t.completion)}`},{label:e(`usageColCacheWrite`),value:D(t.cache_write)},{label:e(`usageColCredits`),value:X(t.credits)}];return(0,L.jsxs)(`article`,{className:`space-y-3 px-5 py-4 ${n?`cursor-pointer`:``}`,onClick:n?()=>ge(t):void 0,onKeyDown:n?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ge(t))}:void 0,role:n?`button`:void 0,tabIndex:n?0:void 0,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[f===`provider`&&t.filter?(0,L.jsx)(M,{provider:t.key,size:14}):null,(0,L.jsx)(`span`,{className:`truncate text-body font-medium`,children:t.label})]}),f===`account`&&t.label!==t.key?(0,L.jsx)(`div`,{className:`mono truncate text-caption text-muted`,children:t.key}):null,(0,L.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:r.map(e=>(0,L.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,L.jsx)(`div`,{className:`text-caption text-muted`,children:e.label}),(0,L.jsx)(`div`,{className:`mono text-body ${e.tone??`text-foreground`}`,children:e.value}),`sub`in e&&e.sub?(0,L.jsx)(`div`,{className:`mono text-caption text-muted`,children:e.sub}):null]},e.label))})]},t.key)})}),(0,L.jsx)(h,{className:`usage-table hidden md:block`,children:(0,L.jsx)(h.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,L.jsxs)(h.Content,{"aria-label":e(`usageTitle`),className:`min-w-[48rem]`,sortDescriptor:{column:z,direction:V},onSortChange:e=>{B(String(e.column)),H(e.direction)},children:[(0,L.jsx)(h.Header,{children:_e.map(e=>(0,L.jsx)(h.Column,{id:e.id,allowsSorting:!0,isRowHeader:e.id===`label`,className:e.numeric?`text-right`:void 0,children:({sortDirection:t})=>(0,L.jsx)(h.SortableColumnHeader,{sortDirection:t,className:e.numeric?`justify-end`:void 0,children:e.label})},e.id))}),(0,L.jsx)(h.Body,{children:Z.map(e=>(0,L.jsxs)(h.Row,{id:e.key,className:e.filter&&O?`cursor-pointer`:void 0,onAction:e.filter&&O?()=>ge(e):void 0,children:[(0,L.jsx)(h.Cell,{children:(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[f===`provider`&&e.filter?(0,L.jsx)(M,{provider:e.key,size:14}):null,(0,L.jsx)(`span`,{className:`truncate text-body font-medium`,children:e.label}),f===`account`&&e.label!==e.key?(0,L.jsx)(`span`,{className:`mono truncate text-caption text-muted`,children:e.key}):null]})}),(0,L.jsx)(h.Cell,{className:`mono text-right text-body`,children:e.count}),(0,L.jsx)(h.Cell,{className:`mono text-right text-body`,children:(0,L.jsx)(`span`,{className:e.success<.9?`text-warning`:void 0,children:E(e.success)})}),(0,L.jsx)(h.Cell,{className:`mono text-right text-body`,children:A(e.p95)}),(0,L.jsxs)(h.Cell,{className:`text-right`,children:[(0,L.jsx)(`div`,{className:`mono text-body`,children:D(e.tokens)}),(0,L.jsxs)(`div`,{className:`mono text-caption text-muted`,children:[D(e.prompt),` / `,D(e.completion)]})]}),(0,L.jsx)(h.Cell,{className:`mono text-right text-body`,children:D(e.cache_write)}),(0,L.jsx)(h.Cell,{className:`mono text-right text-body`,children:X(e.credits)})]},e.key))})]})})})]})]}),(0,L.jsx)(le,{accounts:R,t:e})]});return(0,L.jsxs)(`div`,{className:`space-y-6 sm:space-y-6`,children:[(0,L.jsxs)(`section`,{className:`flex flex-wrap items-end justify-between gap-3 pb-1`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`text-title font-semibold`,children:e(`usageTitle`)}),(0,L.jsx)(`p`,{className:`mt-1 max-w-2xl text-body leading-6 text-muted`,children:e(a===`cost`?`usageCostLead`:`usageLead`)})]}),(0,L.jsx)(l,{ariaLabel:e(`logsColApiKey`),value:U,onChange:e=>{P(!0),W(e)},options:G,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)})]}),(0,L.jsxs)(m,{selectedKey:a,onSelectionChange:e=>s(String(e)),children:[(0,L.jsx)(m.ListContainer,{className:`w-fit`,children:(0,L.jsxs)(m.List,{"aria-label":e(`usageTitle`),children:[(0,L.jsxs)(p,{id:`stats`,className:`gap-1.5 whitespace-nowrap`,children:[(0,L.jsx)(m.Indicator,{className:`transition-none`}),e(`usageStatsTab`)]}),(0,L.jsxs)(p,{id:`cost`,className:`gap-1.5 whitespace-nowrap`,children:[(0,L.jsx)(m.Indicator,{className:`transition-none`}),e(`usageCostTab`)]})]})}),(0,L.jsx)(m.Panel,{id:`stats`,className:`space-y-6 pt-5`,children:ve}),(0,L.jsx)(m.Panel,{id:`cost`,className:`pt-5`,children:(0,L.jsx)(ue,{apiKeyFilter:U})})]})]})}export{me as UsagePage}; \ No newline at end of file diff --git a/internal/webui/static/assets/accordion-IDhFN4Ix.js b/internal/webui/static/assets/accordion-CX4F9HFo.js similarity index 98% rename from internal/webui/static/assets/accordion-IDhFN4Ix.js rename to internal/webui/static/assets/accordion-CX4F9HFo.js index fcc03b86..edc65fd7 100644 --- a/internal/webui/static/assets/accordion-IDhFN4Ix.js +++ b/internal/webui/static/assets/accordion-CX4F9HFo.js @@ -1 +1 @@ -import{a as e,c as t,i as n,n as r}from"./shim-mfK0Rmj6.js";import{B as i,I as a,X as o,Z as s,ot as c}from"./useI18n-B77RWTNi.js";import{A as l,B as u,F as d,J as f,M as p,P as m,Y as h,c as g,d as _,dt as v,j as y,l as b,lt as x,q as S,s as C,ut as w,z as T}from"./SharedElementTransition-BlCsXfb1.js";import{t as E}from"./assertion-BLQtDfw6.js";import{Jt as D}from"./index-CmGY2WQi.js";var O=T({slots:{base:`accordion`,body:`accordion__body`,bodyInner:`accordion__body-inner`,heading:`accordion__heading`,indicator:`accordion__indicator`,item:`accordion__item`,panel:`accordion__panel`,trigger:`accordion__trigger`},variants:{variant:{default:{},surface:{base:`accordion--surface`}}}}),k=t(n(),1),A=t(e(),1);function j(e,t,n){let{isDisabled:r}=e,i=x(),a=x(),o=w(),s=(0,A.useRef)(null),l=(0,A.useCallback)(()=>{s.current=requestAnimationFrame(()=>{n.current&&n.current.setAttribute(`hidden`,`until-found`)}),(0,k.flushSync)(()=>{t.toggle()})},[n,t]);c(n,`beforematch`,l);let u=(0,A.useRef)(null);return v(()=>{if(s.current&&cancelAnimationFrame(s.current),n.current&&!o){let e=n.current;u.current==null||typeof e.getAnimations!=`function`?t.isExpanded?(e.removeAttribute(`hidden`),e.style.setProperty(`--disclosure-panel-width`,`auto`),e.style.setProperty(`--disclosure-panel-height`,`auto`)):(e.setAttribute(`hidden`,`until-found`),e.style.setProperty(`--disclosure-panel-width`,`0px`),e.style.setProperty(`--disclosure-panel-height`,`0px`)):t.isExpanded!==u.current&&(t.isExpanded?(e.removeAttribute(`hidden`),e.style.setProperty(`--disclosure-panel-width`,e.scrollWidth+`px`),e.style.setProperty(`--disclosure-panel-height`,e.scrollHeight+`px`),Promise.all(e.getAnimations().map(e=>e.finished)).then(()=>{e.style.setProperty(`--disclosure-panel-width`,`auto`),e.style.setProperty(`--disclosure-panel-height`,`auto`)}).catch(()=>{})):(e.style.setProperty(`--disclosure-panel-width`,e.scrollWidth+`px`),e.style.setProperty(`--disclosure-panel-height`,e.scrollHeight+`px`),window.getComputedStyle(e).height,e.style.setProperty(`--disclosure-panel-width`,`0px`),e.style.setProperty(`--disclosure-panel-height`,`0px`),Promise.all(e.getAnimations().map(e=>e.finished)).then(()=>e.setAttribute(`hidden`,`until-found`)).catch(()=>{}))),u.current=t.isExpanded}},[r,n,t.isExpanded,o]),(0,A.useEffect)(()=>()=>{s.current&&cancelAnimationFrame(s.current)},[]),{buttonProps:{id:i,"aria-expanded":t.isExpanded,"aria-controls":a,onPress:e=>{!r&&e.pointerType!==`keyboard`&&t.toggle()},isDisabled:r,onPressStart(e){e.pointerType===`keyboard`&&!r&&t.toggle()}},panelProps:{id:a,role:`group`,"aria-labelledby":i,"aria-hidden":!t.isExpanded,hidden:o?!t.isExpanded:void 0}}}function M(e){let{allowsMultipleExpanded:t=!1,isDisabled:n=!1}=e,[r,i]=b((0,A.useMemo)(()=>e.expandedKeys?new Set(e.expandedKeys):void 0,[e.expandedKeys]),(0,A.useMemo)(()=>e.defaultExpandedKeys?new Set(e.defaultExpandedKeys):new Set,[e.defaultExpandedKeys]),e.onExpandedChange);return(0,A.useEffect)(()=>{if(!t&&r.size>1){let e=r.values().next().value;e!=null&&i(new Set([e]))}}),{allowsMultipleExpanded:t,isDisabled:n,expandedKeys:r,setExpandedKeys:i,toggleKey(e){let n;t?(n=new Set(r),n.has(e)?n.delete(e):n.add(e)):n=new Set(r.has(e)?[]:[e]),i(n)}}}function N(e){let[t,n]=b(e.isExpanded,e.defaultExpanded||!1,e.onExpandedChange);return{isExpanded:t,setExpanded:n,expand:(0,A.useCallback)(()=>{n(!0)},[n]),collapse:(0,A.useCallback)(()=>{n(!1)},[n]),toggle:(0,A.useCallback)(()=>{n(!t)},[n,t])}}var P=(0,A.createContext)(null),F=(0,A.forwardRef)(function(e,t){let n=M(e),r=p({...e,defaultClassName:`react-aria-DisclosureGroup`,values:{isDisabled:n.isDisabled,state:n}}),i=S(e,{global:!0});return A.createElement(d.div,{...i,...r,ref:t,"data-disabled":e.isDisabled||void 0},A.createElement(P.Provider,{value:n},r.children))}),I=(0,A.createContext)(null),L=(0,A.createContext)(null),R=(0,A.createContext)(null),z=(0,A.forwardRef)(function(e,t){[e,t]=y(e,t,I);let n=(0,A.useContext)(P),{id:r,...i}=e,a=x();r||=a;let s=n?n.expandedKeys.has(r):e.isExpanded,c=N({...e,isExpanded:s,onExpandedChange(t){n&&n.toggleKey(r),e.onExpandedChange?.(t)}}),u=A.useRef(null),h=e.isDisabled||n?.isDisabled||!1,{buttonProps:g,panelProps:v}=j({...e,isExpanded:s,isDisabled:h},c,u),{isFocusVisible:b,focusProps:C}=_({within:!0}),w=p({...e,id:void 0,defaultClassName:`react-aria-Disclosure`,values:{isExpanded:c.isExpanded,isDisabled:h,isFocusVisibleWithin:b,state:c}}),T=S(i,{global:!0});return A.createElement(l,{values:[[o,{slots:{[m]:{},trigger:g}}],[R,{panelProps:v,panelRef:u}],[L,c]]},A.createElement(d.div,{...f(T,w,C),ref:t,"data-expanded":c.isExpanded||void 0,"data-disabled":h||void 0,"data-focus-visible-within":b||void 0},w.children))}),B=(0,A.forwardRef)(function(e,t){let{role:n=`group`}=e,{panelProps:r,panelRef:i}=(0,A.useContext)(R),{isFocusVisible:a,focusProps:s}=_({within:!0}),c=p({...e,defaultClassName:`react-aria-DisclosurePanel`,values:{isFocusVisibleWithin:a}}),u=S(e,{global:!0,labelable:!0});return A.createElement(d.div,{...f(u,c,r,s),ref:h(t,i),role:n,"data-focus-visible-within":a||void 0},A.createElement(l,{values:[[o,null]]},e.children))}),V=r(),H=(0,A.createContext)({}),U=({children:e,className:t,hideSeparator:n=!1,variant:r,...i})=>{let o=A.useMemo(()=>O({variant:r}),[r]),s=(0,V.jsx)(F,{className:g(t,o.base()),"data-slot":`accordion`,...i,children:t=>(0,V.jsx)(V.Fragment,{children:typeof e==`function`?e(t):e})});return(0,V.jsx)(H,{value:{slots:o,hideSeparator:n},children:r===`surface`?(0,V.jsx)(a,{value:{variant:`default`},children:s}):s})},W=Object.assign(U,{Root:U,Item:({className:e,...t})=>{let{hideSeparator:n,slots:r}=(0,A.use)(H);return(0,V.jsx)(z,{className:g(e,r?.item()),"data-hide-separator":n?`true`:void 0,"data-slot":`accordion-item`,...t,children:t.children})},Heading:({className:e,...t})=>{let{slots:n}=(0,A.use)(H);return(0,V.jsx)(D,{className:C(n?.heading,e),"data-slot":`accordion-heading`,...t})},Trigger:({className:e,...t})=>{let{slots:n}=(0,A.use)(H);return(0,V.jsx)(s,{className:g(e,n?.trigger()),"data-slot":`accordion-trigger`,slot:`trigger`,...t,children:e=>(0,V.jsx)(V.Fragment,{children:typeof t.children==`function`?t.children(e):t.children})})},Panel:({children:e,className:t,...n})=>{let{slots:r}=(0,A.use)(H),{isExpanded:i}=(0,A.use)(L);return(0,V.jsx)(B,{className:g(t,r?.panel()),"data-expanded":E(i),"data-slot":`accordion-panel`,...n,children:e})},Indicator:({children:e,className:t,...n})=>{let{slots:r}=(0,A.use)(H),{isExpanded:a}=(0,A.use)(L);return e&&A.isValidElement(e)?A.cloneElement(e,{...n,"data-expanded":E(a),className:C(r?.indicator,t),"data-slot":`accordion-indicator`}):(0,V.jsx)(i,{className:C(r?.indicator,t),"data-expanded":E(a),"data-slot":`accordion-indicator`,...n})},Body:({children:e,className:t,...n})=>{let{slots:r}=(0,A.use)(H);return(0,V.jsx)(u.div,{className:r?.body({}),"data-slot":`accordion-body`,...n,children:(0,V.jsx)(`div`,{className:C(r?.bodyInner,t),children:e})})}});export{W as t}; \ No newline at end of file +import{a as e,c as t,i as n,n as r}from"./shim-mfK0Rmj6.js";import{B as i,I as a,X as o,Z as s,ot as c}from"./useI18n-DAGWWg9N.js";import{A as l,B as u,F as d,J as f,M as p,P as m,Y as h,c as g,d as _,dt as v,j as y,l as b,lt as x,q as S,s as C,ut as w,z as T}from"./SharedElementTransition-BlCsXfb1.js";import{t as E}from"./assertion-BLQtDfw6.js";import{xt as D}from"./index-BYut8qRj.js";var O=T({slots:{base:`accordion`,body:`accordion__body`,bodyInner:`accordion__body-inner`,heading:`accordion__heading`,indicator:`accordion__indicator`,item:`accordion__item`,panel:`accordion__panel`,trigger:`accordion__trigger`},variants:{variant:{default:{},surface:{base:`accordion--surface`}}}}),k=t(n(),1),A=t(e(),1);function j(e,t,n){let{isDisabled:r}=e,i=x(),a=x(),o=w(),s=(0,A.useRef)(null),l=(0,A.useCallback)(()=>{s.current=requestAnimationFrame(()=>{n.current&&n.current.setAttribute(`hidden`,`until-found`)}),(0,k.flushSync)(()=>{t.toggle()})},[n,t]);c(n,`beforematch`,l);let u=(0,A.useRef)(null);return v(()=>{if(s.current&&cancelAnimationFrame(s.current),n.current&&!o){let e=n.current;u.current==null||typeof e.getAnimations!=`function`?t.isExpanded?(e.removeAttribute(`hidden`),e.style.setProperty(`--disclosure-panel-width`,`auto`),e.style.setProperty(`--disclosure-panel-height`,`auto`)):(e.setAttribute(`hidden`,`until-found`),e.style.setProperty(`--disclosure-panel-width`,`0px`),e.style.setProperty(`--disclosure-panel-height`,`0px`)):t.isExpanded!==u.current&&(t.isExpanded?(e.removeAttribute(`hidden`),e.style.setProperty(`--disclosure-panel-width`,e.scrollWidth+`px`),e.style.setProperty(`--disclosure-panel-height`,e.scrollHeight+`px`),Promise.all(e.getAnimations().map(e=>e.finished)).then(()=>{e.style.setProperty(`--disclosure-panel-width`,`auto`),e.style.setProperty(`--disclosure-panel-height`,`auto`)}).catch(()=>{})):(e.style.setProperty(`--disclosure-panel-width`,e.scrollWidth+`px`),e.style.setProperty(`--disclosure-panel-height`,e.scrollHeight+`px`),window.getComputedStyle(e).height,e.style.setProperty(`--disclosure-panel-width`,`0px`),e.style.setProperty(`--disclosure-panel-height`,`0px`),Promise.all(e.getAnimations().map(e=>e.finished)).then(()=>e.setAttribute(`hidden`,`until-found`)).catch(()=>{}))),u.current=t.isExpanded}},[r,n,t.isExpanded,o]),(0,A.useEffect)(()=>()=>{s.current&&cancelAnimationFrame(s.current)},[]),{buttonProps:{id:i,"aria-expanded":t.isExpanded,"aria-controls":a,onPress:e=>{!r&&e.pointerType!==`keyboard`&&t.toggle()},isDisabled:r,onPressStart(e){e.pointerType===`keyboard`&&!r&&t.toggle()}},panelProps:{id:a,role:`group`,"aria-labelledby":i,"aria-hidden":!t.isExpanded,hidden:o?!t.isExpanded:void 0}}}function M(e){let{allowsMultipleExpanded:t=!1,isDisabled:n=!1}=e,[r,i]=b((0,A.useMemo)(()=>e.expandedKeys?new Set(e.expandedKeys):void 0,[e.expandedKeys]),(0,A.useMemo)(()=>e.defaultExpandedKeys?new Set(e.defaultExpandedKeys):new Set,[e.defaultExpandedKeys]),e.onExpandedChange);return(0,A.useEffect)(()=>{if(!t&&r.size>1){let e=r.values().next().value;e!=null&&i(new Set([e]))}}),{allowsMultipleExpanded:t,isDisabled:n,expandedKeys:r,setExpandedKeys:i,toggleKey(e){let n;t?(n=new Set(r),n.has(e)?n.delete(e):n.add(e)):n=new Set(r.has(e)?[]:[e]),i(n)}}}function N(e){let[t,n]=b(e.isExpanded,e.defaultExpanded||!1,e.onExpandedChange);return{isExpanded:t,setExpanded:n,expand:(0,A.useCallback)(()=>{n(!0)},[n]),collapse:(0,A.useCallback)(()=>{n(!1)},[n]),toggle:(0,A.useCallback)(()=>{n(!t)},[n,t])}}var P=(0,A.createContext)(null),F=(0,A.forwardRef)(function(e,t){let n=M(e),r=p({...e,defaultClassName:`react-aria-DisclosureGroup`,values:{isDisabled:n.isDisabled,state:n}}),i=S(e,{global:!0});return A.createElement(d.div,{...i,...r,ref:t,"data-disabled":e.isDisabled||void 0},A.createElement(P.Provider,{value:n},r.children))}),I=(0,A.createContext)(null),L=(0,A.createContext)(null),R=(0,A.createContext)(null),z=(0,A.forwardRef)(function(e,t){[e,t]=y(e,t,I);let n=(0,A.useContext)(P),{id:r,...i}=e,a=x();r||=a;let s=n?n.expandedKeys.has(r):e.isExpanded,c=N({...e,isExpanded:s,onExpandedChange(t){n&&n.toggleKey(r),e.onExpandedChange?.(t)}}),u=A.useRef(null),h=e.isDisabled||n?.isDisabled||!1,{buttonProps:g,panelProps:v}=j({...e,isExpanded:s,isDisabled:h},c,u),{isFocusVisible:b,focusProps:C}=_({within:!0}),w=p({...e,id:void 0,defaultClassName:`react-aria-Disclosure`,values:{isExpanded:c.isExpanded,isDisabled:h,isFocusVisibleWithin:b,state:c}}),T=S(i,{global:!0});return A.createElement(l,{values:[[o,{slots:{[m]:{},trigger:g}}],[R,{panelProps:v,panelRef:u}],[L,c]]},A.createElement(d.div,{...f(T,w,C),ref:t,"data-expanded":c.isExpanded||void 0,"data-disabled":h||void 0,"data-focus-visible-within":b||void 0},w.children))}),B=(0,A.forwardRef)(function(e,t){let{role:n=`group`}=e,{panelProps:r,panelRef:i}=(0,A.useContext)(R),{isFocusVisible:a,focusProps:s}=_({within:!0}),c=p({...e,defaultClassName:`react-aria-DisclosurePanel`,values:{isFocusVisibleWithin:a}}),u=S(e,{global:!0,labelable:!0});return A.createElement(d.div,{...f(u,c,r,s),ref:h(t,i),role:n,"data-focus-visible-within":a||void 0},A.createElement(l,{values:[[o,null]]},e.children))}),V=r(),H=(0,A.createContext)({}),U=({children:e,className:t,hideSeparator:n=!1,variant:r,...i})=>{let o=A.useMemo(()=>O({variant:r}),[r]),s=(0,V.jsx)(F,{className:g(t,o.base()),"data-slot":`accordion`,...i,children:t=>(0,V.jsx)(V.Fragment,{children:typeof e==`function`?e(t):e})});return(0,V.jsx)(H,{value:{slots:o,hideSeparator:n},children:r===`surface`?(0,V.jsx)(a,{value:{variant:`default`},children:s}):s})},W=Object.assign(U,{Root:U,Item:({className:e,...t})=>{let{hideSeparator:n,slots:r}=(0,A.use)(H);return(0,V.jsx)(z,{className:g(e,r?.item()),"data-hide-separator":n?`true`:void 0,"data-slot":`accordion-item`,...t,children:t.children})},Heading:({className:e,...t})=>{let{slots:n}=(0,A.use)(H);return(0,V.jsx)(D,{className:C(n?.heading,e),"data-slot":`accordion-heading`,...t})},Trigger:({className:e,...t})=>{let{slots:n}=(0,A.use)(H);return(0,V.jsx)(s,{className:g(e,n?.trigger()),"data-slot":`accordion-trigger`,slot:`trigger`,...t,children:e=>(0,V.jsx)(V.Fragment,{children:typeof t.children==`function`?t.children(e):t.children})})},Panel:({children:e,className:t,...n})=>{let{slots:r}=(0,A.use)(H),{isExpanded:i}=(0,A.use)(L);return(0,V.jsx)(B,{className:g(t,r?.panel()),"data-expanded":E(i),"data-slot":`accordion-panel`,...n,children:e})},Indicator:({children:e,className:t,...n})=>{let{slots:r}=(0,A.use)(H),{isExpanded:a}=(0,A.use)(L);return e&&A.isValidElement(e)?A.cloneElement(e,{...n,"data-expanded":E(a),className:C(r?.indicator,t),"data-slot":`accordion-indicator`}):(0,V.jsx)(i,{className:C(r?.indicator,t),"data-expanded":E(a),"data-slot":`accordion-indicator`,...n})},Body:({children:e,className:t,...n})=>{let{slots:r}=(0,A.use)(H);return(0,V.jsx)(u.div,{className:r?.body({}),"data-slot":`accordion-body`,...n,children:(0,V.jsx)(`div`,{className:C(r?.bodyInner,t),children:e})})}});export{W as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/checkbox-CVxi8har.js b/internal/webui/static/assets/checkbox-CVxi8har.js new file mode 100644 index 00000000..ca07f1d5 --- /dev/null +++ b/internal/webui/static/assets/checkbox-CVxi8har.js @@ -0,0 +1 @@ +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{B as r,c as i,s as a,z as o}from"./SharedElementTransition-BlCsXfb1.js";import{n as s,t as c}from"./Checkbox-q1M8UCZU.js";var l=o({defaultVariants:{variant:`primary`},slots:{base:`checkbox`,content:`checkbox__content`,control:`checkbox__control`,indicator:`checkbox__indicator`},variants:{variant:{primary:{base:`checkbox--primary`},secondary:{base:`checkbox--secondary`}}}}),u=t(e(),1),d=n(),f=(0,u.createContext)({}),p=(0,u.createContext)({}),m=({children:e,className:t,variant:n,...r})=>{let a=(0,u.use)(f),o=n??a.variant,c=u.useMemo(()=>l({variant:o}),[o]);return(0,d.jsx)(s,{"data-slot":`checkbox`,...r,className:i(t,c.base()),children:t=>(0,d.jsx)(p,{value:{slots:c,state:t},children:typeof e==`function`?e(t):e})})};m.displayName=`HeroUI.Checkbox`;var h=({children:e,className:t,...n})=>{let{slots:r}=(0,u.use)(p);return(0,d.jsx)(c,{"data-slot":`checkbox-content`,...n,className:i(t,r?.content()),children:e})};h.displayName=`HeroUI.Checkbox.Content`;var g=({children:e,className:t,...n})=>{let{slots:i}=(0,u.use)(p);return(0,d.jsx)(r.span,{className:a(i?.control,t),"data-slot":`checkbox-control`,...n,children:e})};g.displayName=`HeroUI.Checkbox.Control`;var _=({children:e,className:t,...n})=>{let{slots:i,state:o}=(0,u.use)(p),s=o?.isSelected,c=o?.isIndeterminate,l=typeof e==`function`?e(o??{}):e||(c?(0,d.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`checkbox-default-indicator--indeterminate`,fill:`none`,role:`presentation`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:3,viewBox:`0 0 24 24`,children:(0,d.jsx)(`line`,{x1:`21`,x2:`3`,y1:`12`,y2:`12`})}):(0,d.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`checkbox-default-indicator--checkmark`,fill:`none`,role:`presentation`,stroke:`currentColor`,strokeDasharray:22,strokeDashoffset:s?44:66,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 17 18`,children:(0,d.jsx)(`polyline`,{points:`1 9 7 14 15 4`})}));return(0,d.jsx)(r.span,{"aria-hidden":`true`,className:a(i?.indicator,t),"data-slot":`checkbox-indicator`,...n,children:l})};_.displayName=`HeroUI.Checkbox.Indicator`;var v=Object.assign(m,{Root:m,Content:h,Control:g,Indicator:_});export{v as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/clipboard-DfpIZ3R1.js b/internal/webui/static/assets/clipboard-DG4c5Ihq.js similarity index 97% rename from internal/webui/static/assets/clipboard-DfpIZ3R1.js rename to internal/webui/static/assets/clipboard-DG4c5Ihq.js index 40a3b1e8..c812ac97 100644 --- a/internal/webui/static/assets/clipboard-DfpIZ3R1.js +++ b/internal/webui/static/assets/clipboard-DG4c5Ihq.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-B77RWTNi.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,40V168H168V88H88V40Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32Zm-8,128H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,34H88a6,6,0,0,0-6,6V82H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H168a6,6,0,0,0,6-6V174h42a6,6,0,0,0,6-6V40A6,6,0,0,0,216,34ZM162,210H46V94H162Zm48-48H174V88a6,6,0,0,0-6-6H94V46H210Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,36H88a4,4,0,0,0-4,4V84H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H168a4,4,0,0,0,4-4V172h44a4,4,0,0,0,4-4V40A4,4,0,0,0,216,36ZM164,212H44V92H164Zm48-48H172V88a4,4,0,0,0-4-4H92V44H212Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`CopyIcon`;var o=a;async function s(e){if(!e)return!1;try{if(typeof navigator<`u`&&navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-1000px`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}export{o as n,s as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-DAGWWg9N.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,40V168H168V88H88V40Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32Zm-8,128H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,34H88a6,6,0,0,0-6,6V82H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H168a6,6,0,0,0,6-6V174h42a6,6,0,0,0,6-6V40A6,6,0,0,0,216,34ZM162,210H46V94H162Zm48-48H174V88a6,6,0,0,0-6-6H94V46H210Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,36H88a4,4,0,0,0-4,4V84H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H168a4,4,0,0,0,4-4V172h44a4,4,0,0,0,4-4V40A4,4,0,0,0,216,36ZM164,212H44V92H164Zm48-48H172V88a4,4,0,0,0-4-4H92V44H212Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`CopyIcon`;var o=a;async function s(e){if(!e)return!1;try{if(typeof navigator<`u`&&navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-1000px`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}export{o as n,s as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/index-BYut8qRj.js b/internal/webui/static/assets/index-BYut8qRj.js new file mode 100644 index 00000000..1f18115c --- /dev/null +++ b/internal/webui/static/assets/index-BYut8qRj.js @@ -0,0 +1,16 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SidebarUpdateDialog-C1Ql9j5-.js","assets/shim-mfK0Rmj6.js","assets/useI18n-DAGWWg9N.js","assets/SharedElementTransition-BlCsXfb1.js","assets/PageAlert-BTp9jdUz.js","assets/modal-BqXo29An.js","assets/UpdateControls-Cd_MTxBw.js","assets/LoginPage-Co8UBzg7.js","assets/InflightLiveCard-DWPcSiCz.js","assets/Check.es-DrOC94kl.js","assets/useToggle-Zi1rbfHX.js","assets/label-j5K3TFm8.js","assets/CompactSwitch-CzZldrIr.js","assets/gsap-C3sDxib7.js","assets/format-B6SmebW-.js","assets/ProviderMark-IiAZTaQS.js","assets/textfield-DbDjPadh.js","assets/useTextField-zygWfcRL.js","assets/overview-DcWoRgOQ.js","assets/textfield-BfjC-Swp.js","assets/OverviewPage-B0hJjjae.js","assets/TimeRangePicker-BqBfH6td.js","assets/useUpdateEffect-DR9d7F-l.js","assets/useSpinButton-DMIzR_Mu.js","assets/assertion-BLQtDfw6.js","assets/AreaChart-B0YOdVBx.js","assets/provider-gHnttGKq.js","assets/logsLink-Dske8Q7n.js","assets/FilterToggle-nA-ZS4oO.js","assets/toggle-button-group-C1kahmRj.js","assets/ProvidersPage-CICSPpDj.js","assets/SearchBar-UDaAllIT.js","assets/search-field-BuHlt4Rv.js","assets/EmptyPanel-Bs-jQMvG.js","assets/table-CocoYVkm.js","assets/list-box-CGt1vjr2.js","assets/use-has-text-slot-C0lyJpv1.js","assets/Checkbox-q1M8UCZU.js","assets/useHasTabbableChild-8WJt7azf.js","assets/FilterSelect-BkT3LDQz.js","assets/select-6cCnF9ka.js","assets/ModelPoolPage-BtpF1cru.js","assets/Plus.es-BKtgxOxU.js","assets/TrashSimple.es-a96yoz9-.js","assets/ConfirmDialog-2wOP1m7E.js","assets/FormRow-6b4yVFYc.js","assets/collection-prop-injection-UgIu0U6K.js","assets/number-field-CyPgNRvS.js","assets/AccessPage-BtrPkvzM.js","assets/CaiaiSoftLink-DUJ2V4Pr.js","assets/clipboard-DG4c5Ihq.js","assets/tabs-CvBWSueW.js","assets/LatencyStats-DmxRwO-O.js","assets/AccountsPage-CYqKOC4C.js","assets/ShieldCheck.es-Dqq1rq1d.js","assets/checkbox-CVxi8har.js","assets/account-BJHim5bc.js","assets/SystemPage-ykdoQuuk.js","assets/accordion-CX4F9HFo.js","assets/keys-mrKPFyc7.js","assets/LogsPage-CTGAkC1v.js","assets/useApiKeyOptions-mwmshhJ6.js","assets/UsagePage-CZLd1kJx.js","assets/KeysPage-DE4rMPv6.js"])))=>i.map(i=>d[i]); +import{a as e,c as t,i as n,n as r,o as i}from"./shim-mfK0Rmj6.js";import{C as a,E as o,F as s,I as c,L as l,M as u,N as d,P as f,S as p,T as m,X as h,Z as g,_,a as v,at as y,ct as b,d as x,dt as S,f as C,ft as ee,g as te,h as w,it as T,k as E,l as ne,lt as D,m as re,n as ie,o as ae,ot as oe,p as O,pt as k,r as A,s as se,st as ce,t as j,tt as M,u as N,ut as le,w as ue,y as de}from"./useI18n-DAGWWg9N.js";import{$ as fe,A as pe,B as me,C as he,Ct as ge,D as _e,F as ve,G as ye,H as be,J as P,K as xe,L as Se,M as Ce,N as we,O as Te,P as Ee,Q as De,St as Oe,T as ke,U as Ae,V as je,W as Me,X as Ne,Y as Pe,Z as Fe,_t as Ie,a as Le,at as Re,b as ze,bt as Be,c as Ve,ct as He,dt as Ue,f as We,ft as Ge,h as Ke,ht as qe,i as Je,it as Ye,j as Xe,k as Ze,l as Qe,lt as $e,m as et,mt as tt,n as nt,nt as rt,o as it,p as at,pt as ot,q as st,r as ct,rt as lt,s as ut,st as dt,t as ft,tt as F,u as pt,ut as mt,v as ht,w as gt,x as _t,y as vt,yt,z as bt}from"./SharedElementTransition-BlCsXfb1.js";import{A as xt,D as St,O as Ct,h as wt,j as Tt,k as Et}from"./overview-DcWoRgOQ.js";import{r as Dt}from"./gsap-C3sDxib7.js";(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 Ot=i((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,E());else{var t=n(l);t!==null&&re(x,t.startTime-e)}}}var S=!1,C=-1,ee=5,te=-1;function w(){return g?!0:!(e.unstable_now()-tet&&w());){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&&re(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?E():S=!1}}}var E;if(typeof y==`function`)E=function(){y(T)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,D=ne.port2;ne.port1.onmessage=T,E=function(){D.postMessage(null)}}else E=function(){_(T,0)};function re(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,re(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,E()))),r},e.unstable_shouldYield=w,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),kt=i(((e,t)=>{t.exports=Ot()})),At=i((t=>{var r=kt(),i=e(),a=n();function o(e){var t=`https://react.dev/errors/`+e;if(1ce||(e.current=se[ce],se[ce]=null,ce--)}function N(e,t){ce++,se[ce]=e.current,e.current=t}var le=j(null),ue=j(null),de=j(null),fe=j(null);function pe(e,t){switch(N(de,t),N(ue,e),N(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}M(le),N(le,e)}function me(){M(le),M(ue),M(de)}function he(e){e.memoizedState!==null&&N(fe,e);var t=le.current,n=Hd(t,e.type);t!==n&&(N(ue,e),N(le,n))}function ge(e){ue.current===e&&(M(le),M(ue)),fe.current===e&&(M(fe),Qf._currentValue=A)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-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{be=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ye(n):``}function xe(e,t){switch(e.tag){case 26:case 27:case 5:return ye(e.type);case 16:return ye(`Lazy`);case 13:return e.child!==t&&t!==null?ye(`Suspense Fallback`):ye(`Suspense`);case 19:return ye(`SuspenseList`);case 0:case 15:return P(e.type,!1);case 11:return P(e.type.render,!1);case 1:return P(e.type,!0);case 31:return ye(`Activity`);default:return``}}function Se(e){try{var t=``,n=null;do t+=xe(e,n),n=e,e=e.return;while(e);return t}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}var Ce=Object.prototype.hasOwnProperty,we=r.unstable_scheduleCallback,Te=r.unstable_cancelCallback,Ee=r.unstable_shouldYield,De=r.unstable_requestPaint,Oe=r.unstable_now,ke=r.unstable_getCurrentPriorityLevel,Ae=r.unstable_ImmediatePriority,je=r.unstable_UserBlockingPriority,Me=r.unstable_NormalPriority,Ne=r.unstable_LowPriority,Pe=r.unstable_IdlePriority,Fe=r.log,Ie=r.unstable_setDisableYieldValue,Le=null,Re=null;function ze(e){if(typeof Fe==`function`&&Ie(e),Re&&typeof Re.setStrictMode==`function`)try{Re.setStrictMode(Le,e)}catch{}}var Be=Math.clz32?Math.clz32:Ue,Ve=Math.log,He=Math.LN2;function Ue(e){return e>>>=0,e===0?32:31-(Ve(e)/He|0)|0}var We=256,Ge=262144,Ke=4194304;function qe(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 Je(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=qe(n))):i=qe(o):i=qe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=qe(n))):i=qe(o)):i=qe(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 Ye(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Xe(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 Ze(){var e=Ke;return Ke<<=1,!(Ke&62914560)&&(Ke=4194304),e}function Qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function $e(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function et(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),dn=!1;if(un)try{var fn={};Object.defineProperty(fn,"passive",{get:function(){dn=!0}}),window.addEventListener(`test`,fn,fn),window.removeEventListener(`test`,fn,fn)}catch{dn=!1}var pn=null,mn=null,hn=null;function gn(){if(hn)return hn;var e,t=mn,n=t.length,r,i=`value`in pn?pn.value:pn.textContent,a=i.length;for(e=0;e=Jn),Zn=` `,Qn=!1;function $n(e,t){switch(e){case`keyup`:return Kn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function er(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var tr=!1;function nr(e,t){switch(e){case`compositionend`:return er(t);case`keypress`:return t.which===32?(Qn=!0,Zn):null;case`textInput`:return e=t.data,e===Zn&&Qn?null:e;default:return null}}function rr(e,t){if(tr)return e===`compositionend`||!qn&&$n(e,t)?(e=gn(),hn=mn=pn=null,tr=!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=Tr(n)}}function Dr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Dr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Or(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Rt(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=Rt(e.document)}return t}function kr(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 Ar=un&&`documentMode`in document&&11>=document.documentMode,jr=null,Mr=null,Nr=null,Pr=!1;function Fr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pr||jr==null||jr!==Rt(r)||(r=jr,`selectionStart`in r&&kr(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}),Nr&&wr(Nr,r)||(Nr=r,r=Dd(Mr,`onSelect`),0>=o,i-=o,Di=1<<32-Be(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),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),z&&ki(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=a(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),z&&ki(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return z&&ki(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),z&&ki(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===v&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case g:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===v){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===T&&Oa(l)===r.type){n(e,r.sibling),c=i(r,a.props),Fa(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===v?(c=mi(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=pi(a.type,a.key,a.props,null,e.mode,c),Fa(c,a),c.return=e,e=c)}return s(e);case _:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=_i(a,e.mode,c),c.return=e,e=c}return s(e);case T:return a=Oa(a),b(e,r,a,c)}if(oe(a))return h(e,r,a,c);if(re(a)){if(l=re(a),typeof l!=`function`)throw Error(o(150));return a=l.call(a),y(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,Pa(a),c);if(a.$$typeof===S)return b(e,r,na(e,a),c);Ia(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=hi(a,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Na=0;var i=b(e,t,n,r);return Ma=null,i}catch(t){if(t===Sa||t===wa)throw t;var a=li(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ra=La(!0),za=La(!1),Ba=!1;function Va(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ha(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 Ua(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Wa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,W&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=oi(e),ai(e,null,n),t}return ni(e,r,t,n),oi(e)}function Ga(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,nt(e,n)}}function Ka(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 qa=!1;function Ja(){if(qa){var e=pa;if(e!==null)throw e}}function Ya(e,t,n,r){qa=!1;var i=e.updateQueue;Ba=!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?(q&f)===f:(r&f)===f){f!==0&&f===fa&&(qa=!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:Ba=!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),Kl|=o,e.lanes=o,e.memoizedState=d}}function Xa(e,t){if(typeof e!=`function`)throw Error(o(191,e));e.call(t)}function Za(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=O.T,s={};O.T=s,Fs(e,!1,t,n);try{var c=i(),l=O.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ps(e,t,ga(c,r),mu(e)):Ps(e,t,r,mu(e))}catch(n){Ps(e,t,{then:function(){},status:`rejected`,reason:n},mu())}finally{k.p=a,o!==null&&s.types!==null&&(o.types=s.types),O.T=o}}function ws(){}function Ts(e,t,n,r){if(e.tag!==5)throw Error(o(476));var i=Es(e).queue;Cs(e,i,t,A,n===null?ws:function(){return Ds(e),n(r)})}function Es(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:A,baseState:A,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:A},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ds(e){var t=Es(e);t.next===null&&(t=e.alternate.memoizedState),Ps(e,t.next.queue,{},mu())}function Os(){return ta(Qf)}function ks(){return jo().memoizedState}function As(){return jo().memoizedState}function js(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=mu();e=Ua(n);var r=Wa(t,e,n);r!==null&&(gu(r,t,n),Ga(r,t,n)),t={cache:ca()},e.payload=t;return}t=t.return}}function Ms(e,t,n){var r=mu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Is(e)?Ls(t,n):(n=ri(e,t,n,r),n!==null&&(gu(n,e,r),Rs(n,t,r)))}function Ns(e,t,n){Ps(e,t,n,mu())}function Ps(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Is(e))Ls(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,Cr(s,o))return ni(e,t,i,0),G===null&&ti(),!1}catch{}if(n=ri(e,t,i,r),n!==null)return gu(n,e,r),Rs(n,t,r),!0}return!1}function Fs(e,t,n,r){if(r={lane:2,revertLane:fd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Is(e)){if(t)throw Error(o(479))}else t=ri(e,n,r,2),t!==null&&gu(t,e,2)}function Is(e){var t=e.alternate;return e===B||t!==null&&t===B}function Ls(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 Rs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nt(e,n)}}var zs={readContext:ta,use:Po,useCallback:H,useContext:H,useEffect:H,useImperativeHandle:H,useLayoutEffect:H,useInsertionEffect:H,useMemo:H,useReducer:H,useRef:H,useState:H,useDebugValue:H,useDeferredValue:H,useTransition:H,useSyncExternalStore:H,useId:H,useHostTransitionStatus:H,useFormState:H,useActionState:H,useOptimistic:H,useMemoCache:H,useCacheRefresh:H};zs.useEffectEvent=H;var Bs={readContext:ta,use:Po,useCallback:function(e,t){return Ao().memoizedState=[e,t===void 0?null:t],e},useContext:ta,useEffect:us,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),cs(4194308,4,gs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return cs(4194308,4,e,t)},useInsertionEffect:function(e,t){cs(4,2,e,t)},useMemo:function(e,t){var n=Ao();t=t===void 0?null:t;var r=e();if(_o){ze(!0);try{e()}finally{ze(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ao();if(n!==void 0){var i=n(t);if(_o){ze(!0);try{n(t)}finally{ze(!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=Ms.bind(null,B,e),[r.memoizedState,e]},useRef:function(e){var t=Ao();return e={current:e},t.memoizedState=e},useState:function(e){e=Ko(e);var t=e.queue,n=Ns.bind(null,B,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:vs,useDeferredValue:function(e,t){return xs(Ao(),e,t)},useTransition:function(){var e=Ko(!1);return e=Cs.bind(null,B,e.queue,!0,!1),Ao().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=B,i=Ao();if(z){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),G===null)throw Error(o(349));q&127||Vo(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,us(Uo.bind(null,r,a,e),[e]),r.flags|=2048,os(9,{destroy:void 0},Ho.bind(null,r,a,n,t),null),n},useId:function(){var e=Ao(),t=G.identifierPrefix;if(z){var n=Oi,r=Di;n=(r&~(1<<32-Be(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=vo++,0<\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}a[lt]=t,a[ut]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)a.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=a;a:switch(Pd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Pc(t)}}return U(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(o(166));if(e=de.current,Vi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Pi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[lt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Md(e.nodeValue,n)),e||Ri(t,!0)}else e=Bd(e).createTextNode(r),e[lt]=t,t.stateNode=e}return U(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Vi(t),n!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(557));e[lt]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;U(t),e=!1}else n=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(lo(t),t):(lo(t),null);if(t.flags&128)throw Error(o(558))}return U(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Vi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(o(317));i[lt]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;U(t),i=!1}else i=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(lo(t),t):(lo(t),null)}return lo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Lc(t,t.updateQueue),U(t),null);case 4:return me(),e===null&&Cd(t.stateNode.containerInfo),U(t),null;case 10:return Yi(t.type),U(t),null;case 19:if(M(uo),r=t.memoizedState,r===null)return U(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)Rc(r,!1);else{if(Gl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=fo(e),a!==null){for(t.flags|=128,Rc(r,!1),e=a.updateQueue,t.updateQueue=e,Lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)fi(n,e),n=n.sibling;return N(uo,uo.current&1|2),z&&ki(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Oe()>nu&&(t.flags|=128,i=!0,Rc(r,!1),t.lanes=4194304)}}else{if(!i){if(e=fo(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Lc(t,e),Rc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!z)return U(t),null}else 2*Oe()-r.renderingStartTime>nu&&n!==536870912&&(t.flags|=128,i=!0,Rc(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(U(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Oe(),e.sibling=null,n=uo.current,N(uo,i?n&1|2:n&1),z&&ki(t,r.treeForkCount),e);case 22:case 23:return lo(t),no(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(U(t),t.subtreeFlags&6&&(t.flags|=8192)):U(t),n=t.updateQueue,n!==null&&Lc(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&&M(va),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Yi(sa),U(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Bc(e,t){switch(Mi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yi(sa),me(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ge(t),null;case 31:if(t.memoizedState!==null){if(lo(t),t.alternate===null)throw Error(o(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(lo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return M(uo),null;case 4:return me(),null;case 10:return Yi(t.type),null;case 22:case 23:return lo(t),no(),e!==null&&M(va),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Yi(sa),null;case 25:return null;default:return null}}function Vc(e,t){switch(Mi(t),t.tag){case 3:Yi(sa),me();break;case 26:case 27:case 5:ge(t);break;case 4:me();break;case 31:t.memoizedState!==null&&lo(t);break;case 13:lo(t);break;case 19:M(uo);break;case 10:Yi(t.type);break;case 22:case 23:lo(t),no(),e!==null&&M(va);break;case 24:Yi(sa)}}function Hc(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){X(t,t.return,e)}}function Uc(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){X(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){X(t,t.return,e)}}function Wc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Za(t,n)}catch(t){X(e,e.return,t)}}}function Gc(e,t,n){n.props=qs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){X(e,t,n)}}function Kc(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){X(e,t,n)}}function qc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){X(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){X(e,t,n)}else n.current=null}}function Jc(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){X(e,e.return,t)}}function Yc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[ut]=t}catch(t){X(e,e.return,t)}}function Xc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Zc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Xc(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&&Zd(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 Qc(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=en));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function $c(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&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[lt]=e,t[ut]=n}catch(t){X(e,e.return,t)}}var tl=!1,nl=!1,rl=!1,il=typeof WeakSet==`function`?WeakSet:Set,al=null;function ol(e,t){if(e=e.containerInfo,Rd=sp,e=Or(e),kr(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 i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.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||i!==0&&f.nodeType!==3||(c=s+i),f!==a||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===i&&(c=s),p===a&&++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(zd={focusedElem:e,selectionRange:n},sp=!1,al=t;al!==null;)if(t=al,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,al=e;else for(;al!==null;){switch(t=al,a=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`))),Pd(a,r,n),a[lt]=e,xt(a),r=a;break a;case`link`:var s=Vf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=Er(s,h),v=Er(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,O.T=null,n=uu,uu=null;var a=ou,s=cu;if(au=0,su=ou=null,cu=0,W&6)throw Error(o(331));var c=W;if(W|=4,Il(a.current),Ol(a,a.current,s,n),W=c,ad(0,!1),Re&&typeof Re.onPostCommitFiberRoot==`function`)try{Re.onPostCommitFiberRoot(Le,a)}catch{}return!0}finally{k.p=i,O.T=r,Hu(e,t)}}function Gu(e,t,n){t=yi(n,t),t=$s(e.stateNode,t,2),e=Wa(e,t,2),e!==null&&($e(e,2),id(e))}function X(e,t,n){if(e.tag===3)Gu(e,e,n);else for(;t!==null;){if(t.tag===3){Gu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(iu===null||!iu.has(r))){e=yi(n,e),n=ec(2),r=Wa(t,n,2),r!==null&&(tc(n,r,t,e),$e(r,2),id(r));break}}t=t.return}}function Ku(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Bl;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)||(Ul=!0,i.add(n),e=qu.bind(null,e,t,n),t.then(e,e))}function qu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,G===e&&(q&n)===n&&(Gl===4||Gl===3&&(q&62914560)===q&&300>Oe()-eu?!(W&2)&&Cu(e,0):Jl|=n,Xl===q&&(Xl=0)),id(e)}function Ju(e,t){t===0&&(t=Ze()),e=ii(e,t),e!==null&&($e(e,t),id(e))}function Yu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ju(e,n)}function Xu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),Ju(e,n)}function Zu(e,t){return we(e,t)}var Qu=null,$u=null,ed=!1,td=!1,nd=!1,rd=0;function id(e){e!==$u&&e.next===null&&($u===null?Qu=$u=e:$u=$u.next=e),td=!0,ed||(ed=!0,dd())}function ad(e,t){if(!nd&&td){nd=!0;do for(var n=!1,r=Qu;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-Be(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ud(r,a))}else a=q,a=Je(r,r===G?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ye(r,a)||(n=!0,ud(r,a))}r=r.next}while(n);nd=!1}}function od(){sd()}function sd(){td=ed=!1;var e=0;rd!==0&&Gd()&&(e=rd);for(var t=Oe(),n=null,r=Qu;r!==null;){var i=r.next,a=cd(r,t);a===0?(r.next=null,n===null?Qu=i:n.next=i,i===null&&($u=n)):(n=r,(e!==0||a&3)&&(td=!0)),r=i}au!==0&&au!==5||ad(e,!1),rd!==0&&(rd=0)}function cd(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&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Bt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),xt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Bt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Bt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Bt(n.imageSizes)+`"]`)):i+=`[href="`+Bt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),xt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Bt(r)+`"][href="`+Bt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),xt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=bt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);xt(c),Pd(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,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=bt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),xt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=bt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),xt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=de.current)?gf(i):null;if(!i)throw Error(o(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=bt(i).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=Af(n.href);var a=bt(i).hoistableStyles,s=a.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,s),(a=i.querySelector(jf(e)))&&!a._p&&(s.instance=a,s.state.loading=5),mf.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},mf.set(e,n),a||Nf(i,e,n,s.state))),t&&r===null)throw Error(o(528,``));return s}if(t&&r!==null)throw Error(o(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=bt(i).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(o(444,e))}}function Af(e){return`href="`+Bt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(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}),Pd(t,`link`,n),xt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Bt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Bt(n.href)+`"]`);if(r)return t.instance=r,xt(r),r;var i=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),xt(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var a=e.querySelector(jf(i));if(a)return t.state.loading|=4,t.instance=a,xt(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),xt(a);var s=a;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(a,`link`,r),t.state.loading|=4,Lf(a,n.precedence,e),t.instance=a;case`script`:return a=Pf(n.src),(i=e.querySelector(Ff(a)))?(t.instance=i,xt(i),i):(r=n,(i=mf.get(a))&&(r=m({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),xt(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(o(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(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 Uf(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 Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(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=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,xt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),xt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(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=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.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=At()})),I=t(e(),1),Mt=jt(),Nt=`modulepreload`,Pt=function(e){return`/`+e},Ft={},It=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=Pt(t,n),t=s(t),t in Ft)return;Ft[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`:Nt,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)})},Lt=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Rt=/^[\\/]{2}/;function zt(e,t){return t+e.replace(/\\/g,`/`)}var Bt=`popstate`;function Vt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Ht(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Kt(``,{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:qt(t)}return Yt(t,n,null,e)}function L(e,t){if(e===!1||e==null)throw Error(t)}function Ut(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Wt(){return Math.random().toString(36).substring(2,10)}function Gt(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 Kt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Jt(t):t,state:n,key:t&&t.key||r||Wt(),mask:i}}function qt({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 Jt(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 Yt(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=Vt(e)?e:Kt(h.location,e,t);n&&n(r,e),l=u()+1;let d=Gt(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=Vt(e)?e:Kt(h.location,e,t);n&&n(r,e),l=u();let i=Gt(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 Xt(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(Bt,d),c=e,()=>{i.removeEventListener(Bt,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 Xt(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),L(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:qt(t);return i=i.replace(/ $/,`%20`),!n&&Rt.test(i)&&(i=r+i),new URL(i,r)}function Zt(e,t,n=`/`){return Qt(e,t,n,!1)}function Qt(e,t,n,r,i){let a=vn((typeof t==`string`?Jt(t):t).pathname||`/`,n);if(a==null)return null;let o=i??$t(e),s=null,c=_n(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;L(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=En([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(L(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),en(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:dn(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=gn(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 tn(e.path))a(e,t,!0,n)}),t}function tn(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=tn(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 nn(e){e.sort((e,t)=>e.score===t.score?fn(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var rn=/^:[\w-]+$/,an=3,on=2,sn=1,cn=10,ln=-2,un=e=>e===`*`;function dn(e,t){let n=e.split(`/`),r=n.length;return n.some(un)&&(r+=ln),t&&(r+=on),n.filter(e=>!un(e)).reduce((e,t)=>e+(rn.test(t)?an:t===``?sn:cn),r)}function fn(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 pn(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 gn(e,t=!1,n=!0){Ut(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 _n(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return Ut(!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 vn(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 yn(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Jt(e):e,a;return n?(n=Tn(n),a=n.startsWith(`/`)?bn(n.substring(1),`/`):bn(n,t)):a=t,{pathname:a,search:kn(r),hash:An(i)}}function bn(e,t){let n=Dn(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function xn(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 Sn(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Cn(e){let t=Sn(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function wn(e,t,n,r=!1){let i;typeof e==`string`?i=Jt(e):(i={...e},L(!i.pathname||!i.pathname.includes(`?`),xn(`?`,`pathname`,`search`,i)),L(!i.pathname||!i.pathname.includes(`#`),xn(`#`,`pathname`,`hash`,i)),L(!i.search||!i.search.includes(`#`),xn(`#`,`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=yn(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Tn=e=>e.replace(/[\\/]{2,}/g,`/`),En=e=>Tn(e.join(`/`)),Dn=e=>e.replace(/\/+$/,``),On=e=>Dn(e).replace(/^\/*/,`/`),kn=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,An=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,jn=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 Mn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Nn(e){return En(e.map(e=>e.route.path).filter(Boolean))||`/`}var Pn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Fn(e,t){let n=e;if(typeof n!=`string`||!Lt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Pn)try{let e=new URL(window.location.href),r=Rt.test(n)?new URL(zt(n,e.protocol)):new URL(n),a=vn(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{Ut(!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 In=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(In);var Ln=[`GET`,...In];new Set(Ln);var Rn=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function zn(e){try{return Rn.includes(new URL(e).protocol)}catch{return!1}}var Bn=I.createContext(null);Bn.displayName=`DataRouter`;var Vn=I.createContext(null);Vn.displayName=`DataRouterState`;var Hn=I.createContext(!1);function Un(){return I.useContext(Hn)}var Wn=I.createContext({isTransitioning:!1});Wn.displayName=`ViewTransition`;var Gn=I.createContext(new Map);Gn.displayName=`Fetchers`;var Kn=I.createContext(null);Kn.displayName=`Await`;var qn=I.createContext(null);qn.displayName=`Navigation`;var Jn=I.createContext(null);Jn.displayName=`Location`;var Yn=I.createContext({outlet:null,matches:[],isDataRoute:!1});Yn.displayName=`Route`;var Xn=I.createContext(null);Xn.displayName=`RouteError`;var Zn=`REACT_ROUTER_ERROR`,Qn=`REDIRECT`,$n=`ROUTE_ERROR_RESPONSE`;function er(e){if(e.startsWith(`${Zn}:${Qn}:{`))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 tr(e){if(e.startsWith(`${Zn}:${$n}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new jn(t.status,t.statusText,t.data)}catch{}}function nr(e,{relative:t}={}){L(rr(),`useHref() may be used only in the context of a component.`);let{basename:n,navigator:r}=I.useContext(qn),{hash:i,pathname:a,search:o}=dr(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:En([n,a])),r.createHref({pathname:s,search:o,hash:i})}function rr(){return I.useContext(Jn)!=null}function ir(){return L(rr(),`useLocation() may be used only in the context of a component.`),I.useContext(Jn).location}var ar=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function or(e){I.useContext(qn).static||I.useLayoutEffect(e)}function sr(){let{isDataRoute:e}=I.useContext(Yn);return e?Or():cr()}function cr(){L(rr(),`useNavigate() may be used only in the context of a component.`);let e=I.useContext(Bn),{basename:t,navigator:n}=I.useContext(qn),{matches:r}=I.useContext(Yn),{pathname:i}=ir(),a=JSON.stringify(Cn(r)),o=I.useRef(!1);return or(()=>{o.current=!0}),I.useCallback((r,s={})=>{if(Ut(o.current,ar),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=wn(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:En([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var lr=I.createContext(null);function ur(e){let t=I.useContext(Yn).outlet;return I.useMemo(()=>t&&I.createElement(lr.Provider,{value:e},t),[t,e])}function dr(e,{relative:t}={}){let{matches:n}=I.useContext(Yn),{pathname:r}=ir(),i=JSON.stringify(Cn(n));return I.useMemo(()=>wn(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function fr(e,t){return pr(e,t)}function pr(e,t,n){L(rr(),`useRoutes() may be used only in the context of a component.`);let{navigator:r}=I.useContext(qn),{matches:i}=I.useContext(Yn),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||``;Ar(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=ir(),d;if(t){let e=typeof t==`string`?Jt(t):t;L(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})):Zt(e,{pathname:p});Ut(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),Ut(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=br(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:En([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:En([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?I.createElement(Jn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function mr(){let e=Dr(),t=Mn(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=I.createElement(I.Fragment,null,I.createElement(`p`,null,`💿 Hey developer 👋`),I.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,I.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,I.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),I.createElement(I.Fragment,null,I.createElement(`h2`,null,`Unexpected Application Error!`),I.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?I.createElement(`pre`,{style:i},n):null,o)}var hr=I.createElement(mr,null),gr=class extends I.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=tr(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:I.createElement(Yn.Provider,{value:this.props.routeContext},I.createElement(Xn.Provider,{value:e,children:this.props.component}));return this.context?I.createElement(vr,{error:e},t):t}};gr.contextType=Hn;var _r=new WeakMap;function vr({children:e,error:t}){let{basename:n}=I.useContext(qn);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=er(t.digest);if(e){let r=_r.get(t);if(r)throw r;let i=Fn(e.location,n),a=i.absoluteURL||i.to;if(zn(a))throw Error(`Invalid redirect location`);if(Pn&&!_r.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 _r.set(t,n),n}}return I.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function yr({routeContext:e,match:t,children:n}){let r=I.useContext(Bn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),I.createElement(Yn.Provider,{value:e},n)}function br(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);L(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:Nn(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||hr,o&&(s<0&&c===0?(Ar(`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?I.createElement(n.route.Component,null):n.route.element?n.route.element:e,I.createElement(yr,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?I.createElement(gr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function xr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Sr(e){let t=I.useContext(Bn);return L(t,xr(e)),t}function Cr(e){let t=I.useContext(Vn);return L(t,xr(e)),t}function wr(e){let t=I.useContext(Yn);return L(t,xr(e)),t}function Tr(e){let t=wr(e),n=t.matches[t.matches.length-1];return L(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Er(){return Tr(`useRouteId`)}function Dr(){let e=I.useContext(Xn),t=Cr(`useRouteError`),n=Tr(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Or(){let{router:e}=Sr(`useNavigate`),t=Tr(`useNavigate`),n=I.useRef(!1);return or(()=>{n.current=!0}),I.useCallback(async(r,i={})=>{Ut(n.current,ar),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var kr={};function Ar(e,t,n){!t&&!kr[e]&&(kr[e]=!0,Ut(!1,n))}I.memo(jr);function jr({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return pr(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Mr({to:e,replace:t,state:n,relative:r}){L(rr(),` may be used only in the context of a component.`);let{static:i}=I.useContext(qn);Ut(!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}=I.useContext(Yn),{pathname:o}=ir(),s=sr(),c=wn(e,Cn(a),o,r===`path`),l=JSON.stringify(c);return I.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Nr(e){return ur(e.context)}function Pr(e){L(!1,`A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .`)}function Fr({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){L(!rr(),`You cannot render a inside another . You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=I.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=Jt(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=I.useMemo(()=>{let e=vn(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 Ut(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:I.createElement(qn.Provider,{value:c},I.createElement(Jn.Provider,{children:t,value:h}))}function Ir({children:e,location:t}){return fr(Lr(e),t)}I.Component;function Lr(e,t=[]){let n=[];return I.Children.forEach(e,(e,r)=>{if(!I.isValidElement(e))return;let i=[...t,r];if(e.type===I.Fragment){n.push.apply(n,Lr(e.props.children,i));return}L(e.type===Pr,`[${typeof e.type==`string`?e.type:e.type.name}] is not a component. All component children of must be a or `),L(!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=Lr(e.props.children,i)),n.push(a)}),n}var Rr=`get`,zr=`application/x-www-form-urlencoded`;function Br(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Vr(e){return Br(e)&&e.tagName.toLowerCase()===`button`}function Hr(e){return Br(e)&&e.tagName.toLowerCase()===`form`}function Ur(e){return Br(e)&&e.tagName.toLowerCase()===`input`}function Wr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Gr(e,t){return e.button===0&&(!t||t===`_self`)&&!Wr(e)}function Kr(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 qr(e,t){let n=Kr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Jr=null;function Yr(){if(Jr===null)try{new FormData(document.createElement(`form`),0),Jr=!1}catch{Jr=!0}return Jr}var Xr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Zr(e){return e!=null&&!Xr.has(e)?(Ut(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${zr}"`),null):e}function Qr(e,t){let n,r,i,a,o;if(Hr(e)){let o=e.getAttribute(`action`);r=o?vn(o,t):null,n=e.getAttribute(`method`)||Rr,i=Zr(e.getAttribute(`enctype`))||zr,a=new FormData(e)}else if(Vr(e)||Ur(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a