From 08db1a158a76c2792e665b336f878b18678ad705 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 14 Sep 2026 10:49:30 -0600 Subject: [PATCH 1/8] feat: add provider rate limit schema, migration and store methods New provider_rate_limit_sample table stores per-minute snapshots of upstream rate-limit headers. The provider table gains a rate_limit_headers column that maps metric keys to header names. --- internal/store/migrate.go | 1 + internal/store/providers.go | 17 ++- internal/store/ratelimit.go | 94 +++++++++++++ internal/store/ratelimit_test.go | 232 +++++++++++++++++++++++++++++++ internal/store/schema.go | 22 ++- internal/store/types.go | 17 +++ 6 files changed, 374 insertions(+), 9 deletions(-) create mode 100644 internal/store/ratelimit.go create mode 100644 internal/store/ratelimit_test.go diff --git a/internal/store/migrate.go b/internal/store/migrate.go index c088723..b0fa73f 100644 --- a/internal/store/migrate.go +++ b/internal/store/migrate.go @@ -80,6 +80,7 @@ var migrations = []migration{ return err }}, addColumn("009_model_binding_hidden", "model_binding", "hidden", "INTEGER NOT NULL DEFAULT 0"), + addColumn("010_provider_rate_limit_headers", "provider", "rate_limit_headers", "TEXT NOT NULL DEFAULT ''"), } // migrate applies every pending migration in order. Each runs in its own diff --git a/internal/store/providers.go b/internal/store/providers.go index 929075e..00234a9 100644 --- a/internal/store/providers.go +++ b/internal/store/providers.go @@ -9,14 +9,14 @@ import ( ) const providerColumns = `id, name, wire_format, base_url, credential_ciphertext, verify_tls, - ca_pem, timeout_connect, timeout_read, max_concurrency, enabled, created_at` + ca_pem, timeout_connect, timeout_read, max_concurrency, enabled, created_at, rate_limit_headers` func scanProvider(row interface{ Scan(...any) error }) (*Provider, error) { var p Provider var verifyTLS, enabled int64 err := row.Scan(&p.ID, &p.Name, &p.WireFormat, &p.BaseURL, &p.CredentialCiphertext, &verifyTLS, &p.CAPEM, &p.TimeoutConnect, &p.TimeoutRead, - &p.MaxConcurrency, &enabled, &p.CreatedAt) + &p.MaxConcurrency, &enabled, &p.CreatedAt, &p.RateLimitHeaders) if err != nil { if errors.Is(err, sql.ErrNoRows) { return nil, nil @@ -62,11 +62,11 @@ func (s *Store) CreateProvider(ctx context.Context, p *Provider, overrides map[s defer tx.Rollback() if _, err := tx.ExecContext(ctx, s.q(` INSERT INTO provider (id, name, wire_format, base_url, credential_ciphertext, verify_tls, - ca_pem, timeout_connect, timeout_read, max_concurrency, enabled, created_at) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`), + ca_pem, timeout_connect, timeout_read, max_concurrency, enabled, created_at, rate_limit_headers) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`), p.ID, p.Name, p.WireFormat, p.BaseURL, p.CredentialCiphertext, boolInt(p.VerifyTLS), p.CAPEM, p.TimeoutConnect, p.TimeoutRead, p.MaxConcurrency, - boolInt(p.Enabled), p.CreatedAt); err != nil { + boolInt(p.Enabled), p.CreatedAt, p.RateLimitHeaders); err != nil { return err } for endpoint, url := range overrides { @@ -91,10 +91,12 @@ func (s *Store) UpdateProvider(ctx context.Context, p *Provider, audit *Audit) e defer tx.Rollback() if _, err := tx.ExecContext(ctx, s.q(` UPDATE provider SET base_url = ?, credential_ciphertext = ?, enabled = ?, - verify_tls = ?, timeout_connect = ?, timeout_read = ?, max_concurrency = ? + verify_tls = ?, timeout_connect = ?, timeout_read = ?, max_concurrency = ?, + rate_limit_headers = ? WHERE id = ?`), p.BaseURL, p.CredentialCiphertext, boolInt(p.Enabled), - boolInt(p.VerifyTLS), p.TimeoutConnect, p.TimeoutRead, p.MaxConcurrency, p.ID); err != nil { + boolInt(p.VerifyTLS), p.TimeoutConnect, p.TimeoutRead, p.MaxConcurrency, + p.RateLimitHeaders, p.ID); err != nil { return err } if err := s.auditTx(ctx, tx, audit); err != nil { @@ -115,6 +117,7 @@ func (s *Store) DeleteProvider(ctx context.Context, providerID string, audit *Au `DELETE FROM model_binding WHERE target_id IN (SELECT id FROM model_binding WHERE provider_id = ?)`, `DELETE FROM model_binding WHERE provider_id = ?`, `DELETE FROM provider_endpoint WHERE provider_id = ?`, + `DELETE FROM provider_rate_limit_sample WHERE provider_id = ?`, `DELETE FROM provider WHERE id = ?`, } { if _, err := tx.ExecContext(ctx, s.q(stmt), providerID); err != nil { diff --git a/internal/store/ratelimit.go b/internal/store/ratelimit.go new file mode 100644 index 0000000..1019b31 --- /dev/null +++ b/internal/store/ratelimit.go @@ -0,0 +1,94 @@ +package store + +import ( + "context" + "database/sql" + + "github.com/greyhavenhq/llmproxy/internal/secrets" +) + +func (s *Store) InsertRateLimitSample(ctx context.Context, sample *RateLimitSample) error { + sample.ID = secrets.NewID() + _, err := s.db.ExecContext(ctx, s.q(` + INSERT INTO provider_rate_limit_sample + (id, provider_id, bucket, observed_at, observations, + limit_requests, remaining_requests, min_remaining_requests, + limit_tokens, remaining_tokens, min_remaining_tokens, + reset_requests_at, reset_tokens_at) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`), + sample.ID, sample.ProviderID, sample.Bucket, sample.ObservedAt, + sample.Observations, + sample.LimitRequests, sample.RemainingRequests, sample.MinRemainingRequests, + sample.LimitTokens, sample.RemainingTokens, sample.MinRemainingTokens, + sample.ResetRequestsAt, sample.ResetTokensAt) + return err +} + +func (s *Store) LatestRateLimitSamples(ctx context.Context) ([]RateLimitSample, error) { + rows, err := s.db.QueryContext(ctx, s.q(` + SELECT s.id, s.provider_id, s.bucket, s.observed_at, s.observations, + s.limit_requests, s.remaining_requests, s.min_remaining_requests, + s.limit_tokens, s.remaining_tokens, s.min_remaining_tokens, + s.reset_requests_at, s.reset_tokens_at + FROM provider_rate_limit_sample s + INNER JOIN ( + SELECT provider_id, MAX(bucket) AS max_bucket + FROM provider_rate_limit_sample + GROUP BY provider_id + ) latest ON s.provider_id = latest.provider_id AND s.bucket = latest.max_bucket + ORDER BY s.provider_id`)) + if err != nil { + return nil, err + } + defer rows.Close() + return scanRateLimitSamples(rows) +} + +func (s *Store) RateLimitSeries(ctx context.Context, providerID, since, until string) ([]RateLimitSample, error) { + where := ` WHERE provider_id = ?` + args := []any{providerID} + if since != "" { + where += ` AND bucket >= ?` + args = append(args, since) + } + if until != "" { + where += ` AND bucket <= ?` + args = append(args, until) + } + rows, err := s.db.QueryContext(ctx, s.q(` + SELECT id, provider_id, bucket, observed_at, observations, + limit_requests, remaining_requests, min_remaining_requests, + limit_tokens, remaining_tokens, min_remaining_tokens, + reset_requests_at, reset_tokens_at + FROM provider_rate_limit_sample`+where+` ORDER BY bucket`), args...) + if err != nil { + return nil, err + } + defer rows.Close() + return scanRateLimitSamples(rows) +} + +func (s *Store) PruneRateLimitSamples(ctx context.Context, before string) (int64, error) { + res, err := s.db.ExecContext(ctx, + s.q(`DELETE FROM provider_rate_limit_sample WHERE bucket < ?`), before) + if err != nil { + return 0, err + } + return res.RowsAffected() +} + +func scanRateLimitSamples(rows *sql.Rows) ([]RateLimitSample, error) { + var out []RateLimitSample + for rows.Next() { + var s RateLimitSample + if err := rows.Scan(&s.ID, &s.ProviderID, &s.Bucket, &s.ObservedAt, + &s.Observations, + &s.LimitRequests, &s.RemainingRequests, &s.MinRemainingRequests, + &s.LimitTokens, &s.RemainingTokens, &s.MinRemainingTokens, + &s.ResetRequestsAt, &s.ResetTokensAt); err != nil { + return nil, err + } + out = append(out, s) + } + return out, rows.Err() +} diff --git a/internal/store/ratelimit_test.go b/internal/store/ratelimit_test.go new file mode 100644 index 0000000..472c39b --- /dev/null +++ b/internal/store/ratelimit_test.go @@ -0,0 +1,232 @@ +package store_test + +import ( + "context" + "database/sql" + "testing" + + "github.com/greyhavenhq/llmproxy/internal/store" +) + +func openTestStore(t *testing.T) *store.Store { + t.Helper() + st, err := store.Open(t.TempDir() + "/test.db") + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { st.Close() }) + if err := st.Init(context.Background()); err != nil { + t.Fatal(err) + } + return st +} + +func TestRateLimitSampleInsertAndLatest(t *testing.T) { + st := openTestStore(t) + ctx := context.Background() + + p := &store.Provider{ + Name: "test-provider", WireFormat: "openai", BaseURL: "https://example.com", + VerifyTLS: true, TimeoutConnect: 5, TimeoutRead: 30, Enabled: true, + } + if err := st.CreateProvider(ctx, p, nil, nil); err != nil { + t.Fatal(err) + } + + s1 := &store.RateLimitSample{ + ProviderID: p.ID, + Bucket: "2026-09-14T10:00", + ObservedAt: "2026-09-14T10:00:45.000000Z", + Observations: 12, + LimitRequests: sql.NullInt64{Int64: 1000, Valid: true}, + RemainingRequests: sql.NullInt64{Int64: 900, Valid: true}, + MinRemainingRequests: sql.NullInt64{Int64: 850, Valid: true}, + LimitTokens: sql.NullInt64{Int64: 2000000, Valid: true}, + RemainingTokens: sql.NullInt64{Int64: 1500000, Valid: true}, + MinRemainingTokens: sql.NullInt64{Int64: 1400000, Valid: true}, + } + if err := st.InsertRateLimitSample(ctx, s1); err != nil { + t.Fatal(err) + } + if s1.ID == "" { + t.Fatal("expected ID to be assigned") + } + + s2 := &store.RateLimitSample{ + ProviderID: p.ID, + Bucket: "2026-09-14T10:01", + ObservedAt: "2026-09-14T10:01:30.000000Z", + Observations: 5, + LimitRequests: sql.NullInt64{Int64: 1000, Valid: true}, + RemainingRequests: sql.NullInt64{Int64: 800, Valid: true}, + MinRemainingRequests: sql.NullInt64{Int64: 780, Valid: true}, + } + if err := st.InsertRateLimitSample(ctx, s2); err != nil { + t.Fatal(err) + } + + latest, err := st.LatestRateLimitSamples(ctx) + if err != nil { + t.Fatal(err) + } + if len(latest) != 1 { + t.Fatalf("expected 1 latest sample, got %d", len(latest)) + } + if latest[0].Bucket != "2026-09-14T10:01" { + t.Fatalf("expected latest bucket 2026-09-14T10:01, got %s", latest[0].Bucket) + } + if latest[0].RemainingRequests.Int64 != 800 { + t.Fatalf("expected remaining_requests 800, got %d", latest[0].RemainingRequests.Int64) + } +} + +func TestRateLimitSeries(t *testing.T) { + st := openTestStore(t) + ctx := context.Background() + + p := &store.Provider{ + Name: "series-provider", WireFormat: "openai", BaseURL: "https://example.com", + VerifyTLS: true, TimeoutConnect: 5, TimeoutRead: 30, Enabled: true, + } + if err := st.CreateProvider(ctx, p, nil, nil); err != nil { + t.Fatal(err) + } + + buckets := []string{"2026-09-14T08:00", "2026-09-14T09:00", "2026-09-14T10:00"} + for _, b := range buckets { + s := &store.RateLimitSample{ + ProviderID: p.ID, + Bucket: b, + ObservedAt: b + ":30.000000Z", + Observations: 1, + LimitRequests: sql.NullInt64{Int64: 1000, Valid: true}, + } + if err := st.InsertRateLimitSample(ctx, s); err != nil { + t.Fatal(err) + } + } + + series, err := st.RateLimitSeries(ctx, p.ID, "2026-09-14T08:30", "2026-09-14T09:30") + if err != nil { + t.Fatal(err) + } + if len(series) != 1 { + t.Fatalf("expected 1 row in range, got %d", len(series)) + } + if series[0].Bucket != "2026-09-14T09:00" { + t.Fatalf("expected bucket 2026-09-14T09:00, got %s", series[0].Bucket) + } + + all, err := st.RateLimitSeries(ctx, p.ID, "", "") + if err != nil { + t.Fatal(err) + } + if len(all) != 3 { + t.Fatalf("expected 3 rows total, got %d", len(all)) + } +} + +func TestPruneRateLimitSamples(t *testing.T) { + st := openTestStore(t) + ctx := context.Background() + + p := &store.Provider{ + Name: "prune-provider", WireFormat: "openai", BaseURL: "https://example.com", + VerifyTLS: true, TimeoutConnect: 5, TimeoutRead: 30, Enabled: true, + } + if err := st.CreateProvider(ctx, p, nil, nil); err != nil { + t.Fatal(err) + } + + for _, b := range []string{"2026-09-13T10:00", "2026-09-14T10:00", "2026-09-15T10:00"} { + s := &store.RateLimitSample{ + ProviderID: p.ID, Bucket: b, ObservedAt: b + ":00.000000Z", Observations: 1, + } + if err := st.InsertRateLimitSample(ctx, s); err != nil { + t.Fatal(err) + } + } + + pruned, err := st.PruneRateLimitSamples(ctx, "2026-09-14T10:00") + if err != nil { + t.Fatal(err) + } + if pruned != 1 { + t.Fatalf("expected 1 pruned, got %d", pruned) + } + + remaining, err := st.RateLimitSeries(ctx, p.ID, "", "") + if err != nil { + t.Fatal(err) + } + if len(remaining) != 2 { + t.Fatalf("expected 2 remaining, got %d", len(remaining)) + } +} + +func TestProviderRateLimitHeadersRoundtrip(t *testing.T) { + st := openTestStore(t) + ctx := context.Background() + + headers := "limit_requests:x-ratelimit-limit-requests,remaining_requests:x-ratelimit-remaining-requests" + p := &store.Provider{ + Name: "rl-provider", WireFormat: "openai", BaseURL: "https://example.com", + VerifyTLS: true, TimeoutConnect: 5, TimeoutRead: 30, Enabled: true, + RateLimitHeaders: headers, + } + if err := st.CreateProvider(ctx, p, nil, nil); err != nil { + t.Fatal(err) + } + + got, err := st.GetProviderByName(ctx, "rl-provider") + if err != nil { + t.Fatal(err) + } + if got.RateLimitHeaders != headers { + t.Fatalf("expected rate_limit_headers %q, got %q", headers, got.RateLimitHeaders) + } + + got.RateLimitHeaders = "limit_tokens:x-ratelimit-limit-tokens" + if err := st.UpdateProvider(ctx, got, nil); err != nil { + t.Fatal(err) + } + updated, err := st.GetProviderByName(ctx, "rl-provider") + if err != nil { + t.Fatal(err) + } + if updated.RateLimitHeaders != "limit_tokens:x-ratelimit-limit-tokens" { + t.Fatalf("expected updated headers, got %q", updated.RateLimitHeaders) + } +} + +func TestDeleteProviderCascadesRateLimitSamples(t *testing.T) { + st := openTestStore(t) + ctx := context.Background() + + p := &store.Provider{ + Name: "del-provider", WireFormat: "openai", BaseURL: "https://example.com", + VerifyTLS: true, TimeoutConnect: 5, TimeoutRead: 30, Enabled: true, + } + if err := st.CreateProvider(ctx, p, nil, nil); err != nil { + t.Fatal(err) + } + + s := &store.RateLimitSample{ + ProviderID: p.ID, Bucket: "2026-09-14T10:00", ObservedAt: "2026-09-14T10:00:00.000000Z", Observations: 1, + } + if err := st.InsertRateLimitSample(ctx, s); err != nil { + t.Fatal(err) + } + + if err := st.DeleteProvider(ctx, p.ID, nil); err != nil { + t.Fatal(err) + } + + remaining, err := st.LatestRateLimitSamples(ctx) + if err != nil { + t.Fatal(err) + } + if len(remaining) != 0 { + t.Fatalf("expected 0 samples after provider delete, got %d", len(remaining)) + } +} diff --git a/internal/store/schema.go b/internal/store/schema.go index c48bc72..e13f2d6 100644 --- a/internal/store/schema.go +++ b/internal/store/schema.go @@ -66,7 +66,8 @@ CREATE TABLE IF NOT EXISTS provider ( timeout_read DOUBLE PRECISION NOT NULL DEFAULT 300, max_concurrency INTEGER, enabled INTEGER NOT NULL DEFAULT 1, - created_at TEXT NOT NULL + created_at TEXT NOT NULL, + rate_limit_headers TEXT NOT NULL DEFAULT '' ); CREATE TABLE IF NOT EXISTS provider_endpoint ( id TEXT PRIMARY KEY, @@ -156,5 +157,22 @@ CREATE TABLE IF NOT EXISTS admin_event ( target_kind TEXT NOT NULL, target_ref TEXT NOT NULL ); -CREATE INDEX IF NOT EXISTS idx_admin_event_ts ON admin_event(ts) +CREATE INDEX IF NOT EXISTS idx_admin_event_ts ON admin_event(ts); +CREATE TABLE IF NOT EXISTS provider_rate_limit_sample ( + id TEXT PRIMARY KEY, + provider_id TEXT NOT NULL REFERENCES provider(id), + bucket TEXT NOT NULL, + observed_at TEXT NOT NULL, + observations INTEGER NOT NULL DEFAULT 0, + limit_requests INTEGER, + remaining_requests INTEGER, + min_remaining_requests INTEGER, + limit_tokens INTEGER, + remaining_tokens INTEGER, + min_remaining_tokens INTEGER, + reset_requests_at TEXT, + reset_tokens_at TEXT, + UNIQUE (provider_id, bucket) +); +CREATE INDEX IF NOT EXISTS idx_prl_sample_bucket ON provider_rate_limit_sample(bucket) ` diff --git a/internal/store/types.go b/internal/store/types.go index de4092c..905bd3b 100644 --- a/internal/store/types.go +++ b/internal/store/types.go @@ -54,6 +54,23 @@ type Provider struct { MaxConcurrency sql.NullInt64 Enabled bool CreatedAt string + RateLimitHeaders string +} + +type RateLimitSample struct { + ID string + ProviderID string + Bucket string + ObservedAt string + Observations int64 + LimitRequests sql.NullInt64 + RemainingRequests sql.NullInt64 + MinRemainingRequests sql.NullInt64 + LimitTokens sql.NullInt64 + RemainingTokens sql.NullInt64 + MinRemainingTokens sql.NullInt64 + ResetRequestsAt sql.NullString + ResetTokensAt sql.NullString } // ModelBinding is one caller-facing name. It either routes directly to a From 8e4fdbbe8a6b3cd762802e16110e7d7ec52799af Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 14 Sep 2026 10:51:31 -0600 Subject: [PATCH 2/8] feat: add Route.RateLimitHeaders and header-spec parser Parse the provider's rate_limit_headers column into the route at catalog load time. FormatRateLimitHeaders serialises back for the admin API. --- internal/catalog/catalog.go | 59 ++++++++-------- internal/catalog/ratelimit.go | 62 +++++++++++++++++ internal/catalog/ratelimit_test.go | 104 +++++++++++++++++++++++++++++ 3 files changed, 198 insertions(+), 27 deletions(-) create mode 100644 internal/catalog/ratelimit.go create mode 100644 internal/catalog/ratelimit_test.go diff --git a/internal/catalog/catalog.go b/internal/catalog/catalog.go index b06574a..2793b99 100644 --- a/internal/catalog/catalog.go +++ b/internal/catalog/catalog.go @@ -72,6 +72,9 @@ type Route struct { UpstreamName string Capabilities map[string]bool URLOverrides map[string]string + // RateLimitHeaders maps metric keys to upstream header names. + // Empty when the provider has no rate-limit tracking configured. + RateLimitHeaders map[string]string } func (r *Route) EndpointURL(endpoint string) string { @@ -192,21 +195,22 @@ func (c *Catalog) load(ctx context.Context, alias string) (*Route, error) { } } return &Route{ - ProviderID: provider.ID, - ProviderName: provider.Name, - WireFormat: provider.WireFormat, - BaseURL: provider.BaseURL, - Credential: credential, - VerifyTLS: provider.VerifyTLS, - CAPEM: provider.CAPEM.String, - TimeoutConnect: time.Duration(provider.TimeoutConnect * float64(time.Second)), - TimeoutRead: time.Duration(provider.TimeoutRead * float64(time.Second)), - MaxConcurrency: int(provider.MaxConcurrency.Int64), - Alias: binding.Alias, - TargetAlias: binding.TargetAlias, - UpstreamName: binding.UpstreamName, - Capabilities: caps, - URLOverrides: overrides, + ProviderID: provider.ID, + ProviderName: provider.Name, + WireFormat: provider.WireFormat, + BaseURL: provider.BaseURL, + Credential: credential, + VerifyTLS: provider.VerifyTLS, + CAPEM: provider.CAPEM.String, + TimeoutConnect: time.Duration(provider.TimeoutConnect * float64(time.Second)), + TimeoutRead: time.Duration(provider.TimeoutRead * float64(time.Second)), + MaxConcurrency: int(provider.MaxConcurrency.Int64), + Alias: binding.Alias, + TargetAlias: binding.TargetAlias, + UpstreamName: binding.UpstreamName, + Capabilities: caps, + URLOverrides: overrides, + RateLimitHeaders: ParseRateLimitHeaders(provider.RateLimitHeaders), }, nil } @@ -222,17 +226,18 @@ func RouteForProvider(p *store.Provider, secret []byte) (*Route, error) { } } return &Route{ - ProviderID: p.ID, - ProviderName: p.Name, - WireFormat: p.WireFormat, - BaseURL: p.BaseURL, - Credential: credential, - VerifyTLS: p.VerifyTLS, - CAPEM: p.CAPEM.String, - TimeoutConnect: time.Duration(p.TimeoutConnect * float64(time.Second)), - TimeoutRead: time.Duration(p.TimeoutRead * float64(time.Second)), - MaxConcurrency: int(p.MaxConcurrency.Int64), - Capabilities: map[string]bool{}, - URLOverrides: map[string]string{}, + ProviderID: p.ID, + ProviderName: p.Name, + WireFormat: p.WireFormat, + BaseURL: p.BaseURL, + Credential: credential, + VerifyTLS: p.VerifyTLS, + CAPEM: p.CAPEM.String, + TimeoutConnect: time.Duration(p.TimeoutConnect * float64(time.Second)), + TimeoutRead: time.Duration(p.TimeoutRead * float64(time.Second)), + MaxConcurrency: int(p.MaxConcurrency.Int64), + Capabilities: map[string]bool{}, + URLOverrides: map[string]string{}, + RateLimitHeaders: ParseRateLimitHeaders(p.RateLimitHeaders), }, nil } diff --git a/internal/catalog/ratelimit.go b/internal/catalog/ratelimit.go new file mode 100644 index 0000000..ccfce35 --- /dev/null +++ b/internal/catalog/ratelimit.go @@ -0,0 +1,62 @@ +package catalog + +import "strings" + +// ValidRateLimitKeys are the metric keys a rate_limit_headers spec may map. +var ValidRateLimitKeys = []string{ + "limit_requests", "remaining_requests", + "limit_tokens", "remaining_tokens", + "reset_requests", "reset_tokens", +} + +func isValidRateLimitKey(key string) bool { + for _, k := range ValidRateLimitKeys { + if k == key { + return true + } + } + return false +} + +// ParseRateLimitHeaders parses the stored comma-separated "key:header" spec +// into a map. Invalid pairs are silently dropped. +func ParseRateLimitHeaders(spec string) map[string]string { + if spec == "" { + return nil + } + out := make(map[string]string) + for _, pair := range strings.Split(spec, ",") { + key, header, ok := strings.Cut(pair, ":") + if !ok { + continue + } + key = strings.TrimSpace(key) + header = strings.TrimSpace(header) + if key == "" || header == "" { + continue + } + if !isValidRateLimitKey(key) { + continue + } + out[key] = header + } + if len(out) == 0 { + return nil + } + return out +} + +// FormatRateLimitHeaders serialises a map back to the stored comma-separated +// "key:header" canonical form, sorted by key for stable output. +func FormatRateLimitHeaders(m map[string]string) string { + if len(m) == 0 { + return "" + } + var parts []string + for _, key := range ValidRateLimitKeys { + if header, ok := m[key]; ok && header != "" { + parts = append(parts, key+":"+header) + } + } + return strings.Join(parts, ",") +} diff --git a/internal/catalog/ratelimit_test.go b/internal/catalog/ratelimit_test.go new file mode 100644 index 0000000..e093cce --- /dev/null +++ b/internal/catalog/ratelimit_test.go @@ -0,0 +1,104 @@ +package catalog + +import ( + "testing" +) + +func TestParseRateLimitHeaders(t *testing.T) { + tests := []struct { + name string + spec string + want map[string]string + }{ + {"empty", "", nil}, + {"standard openai", "limit_requests:x-ratelimit-limit-requests,remaining_requests:x-ratelimit-remaining-requests,limit_tokens:x-ratelimit-limit-tokens,remaining_tokens:x-ratelimit-remaining-tokens", + map[string]string{ + "limit_requests": "x-ratelimit-limit-requests", + "remaining_requests": "x-ratelimit-remaining-requests", + "limit_tokens": "x-ratelimit-limit-tokens", + "remaining_tokens": "x-ratelimit-remaining-tokens", + }}, + {"with reset headers", "limit_requests:x-ratelimit-limit-requests,reset_requests:x-ratelimit-reset-requests,reset_tokens:x-ratelimit-reset-tokens", + map[string]string{ + "limit_requests": "x-ratelimit-limit-requests", + "reset_requests": "x-ratelimit-reset-requests", + "reset_tokens": "x-ratelimit-reset-tokens", + }}, + {"invalid key ignored", "limit_requests:x-foo,bogus_key:x-bar", + map[string]string{"limit_requests": "x-foo"}}, + {"empty value ignored", "limit_requests:", nil}, + {"no colon ignored", "limit_requests", nil}, + {"whitespace trimmed", " limit_requests : x-foo , remaining_tokens : x-bar ", + map[string]string{"limit_requests": "x-foo", "remaining_tokens": "x-bar"}}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := ParseRateLimitHeaders(tt.spec) + if tt.want == nil { + if got != nil { + t.Fatalf("expected nil, got %v", got) + } + return + } + if len(got) != len(tt.want) { + t.Fatalf("expected %d entries, got %d: %v", len(tt.want), len(got), got) + } + for k, v := range tt.want { + if got[k] != v { + t.Errorf("key %q: expected %q, got %q", k, v, got[k]) + } + } + }) + } +} + +func TestFormatRateLimitHeaders(t *testing.T) { + tests := []struct { + name string + m map[string]string + want string + }{ + {"nil", nil, ""}, + {"empty", map[string]string{}, ""}, + {"single", map[string]string{"limit_requests": "x-foo"}, "limit_requests:x-foo"}, + {"sorted by key order", map[string]string{ + "remaining_tokens": "x-bar", + "limit_requests": "x-foo", + }, "limit_requests:x-foo,remaining_tokens:x-bar"}, + {"all six", map[string]string{ + "limit_requests": "a", + "remaining_requests": "b", + "limit_tokens": "c", + "remaining_tokens": "d", + "reset_requests": "e", + "reset_tokens": "f", + }, "limit_requests:a,remaining_requests:b,limit_tokens:c,remaining_tokens:d,reset_requests:e,reset_tokens:f"}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := FormatRateLimitHeaders(tt.m) + if got != tt.want { + t.Fatalf("expected %q, got %q", tt.want, got) + } + }) + } +} + +func TestRoundtrip(t *testing.T) { + original := map[string]string{ + "limit_requests": "x-ratelimit-limit-requests", + "remaining_requests": "x-ratelimit-remaining-requests", + "limit_tokens": "x-ratelimit-limit-tokens", + "remaining_tokens": "x-ratelimit-remaining-tokens", + } + spec := FormatRateLimitHeaders(original) + parsed := ParseRateLimitHeaders(spec) + if len(parsed) != len(original) { + t.Fatalf("roundtrip lost entries: %v -> %q -> %v", original, spec, parsed) + } + for k, v := range original { + if parsed[k] != v { + t.Errorf("key %q: expected %q, got %q", k, v, parsed[k]) + } + } +} From 25e79d4bebbc2f1ec28479c7c88880edeec27bae Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 14 Sep 2026 10:57:12 -0600 Subject: [PATCH 3/8] feat: rate-limit tracker, capture site, gauges and response headers Single capture site in openai.go reads upstream rate-limit headers, updates the in-memory per-provider tracker, sets x-llmproxy-ratelimit-* response headers and exports Prometheus gauges. Regression tests cover both unary and streaming paths. --- internal/metrics/metrics.go | 20 +- internal/server/openai.go | 1 + internal/server/ratelimit.go | 364 ++++++++++++++++++++++++++++++ internal/server/ratelimit_test.go | 217 ++++++++++++++++++ internal/server/server.go | 13 +- 5 files changed, 610 insertions(+), 5 deletions(-) create mode 100644 internal/server/ratelimit.go create mode 100644 internal/server/ratelimit_test.go diff --git a/internal/metrics/metrics.go b/internal/metrics/metrics.go index 0e9fda8..1ec94c7 100644 --- a/internal/metrics/metrics.go +++ b/internal/metrics/metrics.go @@ -15,10 +15,11 @@ import ( type Metrics struct { mu sync.Mutex counters map[string]float64 + gauges map[string]float64 } func New() *Metrics { - return &Metrics{counters: make(map[string]float64)} + return &Metrics{counters: make(map[string]float64), gauges: make(map[string]float64)} } func key(name string, labels [][2]string) string { @@ -63,16 +64,29 @@ func (m *Metrics) ObserveUnits(provider, alias, unit string, quantity float64, p } } +func (m *Metrics) Set(name string, labels [][2]string, value float64) { + k := key(name, labels) + m.mu.Lock() + m.gauges[k] = value + m.mu.Unlock() +} + func (m *Metrics) Render() string { m.mu.Lock() - keys := make([]string, 0, len(m.counters)) + keys := make([]string, 0, len(m.counters)+len(m.gauges)) for k := range m.counters { keys = append(keys, k) } - values := make(map[string]float64, len(m.counters)) + for k := range m.gauges { + keys = append(keys, k) + } + values := make(map[string]float64, len(m.counters)+len(m.gauges)) for k, v := range m.counters { values[k] = v } + for k, v := range m.gauges { + values[k] = v + } m.mu.Unlock() sort.Strings(keys) var b strings.Builder diff --git a/internal/server/openai.go b/internal/server/openai.go index 6ea9736..367f3e9 100644 --- a/internal/server/openai.go +++ b/internal/server/openai.go @@ -204,6 +204,7 @@ func (s *Server) proxyCompletion(w http.ResponseWriter, r *http.Request, auth *A w.Header().Set("x-llmproxy-provider", route.ProviderName) w.Header().Set("x-llmproxy-model", route.UpstreamName) + s.observeRateLimit(w, resp, route) if !stream || resp.StatusCode >= 400 { s.relayUnary(w, auth, route, endpoint, resp, stream, started) diff --git a/internal/server/ratelimit.go b/internal/server/ratelimit.go new file mode 100644 index 0000000..eeba361 --- /dev/null +++ b/internal/server/ratelimit.go @@ -0,0 +1,364 @@ +package server + +import ( + "context" + "database/sql" + "log/slog" + "net/http" + "strconv" + "strings" + "sync" + "time" + + "github.com/greyhavenhq/llmproxy/internal/catalog" + "github.com/greyhavenhq/llmproxy/internal/metrics" + "github.com/greyhavenhq/llmproxy/internal/store" +) + +// RateLimitReading holds the parsed values from one upstream response. +type RateLimitReading struct { + ProviderID string + ProviderName string + + LimitRequests *int64 + RemainingRequests *int64 + LimitTokens *int64 + RemainingTokens *int64 + ResetRequestsAt string + ResetTokensAt string +} + +// readRateLimitHeaders extracts rate-limit values from upstream response +// headers using the provider's configured header mapping. Returns nil when +// the provider has no mapping or the response carries none of the headers. +func readRateLimitHeaders(headers http.Header, mapping map[string]string) *RateLimitReading { + if len(mapping) == 0 { + return nil + } + r := &RateLimitReading{} + any := false + if h, ok := mapping["limit_requests"]; ok { + if v, err := strconv.ParseInt(headers.Get(h), 10, 64); err == nil { + r.LimitRequests = &v + any = true + } + } + if h, ok := mapping["remaining_requests"]; ok { + if v, err := strconv.ParseInt(headers.Get(h), 10, 64); err == nil { + r.RemainingRequests = &v + any = true + } + } + if h, ok := mapping["limit_tokens"]; ok { + if v, err := strconv.ParseInt(headers.Get(h), 10, 64); err == nil { + r.LimitTokens = &v + any = true + } + } + if h, ok := mapping["remaining_tokens"]; ok { + if v, err := strconv.ParseInt(headers.Get(h), 10, 64); err == nil { + r.RemainingTokens = &v + any = true + } + } + if h, ok := mapping["reset_requests"]; ok { + if raw := headers.Get(h); raw != "" { + if parsed := parseResetTime(raw); parsed != "" { + r.ResetRequestsAt = parsed + any = true + } + } + } + if h, ok := mapping["reset_tokens"]; ok { + if raw := headers.Get(h); raw != "" { + if parsed := parseResetTime(raw); parsed != "" { + r.ResetTokensAt = parsed + any = true + } + } + } + if !any { + return nil + } + return r +} + +// parseResetTime accepts integer seconds, Go-style duration, or RFC 3339. +// Returns an absolute UTC RFC 3339 timestamp, or "" on failure. +func parseResetTime(raw string) string { + raw = strings.TrimSpace(raw) + if raw == "" { + return "" + } + if t, err := time.Parse(time.RFC3339, raw); err == nil { + return t.UTC().Format(time.RFC3339) + } + if d, err := time.ParseDuration(raw); err == nil { + return time.Now().Add(d).UTC().Format(time.RFC3339) + } + if secs, err := strconv.ParseFloat(raw, 64); err == nil { + return time.Now().Add(time.Duration(secs * float64(time.Second))).UTC().Format(time.RFC3339) + } + return "" +} + +// setRateLimitResponseHeaders writes x-llmproxy-ratelimit-* headers on the +// response for every observed value. +func setRateLimitResponseHeaders(w http.ResponseWriter, r *RateLimitReading) { + if r == nil { + return + } + if r.LimitRequests != nil { + w.Header().Set("x-llmproxy-ratelimit-requests-limit", strconv.FormatInt(*r.LimitRequests, 10)) + } + if r.RemainingRequests != nil { + w.Header().Set("x-llmproxy-ratelimit-requests-remaining", strconv.FormatInt(*r.RemainingRequests, 10)) + } + if r.LimitTokens != nil { + w.Header().Set("x-llmproxy-ratelimit-tokens-limit", strconv.FormatInt(*r.LimitTokens, 10)) + } + if r.RemainingTokens != nil { + w.Header().Set("x-llmproxy-ratelimit-tokens-remaining", strconv.FormatInt(*r.RemainingTokens, 10)) + } +} + +// rateLimitCell is the in-memory accumulator for one provider's current minute. +type rateLimitCell struct { + bucket string + observedAt time.Time + observations int64 + + limitRequests *int64 + remainingRequests *int64 + minRemRequests *int64 + limitTokens *int64 + remainingTokens *int64 + minRemTokens *int64 + resetRequestsAt string + resetTokensAt string +} + +func (c *rateLimitCell) observe(r *RateLimitReading, now time.Time) { + c.observedAt = now + c.observations++ + if r.LimitRequests != nil { + c.limitRequests = r.LimitRequests + } + if r.RemainingRequests != nil { + c.remainingRequests = r.RemainingRequests + if c.minRemRequests == nil || *r.RemainingRequests < *c.minRemRequests { + v := *r.RemainingRequests + c.minRemRequests = &v + } + } + if r.LimitTokens != nil { + c.limitTokens = r.LimitTokens + } + if r.RemainingTokens != nil { + c.remainingTokens = r.RemainingTokens + if c.minRemTokens == nil || *r.RemainingTokens < *c.minRemTokens { + v := *r.RemainingTokens + c.minRemTokens = &v + } + } + if r.ResetRequestsAt != "" { + c.resetRequestsAt = r.ResetRequestsAt + } + if r.ResetTokensAt != "" { + c.resetTokensAt = r.ResetTokensAt + } +} + +func (c *rateLimitCell) toSample(providerID string) *store.RateLimitSample { + s := &store.RateLimitSample{ + ProviderID: providerID, + Bucket: c.bucket, + ObservedAt: c.observedAt.UTC().Format(store.TimeFormat), + Observations: c.observations, + } + if c.limitRequests != nil { + s.LimitRequests = sql.NullInt64{Int64: *c.limitRequests, Valid: true} + } + if c.remainingRequests != nil { + s.RemainingRequests = sql.NullInt64{Int64: *c.remainingRequests, Valid: true} + } + if c.minRemRequests != nil { + s.MinRemainingRequests = sql.NullInt64{Int64: *c.minRemRequests, Valid: true} + } + if c.limitTokens != nil { + s.LimitTokens = sql.NullInt64{Int64: *c.limitTokens, Valid: true} + } + if c.remainingTokens != nil { + s.RemainingTokens = sql.NullInt64{Int64: *c.remainingTokens, Valid: true} + } + if c.minRemTokens != nil { + s.MinRemainingTokens = sql.NullInt64{Int64: *c.minRemTokens, Valid: true} + } + if c.resetRequestsAt != "" { + s.ResetRequestsAt = sql.NullString{String: c.resetRequestsAt, Valid: true} + } + if c.resetTokensAt != "" { + s.ResetTokensAt = sql.NullString{String: c.resetTokensAt, Valid: true} + } + return s +} + +// RateLimitSnapshot is the current reading for one provider, served by the +// stats endpoint. +type RateLimitSnapshot struct { + ProviderID string + ProviderName string + ObservedAt time.Time + Observations int64 + + LimitRequests *int64 + RemainingRequests *int64 + MinRemRequests *int64 + LimitTokens *int64 + RemainingTokens *int64 + MinRemTokens *int64 + ResetRequestsAt string + ResetTokensAt string +} + +// RateLimitTracker accumulates per-provider readings in memory and flushes +// finished minute buckets to the store. +type RateLimitTracker struct { + mu sync.Mutex + cells map[string]*rateLimitCell // keyed by provider ID + names map[string]string // provider ID -> name +} + +func NewRateLimitTracker() *RateLimitTracker { + return &RateLimitTracker{ + cells: make(map[string]*rateLimitCell), + names: make(map[string]string), + } +} + +func minuteBucket(t time.Time) string { + return t.UTC().Format("2006-01-02T15:04") +} + +// Observe records one upstream reading. If the minute rolled over, the +// finished bucket is returned for persistence; otherwise nil. +func (t *RateLimitTracker) Observe(r *RateLimitReading, now time.Time) *store.RateLimitSample { + t.mu.Lock() + defer t.mu.Unlock() + + bucket := minuteBucket(now) + t.names[r.ProviderID] = r.ProviderName + + cell, ok := t.cells[r.ProviderID] + if !ok { + cell = &rateLimitCell{bucket: bucket} + t.cells[r.ProviderID] = cell + cell.observe(r, now) + return nil + } + + if cell.bucket == bucket { + cell.observe(r, now) + return nil + } + + // Minute rolled over: snapshot the finished bucket, start a new one. + finished := cell.toSample(r.ProviderID) + newCell := &rateLimitCell{bucket: bucket} + newCell.observe(r, now) + t.cells[r.ProviderID] = newCell + return finished +} + +// Snapshots returns the current in-memory reading for every tracked provider. +func (t *RateLimitTracker) Snapshots() []RateLimitSnapshot { + t.mu.Lock() + defer t.mu.Unlock() + + out := make([]RateLimitSnapshot, 0, len(t.cells)) + for providerID, cell := range t.cells { + out = append(out, RateLimitSnapshot{ + ProviderID: providerID, + ProviderName: t.names[providerID], + ObservedAt: cell.observedAt, + Observations: cell.observations, + LimitRequests: cell.limitRequests, + RemainingRequests: cell.remainingRequests, + MinRemRequests: cell.minRemRequests, + LimitTokens: cell.limitTokens, + RemainingTokens: cell.remainingTokens, + MinRemTokens: cell.minRemTokens, + ResetRequestsAt: cell.resetRequestsAt, + ResetTokensAt: cell.resetTokensAt, + }) + } + return out +} + +// Drain flushes every open bucket and returns the samples for persistence. +func (t *RateLimitTracker) Drain() []*store.RateLimitSample { + t.mu.Lock() + defer t.mu.Unlock() + + var out []*store.RateLimitSample + for providerID, cell := range t.cells { + out = append(out, cell.toSample(providerID)) + } + t.cells = make(map[string]*rateLimitCell) + return out +} + +// observeRateLimit is the single call site that reads upstream rate-limit +// headers, updates the in-memory tracker, sets response headers, updates +// Prometheus gauges, and flushes finished buckets to the store. +func (s *Server) observeRateLimit(w http.ResponseWriter, resp *http.Response, route *catalog.Route) { + reading := readRateLimitHeaders(resp.Header, route.RateLimitHeaders) + if reading == nil { + return + } + reading.ProviderID = route.ProviderID + reading.ProviderName = route.ProviderName + + setRateLimitResponseHeaders(w, reading) + setRateLimitGauges(s.metrics, route.ProviderName, reading) + + finished := s.rateLimits.Observe(reading, time.Now()) + if finished != nil { + s.recordAsync(func(ctx context.Context) { + if err := s.store.InsertRateLimitSample(ctx, finished); err != nil { + slog.Error("failed to persist rate-limit sample", "provider", finished.ProviderID, "error", err) + } + }) + } +} + +func (s *Server) flushRateLimitSample(sample *store.RateLimitSample) { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + if err := s.store.InsertRateLimitSample(ctx, sample); err != nil { + slog.Error("failed to persist rate-limit sample", "provider", sample.ProviderID, "error", err) + } +} + +func setRateLimitGauges(m *metrics.Metrics, provider string, r *RateLimitReading) { + if r.RemainingRequests != nil { + m.Set("llmproxy_provider_rate_limit_remaining", + [][2]string{{"provider", provider}, {"unit", "requests"}}, + float64(*r.RemainingRequests)) + } + if r.LimitRequests != nil { + m.Set("llmproxy_provider_rate_limit_limit", + [][2]string{{"provider", provider}, {"unit", "requests"}}, + float64(*r.LimitRequests)) + } + if r.RemainingTokens != nil { + m.Set("llmproxy_provider_rate_limit_remaining", + [][2]string{{"provider", provider}, {"unit", "tokens"}}, + float64(*r.RemainingTokens)) + } + if r.LimitTokens != nil { + m.Set("llmproxy_provider_rate_limit_limit", + [][2]string{{"provider", provider}, {"unit", "tokens"}}, + float64(*r.LimitTokens)) + } +} diff --git a/internal/server/ratelimit_test.go b/internal/server/ratelimit_test.go new file mode 100644 index 0000000..963c215 --- /dev/null +++ b/internal/server/ratelimit_test.go @@ -0,0 +1,217 @@ +package server_test + +import ( + "bytes" + "context" + "database/sql" + "encoding/json" + "fmt" + "io" + "net/http" + "net/http/httptest" + "path/filepath" + "strings" + "testing" + "time" + + "github.com/greyhavenhq/llmproxy/internal/config" + "github.com/greyhavenhq/llmproxy/internal/secrets" + "github.com/greyhavenhq/llmproxy/internal/server" + "github.com/greyhavenhq/llmproxy/internal/store" +) + +type rlEnv struct { + proxy *httptest.Server + key string + srv *server.Server + st *store.Store +} + +func newRateLimitEnv(t *testing.T) *rlEnv { + t.Helper() + dir := t.TempDir() + + upstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("x-ratelimit-limit-requests", "1000") + w.Header().Set("x-ratelimit-remaining-requests", "943") + w.Header().Set("x-ratelimit-limit-tokens", "2000000") + w.Header().Set("x-ratelimit-remaining-tokens", "1811204") + + raw, _ := io.ReadAll(r.Body) + var fields map[string]json.RawMessage + _ = json.Unmarshal(raw, &fields) + var stream bool + if s, ok := fields["stream"]; ok { + _ = json.Unmarshal(s, &stream) + } + + if !stream { + w.Header().Set("Content-Type", "application/json") + body, _ := json.Marshal(map[string]any{ + "id": "chatcmpl-rl", "object": "chat.completion", "model": "m-rl", + "choices": []any{map[string]any{ + "index": 0, "message": map[string]any{"role": "assistant", "content": "ok"}, + "finish_reason": "stop", + }}, + "usage": map[string]any{"prompt_tokens": 5, "completion_tokens": 3, "total_tokens": 8}, + }) + w.Write(body) + return + } + + w.Header().Set("Content-Type", "text/event-stream") + w.WriteHeader(200) + flusher := w.(http.Flusher) + payload, _ := json.Marshal(map[string]any{ + "id": "chatcmpl-rl", "object": "chat.completion.chunk", "model": "m-rl", + "choices": []any{}, "usage": map[string]any{"prompt_tokens": 5, "completion_tokens": 3, "total_tokens": 8}, + }) + fmt.Fprintf(w, "data: %s\n\n", payload) + fmt.Fprint(w, "data: [DONE]\n\n") + flusher.Flush() + })) + t.Cleanup(upstream.Close) + + cfg := config.Config{ + DatabaseURL: filepath.Join(dir, "proxy.db"), + SecretFile: filepath.Join(dir, "secret"), + LocalAdminName: "local-admin", + AdminPasswordFile: filepath.Join(dir, "admin-password"), + CatalogTTL: 0, + MaxBodyBytes: 256 * 1024, + SessionTTL: time.Hour, + } + secret, err := secrets.LoadOrCreate("", cfg.SecretFile) + if err != nil { + t.Fatal(err) + } + st, err := store.Open(cfg.DatabaseURL) + if err != nil { + t.Fatal(err) + } + srv := server.New(cfg, st, secret) + if err := srv.Bootstrap(context.Background()); err != nil { + t.Fatal(err) + } + + ctx := context.Background() + encrypted, err := secrets.EncryptCredential(secret, "test-key") + if err != nil { + t.Fatal(err) + } + rlHeaders := "limit_requests:x-ratelimit-limit-requests,remaining_requests:x-ratelimit-remaining-requests," + + "limit_tokens:x-ratelimit-limit-tokens,remaining_tokens:x-ratelimit-remaining-tokens" + provider := &store.Provider{ + Name: "rl-upstream", WireFormat: "openai", BaseURL: upstream.URL + "/v1", + CredentialCiphertext: sql.NullString{String: encrypted, Valid: true}, + VerifyTLS: true, TimeoutConnect: 5, TimeoutRead: 30, Enabled: true, + RateLimitHeaders: rlHeaders, + } + if err := st.CreateProvider(ctx, provider, nil, nil); err != nil { + t.Fatal(err) + } + binding := store.ModelBinding{ + Alias: "rl-model", ProviderID: provider.ID, UpstreamName: "m-rl", + CapabilitySet: "chat,chat_stream", Origin: "declared", + } + if err := st.CreateBinding(ctx, &binding, nil); err != nil { + t.Fatal(err) + } + member, err := st.GetOrCreatePrincipal(ctx, "local-admin", "user", "admin", nil) + if err != nil { + t.Fatal(err) + } + plaintext := secrets.GenerateAPIKey() + if _, err := st.CreateAPIKey(ctx, member.ID, + secrets.HashAPIKey(secret, plaintext), secrets.KeySuffix(plaintext), "test", nil); err != nil { + t.Fatal(err) + } + + proxy := httptest.NewServer(srv.Handler()) + t.Cleanup(func() { + proxy.Close() + srv.Drain() + st.Close() + }) + return &rlEnv{proxy: proxy, key: plaintext, srv: srv, st: st} +} + +func (e *rlEnv) chat(t *testing.T, stream bool) *http.Response { + t.Helper() + body := map[string]any{ + "model": "rl-model", "messages": []any{map[string]any{"role": "user", "content": "hi"}}, + } + if stream { + body["stream"] = true + } + data, _ := json.Marshal(body) + req, _ := http.NewRequest("POST", e.proxy.URL+"/v1/chat/completions", bytes.NewReader(data)) + req.Header.Set("Authorization", "Bearer "+e.key) + req.Header.Set("Content-Type", "application/json") + resp, err := http.DefaultClient.Do(req) + if err != nil { + t.Fatal(err) + } + io.ReadAll(resp.Body) + resp.Body.Close() + return resp +} + +func TestRateLimitHeadersCapturedUnary(t *testing.T) { + e := newRateLimitEnv(t) + resp := e.chat(t, false) + if resp.StatusCode != 200 { + t.Fatalf("expected 200, got %d", resp.StatusCode) + } + if got := resp.Header.Get("x-llmproxy-ratelimit-requests-remaining"); got != "943" { + t.Errorf("expected requests-remaining 943, got %q", got) + } + if got := resp.Header.Get("x-llmproxy-ratelimit-tokens-limit"); got != "2000000" { + t.Errorf("expected tokens-limit 2000000, got %q", got) + } +} + +func TestRateLimitHeadersCapturedStream(t *testing.T) { + e := newRateLimitEnv(t) + resp := e.chat(t, true) + if resp.StatusCode != 200 { + t.Fatalf("expected 200, got %d", resp.StatusCode) + } + if got := resp.Header.Get("x-llmproxy-ratelimit-requests-remaining"); got != "943" { + t.Errorf("expected requests-remaining 943, got %q", got) + } + if got := resp.Header.Get("x-llmproxy-ratelimit-tokens-remaining"); got != "1811204" { + t.Errorf("expected tokens-remaining 1811204, got %q", got) + } +} + +func TestRateLimitNoHeadersWithoutConfig(t *testing.T) { + e := newEnv(t) + resp, _ := e.request(t, "POST", "/v1/chat/completions", e.memberKey, + map[string]any{"model": "alpha", "messages": []any{map[string]any{"role": "user", "content": "hi"}}}) + if resp.Header.Get("x-llmproxy-ratelimit-requests-remaining") != "" { + t.Error("rate-limit response headers set on provider without config") + } +} + +func TestRateLimitGaugesExported(t *testing.T) { + e := newRateLimitEnv(t) + e.chat(t, false) + + resp, err := http.Get(e.proxy.URL + "/metrics") + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + body, _ := io.ReadAll(resp.Body) + metrics := string(body) + + for _, want := range []string{ + `llmproxy_provider_rate_limit_remaining{provider="rl-upstream",unit="requests"} 943`, + `llmproxy_provider_rate_limit_limit{provider="rl-upstream",unit="requests"} 1000`, + } { + if !strings.Contains(metrics, want) { + t.Errorf("expected metric line %q in:\n%s", want, metrics) + } + } +} diff --git a/internal/server/server.go b/internal/server/server.go index 22b34f2..fed55e3 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -57,6 +57,8 @@ type Server struct { adminPassword string localAdminID string + rateLimits *RateLimitTracker + // wg tracks detached usage-recording goroutines so shutdown can drain them. wg sync.WaitGroup } @@ -69,6 +71,7 @@ func New(cfg config.Config, st *store.Store, secret []byte) *Server { catalog: catalog.New(st, secret, cfg.CatalogTTL), pool: upstream.New(), metrics: metrics.New(), + rateLimits: NewRateLimitTracker(), sessionKey: deriveSessionKey(secret), cookieSecure: strings.HasPrefix(cfg.OIDCRedirectURL, "https://"), publicHost: hostOf(cfg.OIDCRedirectURL), @@ -155,8 +158,14 @@ func (s *Server) Bootstrap(ctx context.Context) error { return nil } -// Drain waits for detached accounting goroutines (used by shutdown and tests). -func (s *Server) Drain() { s.wg.Wait() } +// Drain flushes open rate-limit buckets and waits for detached accounting +// goroutines (used by shutdown and tests). +func (s *Server) Drain() { + for _, sample := range s.rateLimits.Drain() { + s.flushRateLimitSample(sample) + } + s.wg.Wait() +} // statusWriter records the response status for the access log while passing // Flush through so SSE relays keep working. From cbe15eaef28178cc5812dbd8160e502bab5506d4 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 14 Sep 2026 10:59:25 -0600 Subject: [PATCH 4/8] feat: add /stats/rate-limits and /stats/rate-limits/series endpoints The snapshot endpoint returns the in-memory reading per provider with a stale flag. The series endpoint returns stored minute-bucket samples for one provider over a time range. --- internal/server/ratelimit_test.go | 71 +++++++++++++++++++ internal/server/server.go | 2 + internal/server/stats.go | 113 ++++++++++++++++++++++++++++++ 3 files changed, 186 insertions(+) diff --git a/internal/server/ratelimit_test.go b/internal/server/ratelimit_test.go index 963c215..d6fefcf 100644 --- a/internal/server/ratelimit_test.go +++ b/internal/server/ratelimit_test.go @@ -194,6 +194,77 @@ func TestRateLimitNoHeadersWithoutConfig(t *testing.T) { } } +func TestStatsRateLimitsEndpoint(t *testing.T) { + e := newRateLimitEnv(t) + e.chat(t, false) + + req, _ := http.NewRequest("GET", e.proxy.URL+"/stats/rate-limits", nil) + req.Header.Set("Authorization", "Bearer "+e.key) + resp, err := http.DefaultClient.Do(req) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + body, _ := io.ReadAll(resp.Body) + + if resp.StatusCode != 200 { + t.Fatalf("expected 200, got %d: %s", resp.StatusCode, body) + } + var result map[string]any + json.Unmarshal(body, &result) + limits, ok := result["rate_limits"].([]any) + if !ok || len(limits) == 0 { + t.Fatalf("expected non-empty rate_limits, got %s", body) + } + entry := limits[0].(map[string]any) + if entry["provider"] != "rl-upstream" { + t.Errorf("expected provider rl-upstream, got %v", entry["provider"]) + } + if entry["remaining_requests"].(float64) != 943 { + t.Errorf("expected remaining_requests 943, got %v", entry["remaining_requests"]) + } +} + +func TestStatsRateLimitSeriesEndpoint(t *testing.T) { + e := newRateLimitEnv(t) + e.chat(t, false) + e.srv.Drain() + + req, _ := http.NewRequest("GET", e.proxy.URL+"/stats/rate-limits/series?provider=rl-upstream", nil) + req.Header.Set("Authorization", "Bearer "+e.key) + resp, err := http.DefaultClient.Do(req) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + body, _ := io.ReadAll(resp.Body) + + if resp.StatusCode != 200 { + t.Fatalf("expected 200, got %d: %s", resp.StatusCode, body) + } + var result map[string]any + json.Unmarshal(body, &result) + if result["provider"] != "rl-upstream" { + t.Errorf("expected provider rl-upstream, got %v", result["provider"]) + } +} + +func TestStatsRateLimitSeriesRequiresProvider(t *testing.T) { + e := newRateLimitEnv(t) + + req, _ := http.NewRequest("GET", e.proxy.URL+"/stats/rate-limits/series", nil) + req.Header.Set("Authorization", "Bearer "+e.key) + resp, err := http.DefaultClient.Do(req) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + + if resp.StatusCode != 400 { + t.Fatalf("expected 400, got %d", resp.StatusCode) + } +} + func TestRateLimitGaugesExported(t *testing.T) { e := newRateLimitEnv(t) e.chat(t, false) diff --git a/internal/server/server.go b/internal/server/server.go index fed55e3..abc3c37 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -308,6 +308,8 @@ func (s *Server) Handler() http.Handler { mux.Handle("GET /stats/requests", s.withAuth(s.handleStatsRequests)) mux.Handle("GET /stats/requests/facets", s.withAuth(s.handleStatsFacets)) mux.Handle("GET /stats/errors", s.withAuth(s.handleStatsErrors)) + mux.Handle("GET /stats/rate-limits", s.withAuth(s.handleStatsRateLimits)) + mux.Handle("GET /stats/rate-limits/series", s.withAuth(s.handleStatsRateLimitSeries)) mux.Handle("POST /admin/v1/providers", s.withAdmin(s.handleProviderCreate)) mux.Handle("GET /admin/v1/providers", s.withAdmin(s.handleProviderList)) diff --git a/internal/server/stats.go b/internal/server/stats.go index 0ff3738..2da4736 100644 --- a/internal/server/stats.go +++ b/internal/server/stats.go @@ -3,6 +3,7 @@ package server import ( "net/http" "strings" + "time" "github.com/greyhavenhq/llmproxy/internal/apierr" "github.com/greyhavenhq/llmproxy/internal/store" @@ -137,6 +138,118 @@ func (s *Server) handleStatsRequests(w http.ResponseWriter, r *http.Request, aut s.serveRequestLog(w, r) } +// handleStatsRateLimits returns the current rate-limit snapshot for every +// configured provider: the latest in-memory reading plus a stale flag. +func (s *Server) handleStatsRateLimits(w http.ResponseWriter, r *http.Request, auth *Auth) { + snaps := s.rateLimits.Snapshots() + staleAfter := 5 * time.Minute + + views := make([]map[string]any, 0, len(snaps)) + for _, snap := range snaps { + age := time.Since(snap.ObservedAt) + view := map[string]any{ + "provider": snap.ProviderName, + "provider_id": snap.ProviderID, + "observed_at": snap.ObservedAt.UTC().Format(time.RFC3339), + "stale": age > staleAfter, + } + if snap.LimitRequests != nil { + view["limit_requests"] = *snap.LimitRequests + } + if snap.RemainingRequests != nil { + view["remaining_requests"] = *snap.RemainingRequests + } + if snap.MinRemRequests != nil { + view["min_remaining_requests"] = *snap.MinRemRequests + } + if snap.LimitTokens != nil { + view["limit_tokens"] = *snap.LimitTokens + } + if snap.RemainingTokens != nil { + view["remaining_tokens"] = *snap.RemainingTokens + } + if snap.MinRemTokens != nil { + view["min_remaining_tokens"] = *snap.MinRemTokens + } + if snap.ResetRequestsAt != "" { + view["reset_requests_at"] = snap.ResetRequestsAt + } + if snap.ResetTokensAt != "" { + view["reset_tokens_at"] = snap.ResetTokensAt + } + views = append(views, view) + } + writeJSON(w, 200, map[string]any{"rate_limits": views}) +} + +// handleStatsRateLimitSeries returns stored minute-bucket samples for one +// provider over a time range. +func (s *Server) handleStatsRateLimitSeries(w http.ResponseWriter, r *http.Request, auth *Auth) { + providerName := r.URL.Query().Get("provider") + if providerName == "" { + writeProxyError(w, apierr.New(400, "missing_provider", "'provider' query parameter is required")) + return + } + provider, err := s.store.GetProviderByName(r.Context(), providerName) + if err != nil { + internalErr(w, "failed to load provider") + return + } + if provider == nil { + writeProxyError(w, apierr.Newf(404, "provider_not_found", "no provider named '%s'", providerName)) + return + } + since, perr := parseTimeParam(r.URL.Query().Get("since"), "since") + if perr != nil { + writeProxyError(w, perr) + return + } + until, perr := parseTimeParam(r.URL.Query().Get("until"), "until") + if perr != nil { + writeProxyError(w, perr) + return + } + rows, err := s.store.RateLimitSeries(r.Context(), provider.ID, since, until) + if err != nil { + internalErr(w, "failed to load rate-limit series") + return + } + views := make([]map[string]any, 0, len(rows)) + for _, row := range rows { + view := map[string]any{ + "bucket": row.Bucket, + "observed_at": row.ObservedAt, + "observations": row.Observations, + } + if row.LimitRequests.Valid { + view["limit_requests"] = row.LimitRequests.Int64 + } + if row.RemainingRequests.Valid { + view["remaining_requests"] = row.RemainingRequests.Int64 + } + if row.MinRemainingRequests.Valid { + view["min_remaining_requests"] = row.MinRemainingRequests.Int64 + } + if row.LimitTokens.Valid { + view["limit_tokens"] = row.LimitTokens.Int64 + } + if row.RemainingTokens.Valid { + view["remaining_tokens"] = row.RemainingTokens.Int64 + } + if row.MinRemainingTokens.Valid { + view["min_remaining_tokens"] = row.MinRemainingTokens.Int64 + } + if row.ResetRequestsAt.Valid { + view["reset_requests_at"] = row.ResetRequestsAt.String + } + if row.ResetTokensAt.Valid { + view["reset_tokens_at"] = row.ResetTokensAt.String + } + views = append(views, view) + } + writeJSON(w, 200, map[string]any{"provider": providerName, "series": views}) +} + // handleStatsFacets returns the distinct filter values present in a window, // feeding the request explorer's dropdowns. It reads every event, including // the failures and model-less calls the usage breakdown drops: a request From dc9217aaeae874ea41045a40ee68563a7c67c2fc Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 14 Sep 2026 11:01:46 -0600 Subject: [PATCH 5/8] feat: admin API accepts rate_limit_headers on create and patch Providers return rate_limit_headers in the view, accept them as a key-to-header map on create and patch, and validate against the six accepted metric keys. --- internal/server/admin.go | 86 ++++++++++++++++++++++--------- internal/server/ratelimit_test.go | 66 ++++++++++++++++++++++++ 2 files changed, 127 insertions(+), 25 deletions(-) diff --git a/internal/server/admin.go b/internal/server/admin.go index ee2bb8d..cdf8067 100644 --- a/internal/server/admin.go +++ b/internal/server/admin.go @@ -24,6 +24,23 @@ import ( // usage. Every mutation writes a metadata-only admin event in the same // transaction. No endpoint ever returns a stored credential or key hash. +func validateRateLimitHeaders(m map[string]string) *apierr.ProxyError { + for key := range m { + valid := false + for _, k := range catalog.ValidRateLimitKeys { + if k == key { + valid = true + break + } + } + if !valid { + return apierr.Newf(400, "invalid_rate_limit_key", + "unknown rate limit key '%s'; valid: %v", key, catalog.ValidRateLimitKeys) + } + } + return nil +} + var nameRe = regexp.MustCompile(`^[a-z0-9][a-z0-9._-]*$`) var aliasRe = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._:/-]*$`) @@ -75,21 +92,27 @@ func providerView(p *store.Provider, overrides map[string]string) map[string]any if overrides != nil { view["endpoints"] = overrides } + if p.RateLimitHeaders != "" { + view["rate_limit_headers"] = catalog.ParseRateLimitHeaders(p.RateLimitHeaders) + } else { + view["rate_limit_headers"] = nil + } return view } func (s *Server) handleProviderCreate(w http.ResponseWriter, r *http.Request, auth *Auth) { body := struct { - Name string `json:"name"` - WireFormat string `json:"wire_format"` - BaseURL string `json:"base_url"` - APIKey string `json:"api_key"` - VerifyTLS *bool `json:"verify_tls"` - CAPEM string `json:"ca_pem"` - TimeoutConnect float64 `json:"timeout_connect"` - TimeoutRead float64 `json:"timeout_read"` - MaxConcurrency *int64 `json:"max_concurrency"` - Endpoints map[string]string `json:"endpoints"` + Name string `json:"name"` + WireFormat string `json:"wire_format"` + BaseURL string `json:"base_url"` + APIKey string `json:"api_key"` + VerifyTLS *bool `json:"verify_tls"` + CAPEM string `json:"ca_pem"` + TimeoutConnect float64 `json:"timeout_connect"` + TimeoutRead float64 `json:"timeout_read"` + MaxConcurrency *int64 `json:"max_concurrency"` + Endpoints map[string]string `json:"endpoints"` + RateLimitHeaders map[string]string `json:"rate_limit_headers"` }{WireFormat: "openai", TimeoutConnect: 10, TimeoutRead: 300} if perr := readJSONBody(r, 1<<20, &body); perr != nil { writeProxyError(w, perr) @@ -130,14 +153,19 @@ func (s *Server) handleProviderCreate(w http.ResponseWriter, r *http.Request, au writeProxyError(w, apierr.Newf(409, "provider_exists", "provider '%s' already exists", body.Name)) return } + if perr := validateRateLimitHeaders(body.RateLimitHeaders); perr != nil { + writeProxyError(w, perr) + return + } p := &store.Provider{ - Name: body.Name, - WireFormat: body.WireFormat, - BaseURL: strings.TrimRight(body.BaseURL, "/"), - VerifyTLS: body.VerifyTLS == nil || *body.VerifyTLS, - TimeoutConnect: body.TimeoutConnect, - TimeoutRead: body.TimeoutRead, - Enabled: true, + Name: body.Name, + WireFormat: body.WireFormat, + BaseURL: strings.TrimRight(body.BaseURL, "/"), + VerifyTLS: body.VerifyTLS == nil || *body.VerifyTLS, + TimeoutConnect: body.TimeoutConnect, + TimeoutRead: body.TimeoutRead, + Enabled: true, + RateLimitHeaders: catalog.FormatRateLimitHeaders(body.RateLimitHeaders), } if body.CAPEM != "" { p.CAPEM = sql.NullString{String: body.CAPEM, Valid: true} @@ -205,15 +233,16 @@ func (s *Server) handleProviderGet(w http.ResponseWriter, r *http.Request, auth func (s *Server) handleProviderPatch(w http.ResponseWriter, r *http.Request, auth *Auth) { var body struct { - Enabled *bool `json:"enabled"` - BaseURL *string `json:"base_url"` - APIKey *string `json:"api_key"` - RemoveCredential bool `json:"remove_credential"` - VerifyTLS *bool `json:"verify_tls"` - TimeoutConnect *float64 `json:"timeout_connect"` - TimeoutRead *float64 `json:"timeout_read"` + Enabled *bool `json:"enabled"` + BaseURL *string `json:"base_url"` + APIKey *string `json:"api_key"` + RemoveCredential bool `json:"remove_credential"` + VerifyTLS *bool `json:"verify_tls"` + TimeoutConnect *float64 `json:"timeout_connect"` + TimeoutRead *float64 `json:"timeout_read"` // MaxConcurrency zero or negative clears the cap back to unlimited. - MaxConcurrency *int64 `json:"max_concurrency"` + MaxConcurrency *int64 `json:"max_concurrency"` + RateLimitHeaders *map[string]string `json:"rate_limit_headers"` } if perr := readJSONBody(r, 1<<20, &body); perr != nil { writeProxyError(w, perr) @@ -261,6 +290,13 @@ func (s *Server) handleProviderPatch(w http.ResponseWriter, r *http.Request, aut } provider.CredentialCiphertext = sql.NullString{String: encrypted, Valid: true} } + if body.RateLimitHeaders != nil { + if perr := validateRateLimitHeaders(*body.RateLimitHeaders); perr != nil { + writeProxyError(w, perr) + return + } + provider.RateLimitHeaders = catalog.FormatRateLimitHeaders(*body.RateLimitHeaders) + } audit := &store.Audit{Actor: auth.PrincipalID, Action: "provider.update", TargetKind: "provider", TargetRef: provider.Name} if err := s.store.UpdateProvider(r.Context(), provider, audit); err != nil { internalErr(w, "failed to update provider") diff --git a/internal/server/ratelimit_test.go b/internal/server/ratelimit_test.go index d6fefcf..f2e147f 100644 --- a/internal/server/ratelimit_test.go +++ b/internal/server/ratelimit_test.go @@ -265,6 +265,72 @@ func TestStatsRateLimitSeriesRequiresProvider(t *testing.T) { } } +func TestAdminProviderRateLimitHeadersCreateAndPatch(t *testing.T) { + e := newEnv(t) + + resp, body := e.request(t, "POST", "/admin/v1/providers", e.adminKey, map[string]any{ + "name": "rl-test", + "base_url": "https://example.com/v1", + "rate_limit_headers": map[string]string{ + "limit_requests": "x-ratelimit-limit-requests", + "remaining_requests": "x-ratelimit-remaining-requests", + }, + }) + if resp.StatusCode != 201 { + t.Fatalf("expected 201, got %d: %s", resp.StatusCode, body) + } + result := decode(t, body) + rlh, ok := result["rate_limit_headers"].(map[string]any) + if !ok || len(rlh) != 2 { + t.Fatalf("expected rate_limit_headers map with 2 entries, got %v", result["rate_limit_headers"]) + } + + resp, body = e.request(t, "PATCH", "/admin/v1/providers/rl-test", e.adminKey, map[string]any{ + "rate_limit_headers": map[string]string{ + "limit_tokens": "x-ratelimit-limit-tokens", + "remaining_tokens": "x-ratelimit-remaining-tokens", + }, + }) + if resp.StatusCode != 200 { + t.Fatalf("expected 200, got %d: %s", resp.StatusCode, body) + } + result = decode(t, body) + rlh, ok = result["rate_limit_headers"].(map[string]any) + if !ok || len(rlh) != 2 { + t.Fatalf("expected rate_limit_headers map with 2 entries after patch, got %v", result["rate_limit_headers"]) + } + if rlh["limit_tokens"] != "x-ratelimit-limit-tokens" { + t.Errorf("expected limit_tokens header, got %v", rlh["limit_tokens"]) + } + + // Clear with empty object. + resp, body = e.request(t, "PATCH", "/admin/v1/providers/rl-test", e.adminKey, map[string]any{ + "rate_limit_headers": map[string]string{}, + }) + if resp.StatusCode != 200 { + t.Fatalf("expected 200, got %d: %s", resp.StatusCode, body) + } + result = decode(t, body) + if result["rate_limit_headers"] != nil { + t.Errorf("expected nil rate_limit_headers after clear, got %v", result["rate_limit_headers"]) + } +} + +func TestAdminProviderRateLimitHeadersInvalidKey(t *testing.T) { + e := newEnv(t) + + resp, _ := e.request(t, "POST", "/admin/v1/providers", e.adminKey, map[string]any{ + "name": "rl-bad", + "base_url": "https://example.com/v1", + "rate_limit_headers": map[string]string{ + "bogus_key": "x-whatever", + }, + }) + if resp.StatusCode != 400 { + t.Fatalf("expected 400, got %d", resp.StatusCode) + } +} + func TestRateLimitGaugesExported(t *testing.T) { e := newRateLimitEnv(t) e.chat(t, false) From 206bf6a16ae0a41fee1e0fa6a7734e73ae2247b0 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 14 Sep 2026 11:05:31 -0600 Subject: [PATCH 6/8] feat(ui): provider rate-limit config and usage pane Add rate_limit_headers configuration block to the provider edit form with a "Use standard headers" preset button. Add a Providers sub-tab under Usage that shows one card per configured provider with remaining over limit meters and staleness indicator. --- .../server/uidist/assets/index-BdV0lRac.css | 1 - .../server/uidist/assets/index-By9Rdkkp.js | 296 ------------------ .../server/uidist/assets/index-Denc3dV8.css | 1 + .../server/uidist/assets/index-mJpD-dF1.js | 296 ++++++++++++++++++ internal/server/uidist/index.html | 4 +- ui/src/App.tsx | 2 +- ui/src/components/ProvidersUsage.tsx | 154 +++++++++ ui/src/lib/api.ts | 16 + ui/src/pages/Providers.tsx | 72 +++++ ui/src/pages/Usage.tsx | 4 + 10 files changed, 546 insertions(+), 300 deletions(-) delete mode 100644 internal/server/uidist/assets/index-BdV0lRac.css delete mode 100644 internal/server/uidist/assets/index-By9Rdkkp.js create mode 100644 internal/server/uidist/assets/index-Denc3dV8.css create mode 100644 internal/server/uidist/assets/index-mJpD-dF1.js create mode 100644 ui/src/components/ProvidersUsage.tsx diff --git a/internal/server/uidist/assets/index-BdV0lRac.css b/internal/server/uidist/assets/index-BdV0lRac.css deleted file mode 100644 index b40a4bd..0000000 --- a/internal/server/uidist/assets/index-BdV0lRac.css +++ /dev/null @@ -1 +0,0 @@ -/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:forwards;--tw-animation-iteration-count:1;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-lg:32rem;--container-6xl:72rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-widest:.1em;--leading-relaxed:1.625;--radius-xs:.125rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:"Aspekta", ui-sans-serif, system-ui, sans-serif;--default-mono-font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--color-popover:rgb(var(--popover));--color-popover-foreground:rgb(var(--popover-foreground));--color-border:rgb(var(--border))}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:rgb(var(--border));outline-color:rgb(var(--ring))}@supports (color:color-mix(in lab,red,red)){*{outline-color:color-mix(in oklab,rgb(var(--ring)) 50%,transparent)}}body{background-color:rgb(var(--background));color:rgb(var(--foreground));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Aspekta,ui-sans-serif,system-ui,sans-serif}}@layer components;@layer utilities{.\@container\/card-header{container:card-header/inline-size}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{inset-inline:0}.inset-y-0{inset-block:0}.-top-2{top:calc(var(--spacing) * -2)}.top-0{top:0}.top-1\/2,.top-\[50\%\]{top:50%}.-right-2{right:calc(var(--spacing) * -2)}.right-1{right:var(--spacing)}.right-2{right:calc(var(--spacing) * 2)}.right-8{right:calc(var(--spacing) * 8)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing) * 2)}.left-\[50\%\]{left:50%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.col-start-2{grid-column-start:2}.row-span-2{grid-row:span 2/span 2}.row-start-1{grid-row-start:1}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.mx-auto{margin-inline:auto}.my-1{margin-block:var(--spacing)}.-mt-2{margin-top:calc(var(--spacing) * -2)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mr-1{margin-right:var(--spacing)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-row{display:table-row}.field-sizing-content{field-sizing:content}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.h-0\.5{height:calc(var(--spacing) * .5)}.h-2{height:calc(var(--spacing) * 2)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-16{height:calc(var(--spacing) * 16)}.h-\[1\.15rem\]{height:1.15rem}.h-\[calc\(100\%-1px\)\]{height:calc(100% - 1px)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-full{height:100%}.h-px{height:1px}.max-h-\(--radix-dropdown-menu-content-available-height\){max-height:var(--radix-dropdown-menu-content-available-height)}.max-h-\(--radix-select-content-available-height\){max-height:var(--radix-select-content-available-height)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-96{max-height:calc(var(--spacing) * 96)}.min-h-9{min-height:calc(var(--spacing) * 9)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-screen{min-height:100vh}.w-3{width:calc(var(--spacing) * 3)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-12{width:calc(var(--spacing) * 12)}.w-16{width:calc(var(--spacing) * 16)}.w-24{width:calc(var(--spacing) * 24)}.w-32{width:calc(var(--spacing) * 32)}.w-40{width:calc(var(--spacing) * 40)}.w-44{width:calc(var(--spacing) * 44)}.w-56{width:calc(var(--spacing) * 56)}.w-64{width:calc(var(--spacing) * 64)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.max-w-6xl{max-width:var(--container-6xl)}.max-w-36{max-width:calc(var(--spacing) * 36)}.max-w-40{max-width:calc(var(--spacing) * 40)}.max-w-44{max-width:calc(var(--spacing) * 44)}.max-w-\[85\%\]{max-width:85%}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-full{max-width:100%}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:0}.min-w-32{min-width:calc(var(--spacing) * 32)}.min-w-36{min-width:calc(var(--spacing) * 36)}.min-w-48{min-width:calc(var(--spacing) * 48)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.caption-bottom{caption-side:bottom}.origin-\(--radix-dropdown-menu-content-transform-origin\){transform-origin:var(--radix-dropdown-menu-content-transform-origin)}.origin-\(--radix-select-content-transform-origin\){transform-origin:var(--radix-select-content-transform-origin)}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-\[-50\%\]{--tw-translate-x:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[-50\%\]{--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-180{rotate:180deg}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.scroll-my-1{scroll-margin-block:var(--spacing)}.auto-rows-min{grid-auto-rows:min-content}.\[grid-template-columns\:repeat\(auto-fit\,minmax\(260px\,1fr\)\)\]{grid-template-columns:repeat(auto-fit,minmax(260px,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[minmax\(6rem\,14rem\)_1fr_auto\]{grid-template-columns:minmax(6rem,14rem) 1fr auto}.grid-rows-\[auto_auto\]{grid-template-rows:auto auto}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-x-8{column-gap:calc(var(--spacing) * 8)}.gap-y-1{row-gap:var(--spacing)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.gap-y-4{row-gap:calc(var(--spacing) * 4)}.self-start{align-self:flex-start}.justify-self-end{justify-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[4px\]{border-radius:4px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:calc(var(--radius) + 2px)}.rounded-md{border-radius:var(--radius)}.rounded-sm{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-xs{border-radius:var(--radius-xs)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-border{border-color:rgb(var(--border))}.border-foreground{border-color:rgb(var(--foreground))}.border-input{border-color:rgb(var(--input))}.border-primary\/40{border-color:rgb(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/40{border-color:color-mix(in oklab,rgb(var(--primary)) 40%,transparent)}}.border-transparent{border-color:#0000}.bg-\[\#1a7f37\]{background-color:#1a7f37}.bg-\[\#3b82f6\]{background-color:#3b82f6}.bg-\[\#4b5563\]{background-color:#4b5563}.bg-\[\#9a6700\]{background-color:#9a6700}.bg-\[\#22c55e\]{background-color:#22c55e}.bg-\[\#0969da\]{background-color:#0969da}.bg-\[\#a855f7\]{background-color:#a855f7}.bg-\[\#f97316\]{background-color:#f97316}.bg-\[rgb\(var\(--border\)\)\]{background-color:rgb(var(--border))}.bg-accent{background-color:rgb(var(--accent))}.bg-background{background-color:rgb(var(--background))}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-border{background-color:rgb(var(--border))}.bg-card{background-color:rgb(var(--card))}.bg-chart-1{background-color:rgb(var(--chart-1))}.bg-chart-2{background-color:rgb(var(--chart-2))}.bg-chart-3{background-color:rgb(var(--chart-3))}.bg-chart-5{background-color:rgb(var(--chart-5))}.bg-destructive{background-color:rgb(var(--destructive))}.bg-foreground\/5{background-color:rgb(var(--foreground))}@supports (color:color-mix(in lab,red,red)){.bg-foreground\/5{background-color:color-mix(in oklab,rgb(var(--foreground)) 5%,transparent)}}.bg-muted,.bg-muted\/30{background-color:rgb(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/30{background-color:color-mix(in oklab,rgb(var(--muted)) 30%,transparent)}}.bg-muted\/50{background-color:rgb(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/50{background-color:color-mix(in oklab,rgb(var(--muted)) 50%,transparent)}}.bg-popover{background-color:rgb(var(--popover))}.bg-primary,.bg-primary\/5{background-color:rgb(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/5{background-color:color-mix(in oklab,rgb(var(--primary)) 5%,transparent)}}.bg-secondary{background-color:rgb(var(--secondary))}.bg-transparent{background-color:#0000}.fill-border{fill:rgb(var(--border))}.fill-chart-1{fill:rgb(var(--chart-1))}.fill-chart-2{fill:rgb(var(--chart-2))}.fill-chart-3{fill:rgb(var(--chart-3))}.fill-chart-5{fill:rgb(var(--chart-5))}.fill-current{fill:currentColor}.fill-foreground,.fill-foreground\/5{fill:rgb(var(--foreground))}@supports (color:color-mix(in lab,red,red)){.fill-foreground\/5{fill:color-mix(in oklab,rgb(var(--foreground)) 5%,transparent)}}.fill-muted-foreground{fill:rgb(var(--muted-foreground))}.stroke-border{stroke:rgb(var(--border))}.object-cover{object-fit:cover}.p-1{padding:var(--spacing)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.p-\[3px\]{padding:3px}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0{padding-block:0}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-0{padding-right:0}.pr-1{padding-right:var(--spacing)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-6{padding-right:calc(var(--spacing) * 6)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-14{padding-right:calc(var(--spacing) * 14)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-\[18px\]{padding-left:18px}.pl-\[26px\]{padding-left:26px}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}.font-serif{font-family:"Source Serif 4",Source Serif Pro,Georgia,serif}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-sm\/relaxed{font-size:var(--text-sm);line-height:var(--leading-relaxed)}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.text-balance{text-wrap:balance}.wrap-anywhere{overflow-wrap:anywhere}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent-foreground{color:rgb(var(--accent-foreground))}.text-card-foreground{color:rgb(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:rgb(var(--destructive))}.text-foreground{color:rgb(var(--foreground))}.text-muted-foreground{color:rgb(var(--muted-foreground))}.text-popover-foreground{color:rgb(var(--popover-foreground))}.text-primary{color:rgb(var(--primary))}.text-primary-foreground{color:rgb(var(--primary-foreground))}.text-secondary-foreground{color:rgb(var(--secondary-foreground))}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition-\[color\,box-shadow\]{transition-property:color,box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-none{transition-property:none}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.running{animation-play-state:running}.group-data-\[disabled\=true\]\:pointer-events-none:is(:where(.group)[data-disabled=true] *){pointer-events:none}.group-data-\[disabled\=true\]\:opacity-50:is(:where(.group)[data-disabled=true] *){opacity:.5}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-50:is(:where(.peer):disabled~*){opacity:.5}.selection\:bg-primary ::selection{background-color:rgb(var(--primary))}.selection\:bg-primary::selection{background-color:rgb(var(--primary))}.selection\:text-primary-foreground ::selection{color:rgb(var(--primary-foreground))}.selection\:text-primary-foreground::selection{color:rgb(var(--primary-foreground))}.file\:inline-flex::file-selector-button{display:inline-flex}.file\:h-7::file-selector-button{height:calc(var(--spacing) * 7)}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.file\:text-foreground::file-selector-button{color:rgb(var(--foreground))}.placeholder\:text-muted-foreground::placeholder{color:rgb(var(--muted-foreground))}@media(hover:hover){.hover\:bg-accent:hover{background-color:rgb(var(--accent))}.hover\:bg-destructive\/90:hover{background-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,rgb(var(--destructive)) 90%,transparent)}}.hover\:bg-muted\/30:hover{background-color:rgb(var(--muted))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-muted\/30:hover{background-color:color-mix(in oklab,rgb(var(--muted)) 30%,transparent)}}.hover\:bg-muted\/50:hover{background-color:rgb(var(--muted))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab,rgb(var(--muted)) 50%,transparent)}}.hover\:bg-primary\/90:hover{background-color:rgb(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,rgb(var(--primary)) 90%,transparent)}}.hover\:bg-secondary\/80:hover{background-color:rgb(var(--secondary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,rgb(var(--secondary)) 80%,transparent)}}.hover\:text-accent-foreground:hover{color:rgb(var(--accent-foreground))}.hover\:text-foreground:hover{color:rgb(var(--foreground))}.hover\:underline:hover{text-decoration-line:underline}}.focus\:bg-accent:focus{background-color:rgb(var(--accent))}.focus\:text-accent-foreground:focus{color:rgb(var(--accent-foreground))}.focus-visible\:border-ring:focus-visible{border-color:rgb(var(--ring))}.focus-visible\:stroke-ring:focus-visible{stroke:rgb(var(--ring))}.focus-visible\:\[stroke-width\:2\]:focus-visible{stroke-width:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:color-mix(in oklab, rgb(var(--destructive)) 20%, transparent)}}.focus-visible\:ring-ring:focus-visible,.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:rgb(var(--ring))}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, rgb(var(--ring)) 50%, transparent)}}.focus-visible\:outline-1:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\:outline-ring:focus-visible{outline-color:rgb(var(--ring))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.has-data-\[slot\=card-action\]\:grid-cols-\[1fr_auto\]:has([data-slot=card-action]){grid-template-columns:1fr auto}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing) * 2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing) * 3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing) * 4)}.aria-invalid\:border-destructive[aria-invalid=true]{border-color:rgb(var(--destructive))}.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, rgb(var(--destructive)) 20%, transparent)}}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[inset\]\:pl-8[data-inset]{padding-left:calc(var(--spacing) * 8)}.data-\[orientation\=horizontal\]\:h-px[data-orientation=horizontal]{height:1px}.data-\[orientation\=horizontal\]\:w-full[data-orientation=horizontal]{width:100%}.data-\[orientation\=vertical\]\:h-full[data-orientation=vertical]{height:100%}.data-\[orientation\=vertical\]\:w-px[data-orientation=vertical]{width:1px}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:rgb(var(--muted-foreground))}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:var(--spacing);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:calc(2*var(--spacing)*-1)}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:calc(2*var(--spacing))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:var(--spacing);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:calc(2*var(--spacing)*-1)}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:calc(2*var(--spacing))}.data-\[size\=default\]\:h-9[data-size=default]{height:calc(var(--spacing) * 9)}.data-\[size\=sm\]\:h-8[data-size=sm]{height:calc(var(--spacing) * 8)}:is(.\*\:data-\[slot\=select-value\]\:line-clamp-1>*)[data-slot=select-value]{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}:is(.\*\:data-\[slot\=select-value\]\:flex>*)[data-slot=select-value]{display:flex}:is(.\*\:data-\[slot\=select-value\]\:items-center>*)[data-slot=select-value]{align-items:center}:is(.\*\:data-\[slot\=select-value\]\:gap-2>*)[data-slot=select-value]{gap:calc(var(--spacing) * 2)}.data-\[state\=active\]\:bg-card[data-state=active]{background-color:rgb(var(--card))}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-\[calc\(100\%-2px\)\][data-state=checked]{--tw-translate-x: calc(100% - 2px) ;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[state\=checked\]\:border-primary[data-state=checked]{border-color:rgb(var(--primary))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:rgb(var(--primary))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:rgb(var(--primary-foreground))}.data-\[state\=closed\]\:animate-out[data-state=closed]{animation:exit var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,forwards)}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\[state\=inactive\]\:hidden[data-state=inactive]{display:none}.data-\[state\=open\]\:animate-in[data-state=open]{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,forwards)}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:rgb(var(--accent))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:rgb(var(--accent-foreground))}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:rgb(var(--muted))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-\[\#7F7F79\][data-state=unchecked]{background-color:#7f7f79}.data-\[variant\=destructive\]\:text-destructive[data-variant=destructive]{color:rgb(var(--destructive))}.data-\[variant\=destructive\]\:focus\:bg-destructive\/10[data-variant=destructive]:focus{background-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.data-\[variant\=destructive\]\:focus\:bg-destructive\/10[data-variant=destructive]:focus{background-color:color-mix(in oklab,rgb(var(--destructive)) 10%,transparent)}}.data-\[variant\=destructive\]\:focus\:text-destructive[data-variant=destructive]:focus{color:rgb(var(--destructive))}@media(min-width:40rem){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:max-w-lg{max-width:var(--container-lg)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:p-12{padding:calc(var(--spacing) * 12)}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.dark\:border-input:is(.dark *){border-color:rgb(var(--input))}.dark\:bg-chart-4:is(.dark *){background-color:rgb(var(--chart-4))}.dark\:bg-destructive\/60:is(.dark *){background-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.dark\:bg-destructive\/60:is(.dark *){background-color:color-mix(in oklab,rgb(var(--destructive)) 60%,transparent)}}.dark\:bg-input\/30:is(.dark *){background-color:rgb(var(--input))}@supports (color:color-mix(in lab,red,red)){.dark\:bg-input\/30:is(.dark *){background-color:color-mix(in oklab,rgb(var(--input)) 30%,transparent)}}.dark\:fill-chart-4:is(.dark *){fill:rgb(var(--chart-4))}.dark\:text-muted-foreground:is(.dark *){color:rgb(var(--muted-foreground))}@media(hover:hover){.dark\:hover\:bg-accent\/50:is(.dark *):hover{background-color:rgb(var(--accent))}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-accent\/50:is(.dark *):hover{background-color:color-mix(in oklab,rgb(var(--accent)) 50%,transparent)}}.dark\:hover\:bg-input\/50:is(.dark *):hover{background-color:rgb(var(--input))}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-input\/50:is(.dark *):hover{background-color:color-mix(in oklab,rgb(var(--input)) 50%,transparent)}}}.dark\:focus-visible\:ring-destructive\/40:is(.dark *):focus-visible{--tw-ring-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.dark\:focus-visible\:ring-destructive\/40:is(.dark *):focus-visible{--tw-ring-color:color-mix(in oklab, rgb(var(--destructive)) 40%, transparent)}}.dark\:aria-invalid\:ring-destructive\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.dark\:aria-invalid\:ring-destructive\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, rgb(var(--destructive)) 40%, transparent)}}.dark\:data-\[state\=active\]\:border-input:is(.dark *)[data-state=active]{border-color:rgb(var(--input))}.dark\:data-\[state\=active\]\:bg-input\/30:is(.dark *)[data-state=active]{background-color:rgb(var(--input))}@supports (color:color-mix(in lab,red,red)){.dark\:data-\[state\=active\]\:bg-input\/30:is(.dark *)[data-state=active]{background-color:color-mix(in oklab,rgb(var(--input)) 30%,transparent)}}.dark\:data-\[state\=active\]\:text-foreground:is(.dark *)[data-state=active]{color:rgb(var(--foreground))}.dark\:data-\[state\=checked\]\:bg-primary:is(.dark *)[data-state=checked]{background-color:rgb(var(--primary))}.dark\:data-\[state\=checked\]\:bg-primary-foreground:is(.dark *)[data-state=checked]{background-color:rgb(var(--primary-foreground))}.dark\:data-\[state\=unchecked\]\:bg-foreground:is(.dark *)[data-state=unchecked]{background-color:rgb(var(--foreground))}.dark\:data-\[state\=unchecked\]\:bg-input:is(.dark *)[data-state=unchecked]{background-color:rgb(var(--input))}.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20:is(.dark *)[data-variant=destructive]:focus{background-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20:is(.dark *)[data-variant=destructive]:focus{background-color:color-mix(in oklab,rgb(var(--destructive)) 20%,transparent)}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-6 svg:not([class*=size-]){width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.\[\&_svg\:not\(\[class\*\=\'text-\'\]\)\]\:text-muted-foreground svg:not([class*=text-]){color:rgb(var(--muted-foreground))}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\.border-b\]\:pb-6.border-b{padding-bottom:calc(var(--spacing) * 6)}.\[\.border-t\]\:pt-6.border-t{padding-top:calc(var(--spacing) * 6)}:is(.\*\:\[span\]\:last\:flex>*):is(span):last-child{display:flex}:is(.\*\:\[span\]\:last\:items-center>*):is(span):last-child{align-items:center}:is(.\*\:\[span\]\:last\:gap-2>*):is(span):last-child{gap:calc(var(--spacing) * 2)}:is(.data-\[variant\=destructive\]\:\*\:\[svg\]\:\!text-destructive[data-variant=destructive]>*):is(svg){color:rgb(var(--destructive))!important}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}.\[\&\>a\]\:underline>a{text-decoration-line:underline}.\[\&\>a\]\:underline-offset-4>a{text-underline-offset:4px}.\[\&\>a\:hover\]\:text-primary>a:hover{color:rgb(var(--primary))}.\[\&\>svg\]\:pointer-events-none>svg{pointer-events:none}.\[\&\>svg\]\:size-3>svg{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.\[\&\>svg\]\:size-3\.5>svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\[\&\>tr\]\:last\:border-b-0>tr:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){a.\[a\&\]\:hover\:bg-\[\#1a7f37\]\/90:hover{background-color:#1a7f37e6}a.\[a\&\]\:hover\:bg-\[\#3b82f6\]\/90:hover{background-color:#3b82f6e6}a.\[a\&\]\:hover\:bg-\[\#4b5563\]\/90:hover{background-color:#4b5563e6}a.\[a\&\]\:hover\:bg-\[\#9a6700\]\/90:hover{background-color:#9a6700e6}a.\[a\&\]\:hover\:bg-\[\#22c55e\]\/90:hover{background-color:#22c55ee6}a.\[a\&\]\:hover\:bg-\[\#0969da\]\/90:hover{background-color:#0969dae6}a.\[a\&\]\:hover\:bg-\[\#a855f7\]\/90:hover{background-color:#a855f7e6}a.\[a\&\]\:hover\:bg-\[\#f97316\]\/90:hover{background-color:#f97316e6}a.\[a\&\]\:hover\:bg-accent\/10:hover{background-color:rgb(var(--accent))}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-accent\/10:hover{background-color:color-mix(in oklab,rgb(var(--accent)) 10%,transparent)}}a.\[a\&\]\:hover\:bg-destructive\/90:hover{background-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,rgb(var(--destructive)) 90%,transparent)}}a.\[a\&\]\:hover\:bg-muted:hover,a.\[a\&\]\:hover\:bg-muted\/80:hover{background-color:rgb(var(--muted))}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-muted\/80:hover{background-color:color-mix(in oklab,rgb(var(--muted)) 80%,transparent)}}a.\[a\&\]\:hover\:bg-primary\/90:hover{background-color:rgb(var(--primary))}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,rgb(var(--primary)) 90%,transparent)}}a.\[a\&\]\:hover\:bg-secondary\/90:hover{background-color:rgb(var(--secondary))}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-secondary\/90:hover{background-color:color-mix(in oklab,rgb(var(--secondary)) 90%,transparent)}}a.\[a\&\]\:hover\:text-accent-foreground:hover{color:rgb(var(--accent-foreground))}}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:forwards}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}@font-face{font-family:Aspekta;font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/Aspekta-400.woff2)format("woff2")}@font-face{font-family:Aspekta;font-style:normal;font-weight:500;font-display:swap;src:url(/fonts/Aspekta-500.woff2)format("woff2")}@font-face{font-family:Aspekta;font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/Aspekta-600.woff2)format("woff2")}@font-face{font-family:Aspekta;font-style:normal;font-weight:700;font-display:swap;src:url(/fonts/Aspekta-700.woff2)format("woff2")}:root{--background:240 240 236;--foreground:22 22 20;--card:249 249 247;--card-foreground:22 22 20;--popover:249 249 247;--popover-foreground:22 22 20;--primary:217 94 42;--primary-foreground:249 249 247;--secondary:240 240 236;--secondary-foreground:47 47 44;--muted:240 240 236;--muted-foreground:87 87 83;--accent:221 221 215;--accent-foreground:22 22 20;--destructive:180 50 50;--destructive-foreground:249 249 247;--border:196 196 189;--input:196 196 189;--ring:217 94 42;--chart-1:217 94 42;--chart-2:87 87 83;--chart-3:127 127 121;--chart-4:166 166 159;--chart-5:47 47 44;--radius:.375rem}.dark{--background:22 22 20;--foreground:249 249 247;--card:47 47 44;--card-foreground:249 249 247;--popover:47 47 44;--popover-foreground:249 249 247;--primary:217 94 42;--primary-foreground:249 249 247;--secondary:87 87 83;--secondary-foreground:249 249 247;--muted:87 87 83;--muted-foreground:196 196 189;--accent:87 87 83;--accent-foreground:249 249 247;--destructive:180 50 50;--destructive-foreground:249 249 247;--border:87 87 83;--input:87 87 83;--ring:217 94 42;--chart-1:217 94 42;--chart-2:196 196 189;--chart-3:166 166 159;--chart-4:127 127 121;--chart-5:240 240 236}.chat-markdown{overflow-wrap:break-word;line-height:1.55}.chat-markdown>:first-child{margin-top:0}.chat-markdown>:last-child{margin-bottom:0}.chat-markdown p{margin:.5em 0}.chat-markdown h1,.chat-markdown h2,.chat-markdown h3,.chat-markdown h4,.chat-markdown h5,.chat-markdown h6{margin:1em 0 .4em;font-size:1em;font-weight:600;line-height:1.3}.chat-markdown h1{font-size:1.15em}.chat-markdown h2{font-size:1.08em}.chat-markdown ul,.chat-markdown ol{margin:.5em 0;padding-left:1.4em}.chat-markdown ul{list-style:outside}.chat-markdown ol{list-style:decimal}.chat-markdown li,.chat-markdown li>ul,.chat-markdown li>ol{margin:.2em 0}.chat-markdown li::marker{color:rgb(var(--muted-foreground))}.chat-markdown code{font-family:var(--font-mono);background:rgb(var(--muted));border:1px solid rgb(var(--border) / .6);border-radius:4px;padding:.1em .35em;font-size:.9em}.chat-markdown pre{background:rgb(var(--muted));border:1px solid rgb(var(--border) / .6);border-radius:var(--radius);margin:.6em 0;padding:.6em .75em;overflow-x:auto}.chat-markdown pre code{background:0 0;border:none;padding:0;font-size:.85em;line-height:1.5}.chat-markdown blockquote{border-left:3px solid rgb(var(--border));color:rgb(var(--muted-foreground));margin:.6em 0;padding:.1em 0 .1em .9em}.chat-markdown a{color:rgb(var(--primary));text-underline-offset:2px;text-decoration:underline}.chat-markdown table{border-collapse:collapse;margin:.6em 0;font-size:.95em;display:block;overflow-x:auto}.chat-markdown th,.chat-markdown td{border:1px solid rgb(var(--border));text-align:left;padding:4px 10px}.chat-markdown th{background:rgb(var(--muted));font-weight:600}.chat-markdown hr{border:none;border-top:1px solid rgb(var(--border));margin:1em 0}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0)scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1))rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0)scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1))rotate(var(--tw-exit-rotate,0))}} diff --git a/internal/server/uidist/assets/index-By9Rdkkp.js b/internal/server/uidist/assets/index-By9Rdkkp.js deleted file mode 100644 index c33f413..0000000 --- a/internal/server/uidist/assets/index-By9Rdkkp.js +++ /dev/null @@ -1,296 +0,0 @@ -var w2=Object.defineProperty;var S2=(e,r,a)=>r in e?w2(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a;var lh=(e,r,a)=>S2(e,typeof r!="symbol"?r+"":r,a);function j2(e,r){for(var a=0;al[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))l(s);new MutationObserver(s=>{for(const c of s)if(c.type==="childList")for(const f of c.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&l(f)}).observe(document,{childList:!0,subtree:!0});function a(s){const c={};return s.integrity&&(c.integrity=s.integrity),s.referrerPolicy&&(c.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?c.credentials="include":s.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function l(s){if(s.ep)return;s.ep=!0;const c=a(s);fetch(s.href,c)}})();function gc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ih={exports:{}},Vo={};/** - * @license React - * react-jsx-runtime.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Ny;function k2(){if(Ny)return Vo;Ny=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function a(l,s,c){var f=null;if(c!==void 0&&(f=""+c),s.key!==void 0&&(f=""+s.key),"key"in s){c={};for(var d in s)d!=="key"&&(c[d]=s[d])}else c=s;return s=c.ref,{$$typeof:e,type:l,key:f,ref:s!==void 0?s:null,props:c}}return Vo.Fragment=r,Vo.jsx=a,Vo.jsxs=a,Vo}var Ty;function C2(){return Ty||(Ty=1,ih.exports=k2()),ih.exports}var u=C2(),oh={exports:{}},Fe={};/** - * @license React - * react.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Ay;function E2(){if(Ay)return Fe;Ay=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),f=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),b=Symbol.iterator;function y(L){return L===null||typeof L!="object"?null:(L=b&&L[b]||L["@@iterator"],typeof L=="function"?L:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,T={};function C(L,F,M){this.props=L,this.context=F,this.refs=T,this.updater=M||k}C.prototype.isReactComponent={},C.prototype.setState=function(L,F){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,F,"setState")},C.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function R(){}R.prototype=C.prototype;function D(L,F,M){this.props=L,this.context=F,this.refs=T,this.updater=M||k}var B=D.prototype=new R;B.constructor=D,j(B,C.prototype),B.isPureReactComponent=!0;var O=Array.isArray;function _(){}var A={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function ee(L,F,M){var oe=M.ref;return{$$typeof:e,type:L,key:F,ref:oe!==void 0?oe:null,props:M}}function q(L,F){return ee(L.type,F,L.props)}function $(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function X(L){var F={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(M){return F[M]})}var ce=/\/+/g;function le(L,F){return typeof L=="object"&&L!==null&&L.key!=null?X(""+L.key):F.toString(36)}function W(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(_,_):(L.status="pending",L.then(function(F){L.status==="pending"&&(L.status="fulfilled",L.value=F)},function(F){L.status==="pending"&&(L.status="rejected",L.reason=F)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function U(L,F,M,oe,G){var ue=typeof L;(ue==="undefined"||ue==="boolean")&&(L=null);var re=!1;if(L===null)re=!0;else switch(ue){case"bigint":case"string":case"number":re=!0;break;case"object":switch(L.$$typeof){case e:case r:re=!0;break;case v:return re=L._init,U(re(L._payload),F,M,oe,G)}}if(re)return G=G(L),re=oe===""?"."+le(L,0):oe,O(G)?(M="",re!=null&&(M=re.replace(ce,"$&/")+"/"),U(G,F,M,"",function(be){return be})):G!=null&&($(G)&&(G=q(G,M+(G.key==null||L&&L.key===G.key?"":(""+G.key).replace(ce,"$&/")+"/")+re)),F.push(G)),1;re=0;var ye=oe===""?".":oe+":";if(O(L))for(var fe=0;fe>>1,E=U[K];if(0>>1;Ks(M,ie))oes(G,M)?(U[K]=G,U[oe]=ie,K=oe):(U[K]=M,U[F]=ie,K=F);else if(oes(G,ie))U[K]=G,U[oe]=ie,K=oe;else break e}}return Z}function s(U,Z){var ie=U.sortIndex-Z.sortIndex;return ie!==0?ie:U.id-Z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var f=Date,d=f.now();e.unstable_now=function(){return f.now()-d}}var p=[],h=[],v=1,x=null,b=3,y=!1,k=!1,j=!1,T=!1,C=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function B(U){for(var Z=a(h);Z!==null;){if(Z.callback===null)l(h);else if(Z.startTime<=U)l(h),Z.sortIndex=Z.expirationTime,r(p,Z);else break;Z=a(h)}}function O(U){if(j=!1,B(U),!k)if(a(p)!==null)k=!0,_||(_=!0,X());else{var Z=a(h);Z!==null&&W(O,Z.startTime-U)}}var _=!1,A=-1,I=5,ee=-1;function q(){return T?!0:!(e.unstable_now()-eeU&&q());){var K=x.callback;if(typeof K=="function"){x.callback=null,b=x.priorityLevel;var E=K(x.expirationTime<=U);if(U=e.unstable_now(),typeof E=="function"){x.callback=E,B(U),Z=!0;break t}x===a(p)&&l(p),B(U)}else l(p);x=a(p)}if(x!==null)Z=!0;else{var L=a(h);L!==null&&W(O,L.startTime-U),Z=!1}}break e}finally{x=null,b=ie,y=!1}Z=void 0}}finally{Z?X():_=!1}}}var X;if(typeof D=="function")X=function(){D($)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,le=ce.port2;ce.port1.onmessage=$,X=function(){le.postMessage(null)}}else X=function(){C($,0)};function W(U,Z){A=C(function(){U(e.unstable_now())},Z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125K?(U.sortIndex=ie,r(h,U),a(p)===null&&U===a(h)&&(j?(R(A),A=-1):j=!0,W(O,ie-K))):(U.sortIndex=E,r(p,U),k||y||(k=!0,_||(_=!0,X()))),U},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(U){var Z=b;return function(){var ie=b;b=Z;try{return U.apply(this,arguments)}finally{b=ie}}}})(ch)),ch}var Ry;function A2(){return Ry||(Ry=1,uh.exports=T2()),uh.exports}var fh={exports:{}},hn={};/** - * @license React - * react-dom.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Dy;function _2(){if(Dy)return hn;Dy=1;var e=Am();function r(p){var h="https://react.dev/errors/"+p;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),fh.exports=_2(),fh.exports}/** - * @license React - * react-dom-client.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var zy;function M2(){if(zy)return Go;zy=1;var e=A2(),r=Am(),a=C0();function l(t){var n="https://react.dev/errors/"+t;if(1E||(t.current=K[E],K[E]=null,E--)}function M(t,n){E++,K[E]=t.current,t.current=n}var oe=L(null),G=L(null),ue=L(null),re=L(null);function ye(t,n){switch(M(ue,n),M(G,t),M(oe,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?Qv(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Qv(n),t=Zv(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}F(oe),M(oe,t)}function fe(){F(oe),F(G),F(ue)}function be(t){t.memoizedState!==null&&M(re,t);var n=oe.current,i=Zv(n,t.type);n!==i&&(M(G,t),M(oe,i))}function Ee(t){G.current===t&&(F(oe),F(G)),re.current===t&&(F(re),qo._currentValue=ie)}var Se,Ie;function Be(t){if(Se===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);Se=n&&n[1]||"",Ie=-1)":-1m||H[o]!==J[m]){var se=` -`+H[o].replace(" at new "," at ");return t.displayName&&se.includes("")&&(se=se.replace("",t.displayName)),se}while(1<=o&&0<=m);break}}}finally{_t=!1,Error.prepareStackTrace=i}return(i=t?t.displayName||t.name:"")?Be(i):""}function Et(t,n){switch(t.tag){case 26:case 27:case 5:return Be(t.type);case 16:return Be("Lazy");case 13:return t.child!==n&&n!==null?Be("Suspense Fallback"):Be("Suspense");case 19:return Be("SuspenseList");case 0:case 15:return Ct(t.type,!1);case 11:return Ct(t.type.render,!1);case 1:return Ct(t.type,!0);case 31:return Be("Activity");default:return""}}function Lt(t){try{var n="",i=null;do n+=Et(t,i),i=t,t=t.return;while(t);return n}catch(o){return` -Error generating stack: `+o.message+` -`+o.stack}}var Mt=Object.prototype.hasOwnProperty,Rt=e.unstable_scheduleCallback,zt=e.unstable_cancelCallback,we=e.unstable_shouldYield,mt=e.unstable_requestPaint,Y=e.unstable_now,qe=e.unstable_getCurrentPriorityLevel,ne=e.unstable_ImmediatePriority,z=e.unstable_UserBlockingPriority,de=e.unstable_NormalPriority,ke=e.unstable_LowPriority,De=e.unstable_IdlePriority,en=e.log,kn=e.unstable_setDisableYieldValue,Xt=null,Nt=null;function rn(t){if(typeof en=="function"&&kn(t),Nt&&typeof Nt.setStrictMode=="function")try{Nt.setStrictMode(Xt,t)}catch{}}var it=Math.clz32?Math.clz32:ws,br=Math.log,Bn=Math.LN2;function ws(t){return t>>>=0,t===0?32:31-(br(t)/Bn|0)|0}var xl=256,Zl=262144,ba=4194304;function dn(t){var n=t&42;if(n!==0)return n;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Jl(t,n,i){var o=t.pendingLanes;if(o===0)return 0;var m=0,g=t.suspendedLanes,w=t.pingedLanes;t=t.warmLanes;var N=o&134217727;return N!==0?(o=N&~g,o!==0?m=dn(o):(w&=N,w!==0?m=dn(w):i||(i=N&~t,i!==0&&(m=dn(i))))):(N=o&~g,N!==0?m=dn(N):w!==0?m=dn(w):i||(i=o&~t,i!==0&&(m=dn(i)))),m===0?0:n!==0&&n!==m&&(n&g)===0&&(g=m&-m,i=n&-n,g>=i||g===32&&(i&4194048)!==0)?n:m}function He(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function ht(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 wt(){var t=ba;return ba<<=1,(ba&62914560)===0&&(ba=4194304),t}function yn(t){for(var n=[],i=0;31>i;i++)n.push(t);return n}function an(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function wr(t,n,i,o,m,g){var w=t.pendingLanes;t.pendingLanes=i,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=i,t.entangledLanes&=i,t.errorRecoveryDisabledLanes&=i,t.shellSuspendCounter=0;var N=t.entanglements,H=t.expirationTimes,J=t.hiddenUpdates;for(i=w&~i;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var pk=/[\n"\\]/g;function Kn(t){return t.replace(pk,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Jc(t,n,i,o,m,g,w,N){t.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.type=w:t.removeAttribute("type"),n!=null?w==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Xn(n)):t.value!==""+Xn(n)&&(t.value=""+Xn(n)):w!=="submit"&&w!=="reset"||t.removeAttribute("value"),n!=null?Wc(t,w,Xn(n)):i!=null?Wc(t,w,Xn(i)):o!=null&&t.removeAttribute("value"),m==null&&g!=null&&(t.defaultChecked=!!g),m!=null&&(t.checked=m&&typeof m!="function"&&typeof m!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?t.name=""+Xn(N):t.removeAttribute("name")}function Fp(t,n,i,o,m,g,w,N){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(t.type=g),n!=null||i!=null){if(!(g!=="submit"&&g!=="reset"||n!=null)){Zc(t);return}i=i!=null?""+Xn(i):"",n=n!=null?""+Xn(n):i,N||n===t.value||(t.value=n),t.defaultValue=n}o=o??m,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=N?t.checked:!!o,t.defaultChecked=!!o,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(t.name=w),Zc(t)}function Wc(t,n,i){n==="number"&&ks(t.ownerDocument)===t||t.defaultValue===""+i||(t.defaultValue=""+i)}function ai(t,n,i,o){if(t=t.options,n){n={};for(var m=0;m"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),af=!1;if($r)try{var ao={};Object.defineProperty(ao,"passive",{get:function(){af=!0}}),window.addEventListener("test",ao,ao),window.removeEventListener("test",ao,ao)}catch{af=!1}var Sa=null,lf=null,Es=null;function Zp(){if(Es)return Es;var t,n=lf,i=n.length,o,m="value"in Sa?Sa.value:Sa.textContent,g=m.length;for(t=0;t=oo),rg=" ",ag=!1;function lg(t,n){switch(t){case"keyup":return $k.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ig(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var si=!1;function Vk(t,n){switch(t){case"compositionend":return ig(n);case"keypress":return n.which!==32?null:(ag=!0,rg);case"textInput":return t=n.data,t===rg&&ag?null:t;default:return null}}function Gk(t,n){if(si)return t==="compositionend"||!ff&&lg(t,n)?(t=Zp(),Es=lf=Sa=null,si=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:i,offset:n-t};t=o}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=mg(i)}}function gg(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?gg(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function xg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=ks(t.document);n instanceof t.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)t=n.contentWindow;else break;n=ks(t.document)}return n}function mf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var eC=$r&&"documentMode"in document&&11>=document.documentMode,ui=null,pf=null,fo=null,gf=!1;function vg(t,n,i){var o=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;gf||ui==null||ui!==ks(o)||(o=ui,"selectionStart"in o&&mf(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),fo&&co(fo,o)||(fo=o,o=yu(pf,"onSelect"),0>=w,m-=w,jr=1<<32-it(n)+m|i<Xe?(et=Ae,Ae=null):et=Ae.sibling;var ut=te(V,Ae,Q[Xe],he);if(ut===null){Ae===null&&(Ae=et);break}t&&Ae&&ut.alternate===null&&n(V,Ae),P=g(ut,P,Xe),st===null?Me=ut:st.sibling=ut,st=ut,Ae=et}if(Xe===Q.length)return i(V,Ae),lt&&Vr(V,Xe),Me;if(Ae===null){for(;XeXe?(et=Ae,Ae=null):et=Ae.sibling;var Fa=te(V,Ae,ut.value,he);if(Fa===null){Ae===null&&(Ae=et);break}t&&Ae&&Fa.alternate===null&&n(V,Ae),P=g(Fa,P,Xe),st===null?Me=Fa:st.sibling=Fa,st=Fa,Ae=et}if(ut.done)return i(V,Ae),lt&&Vr(V,Xe),Me;if(Ae===null){for(;!ut.done;Xe++,ut=Q.next())ut=pe(V,ut.value,he),ut!==null&&(P=g(ut,P,Xe),st===null?Me=ut:st.sibling=ut,st=ut);return lt&&Vr(V,Xe),Me}for(Ae=o(Ae);!ut.done;Xe++,ut=Q.next())ut=ae(Ae,V,Xe,ut.value,he),ut!==null&&(t&&ut.alternate!==null&&Ae.delete(ut.key===null?Xe:ut.key),P=g(ut,P,Xe),st===null?Me=ut:st.sibling=ut,st=ut);return t&&Ae.forEach(function(b2){return n(V,b2)}),lt&&Vr(V,Xe),Me}function yt(V,P,Q,he){if(typeof Q=="object"&&Q!==null&&Q.type===j&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case y:e:{for(var Me=Q.key;P!==null;){if(P.key===Me){if(Me=Q.type,Me===j){if(P.tag===7){i(V,P.sibling),he=m(P,Q.props.children),he.return=V,V=he;break e}}else if(P.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===I&&Tl(Me)===P.type){i(V,P.sibling),he=m(P,Q.props),vo(he,Q),he.return=V,V=he;break e}i(V,P);break}else n(V,P);P=P.sibling}Q.type===j?(he=jl(Q.props.children,V.mode,he,Q.key),he.return=V,V=he):(he=Ls(Q.type,Q.key,Q.props,null,V.mode,he),vo(he,Q),he.return=V,V=he)}return w(V);case k:e:{for(Me=Q.key;P!==null;){if(P.key===Me)if(P.tag===4&&P.stateNode.containerInfo===Q.containerInfo&&P.stateNode.implementation===Q.implementation){i(V,P.sibling),he=m(P,Q.children||[]),he.return=V,V=he;break e}else{i(V,P);break}else n(V,P);P=P.sibling}he=jf(Q,V.mode,he),he.return=V,V=he}return w(V);case I:return Q=Tl(Q),yt(V,P,Q,he)}if(W(Q))return Ne(V,P,Q,he);if(X(Q)){if(Me=X(Q),typeof Me!="function")throw Error(l(150));return Q=Me.call(Q),Le(V,P,Q,he)}if(typeof Q.then=="function")return yt(V,P,$s(Q),he);if(Q.$$typeof===D)return yt(V,P,Is(V,Q),he);Fs(V,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,P!==null&&P.tag===6?(i(V,P.sibling),he=m(P,Q),he.return=V,V=he):(i(V,P),he=Sf(Q,V.mode,he),he.return=V,V=he),w(V)):i(V,P)}return function(V,P,Q,he){try{xo=0;var Me=yt(V,P,Q,he);return bi=null,Me}catch(Ae){if(Ae===yi||Ae===qs)throw Ae;var st=Hn(29,Ae,null,V.mode);return st.lanes=he,st.return=V,st}finally{}}}var _l=qg(!0),Pg=qg(!1),Na=!1;function zf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Lf(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ta(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Aa(t,n,i){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(ft&2)!==0){var m=o.pending;return m===null?n.next=n:(n.next=m.next,m.next=n),o.pending=n,n=zs(t),Cg(t,null,i),n}return Os(t,o,n,i),zs(t)}function yo(t,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194048)!==0)){var o=n.lanes;o&=t.pendingLanes,i|=o,n.lanes=i,Cn(t,i)}}function Uf(t,n){var i=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,i===o)){var m=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var w={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};g===null?m=g=w:g=g.next=w,i=i.next}while(i!==null);g===null?m=g=n:g=g.next=n}else m=g=n;i={baseState:o.baseState,firstBaseUpdate:m,lastBaseUpdate:g,shared:o.shared,callbacks:o.callbacks},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=n:t.next=n,i.lastBaseUpdate=n}var Bf=!1;function bo(){if(Bf){var t=vi;if(t!==null)throw t}}function wo(t,n,i,o){Bf=!1;var m=t.updateQueue;Na=!1;var g=m.firstBaseUpdate,w=m.lastBaseUpdate,N=m.shared.pending;if(N!==null){m.shared.pending=null;var H=N,J=H.next;H.next=null,w===null?g=J:w.next=J,w=H;var se=t.alternate;se!==null&&(se=se.updateQueue,N=se.lastBaseUpdate,N!==w&&(N===null?se.firstBaseUpdate=J:N.next=J,se.lastBaseUpdate=H))}if(g!==null){var pe=m.baseState;w=0,se=J=H=null,N=g;do{var te=N.lane&-536870913,ae=te!==N.lane;if(ae?(We&te)===te:(o&te)===te){te!==0&&te===xi&&(Bf=!0),se!==null&&(se=se.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Ne=t,Le=N;te=n;var yt=i;switch(Le.tag){case 1:if(Ne=Le.payload,typeof Ne=="function"){pe=Ne.call(yt,pe,te);break e}pe=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Le.payload,te=typeof Ne=="function"?Ne.call(yt,pe,te):Ne,te==null)break e;pe=x({},pe,te);break e;case 2:Na=!0}}te=N.callback,te!==null&&(t.flags|=64,ae&&(t.flags|=8192),ae=m.callbacks,ae===null?m.callbacks=[te]:ae.push(te))}else ae={lane:te,tag:N.tag,payload:N.payload,callback:N.callback,next:null},se===null?(J=se=ae,H=pe):se=se.next=ae,w|=te;if(N=N.next,N===null){if(N=m.shared.pending,N===null)break;ae=N,N=ae.next,ae.next=null,m.lastBaseUpdate=ae,m.shared.pending=null}}while(!0);se===null&&(H=pe),m.baseState=H,m.firstBaseUpdate=J,m.lastBaseUpdate=se,g===null&&(m.shared.lanes=0),Oa|=w,t.lanes=w,t.memoizedState=pe}}function $g(t,n){if(typeof t!="function")throw Error(l(191,t));t.call(n)}function Fg(t,n){var i=t.callbacks;if(i!==null)for(t.callbacks=null,t=0;tg?g:8;var w=U.T,N={};U.T=N,rd(t,!1,n,i);try{var H=m(),J=U.S;if(J!==null&&J(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var se=uC(H,o);ko(t,n,se,Vn(t))}else ko(t,n,o,Vn(t))}catch(pe){ko(t,n,{then:function(){},status:"rejected",reason:pe},Vn())}finally{Z.p=g,w!==null&&N.types!==null&&(w.types=N.types),U.T=w}}function pC(){}function td(t,n,i,o){if(t.tag!==5)throw Error(l(476));var m=Sx(t).queue;wx(t,m,n,ie,i===null?pC:function(){return jx(t),i(o)})}function Sx(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kr,lastRenderedState:ie},next:null};var i={};return n.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kr,lastRenderedState:i},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function jx(t){var n=Sx(t);n.next===null&&(n=t.alternate.memoizedState),ko(t,n.next.queue,{},Vn())}function nd(){return sn(qo)}function kx(){return Ht().memoizedState}function Cx(){return Ht().memoizedState}function gC(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var i=Vn();t=Ta(i);var o=Aa(n,t,i);o!==null&&(Rn(o,n,i),yo(o,n,i)),n={cache:Mf()},t.payload=n;return}n=n.return}}function xC(t,n,i){var o=Vn();i={lane:o,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},eu(t)?Nx(n,i):(i=bf(t,n,i,o),i!==null&&(Rn(i,t,o),Tx(i,n,o)))}function Ex(t,n,i){var o=Vn();ko(t,n,i,o)}function ko(t,n,i,o){var m={lane:o,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(eu(t))Nx(n,m);else{var g=t.alternate;if(t.lanes===0&&(g===null||g.lanes===0)&&(g=n.lastRenderedReducer,g!==null))try{var w=n.lastRenderedState,N=g(w,i);if(m.hasEagerState=!0,m.eagerState=N,In(N,w))return Os(t,n,m,0),St===null&&Ds(),!1}catch{}finally{}if(i=bf(t,n,m,o),i!==null)return Rn(i,t,o),Tx(i,n,o),!0}return!1}function rd(t,n,i,o){if(o={lane:2,revertLane:zd(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},eu(t)){if(n)throw Error(l(479))}else n=bf(t,i,o,2),n!==null&&Rn(n,t,2)}function eu(t){var n=t.alternate;return t===Ye||n!==null&&n===Ye}function Nx(t,n){Si=Ys=!0;var i=t.pending;i===null?n.next=n:(n.next=i.next,i.next=n),t.pending=n}function Tx(t,n,i){if((i&4194048)!==0){var o=n.lanes;o&=t.pendingLanes,i|=o,n.lanes=i,Cn(t,i)}}var Co={readContext:sn,use:Qs,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useLayoutEffect:Ut,useInsertionEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useSyncExternalStore:Ut,useId:Ut,useHostTransitionStatus:Ut,useFormState:Ut,useActionState:Ut,useOptimistic:Ut,useMemoCache:Ut,useCacheRefresh:Ut};Co.useEffectEvent=Ut;var Ax={readContext:sn,use:Qs,useCallback:function(t,n){return bn().memoizedState=[t,n===void 0?null:n],t},useContext:sn,useEffect:dx,useImperativeHandle:function(t,n,i){i=i!=null?i.concat([t]):null,Js(4194308,4,gx.bind(null,n,t),i)},useLayoutEffect:function(t,n){return Js(4194308,4,t,n)},useInsertionEffect:function(t,n){Js(4,2,t,n)},useMemo:function(t,n){var i=bn();n=n===void 0?null:n;var o=t();if(Ml){rn(!0);try{t()}finally{rn(!1)}}return i.memoizedState=[o,n],o},useReducer:function(t,n,i){var o=bn();if(i!==void 0){var m=i(n);if(Ml){rn(!0);try{i(n)}finally{rn(!1)}}}else m=n;return o.memoizedState=o.baseState=m,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:m},o.queue=t,t=t.dispatch=xC.bind(null,Ye,t),[o.memoizedState,t]},useRef:function(t){var n=bn();return t={current:t},n.memoizedState=t},useState:function(t){t=Qf(t);var n=t.queue,i=Ex.bind(null,Ye,n);return n.dispatch=i,[t.memoizedState,i]},useDebugValue:Wf,useDeferredValue:function(t,n){var i=bn();return ed(i,t,n)},useTransition:function(){var t=Qf(!1);return t=wx.bind(null,Ye,t.queue,!0,!1),bn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,i){var o=Ye,m=bn();if(lt){if(i===void 0)throw Error(l(407));i=i()}else{if(i=n(),St===null)throw Error(l(349));(We&127)!==0||Qg(o,n,i)}m.memoizedState=i;var g={value:i,getSnapshot:n};return m.queue=g,dx(Jg.bind(null,o,g,t),[t]),o.flags|=2048,ki(9,{destroy:void 0},Zg.bind(null,o,g,i,n),null),i},useId:function(){var t=bn(),n=St.identifierPrefix;if(lt){var i=kr,o=jr;i=(o&~(1<<32-it(o)-1)).toString(32)+i,n="_"+n+"R_"+i,i=Xs++,0<\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof o.is=="string"?w.createElement("select",{is:o.is}):w.createElement("select"),o.multiple?g.multiple=!0:o.size&&(g.size=o.size);break;default:g=typeof o.is=="string"?w.createElement(m,{is:o.is}):w.createElement(m)}}g[ln]=n,g[En]=o;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)g.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===n)break e;for(;w.sibling===null;){if(w.return===null||w.return===n)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}n.stateNode=g;e:switch(cn(g,m,o),m){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Zr(n)}}return At(n),xd(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,i),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==o&&Zr(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(l(166));if(t=ue.current,pi(n)){if(t=n.stateNode,i=n.memoizedProps,o=null,m=on,m!==null)switch(m.tag){case 27:case 5:o=m.memoizedProps}t[ln]=n,t=!!(t.nodeValue===i||o!==null&&o.suppressHydrationWarning===!0||Xv(t.nodeValue,i)),t||Ca(n,!0)}else t=bu(t).createTextNode(o),t[ln]=n,n.stateNode=t}return At(n),null;case 31:if(i=n.memoizedState,t===null||t.memoizedState!==null){if(o=pi(n),i!==null){if(t===null){if(!o)throw Error(l(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[ln]=n}else kl(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;At(n),t=!1}else i=Nf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=i),t=!0;if(!t)return n.flags&256?(Pn(n),n):(Pn(n),null);if((n.flags&128)!==0)throw Error(l(558))}return At(n),null;case 13:if(o=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(m=pi(n),o!==null&&o.dehydrated!==null){if(t===null){if(!m)throw Error(l(318));if(m=n.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(l(317));m[ln]=n}else kl(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;At(n),m=!1}else m=Nf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=m),m=!0;if(!m)return n.flags&256?(Pn(n),n):(Pn(n),null)}return Pn(n),(n.flags&128)!==0?(n.lanes=i,n):(i=o!==null,t=t!==null&&t.memoizedState!==null,i&&(o=n.child,m=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(m=o.alternate.memoizedState.cachePool.pool),g=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(g=o.memoizedState.cachePool.pool),g!==m&&(o.flags|=2048)),i!==t&&i&&(n.child.flags|=8192),lu(n,n.updateQueue),At(n),null);case 4:return fe(),t===null&&Id(n.stateNode.containerInfo),At(n),null;case 10:return Yr(n.type),At(n),null;case 19:if(F(It),o=n.memoizedState,o===null)return At(n),null;if(m=(n.flags&128)!==0,g=o.rendering,g===null)if(m)No(o,!1);else{if(Bt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(g=Gs(t),g!==null){for(n.flags|=128,No(o,!1),t=g.updateQueue,n.updateQueue=t,lu(n,t),n.subtreeFlags=0,t=i,i=n.child;i!==null;)Eg(i,t),i=i.sibling;return M(It,It.current&1|2),lt&&Vr(n,o.treeForkCount),n.child}t=t.sibling}o.tail!==null&&Y()>cu&&(n.flags|=128,m=!0,No(o,!1),n.lanes=4194304)}else{if(!m)if(t=Gs(g),t!==null){if(n.flags|=128,m=!0,t=t.updateQueue,n.updateQueue=t,lu(n,t),No(o,!0),o.tail===null&&o.tailMode==="hidden"&&!g.alternate&&!lt)return At(n),null}else 2*Y()-o.renderingStartTime>cu&&i!==536870912&&(n.flags|=128,m=!0,No(o,!1),n.lanes=4194304);o.isBackwards?(g.sibling=n.child,n.child=g):(t=o.last,t!==null?t.sibling=g:n.child=g,o.last=g)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Y(),t.sibling=null,i=It.current,M(It,m?i&1|2:i&1),lt&&Vr(n,o.treeForkCount),t):(At(n),null);case 22:case 23:return Pn(n),Hf(),o=n.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(i&536870912)!==0&&(n.flags&128)===0&&(At(n),n.subtreeFlags&6&&(n.flags|=8192)):At(n),i=n.updateQueue,i!==null&&lu(n,i.retryQueue),i=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==i&&(n.flags|=2048),t!==null&&F(Nl),null;case 24:return i=null,t!==null&&(i=t.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),Yr(Pt),At(n),null;case 25:return null;case 30:return null}throw Error(l(156,n.tag))}function SC(t,n){switch(Cf(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return Yr(Pt),fe(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return Ee(n),null;case 31:if(n.memoizedState!==null){if(Pn(n),n.alternate===null)throw Error(l(340));kl()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(Pn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(l(340));kl()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return F(It),null;case 4:return fe(),null;case 10:return Yr(n.type),null;case 22:case 23:return Pn(n),Hf(),t!==null&&F(Nl),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return Yr(Pt),null;case 25:return null;default:return null}}function Wx(t,n){switch(Cf(n),n.tag){case 3:Yr(Pt),fe();break;case 26:case 27:case 5:Ee(n);break;case 4:fe();break;case 31:n.memoizedState!==null&&Pn(n);break;case 13:Pn(n);break;case 19:F(It);break;case 10:Yr(n.type);break;case 22:case 23:Pn(n),Hf(),t!==null&&F(Nl);break;case 24:Yr(Pt)}}function To(t,n){try{var i=n.updateQueue,o=i!==null?i.lastEffect:null;if(o!==null){var m=o.next;i=m;do{if((i.tag&t)===t){o=void 0;var g=i.create,w=i.inst;o=g(),w.destroy=o}i=i.next}while(i!==m)}}catch(N){gt(n,n.return,N)}}function Ra(t,n,i){try{var o=n.updateQueue,m=o!==null?o.lastEffect:null;if(m!==null){var g=m.next;o=g;do{if((o.tag&t)===t){var w=o.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,m=n;var H=i,J=N;try{J()}catch(se){gt(m,H,se)}}}o=o.next}while(o!==g)}}catch(se){gt(n,n.return,se)}}function ev(t){var n=t.updateQueue;if(n!==null){var i=t.stateNode;try{Fg(n,i)}catch(o){gt(t,t.return,o)}}}function tv(t,n,i){i.props=Rl(t.type,t.memoizedProps),i.state=t.memoizedState;try{i.componentWillUnmount()}catch(o){gt(t,n,o)}}function Ao(t,n){try{var i=t.ref;if(i!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof i=="function"?t.refCleanup=i(o):i.current=o}}catch(m){gt(t,n,m)}}function Cr(t,n){var i=t.ref,o=t.refCleanup;if(i!==null)if(typeof o=="function")try{o()}catch(m){gt(t,n,m)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(m){gt(t,n,m)}else i.current=null}function nv(t){var n=t.type,i=t.memoizedProps,o=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":i.autoFocus&&o.focus();break e;case"img":i.src?o.src=i.src:i.srcSet&&(o.srcset=i.srcSet)}}catch(m){gt(t,t.return,m)}}function vd(t,n,i){try{var o=t.stateNode;FC(o,t.type,i,n),o[En]=n}catch(m){gt(t,t.return,m)}}function rv(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ia(t.type)||t.tag===4}function yd(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||rv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Ia(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function bd(t,n,i){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(t,n):(n=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,n.appendChild(t),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=Pr));else if(o!==4&&(o===27&&Ia(t.type)&&(i=t.stateNode,n=null),t=t.child,t!==null))for(bd(t,n,i),t=t.sibling;t!==null;)bd(t,n,i),t=t.sibling}function iu(t,n,i){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?i.insertBefore(t,n):i.appendChild(t);else if(o!==4&&(o===27&&Ia(t.type)&&(i=t.stateNode),t=t.child,t!==null))for(iu(t,n,i),t=t.sibling;t!==null;)iu(t,n,i),t=t.sibling}function av(t){var n=t.stateNode,i=t.memoizedProps;try{for(var o=t.type,m=n.attributes;m.length;)n.removeAttributeNode(m[0]);cn(n,o,i),n[ln]=t,n[En]=i}catch(g){gt(t,t.return,g)}}var Jr=!1,Vt=!1,wd=!1,lv=typeof WeakSet=="function"?WeakSet:Set,nn=null;function jC(t,n){if(t=t.containerInfo,Pd=Nu,t=xg(t),mf(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var o=i.getSelection&&i.getSelection();if(o&&o.rangeCount!==0){i=o.anchorNode;var m=o.anchorOffset,g=o.focusNode;o=o.focusOffset;try{i.nodeType,g.nodeType}catch{i=null;break e}var w=0,N=-1,H=-1,J=0,se=0,pe=t,te=null;t:for(;;){for(var ae;pe!==i||m!==0&&pe.nodeType!==3||(N=w+m),pe!==g||o!==0&&pe.nodeType!==3||(H=w+o),pe.nodeType===3&&(w+=pe.nodeValue.length),(ae=pe.firstChild)!==null;)te=pe,pe=ae;for(;;){if(pe===t)break t;if(te===i&&++J===m&&(N=w),te===g&&++se===o&&(H=w),(ae=pe.nextSibling)!==null)break;pe=te,te=pe.parentNode}pe=ae}i=N===-1||H===-1?null:{start:N,end:H}}else i=null}i=i||{start:0,end:0}}else i=null;for($d={focusedElem:t,selectionRange:i},Nu=!1,nn=n;nn!==null;)if(n=nn,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,nn=t;else for(;nn!==null;){switch(n=nn,g=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(i=0;i title"))),cn(g,o,i),g[ln]=t,tn(g),o=g;break e;case"link":var w=fy("link","href",m).get(o+(i.href||""));if(w){for(var N=0;Nyt&&(w=yt,yt=Le,Le=w);var V=pg(N,Le),P=pg(N,yt);if(V&&P&&(ae.rangeCount!==1||ae.anchorNode!==V.node||ae.anchorOffset!==V.offset||ae.focusNode!==P.node||ae.focusOffset!==P.offset)){var Q=pe.createRange();Q.setStart(V.node,V.offset),ae.removeAllRanges(),Le>yt?(ae.addRange(Q),ae.extend(P.node,P.offset)):(Q.setEnd(P.node,P.offset),ae.addRange(Q))}}}}for(pe=[],ae=N;ae=ae.parentNode;)ae.nodeType===1&&pe.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;Ni?32:i,U.T=null,i=Td,Td=null;var g=La,w=ra;if(Kt=0,Ai=La=null,ra=0,(ft&6)!==0)throw Error(l(331));var N=ft;if(ft|=4,gv(g.current),hv(g,g.current,w,i),ft=N,zo(0,!1),Nt&&typeof Nt.onPostCommitFiberRoot=="function")try{Nt.onPostCommitFiberRoot(Xt,g)}catch{}return!0}finally{Z.p=m,U.T=o,Ov(t,n)}}function Lv(t,n,i){n=Zn(i,n),n=od(t.stateNode,n,2),t=Aa(t,n,2),t!==null&&(an(t,2),Er(t))}function gt(t,n,i){if(t.tag===3)Lv(t,t,i);else for(;n!==null;){if(n.tag===3){Lv(n,t,i);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(za===null||!za.has(o))){t=Zn(i,t),i=Ux(2),o=Aa(n,i,2),o!==null&&(Bx(i,o,n,t),an(o,2),Er(o));break}}n=n.return}}function Rd(t,n,i){var o=t.pingCache;if(o===null){o=t.pingCache=new EC;var m=new Set;o.set(n,m)}else m=o.get(n),m===void 0&&(m=new Set,o.set(n,m));m.has(i)||(kd=!0,m.add(i),t=MC.bind(null,t,n,i),n.then(t,t))}function MC(t,n,i){var o=t.pingCache;o!==null&&o.delete(n),t.pingedLanes|=t.suspendedLanes&i,t.warmLanes&=~i,St===t&&(We&i)===i&&(Bt===4||Bt===3&&(We&62914560)===We&&300>Y()-uu?(ft&2)===0&&_i(t,0):Cd|=i,Ti===We&&(Ti=0)),Er(t)}function Uv(t,n){n===0&&(n=wt()),t=Sl(t,n),t!==null&&(an(t,n),Er(t))}function RC(t){var n=t.memoizedState,i=0;n!==null&&(i=n.retryLane),Uv(t,i)}function DC(t,n){var i=0;switch(t.tag){case 31:case 13:var o=t.stateNode,m=t.memoizedState;m!==null&&(i=m.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(l(314))}o!==null&&o.delete(n),Uv(t,i)}function OC(t,n){return Rt(t,n)}var gu=null,Ri=null,Dd=!1,xu=!1,Od=!1,Ba=0;function Er(t){t!==Ri&&t.next===null&&(Ri===null?gu=Ri=t:Ri=Ri.next=t),xu=!0,Dd||(Dd=!0,LC())}function zo(t,n){if(!Od&&xu){Od=!0;do for(var i=!1,o=gu;o!==null;){if(t!==0){var m=o.pendingLanes;if(m===0)var g=0;else{var w=o.suspendedLanes,N=o.pingedLanes;g=(1<<31-it(42|t)+1)-1,g&=m&~(w&~N),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(i=!0,qv(o,g))}else g=We,g=Jl(o,o===St?g:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(g&3)===0||He(o,g)||(i=!0,qv(o,g));o=o.next}while(i);Od=!1}}function zC(){Bv()}function Bv(){xu=Dd=!1;var t=0;Ba!==0&&GC()&&(t=Ba);for(var n=Y(),i=null,o=gu;o!==null;){var m=o.next,g=Iv(o,n);g===0?(o.next=null,i===null?gu=m:i.next=m,m===null&&(Ri=i)):(i=o,(t!==0||(g&3)!==0)&&(xu=!0)),o=m}Kt!==0&&Kt!==5||zo(t),Ba!==0&&(Ba=0)}function Iv(t,n){for(var i=t.suspendedLanes,o=t.pingedLanes,m=t.expirationTimes,g=t.pendingLanes&-62914561;0N)break;var se=H.transferSize,pe=H.initiatorType;se&&Kv(pe)&&(H=H.responseEnd,w+=se*(H"u"?null:document;function oy(t,n,i){var o=Di;if(o&&typeof n=="string"&&n){var m=Kn(n);m='link[rel="'+t+'"][href="'+m+'"]',typeof i=="string"&&(m+='[crossorigin="'+i+'"]'),iy.has(m)||(iy.add(m),t={rel:t,crossOrigin:i,href:n},o.querySelector(m)===null&&(n=o.createElement("link"),cn(n,"link",t),tn(n),o.head.appendChild(n)))}}function t2(t){aa.D(t),oy("dns-prefetch",t,null)}function n2(t,n){aa.C(t,n),oy("preconnect",t,n)}function r2(t,n,i){aa.L(t,n,i);var o=Di;if(o&&t&&n){var m='link[rel="preload"][as="'+Kn(n)+'"]';n==="image"&&i&&i.imageSrcSet?(m+='[imagesrcset="'+Kn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(m+='[imagesizes="'+Kn(i.imageSizes)+'"]')):m+='[href="'+Kn(t)+'"]';var g=m;switch(n){case"style":g=Oi(t);break;case"script":g=zi(t)}rr.has(g)||(t=x({rel:"preload",href:n==="image"&&i&&i.imageSrcSet?void 0:t,as:n},i),rr.set(g,t),o.querySelector(m)!==null||n==="style"&&o.querySelector(Io(g))||n==="script"&&o.querySelector(Ho(g))||(n=o.createElement("link"),cn(n,"link",t),tn(n),o.head.appendChild(n)))}}function a2(t,n){aa.m(t,n);var i=Di;if(i&&t){var o=n&&typeof n.as=="string"?n.as:"script",m='link[rel="modulepreload"][as="'+Kn(o)+'"][href="'+Kn(t)+'"]',g=m;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=zi(t)}if(!rr.has(g)&&(t=x({rel:"modulepreload",href:t},n),rr.set(g,t),i.querySelector(m)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Ho(g)))return}o=i.createElement("link"),cn(o,"link",t),tn(o),i.head.appendChild(o)}}}function l2(t,n,i){aa.S(t,n,i);var o=Di;if(o&&t){var m=ni(o).hoistableStyles,g=Oi(t);n=n||"default";var w=m.get(g);if(!w){var N={loading:0,preload:null};if(w=o.querySelector(Io(g)))N.loading=5;else{t=x({rel:"stylesheet",href:t,"data-precedence":n},i),(i=rr.get(g))&&Qd(t,i);var H=w=o.createElement("link");tn(H),cn(H,"link",t),H._p=new Promise(function(J,se){H.onload=J,H.onerror=se}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Su(w,n,o)}w={type:"stylesheet",instance:w,count:1,state:N},m.set(g,w)}}}function i2(t,n){aa.X(t,n);var i=Di;if(i&&t){var o=ni(i).hoistableScripts,m=zi(t),g=o.get(m);g||(g=i.querySelector(Ho(m)),g||(t=x({src:t,async:!0},n),(n=rr.get(m))&&Zd(t,n),g=i.createElement("script"),tn(g),cn(g,"link",t),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},o.set(m,g))}}function o2(t,n){aa.M(t,n);var i=Di;if(i&&t){var o=ni(i).hoistableScripts,m=zi(t),g=o.get(m);g||(g=i.querySelector(Ho(m)),g||(t=x({src:t,async:!0,type:"module"},n),(n=rr.get(m))&&Zd(t,n),g=i.createElement("script"),tn(g),cn(g,"link",t),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},o.set(m,g))}}function sy(t,n,i,o){var m=(m=ue.current)?wu(m):null;if(!m)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(n=Oi(i.href),i=ni(m).hoistableStyles,o=i.get(n),o||(o={type:"style",instance:null,count:0,state:null},i.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){t=Oi(i.href);var g=ni(m).hoistableStyles,w=g.get(t);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(t,w),(g=m.querySelector(Io(t)))&&!g._p&&(w.instance=g,w.state.loading=5),rr.has(t)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},rr.set(t,i),g||s2(m,t,i,w.state))),n&&o===null)throw Error(l(528,""));return w}if(n&&o!==null)throw Error(l(529,""));return null;case"script":return n=i.async,i=i.src,typeof i=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=zi(i),i=ni(m).hoistableScripts,o=i.get(n),o||(o={type:"script",instance:null,count:0,state:null},i.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function Oi(t){return'href="'+Kn(t)+'"'}function Io(t){return'link[rel="stylesheet"]['+t+"]"}function uy(t){return x({},t,{"data-precedence":t.precedence,precedence:null})}function s2(t,n,i,o){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=t.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),cn(n,"link",i),tn(n),t.head.appendChild(n))}function zi(t){return'[src="'+Kn(t)+'"]'}function Ho(t){return"script[async]"+t}function cy(t,n,i){if(n.count++,n.instance===null)switch(n.type){case"style":var o=t.querySelector('style[data-href~="'+Kn(i.href)+'"]');if(o)return n.instance=o,tn(o),o;var m=x({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),tn(o),cn(o,"style",m),Su(o,i.precedence,t),n.instance=o;case"stylesheet":m=Oi(i.href);var g=t.querySelector(Io(m));if(g)return n.state.loading|=4,n.instance=g,tn(g),g;o=uy(i),(m=rr.get(m))&&Qd(o,m),g=(t.ownerDocument||t).createElement("link"),tn(g);var w=g;return w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),cn(g,"link",o),n.state.loading|=4,Su(g,i.precedence,t),n.instance=g;case"script":return g=zi(i.src),(m=t.querySelector(Ho(g)))?(n.instance=m,tn(m),m):(o=i,(m=rr.get(g))&&(o=x({},i),Zd(o,m)),t=t.ownerDocument||t,m=t.createElement("script"),tn(m),cn(m,"link",o),t.head.appendChild(m),n.instance=m);case"void":return null;default:throw Error(l(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Su(o,i.precedence,t));return n.instance}function Su(t,n,i){for(var o=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=o.length?o[o.length-1]:null,g=m,w=0;w title"):null)}function u2(t,n,i){if(i===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return t=n.disabled,typeof n.precedence=="string"&&t==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function hy(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function c2(t,n,i,o){if(i.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var m=Oi(o.href),g=n.querySelector(Io(m));if(g){n=g._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=ku.bind(t),n.then(t,t)),i.state.loading|=4,i.instance=g,tn(g);return}g=n.ownerDocument||n,o=uy(o),(m=rr.get(m))&&Qd(o,m),g=g.createElement("link"),tn(g);var w=g;w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),cn(g,"link",o),i.instance=g}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(i,n),(n=i.state.preload)&&(i.state.loading&3)===0&&(t.count++,i=ku.bind(t),n.addEventListener("load",i),n.addEventListener("error",i))}}var Jd=0;function f2(t,n){return t.stylesheets&&t.count===0&&Eu(t,t.stylesheets),0Jd?50:800)+n);return t.unsuspend=i,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(m)}}:null}function ku(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Eu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Cu=null;function Eu(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Cu=new Map,n.forEach(d2,t),Cu=null,ku.call(t))}function d2(t,n){if(!(n.state.loading&4)){var i=Cu.get(t);if(i)var o=i.get(null);else{i=new Map,Cu.set(t,i);for(var m=t.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),sh.exports=M2(),sh.exports}var D2=R2();class xc extends Error{constructor(a,l,s){super(a);lh(this,"code");lh(this,"status");this.code=l,this.status=s}}async function Ou(e,r,a){const l=await fetch(r,{method:e,headers:a!==void 0?{"Content-Type":"application/json"}:void 0,body:a!==void 0?JSON.stringify(a):void 0,credentials:"same-origin"}),s=await l.text();let c=null;try{c=s?JSON.parse(s):null}catch{}if(!l.ok){const f=c==null?void 0:c.error;throw new xc((f==null?void 0:f.message)??`HTTP ${l.status}`,(f==null?void 0:f.code)??"http_error",l.status)}return c}const Pe={get:e=>Ou("GET",e),post:(e,r)=>Ou("POST",e,r),patch:(e,r)=>Ou("PATCH",e,r),del:e=>Ou("DELETE",e)};function oa(e,r){for(const a of e.split(",")){const l=a.indexOf(":");if(l>0&&a.slice(0,l)===r)return a.slice(l+1)}return""}function O2(e){return e?e.split(",").filter(Boolean):[]}function z2(e){return e.trim().split(" ")[0]||"unknown"}function ns(e){return e.trim().split(" ")[0].split("/")[0]||"unknown"}function Jh(e){if(e<1e3)return`${e} ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const r=Math.round(e/1e3),a=Math.floor(r/60),l=r%60;return`${a}m ${String(l).padStart(2,"0")}s`}function _m(e){return e==null?"unpriced":`$${e.toFixed(6)}`}function Rr(e){return e==null?"unpriced":e===0?"$0":e<.01?`$${e.toFixed(5)}`:e<1e3?`$${e.toFixed(2)}`:`$${new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e)}`}function qt(e){return e?new Intl.NumberFormat().format(e):""}function zn(e){return new Intl.NumberFormat().format(e)}function Re(e){return Math.abs(e)<1e3?new Intl.NumberFormat().format(e):new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1}).format(e)}function E0(e){if(!e)return"";const r=new Date(e);return isNaN(r.getTime())?e:r.toLocaleString()}function Wa(e){if(!e)return"";const r=new Date(e);return isNaN(r.getTime())?e:r.toLocaleDateString()}function N0(e){var r,a,l="";if(typeof e=="string"||typeof e=="number")l+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(r=0;r{const a=new Array(e.length+r.length);for(let l=0;l({classGroupId:e,validator:r}),A0=(e=new Map,r=null,a)=>({nextPart:e,validators:r,classGroupId:a}),nc="-",Uy=[],B2="arbitrary..",I2=e=>{const r=q2(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:l}=e;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return H2(f);const d=f.split(nc),p=d[0]===""&&d.length>1?1:0;return _0(d,p,r)},getConflictingClassGroupIds:(f,d)=>{if(d){const p=l[f],h=a[f];return p?h?L2(h,p):p:h||Uy}return a[f]||Uy}}},_0=(e,r,a)=>{if(e.length-r===0)return a.classGroupId;const s=e[r],c=a.nextPart.get(s);if(c){const h=_0(e,r+1,c);if(h)return h}const f=a.validators;if(f===null)return;const d=r===0?e.join(nc):e.slice(r).join(nc),p=f.length;for(let h=0;he.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=e.slice(1,-1),a=r.indexOf(":"),l=r.slice(0,a);return l?B2+l:void 0})(),q2=e=>{const{theme:r,classGroups:a}=e;return P2(a,r)},P2=(e,r)=>{const a=A0();for(const l in e){const s=e[l];Mm(s,a,l,r)}return a},Mm=(e,r,a,l)=>{const s=e.length;for(let c=0;c{if(typeof e=="string"){F2(e,r,a);return}if(typeof e=="function"){V2(e,r,a,l);return}G2(e,r,a,l)},F2=(e,r,a)=>{const l=e===""?r:M0(r,e);l.classGroupId=a},V2=(e,r,a,l)=>{if(Y2(e)){Mm(e(l),r,a,l);return}r.validators===null&&(r.validators=[]),r.validators.push(U2(a,e))},G2=(e,r,a,l)=>{const s=Object.entries(e),c=s.length;for(let f=0;f{let a=e;const l=r.split(nc),s=l.length;for(let c=0;c"isThemeGetter"in e&&e.isThemeGetter===!0,X2=e=>{if(e<1)return{get:()=>{},set:()=>{}};let r=0,a=Object.create(null),l=Object.create(null);const s=(c,f)=>{a[c]=f,r++,r>e&&(r=0,l=a,a=Object.create(null))};return{get(c){let f=a[c];if(f!==void 0)return f;if((f=l[c])!==void 0)return s(c,f),f},set(c,f){c in a?a[c]=f:s(c,f)}}},Wh="!",By=":",K2=[],Iy=(e,r,a,l,s)=>({modifiers:e,hasImportantModifier:r,baseClassName:a,maybePostfixModifierPosition:l,isExternal:s}),Q2=e=>{const{prefix:r,experimentalParseClassName:a}=e;let l=s=>{const c=[];let f=0,d=0,p=0,h;const v=s.length;for(let j=0;jp?h-p:void 0;return Iy(c,y,b,k)};if(r){const s=r+By,c=l;l=f=>f.startsWith(s)?c(f.slice(s.length)):Iy(K2,!1,f,void 0,!0)}if(a){const s=l;l=c=>a({className:c,parseClassName:s})}return l},Z2=e=>{const r=new Map;return e.orderSensitiveModifiers.forEach((a,l)=>{r.set(a,1e6+l)}),a=>{const l=[];let s=[];for(let c=0;c0&&(s.sort(),l.push(...s),s=[]),l.push(f)):s.push(f)}return s.length>0&&(s.sort(),l.push(...s)),l}},J2=e=>({cache:X2(e.cacheSize),parseClassName:Q2(e),sortModifiers:Z2(e),postfixLookupClassGroupIds:W2(e),...I2(e)}),W2=e=>{const r=Object.create(null),a=e.postfixLookupClassGroups;if(a)for(let l=0;l{const{parseClassName:a,getClassGroupId:l,getConflictingClassGroupIds:s,sortModifiers:c,postfixLookupClassGroupIds:f}=r,d=[],p=e.trim().split(eE);let h="";for(let v=p.length-1;v>=0;v-=1){const x=p[v],{isExternal:b,modifiers:y,hasImportantModifier:k,baseClassName:j,maybePostfixModifierPosition:T}=a(x);if(b){h=x+(h.length>0?" "+h:h);continue}let C=!!T,R;if(C){const A=j.substring(0,T);R=l(A);const I=R&&f[R]?l(j):void 0;I&&I!==R&&(R=I,C=!1)}else R=l(j);if(!R){if(!C){h=x+(h.length>0?" "+h:h);continue}if(R=l(j),!R){h=x+(h.length>0?" "+h:h);continue}C=!1}const D=y.length===0?"":y.length===1?y[0]:c(y).join(":"),B=k?D+Wh:D,O=B+R;if(d.indexOf(O)>-1)continue;d.push(O);const _=s(R,C);for(let A=0;A<_.length;++A){const I=_[A];d.push(B+I)}h=x+(h.length>0?" "+h:h)}return h},nE=(...e)=>{let r=0,a,l,s="";for(;r{if(typeof e=="string")return e;let r,a="";for(let l=0;l{let a,l,s,c;const f=p=>{const h=r.reduce((v,x)=>x(v),e());return a=J2(h),l=a.cache.get,s=a.cache.set,c=d,d(p)},d=p=>{const h=l(p);if(h)return h;const v=tE(p,a);return s(p,v),v};return c=f,(...p)=>c(nE(...p))},aE=[],Qt=e=>{const r=a=>a[e]||aE;return r.isThemeGetter=!0,r},D0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,O0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,lE=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,iE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,oE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,sE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,uE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,cE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Va=e=>lE.test(e),Ke=e=>!!e&&!Number.isNaN(Number(e)),Nr=e=>!!e&&Number.isInteger(Number(e)),dh=e=>e.endsWith("%")&&Ke(e.slice(0,-1)),la=e=>iE.test(e),z0=()=>!0,fE=e=>oE.test(e)&&!sE.test(e),Rm=()=>!1,dE=e=>uE.test(e),hE=e=>cE.test(e),mE=e=>!je(e)&&!Ce(e),pE=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),gE=e=>dl(e,B0,Rm),je=e=>D0.test(e),zl=e=>dl(e,I0,fE),Hy=e=>dl(e,kE,Ke),xE=e=>dl(e,q0,z0),vE=e=>dl(e,H0,Rm),qy=e=>dl(e,L0,Rm),yE=e=>dl(e,U0,hE),zu=e=>dl(e,P0,dE),Ce=e=>O0.test(e),Yo=e=>Yl(e,I0),bE=e=>Yl(e,H0),Py=e=>Yl(e,L0),wE=e=>Yl(e,B0),SE=e=>Yl(e,U0),Lu=e=>Yl(e,P0,!0),jE=e=>Yl(e,q0,!0),dl=(e,r,a)=>{const l=D0.exec(e);return l?l[1]?r(l[1]):a(l[2]):!1},Yl=(e,r,a=!1)=>{const l=O0.exec(e);return l?l[1]?r(l[1]):a:!1},L0=e=>e==="position"||e==="percentage",U0=e=>e==="image"||e==="url",B0=e=>e==="length"||e==="size"||e==="bg-size",I0=e=>e==="length",kE=e=>e==="number",H0=e=>e==="family-name",q0=e=>e==="number"||e==="weight",P0=e=>e==="shadow",CE=()=>{const e=Qt("color"),r=Qt("font"),a=Qt("text"),l=Qt("font-weight"),s=Qt("tracking"),c=Qt("leading"),f=Qt("breakpoint"),d=Qt("container"),p=Qt("spacing"),h=Qt("radius"),v=Qt("shadow"),x=Qt("inset-shadow"),b=Qt("text-shadow"),y=Qt("drop-shadow"),k=Qt("blur"),j=Qt("perspective"),T=Qt("aspect"),C=Qt("ease"),R=Qt("animate"),D=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...B(),Ce,je],_=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],I=()=>[Ce,je,p],ee=()=>[Va,"full","auto",...I()],q=()=>[Nr,"none","subgrid",Ce,je],$=()=>["auto",{span:["full",Nr,Ce,je]},Nr,Ce,je],X=()=>[Nr,"auto",Ce,je],ce=()=>["auto","min","max","fr",Ce,je],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...I()],Z=()=>[Va,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],ie=()=>[Va,"screen","full","dvw","lvw","svw","min","max","fit",...I()],K=()=>[Va,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],E=()=>[e,Ce,je],L=()=>[...B(),Py,qy,{position:[Ce,je]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],M=()=>["auto","cover","contain",wE,gE,{size:[Ce,je]}],oe=()=>[dh,Yo,zl],G=()=>["","none","full",h,Ce,je],ue=()=>["",Ke,Yo,zl],re=()=>["solid","dashed","dotted","double"],ye=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>[Ke,dh,Py,qy],be=()=>["","none",k,Ce,je],Ee=()=>["none",Ke,Ce,je],Se=()=>["none",Ke,Ce,je],Ie=()=>[Ke,Ce,je],Be=()=>[Va,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[la],breakpoint:[la],color:[z0],container:[la],"drop-shadow":[la],ease:["in","out","in-out"],font:[mE],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[la],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[la],shadow:[la],spacing:["px",Ke],text:[la],"text-shadow":[la],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Va,je,Ce,T]}],container:["container"],"container-type":[{"@container":["","normal","size",Ce,je]}],"container-named":[pE],columns:[{columns:[Ke,je,Ce,d]}],"break-after":[{"break-after":D()}],"break-before":[{"break-before":D()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:O()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ee()}],"inset-x":[{"inset-x":ee()}],"inset-y":[{"inset-y":ee()}],start:[{"inset-s":ee(),start:ee()}],end:[{"inset-e":ee(),end:ee()}],"inset-bs":[{"inset-bs":ee()}],"inset-be":[{"inset-be":ee()}],top:[{top:ee()}],right:[{right:ee()}],bottom:[{bottom:ee()}],left:[{left:ee()}],visibility:["visible","invisible","collapse"],z:[{z:[Nr,"auto",Ce,je]}],basis:[{basis:[Va,"full","auto",d,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ke,Va,"auto","initial","none",je]}],grow:[{grow:["",Ke,Ce,je]}],shrink:[{shrink:["",Ke,Ce,je]}],order:[{order:[Nr,"first","last","none",Ce,je]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ce()}],"auto-rows":[{"auto-rows":ce()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...ie()]}],"min-inline-size":[{"min-inline":["auto",...ie()]}],"max-inline-size":[{"max-inline":["none",...ie()]}],"block-size":[{block:["auto",...K()]}],"min-block-size":[{"min-block":["auto",...K()]}],"max-block-size":[{"max-block":["none",...K()]}],w:[{w:[d,"screen",...Z()]}],"min-w":[{"min-w":[d,"screen","none",...Z()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[f]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",a,Yo,zl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,jE,xE]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",dh,je]}],"font-family":[{font:[bE,vE,r]}],"font-features":[{"font-features":[je]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ce,je]}],"line-clamp":[{"line-clamp":[Ke,"none",Ce,Hy]}],leading:[{leading:[c,...I()]}],"list-image":[{"list-image":["none",Ce,je]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ce,je]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ke,"from-font","auto",Ce,zl]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[Ke,"auto",Ce,je]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"tab-size":[{tab:[Nr,Ce,je]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ce,je]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ce,je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:M()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Nr,Ce,je],radial:["",Ce,je],conic:[Nr,Ce,je]},SE,yE]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:oe()}],"gradient-via-pos":[{via:oe()}],"gradient-to-pos":[{to:oe()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-bs":[{"border-bs":ue()}],"border-w-be":[{"border-be":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-bs":[{"border-bs":E()}],"border-color-be":[{"border-be":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ke,Ce,je]}],"outline-w":[{outline:["",Ke,Yo,zl]}],"outline-color":[{outline:E()}],shadow:[{shadow:["","none",v,Lu,zu]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":["none",x,Lu,zu]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[Ke,zl]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":["none",b,Lu,zu]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[Ke,Ce,je]}],"mix-blend":[{"mix-blend":[...ye(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ye()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ke]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[Ce,je]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":B()}],"mask-image-conic-pos":[{"mask-conic":[Ke]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:M()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ce,je]}],filter:[{filter:["","none",Ce,je]}],blur:[{blur:be()}],brightness:[{brightness:[Ke,Ce,je]}],contrast:[{contrast:[Ke,Ce,je]}],"drop-shadow":[{"drop-shadow":["","none",y,Lu,zu]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:["",Ke,Ce,je]}],"hue-rotate":[{"hue-rotate":[Ke,Ce,je]}],invert:[{invert:["",Ke,Ce,je]}],saturate:[{saturate:[Ke,Ce,je]}],sepia:[{sepia:["",Ke,Ce,je]}],"backdrop-filter":[{"backdrop-filter":["","none",Ce,je]}],"backdrop-blur":[{"backdrop-blur":be()}],"backdrop-brightness":[{"backdrop-brightness":[Ke,Ce,je]}],"backdrop-contrast":[{"backdrop-contrast":[Ke,Ce,je]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ke,Ce,je]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ke,Ce,je]}],"backdrop-invert":[{"backdrop-invert":["",Ke,Ce,je]}],"backdrop-opacity":[{"backdrop-opacity":[Ke,Ce,je]}],"backdrop-saturate":[{"backdrop-saturate":[Ke,Ce,je]}],"backdrop-sepia":[{"backdrop-sepia":["",Ke,Ce,je]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ce,je]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ke,"initial",Ce,je]}],ease:[{ease:["linear","initial",C,Ce,je]}],delay:[{delay:[Ke,Ce,je]}],animate:[{animate:["none",R,Ce,je]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Ce,je]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:Se()}],"scale-x":[{"scale-x":Se()}],"scale-y":[{"scale-y":Se()}],"scale-z":[{"scale-z":Se()}],"scale-3d":["scale-3d"],skew:[{skew:Ie()}],"skew-x":[{"skew-x":Ie()}],"skew-y":[{"skew-y":Ie()}],transform:[{transform:[Ce,je,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Be()}],"translate-x":[{"translate-x":Be()}],"translate-y":[{"translate-y":Be()}],"translate-z":[{"translate-z":Be()}],"translate-none":["translate-none"],zoom:[{zoom:[Nr,Ce,je]}],accent:[{accent:E()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:E()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ce,je]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":E()}],"scrollbar-track-color":[{"scrollbar-track":E()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ce,je]}],fill:[{fill:["none",...E()]}],"stroke-w":[{stroke:[Ke,Yo,zl,Hy]}],stroke:[{stroke:["none",...E()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},EE=rE(CE);function _e(...e){return EE(T0(e))}function $0({className:e}){return u.jsx("svg",{viewBox:"0 0 151.08 184",className:_e("h-6 w-auto",e),"aria-hidden":"true",fill:"currentColor",children:u.jsx("path",{d:"M131.08,52.32l-18.67-10.96h-1.01l-16.68,9.79v-20.19s-18.67-10.96-18.67-10.96h-1.01l-18.67,10.96v20.19s-16.68-9.79-16.68-9.79h-1.01l-18.67,10.96v.72s0,78.5,0,78.5l18.67,11.12h1.02l16.67-9.92v20.16s18.67,11.12,18.67,11.12h1.02l18.67-11.12v-20.16s16.67,9.92,16.67,9.92h1.02l18.67-11.12V52.32ZM39.18,43.38l16.7,9.81-16.7,9.94-16.7-9.94,16.7-9.81ZM22,55.23l16.18,9.63v54.28l-16.18,9.5V55.23ZM38.18,121.46v18.57l-15.7-9.35,15.7-9.22ZM40.18,140.03v-18.57l15.7,9.22-15.7,9.35ZM56.36,128.64l-16.18-9.5v-54.28l16.18-9.63v73.41ZM92.72,53.04v19.46l-16.18-9.5v-19.49l16.18-9.63v19.16ZM75.54,84.48l-16.7-9.94,16.7-9.81,16.7,9.81-16.7,9.94ZM76.54,41.18v-18.57l15.7,9.22-15.7,9.35ZM74.54,22.61v18.57l-15.7-9.35,15.7-9.22ZM58.36,33.87l16.18,9.63v19.49l-16.18,9.5v-38.63ZM58.36,76.58l16.18,9.63v54.28l-16.18,9.5v-73.41ZM74.54,142.81v18.57l-15.7-9.35,15.7-9.22ZM76.54,161.38v-18.57l15.7,9.22-15.7,9.35ZM92.72,149.99l-16.18-9.5v-54.28l16.18-9.63v73.41ZM112.9,43.97l15.7,9.22-15.7,9.35v-18.57ZM110.9,43.97v18.57l-15.7-9.35,15.7-9.22ZM94.72,55.23l16.18,9.63v54.28l-16.18,9.5V55.23ZM111.9,140.63l-16.7-9.95,16.7-9.81,16.7,9.81-16.7,9.95ZM129.08,128.64l-16.18-9.5v-54.28l16.18-9.63v73.41Z"})})}function $y(e,r){if(typeof e=="function")return e(r);e!=null&&(e.current=r)}function vc(...e){return r=>{let a=!1;const l=e.map(s=>{const c=$y(s,r);return!a&&typeof c=="function"&&(a=!0),c});if(a)return()=>{for(let s=0;s{const{children:a,...l}=e,s=S.Children.toArray(a),c=s.find(NE);if(c){const f=c.props.children,d=s.map(p=>p===c?S.Children.count(f)>1?S.Children.only(null):S.isValidElement(f)?f.props.children:null:p);return u.jsx(em,{...l,ref:r,children:S.isValidElement(f)?S.cloneElement(f,void 0,d):null})}return u.jsx(em,{...l,ref:r,children:a})});fa.displayName="Slot";var em=S.forwardRef((e,r)=>{const{children:a,...l}=e;if(S.isValidElement(a)){const s=AE(a);return S.cloneElement(a,{...TE(l,a.props),ref:r?vc(r,s):s})}return S.Children.count(a)>1?S.Children.only(null):null});em.displayName="SlotClone";var F0=({children:e})=>u.jsx(u.Fragment,{children:e});function NE(e){return S.isValidElement(e)&&e.type===F0}function TE(e,r){const a={...r};for(const l in r){const s=e[l],c=r[l];/^on[A-Z]/.test(l)?s&&c?a[l]=(...d)=>{c(...d),s(...d)}:s&&(a[l]=s):l==="style"?a[l]={...s,...c}:l==="className"&&(a[l]=[s,c].filter(Boolean).join(" "))}return{...e,...a}}function AE(e){var l,s;let r=(l=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:l.get,a=r&&"isReactWarning"in r&&r.isReactWarning;return a?e.ref:(r=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,a=r&&"isReactWarning"in r&&r.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}const Fy=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Vy=T0,V0=(e,r)=>a=>{var l;if((r==null?void 0:r.variants)==null)return Vy(e,a==null?void 0:a.class,a==null?void 0:a.className);const{variants:s,defaultVariants:c}=r,f=Object.keys(s).map(h=>{const v=a==null?void 0:a[h],x=c==null?void 0:c[h];if(v===null)return null;const b=Fy(v)||Fy(x);return s[h][b]}),d=a&&Object.entries(a).reduce((h,v)=>{let[x,b]=v;return b===void 0||(h[x]=b),h},{}),p=r==null||(l=r.compoundVariants)===null||l===void 0?void 0:l.reduce((h,v)=>{let{class:x,className:b,...y}=v;return Object.entries(y).every(k=>{let[j,T]=k;return Array.isArray(T)?T.includes({...c,...d}[j]):{...c,...d}[j]===T})?[...h,x,b]:h},[]);return Vy(e,f,p,a==null?void 0:a.class,a==null?void 0:a.className)},Dm=V0("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function ze({className:e,variant:r,size:a,asChild:l=!1,...s}){const c=l?fa:"button";return u.jsx(c,{"data-slot":"button",className:_e(Dm({variant:r,size:a,className:e})),...s})}function Jt({className:e,type:r,...a}){return u.jsx("input",{type:r,"data-slot":"input",autoComplete:"off",className:_e("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...a})}var ms=C0();const G0=gc(ms);var _E=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ge=_E.reduce((e,r)=>{const a=S.forwardRef((l,s)=>{const{asChild:c,...f}=l,d=c?fa:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(d,{...f,ref:s})});return a.displayName=`Primitive.${r}`,{...e,[r]:a}},{});function Y0(e,r){e&&ms.flushSync(()=>e.dispatchEvent(r))}var ME="Label",X0=S.forwardRef((e,r)=>u.jsx(Ge.label,{...e,ref:r,onMouseDown:a=>{var s;a.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));X0.displayName=ME;var RE=X0;function Zt({className:e,...r}){return u.jsx(RE,{"data-slot":"label",className:_e("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...r})}/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DE=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K0=(...e)=>e.filter((r,a,l)=>!!r&&r.trim()!==""&&l.indexOf(r)===a).join(" ").trim();/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var OE={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zE=S.forwardRef(({color:e="currentColor",size:r=24,strokeWidth:a=2,absoluteStrokeWidth:l,className:s="",children:c,iconNode:f,...d},p)=>S.createElement("svg",{ref:p,...OE,width:r,height:r,stroke:e,strokeWidth:l?Number(a)*24/Number(r):a,className:K0("lucide",s),...d},[...f.map(([h,v])=>S.createElement(h,v)),...Array.isArray(c)?c:[c]]));/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bt=(e,r)=>{const a=S.forwardRef(({className:l,...s},c)=>S.createElement(zE,{ref:c,iconNode:r,className:K0(`lucide-${DE(e)}`,l),...s}));return a.displayName=`${e}`,a};/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LE=bt("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Q0=bt("ChartBar",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const UE=bt("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yc=bt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Xi=bt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const BE=bt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tm=bt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IE=bt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const HE=bt("CircleUserRound",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Om=bt("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qE=bt("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PE=bt("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bc=bt("FilterX",[["path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055",key:"1fi1da"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Z0=bt("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $E=bt("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const FE=bt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const VE=bt("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const J0=bt("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ki=bt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const GE=bt("SendHorizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YE=bt("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const XE=bt("SunMoon",[["path",{d:"M12 8a2.83 2.83 0 0 0 4 4 4 4 0 1 1-4-4",key:"1fu5g2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.9 4.9 1.4 1.4",key:"b9915j"}],["path",{d:"m17.7 17.7 1.4 1.4",key:"qc3ed3"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.3 17.7-1.4 1.4",key:"5gca6"}],["path",{d:"m19.1 4.9-1.4 1.4",key:"wpu9u6"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KE=bt("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nm=bt("TableProperties",[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const QE=bt("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zm=bt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Lm=bt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** - * @license lucide-react v0.454.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ZE=bt("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Ot({className:e,...r}){return u.jsx(FE,{role:"status","aria-label":"Loading",className:_e("size-4 animate-spin",e),...r})}var JE="Separator",Gy="horizontal",WE=["horizontal","vertical"],W0=S.forwardRef((e,r)=>{const{decorative:a,orientation:l=Gy,...s}=e,c=eN(l)?l:Gy,d=a?{role:"none"}:{"aria-orientation":c==="vertical"?c:void 0,role:"separator"};return u.jsx(Ge.div,{"data-orientation":c,...d,...s,ref:r})});W0.displayName=JE;function eN(e){return WE.includes(e)}var tN=W0;function Yy({className:e,orientation:r="horizontal",decorative:a=!0,...l}){return u.jsx(tN,{"data-slot":"separator",decorative:a,orientation:r,className:_e("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...l})}function tt({className:e,...r}){return u.jsx("div",{"data-slot":"card",className:_e("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...r})}function nt({className:e,...r}){return u.jsx("div",{"data-slot":"card-header",className:_e("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...r})}function rt({className:e,...r}){return u.jsx("div",{"data-slot":"card-title",className:_e("leading-none font-semibold",e),...r})}function ct({className:e,...r}){return u.jsx("div",{"data-slot":"card-description",className:_e("text-muted-foreground text-sm",e),...r})}function nN({className:e,...r}){return u.jsx("div",{"data-slot":"card-action",className:_e("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...r})}function at({className:e,...r}){return u.jsx("div",{"data-slot":"card-content",className:_e("px-6",e),...r})}function rN({me:e,onLogin:r}){const[a,l]=S.useState(""),[s,c]=S.useState(null),[f,d]=S.useState(!1),p=async h=>{h.preventDefault(),d(!0),c(null);try{await Pe.post("/auth/password",{password:a}),r()}catch(v){c(v instanceof xc?v.message:"login failed"),d(!1)}};return u.jsx("div",{className:"flex min-h-screen items-center justify-center p-4",children:u.jsxs(tt,{className:"w-full max-w-sm",children:[u.jsxs(nt,{className:"items-center text-center",children:[u.jsx($0,{className:"mx-auto mb-2 h-10"}),u.jsx(rt,{className:"font-serif text-2xl",children:"llmproxy"})]}),u.jsxs(at,{className:"flex flex-col gap-4",children:[e.sso_enabled&&u.jsx(ze,{className:"w-full",onClick:()=>window.location.href="/auth/login",children:"Sign in with SSO"}),e.sso_enabled&&e.password_enabled&&u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(Yy,{className:"flex-1"}),u.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),u.jsx(Yy,{className:"flex-1"})]}),e.password_enabled&&u.jsxs("form",{onSubmit:p,className:"flex flex-col gap-4",children:[u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:"admin-password",children:"Admin password"}),u.jsx(Jt,{id:"admin-password",type:"password",autoComplete:"current-password",value:a,onChange:h=>l(h.target.value),"aria-invalid":s!=null}),s&&u.jsx("p",{className:"text-sm text-destructive",children:s})]}),u.jsxs(ze,{type:"submit",variant:e.sso_enabled?"outline":"default",disabled:f||a==="",className:"w-full",children:[f&&u.jsx(Ot,{}),"Sign in as admin"]})]}),!e.sso_enabled&&!e.password_enabled&&u.jsxs("p",{className:"text-sm text-muted-foreground",children:["Password login is disabled and no SSO is configured. Mint a key with ",u.jsx("code",{className:"font-mono",children:"llmproxy key create"})," and use the API directly."]})]})]})})}var aN=e=>{switch(e){case"success":return oN;case"info":return uN;case"warning":return sN;case"error":return cN;default:return null}},lN=Array(12).fill(0),iN=({visible:e,className:r})=>ve.createElement("div",{className:["sonner-loading-wrapper",r].filter(Boolean).join(" "),"data-visible":e},ve.createElement("div",{className:"sonner-spinner"},lN.map((a,l)=>ve.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${l}`})))),oN=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ve.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),sN=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ve.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),uN=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ve.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),cN=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ve.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),fN=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ve.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ve.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),dN=()=>{let[e,r]=ve.useState(document.hidden);return ve.useEffect(()=>{let a=()=>{r(document.hidden)};return document.addEventListener("visibilitychange",a),()=>window.removeEventListener("visibilitychange",a)},[]),e},rm=1,hN=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let r=this.subscribers.indexOf(e);this.subscribers.splice(r,1)}),this.publish=e=>{this.subscribers.forEach(r=>r(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var r;let{message:a,...l}=e,s=typeof(e==null?void 0:e.id)=="number"||((r=e.id)==null?void 0:r.length)>0?e.id:rm++,c=this.toasts.find(d=>d.id===s),f=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),c?this.toasts=this.toasts.map(d=>d.id===s?(this.publish({...d,...e,id:s,title:a}),{...d,...e,id:s,dismissible:f,title:a}):d):this.addToast({title:a,...l,dismissible:f,id:s}),s},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(r=>{this.subscribers.forEach(a=>a({id:r.id,dismiss:!0}))}),this.subscribers.forEach(r=>r({id:e,dismiss:!0})),e),this.message=(e,r)=>this.create({...r,message:e}),this.error=(e,r)=>this.create({...r,message:e,type:"error"}),this.success=(e,r)=>this.create({...r,type:"success",message:e}),this.info=(e,r)=>this.create({...r,type:"info",message:e}),this.warning=(e,r)=>this.create({...r,type:"warning",message:e}),this.loading=(e,r)=>this.create({...r,type:"loading",message:e}),this.promise=(e,r)=>{if(!r)return;let a;r.loading!==void 0&&(a=this.create({...r,promise:e,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));let l=e instanceof Promise?e:e(),s=a!==void 0,c,f=l.then(async p=>{if(c=["resolve",p],ve.isValidElement(p))s=!1,this.create({id:a,type:"default",message:p});else if(pN(p)&&!p.ok){s=!1;let h=typeof r.error=="function"?await r.error(`HTTP error! status: ${p.status}`):r.error,v=typeof r.description=="function"?await r.description(`HTTP error! status: ${p.status}`):r.description;this.create({id:a,type:"error",message:h,description:v})}else if(r.success!==void 0){s=!1;let h=typeof r.success=="function"?await r.success(p):r.success,v=typeof r.description=="function"?await r.description(p):r.description;this.create({id:a,type:"success",message:h,description:v})}}).catch(async p=>{if(c=["reject",p],r.error!==void 0){s=!1;let h=typeof r.error=="function"?await r.error(p):r.error,v=typeof r.description=="function"?await r.description(p):r.description;this.create({id:a,type:"error",message:h,description:v})}}).finally(()=>{var p;s&&(this.dismiss(a),a=void 0),(p=r.finally)==null||p.call(r)}),d=()=>new Promise((p,h)=>f.then(()=>c[0]==="reject"?h(c[1]):p(c[1])).catch(h));return typeof a!="string"&&typeof a!="number"?{unwrap:d}:Object.assign(a,{unwrap:d})},this.custom=(e,r)=>{let a=(r==null?void 0:r.id)||rm++;return this.create({jsx:e(a),id:a,...r}),a},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},On=new hN,mN=(e,r)=>{let a=(r==null?void 0:r.id)||rm++;return On.addToast({title:e,...r,id:a}),a},pN=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",gN=mN,xN=()=>On.toasts,vN=()=>On.getActiveToasts(),Ve=Object.assign(gN,{success:On.success,info:On.info,warning:On.warning,error:On.error,custom:On.custom,message:On.message,promise:On.promise,dismiss:On.dismiss,loading:On.loading},{getHistory:xN,getToasts:vN});function yN(e,{insertAt:r}={}){if(typeof document>"u")return;let a=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css",r==="top"&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}yN(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} -`);function Uu(e){return e.label!==void 0}var bN=3,wN="32px",SN="16px",Xy=4e3,jN=356,kN=14,CN=20,EN=200;function hr(...e){return e.filter(Boolean).join(" ")}function NN(e){let[r,a]=e.split("-"),l=[];return r&&l.push(r),a&&l.push(a),l}var TN=e=>{var r,a,l,s,c,f,d,p,h,v,x;let{invert:b,toast:y,unstyled:k,interacting:j,setHeights:T,visibleToasts:C,heights:R,index:D,toasts:B,expanded:O,removeToast:_,defaultRichColors:A,closeButton:I,style:ee,cancelButtonStyle:q,actionButtonStyle:$,className:X="",descriptionClassName:ce="",duration:le,position:W,gap:U,loadingIcon:Z,expandByDefault:ie,classNames:K,icons:E,closeButtonAriaLabel:L="Close toast",pauseWhenPageIsHidden:F}=e,[M,oe]=ve.useState(null),[G,ue]=ve.useState(null),[re,ye]=ve.useState(!1),[fe,be]=ve.useState(!1),[Ee,Se]=ve.useState(!1),[Ie,Be]=ve.useState(!1),[_t,Ct]=ve.useState(!1),[Et,Lt]=ve.useState(0),[Mt,Rt]=ve.useState(0),zt=ve.useRef(y.duration||le||Xy),we=ve.useRef(null),mt=ve.useRef(null),Y=D===0,qe=D+1<=C,ne=y.type,z=y.dismissible!==!1,de=y.className||"",ke=y.descriptionClassName||"",De=ve.useMemo(()=>R.findIndex(He=>He.toastId===y.id)||0,[R,y.id]),en=ve.useMemo(()=>{var He;return(He=y.closeButton)!=null?He:I},[y.closeButton,I]),kn=ve.useMemo(()=>y.duration||le||Xy,[y.duration,le]),Xt=ve.useRef(0),Nt=ve.useRef(0),rn=ve.useRef(0),it=ve.useRef(null),[br,Bn]=W.split("-"),ws=ve.useMemo(()=>R.reduce((He,ht,wt)=>wt>=De?He:He+ht.height,0),[R,De]),xl=dN(),Zl=y.invert||b,ba=ne==="loading";Nt.current=ve.useMemo(()=>De*U+ws,[De,ws]),ve.useEffect(()=>{zt.current=kn},[kn]),ve.useEffect(()=>{ye(!0)},[]),ve.useEffect(()=>{let He=mt.current;if(He){let ht=He.getBoundingClientRect().height;return Rt(ht),T(wt=>[{toastId:y.id,height:ht,position:y.position},...wt]),()=>T(wt=>wt.filter(yn=>yn.toastId!==y.id))}},[T,y.id]),ve.useLayoutEffect(()=>{if(!re)return;let He=mt.current,ht=He.style.height;He.style.height="auto";let wt=He.getBoundingClientRect().height;He.style.height=ht,Rt(wt),T(yn=>yn.find(an=>an.toastId===y.id)?yn.map(an=>an.toastId===y.id?{...an,height:wt}:an):[{toastId:y.id,height:wt,position:y.position},...yn])},[re,y.title,y.description,T,y.id]);let dn=ve.useCallback(()=>{be(!0),Lt(Nt.current),T(He=>He.filter(ht=>ht.toastId!==y.id)),setTimeout(()=>{_(y)},EN)},[y,_,T,Nt]);ve.useEffect(()=>{if(y.promise&&ne==="loading"||y.duration===1/0||y.type==="loading")return;let He;return O||j||F&&xl?(()=>{if(rn.current{var ht;(ht=y.onAutoClose)==null||ht.call(y,y),dn()},zt.current)),()=>clearTimeout(He)},[O,j,y,ne,F,xl,dn]),ve.useEffect(()=>{y.delete&&dn()},[dn,y.delete]);function Jl(){var He,ht,wt;return E!=null&&E.loading?ve.createElement("div",{className:hr(K==null?void 0:K.loader,(He=y==null?void 0:y.classNames)==null?void 0:He.loader,"sonner-loader"),"data-visible":ne==="loading"},E.loading):Z?ve.createElement("div",{className:hr(K==null?void 0:K.loader,(ht=y==null?void 0:y.classNames)==null?void 0:ht.loader,"sonner-loader"),"data-visible":ne==="loading"},Z):ve.createElement(iN,{className:hr(K==null?void 0:K.loader,(wt=y==null?void 0:y.classNames)==null?void 0:wt.loader),visible:ne==="loading"})}return ve.createElement("li",{tabIndex:0,ref:mt,className:hr(X,de,K==null?void 0:K.toast,(r=y==null?void 0:y.classNames)==null?void 0:r.toast,K==null?void 0:K.default,K==null?void 0:K[ne],(a=y==null?void 0:y.classNames)==null?void 0:a[ne]),"data-sonner-toast":"","data-rich-colors":(l=y.richColors)!=null?l:A,"data-styled":!(y.jsx||y.unstyled||k),"data-mounted":re,"data-promise":!!y.promise,"data-swiped":_t,"data-removed":fe,"data-visible":qe,"data-y-position":br,"data-x-position":Bn,"data-index":D,"data-front":Y,"data-swiping":Ee,"data-dismissible":z,"data-type":ne,"data-invert":Zl,"data-swipe-out":Ie,"data-swipe-direction":G,"data-expanded":!!(O||ie&&re),style:{"--index":D,"--toasts-before":D,"--z-index":B.length-D,"--offset":`${fe?Et:Nt.current}px`,"--initial-height":ie?"auto":`${Mt}px`,...ee,...y.style},onDragEnd:()=>{Se(!1),oe(null),it.current=null},onPointerDown:He=>{ba||!z||(we.current=new Date,Lt(Nt.current),He.target.setPointerCapture(He.pointerId),He.target.tagName!=="BUTTON"&&(Se(!0),it.current={x:He.clientX,y:He.clientY}))},onPointerUp:()=>{var He,ht,wt,yn;if(Ie||!z)return;it.current=null;let an=Number(((He=mt.current)==null?void 0:He.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),wr=Number(((ht=mt.current)==null?void 0:ht.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Sr=new Date().getTime()-((wt=we.current)==null?void 0:wt.getTime()),Cn=M==="x"?an:wr,ur=Math.abs(Cn)/Sr;if(Math.abs(Cn)>=CN||ur>.11){Lt(Nt.current),(yn=y.onDismiss)==null||yn.call(y,y),ue(M==="x"?an>0?"right":"left":wr>0?"down":"up"),dn(),Be(!0),Ct(!1);return}Se(!1),oe(null)},onPointerMove:He=>{var ht,wt,yn,an;if(!it.current||!z||((ht=window.getSelection())==null?void 0:ht.toString().length)>0)return;let wr=He.clientY-it.current.y,Sr=He.clientX-it.current.x,Cn=(wt=e.swipeDirections)!=null?wt:NN(W);!M&&(Math.abs(Sr)>1||Math.abs(wr)>1)&&oe(Math.abs(Sr)>Math.abs(wr)?"x":"y");let ur={x:0,y:0};M==="y"?(Cn.includes("top")||Cn.includes("bottom"))&&(Cn.includes("top")&&wr<0||Cn.includes("bottom")&&wr>0)&&(ur.y=wr):M==="x"&&(Cn.includes("left")||Cn.includes("right"))&&(Cn.includes("left")&&Sr<0||Cn.includes("right")&&Sr>0)&&(ur.x=Sr),(Math.abs(ur.x)>0||Math.abs(ur.y)>0)&&Ct(!0),(yn=mt.current)==null||yn.style.setProperty("--swipe-amount-x",`${ur.x}px`),(an=mt.current)==null||an.style.setProperty("--swipe-amount-y",`${ur.y}px`)}},en&&!y.jsx?ve.createElement("button",{"aria-label":L,"data-disabled":ba,"data-close-button":!0,onClick:ba||!z?()=>{}:()=>{var He;dn(),(He=y.onDismiss)==null||He.call(y,y)},className:hr(K==null?void 0:K.closeButton,(s=y==null?void 0:y.classNames)==null?void 0:s.closeButton)},(c=E==null?void 0:E.close)!=null?c:fN):null,y.jsx||S.isValidElement(y.title)?y.jsx?y.jsx:typeof y.title=="function"?y.title():y.title:ve.createElement(ve.Fragment,null,ne||y.icon||y.promise?ve.createElement("div",{"data-icon":"",className:hr(K==null?void 0:K.icon,(f=y==null?void 0:y.classNames)==null?void 0:f.icon)},y.promise||y.type==="loading"&&!y.icon?y.icon||Jl():null,y.type!=="loading"?y.icon||(E==null?void 0:E[ne])||aN(ne):null):null,ve.createElement("div",{"data-content":"",className:hr(K==null?void 0:K.content,(d=y==null?void 0:y.classNames)==null?void 0:d.content)},ve.createElement("div",{"data-title":"",className:hr(K==null?void 0:K.title,(p=y==null?void 0:y.classNames)==null?void 0:p.title)},typeof y.title=="function"?y.title():y.title),y.description?ve.createElement("div",{"data-description":"",className:hr(ce,ke,K==null?void 0:K.description,(h=y==null?void 0:y.classNames)==null?void 0:h.description)},typeof y.description=="function"?y.description():y.description):null),S.isValidElement(y.cancel)?y.cancel:y.cancel&&Uu(y.cancel)?ve.createElement("button",{"data-button":!0,"data-cancel":!0,style:y.cancelButtonStyle||q,onClick:He=>{var ht,wt;Uu(y.cancel)&&z&&((wt=(ht=y.cancel).onClick)==null||wt.call(ht,He),dn())},className:hr(K==null?void 0:K.cancelButton,(v=y==null?void 0:y.classNames)==null?void 0:v.cancelButton)},y.cancel.label):null,S.isValidElement(y.action)?y.action:y.action&&Uu(y.action)?ve.createElement("button",{"data-button":!0,"data-action":!0,style:y.actionButtonStyle||$,onClick:He=>{var ht,wt;Uu(y.action)&&((wt=(ht=y.action).onClick)==null||wt.call(ht,He),!He.defaultPrevented&&dn())},className:hr(K==null?void 0:K.actionButton,(x=y==null?void 0:y.classNames)==null?void 0:x.actionButton)},y.action.label):null))};function Ky(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function AN(e,r){let a={};return[e,r].forEach((l,s)=>{let c=s===1,f=c?"--mobile-offset":"--offset",d=c?SN:wN;function p(h){["top","right","bottom","left"].forEach(v=>{a[`${f}-${v}`]=typeof h=="number"?`${h}px`:h})}typeof l=="number"||typeof l=="string"?p(l):typeof l=="object"?["top","right","bottom","left"].forEach(h=>{l[h]===void 0?a[`${f}-${h}`]=d:a[`${f}-${h}`]=typeof l[h]=="number"?`${l[h]}px`:l[h]}):p(d)}),a}var _N=S.forwardRef(function(e,r){let{invert:a,position:l="bottom-right",hotkey:s=["altKey","KeyT"],expand:c,closeButton:f,className:d,offset:p,mobileOffset:h,theme:v="light",richColors:x,duration:b,style:y,visibleToasts:k=bN,toastOptions:j,dir:T=Ky(),gap:C=kN,loadingIcon:R,icons:D,containerAriaLabel:B="Notifications",pauseWhenPageIsHidden:O}=e,[_,A]=ve.useState([]),I=ve.useMemo(()=>Array.from(new Set([l].concat(_.filter(F=>F.position).map(F=>F.position)))),[_,l]),[ee,q]=ve.useState([]),[$,X]=ve.useState(!1),[ce,le]=ve.useState(!1),[W,U]=ve.useState(v!=="system"?v:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Z=ve.useRef(null),ie=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),K=ve.useRef(null),E=ve.useRef(!1),L=ve.useCallback(F=>{A(M=>{var oe;return(oe=M.find(G=>G.id===F.id))!=null&&oe.delete||On.dismiss(F.id),M.filter(({id:G})=>G!==F.id)})},[]);return ve.useEffect(()=>On.subscribe(F=>{if(F.dismiss){A(M=>M.map(oe=>oe.id===F.id?{...oe,delete:!0}:oe));return}setTimeout(()=>{G0.flushSync(()=>{A(M=>{let oe=M.findIndex(G=>G.id===F.id);return oe!==-1?[...M.slice(0,oe),{...M[oe],...F},...M.slice(oe+1)]:[F,...M]})})})}),[]),ve.useEffect(()=>{if(v!=="system"){U(v);return}if(v==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?U("dark"):U("light")),typeof window>"u")return;let F=window.matchMedia("(prefers-color-scheme: dark)");try{F.addEventListener("change",({matches:M})=>{U(M?"dark":"light")})}catch{F.addListener(({matches:oe})=>{try{U(oe?"dark":"light")}catch(G){console.error(G)}})}},[v]),ve.useEffect(()=>{_.length<=1&&X(!1)},[_]),ve.useEffect(()=>{let F=M=>{var oe,G;s.every(ue=>M[ue]||M.code===ue)&&(X(!0),(oe=Z.current)==null||oe.focus()),M.code==="Escape"&&(document.activeElement===Z.current||(G=Z.current)!=null&&G.contains(document.activeElement))&&X(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[s]),ve.useEffect(()=>{if(Z.current)return()=>{K.current&&(K.current.focus({preventScroll:!0}),K.current=null,E.current=!1)}},[Z.current]),ve.createElement("section",{ref:r,"aria-label":`${B} ${ie}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},I.map((F,M)=>{var oe;let[G,ue]=F.split("-");return _.length?ve.createElement("ol",{key:F,dir:T==="auto"?Ky():T,tabIndex:-1,ref:Z,className:d,"data-sonner-toaster":!0,"data-theme":W,"data-y-position":G,"data-lifted":$&&_.length>1&&!c,"data-x-position":ue,style:{"--front-toast-height":`${((oe=ee[0])==null?void 0:oe.height)||0}px`,"--width":`${jN}px`,"--gap":`${C}px`,...y,...AN(p,h)},onBlur:re=>{E.current&&!re.currentTarget.contains(re.relatedTarget)&&(E.current=!1,K.current&&(K.current.focus({preventScroll:!0}),K.current=null))},onFocus:re=>{re.target instanceof HTMLElement&&re.target.dataset.dismissible==="false"||E.current||(E.current=!0,K.current=re.relatedTarget)},onMouseEnter:()=>X(!0),onMouseMove:()=>X(!0),onMouseLeave:()=>{ce||X(!1)},onDragEnd:()=>X(!1),onPointerDown:re=>{re.target instanceof HTMLElement&&re.target.dataset.dismissible==="false"||le(!0)},onPointerUp:()=>le(!1)},_.filter(re=>!re.position&&M===0||re.position===F).map((re,ye)=>{var fe,be;return ve.createElement(TN,{key:re.id,icons:D,index:ye,toast:re,defaultRichColors:x,duration:(fe=j==null?void 0:j.duration)!=null?fe:b,className:j==null?void 0:j.className,descriptionClassName:j==null?void 0:j.descriptionClassName,invert:a,visibleToasts:k,closeButton:(be=j==null?void 0:j.closeButton)!=null?be:f,interacting:ce,position:F,style:j==null?void 0:j.style,unstyled:j==null?void 0:j.unstyled,classNames:j==null?void 0:j.classNames,cancelButtonStyle:j==null?void 0:j.cancelButtonStyle,actionButtonStyle:j==null?void 0:j.actionButtonStyle,removeToast:L,toasts:_.filter(Ee=>Ee.position==re.position),heights:ee.filter(Ee=>Ee.position==re.position),setHeights:q,expandByDefault:c,gap:C,loadingIcon:R,expanded:$,pauseWhenPageIsHidden:O,swipeDirections:e.swipeDirections})})):null}))});function Yt(e,r=[]){const[a,l]=S.useState(null),[s,c]=S.useState(null),[f,d]=S.useState(!0),p=S.useRef(e);p.current=e;const h=S.useCallback(()=>{d(!0),p.current().then(v=>{l(v),c(null)}).catch(v=>{c(v instanceof xc?v.message:String(v))}).finally(()=>d(!1))},r);return S.useEffect(()=>{h()},[h]),{data:a,error:s,loading:f,reload:h}}function pn({className:e,...r}){return u.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:u.jsx("table",{"data-slot":"table",className:_e("w-full caption-bottom text-sm",e),...r})})}function gn({className:e,...r}){return u.jsx("thead",{"data-slot":"table-header",className:_e("[&_tr]:border-b",e),...r})}function xn({className:e,...r}){return u.jsx("tbody",{"data-slot":"table-body",className:_e("[&_tr:last-child]:border-0",e),...r})}function Ue({className:e,...r}){return u.jsx("tr",{"data-slot":"table-row",className:_e("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...r})}function ge({className:e,...r}){return u.jsx("th",{"data-slot":"table-head",className:_e("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...r})}function me({className:e,...r}){return u.jsx("td",{"data-slot":"table-cell",className:_e("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...r})}function MN(e,r){const a=S.createContext(r),l=c=>{const{children:f,...d}=c,p=S.useMemo(()=>d,Object.values(d));return u.jsx(a.Provider,{value:p,children:f})};l.displayName=e+"Provider";function s(c){const f=S.useContext(a);if(f)return f;if(r!==void 0)return r;throw new Error(`\`${c}\` must be used within \`${e}\``)}return[l,s]}function vr(e,r=[]){let a=[];function l(c,f){const d=S.createContext(f),p=a.length;a=[...a,f];const h=x=>{var C;const{scope:b,children:y,...k}=x,j=((C=b==null?void 0:b[e])==null?void 0:C[p])||d,T=S.useMemo(()=>k,Object.values(k));return u.jsx(j.Provider,{value:T,children:y})};h.displayName=c+"Provider";function v(x,b){var j;const y=((j=b==null?void 0:b[e])==null?void 0:j[p])||d,k=S.useContext(y);if(k)return k;if(f!==void 0)return f;throw new Error(`\`${x}\` must be used within \`${c}\``)}return[h,v]}const s=()=>{const c=a.map(f=>S.createContext(f));return function(d){const p=(d==null?void 0:d[e])||c;return S.useMemo(()=>({[`__scope${e}`]:{...d,[e]:p}}),[d,p])}};return s.scopeName=e,[l,RN(s,...r)]}function RN(...e){const r=e[0];if(e.length===1)return r;const a=()=>{const l=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(c){const f=l.reduce((d,{useScope:p,scopeName:h})=>{const x=p(c)[`__scope${h}`];return{...d,...x}},{});return S.useMemo(()=>({[`__scope${r.scopeName}`]:f}),[f])}};return a.scopeName=r.scopeName,a}function Te(e,r,{checkForDefaultPrevented:a=!0}={}){return function(s){if(e==null||e(s),a===!1||!s.defaultPrevented)return r==null?void 0:r(s)}}var Sn=globalThis!=null&&globalThis.document?S.useLayoutEffect:()=>{},DN=N2.useId||(()=>{}),ON=0;function zr(e){const[r,a]=S.useState(DN());return Sn(()=>{a(l=>l??String(ON++))},[e]),e||(r?`radix-${r}`:"")}function sr(e){const r=S.useRef(e);return S.useEffect(()=>{r.current=e}),S.useMemo(()=>(...a)=>{var l;return(l=r.current)==null?void 0:l.call(r,...a)},[])}function el({prop:e,defaultProp:r,onChange:a=()=>{}}){const[l,s]=zN({defaultProp:r,onChange:a}),c=e!==void 0,f=c?e:l,d=sr(a),p=S.useCallback(h=>{if(c){const x=typeof h=="function"?h(e):h;x!==e&&d(x)}else s(h)},[c,e,s,d]);return[f,p]}function zN({defaultProp:e,onChange:r}){const a=S.useState(e),[l]=a,s=S.useRef(l),c=sr(r);return S.useEffect(()=>{s.current!==l&&(c(l),s.current=l)},[l,s,c]),a}function LN(e,r=globalThis==null?void 0:globalThis.document){const a=sr(e);S.useEffect(()=>{const l=s=>{s.key==="Escape"&&a(s)};return r.addEventListener("keydown",l,{capture:!0}),()=>r.removeEventListener("keydown",l,{capture:!0})},[a,r])}var UN="DismissableLayer",am="dismissableLayer.update",BN="dismissableLayer.pointerDownOutside",IN="dismissableLayer.focusOutside",Qy,e1=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),wc=S.forwardRef((e,r)=>{const{disableOutsidePointerEvents:a=!1,onEscapeKeyDown:l,onPointerDownOutside:s,onFocusOutside:c,onInteractOutside:f,onDismiss:d,...p}=e,h=S.useContext(e1),[v,x]=S.useState(null),b=(v==null?void 0:v.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=S.useState({}),k=dt(r,A=>x(A)),j=Array.from(h.layers),[T]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),C=j.indexOf(T),R=v?j.indexOf(v):-1,D=h.layersWithOutsidePointerEventsDisabled.size>0,B=R>=C,O=PN(A=>{const I=A.target,ee=[...h.branches].some(q=>q.contains(I));!B||ee||(s==null||s(A),f==null||f(A),A.defaultPrevented||d==null||d())},b),_=$N(A=>{const I=A.target;[...h.branches].some(q=>q.contains(I))||(c==null||c(A),f==null||f(A),A.defaultPrevented||d==null||d())},b);return LN(A=>{R===h.layers.size-1&&(l==null||l(A),!A.defaultPrevented&&d&&(A.preventDefault(),d()))},b),S.useEffect(()=>{if(v)return a&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Qy=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(v)),h.layers.add(v),Zy(),()=>{a&&h.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=Qy)}},[v,b,a,h]),S.useEffect(()=>()=>{v&&(h.layers.delete(v),h.layersWithOutsidePointerEventsDisabled.delete(v),Zy())},[v,h]),S.useEffect(()=>{const A=()=>y({});return document.addEventListener(am,A),()=>document.removeEventListener(am,A)},[]),u.jsx(Ge.div,{...p,ref:k,style:{pointerEvents:D?B?"auto":"none":void 0,...e.style},onFocusCapture:Te(e.onFocusCapture,_.onFocusCapture),onBlurCapture:Te(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:Te(e.onPointerDownCapture,O.onPointerDownCapture)})});wc.displayName=UN;var HN="DismissableLayerBranch",qN=S.forwardRef((e,r)=>{const a=S.useContext(e1),l=S.useRef(null),s=dt(r,l);return S.useEffect(()=>{const c=l.current;if(c)return a.branches.add(c),()=>{a.branches.delete(c)}},[a.branches]),u.jsx(Ge.div,{...e,ref:s})});qN.displayName=HN;function PN(e,r=globalThis==null?void 0:globalThis.document){const a=sr(e),l=S.useRef(!1),s=S.useRef(()=>{});return S.useEffect(()=>{const c=d=>{if(d.target&&!l.current){let p=function(){t1(BN,a,h,{discrete:!0})};const h={originalEvent:d};d.pointerType==="touch"?(r.removeEventListener("click",s.current),s.current=p,r.addEventListener("click",s.current,{once:!0})):p()}else r.removeEventListener("click",s.current);l.current=!1},f=window.setTimeout(()=>{r.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(f),r.removeEventListener("pointerdown",c),r.removeEventListener("click",s.current)}},[r,a]),{onPointerDownCapture:()=>l.current=!0}}function $N(e,r=globalThis==null?void 0:globalThis.document){const a=sr(e),l=S.useRef(!1);return S.useEffect(()=>{const s=c=>{c.target&&!l.current&&t1(IN,a,{originalEvent:c},{discrete:!1})};return r.addEventListener("focusin",s),()=>r.removeEventListener("focusin",s)},[r,a]),{onFocusCapture:()=>l.current=!0,onBlurCapture:()=>l.current=!1}}function Zy(){const e=new CustomEvent(am);document.dispatchEvent(e)}function t1(e,r,a,{discrete:l}){const s=a.originalEvent.target,c=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:a});r&&s.addEventListener(e,r,{once:!0}),l?Y0(s,c):s.dispatchEvent(c)}var hh="focusScope.autoFocusOnMount",mh="focusScope.autoFocusOnUnmount",Jy={bubbles:!1,cancelable:!0},FN="FocusScope",Sc=S.forwardRef((e,r)=>{const{loop:a=!1,trapped:l=!1,onMountAutoFocus:s,onUnmountAutoFocus:c,...f}=e,[d,p]=S.useState(null),h=sr(s),v=sr(c),x=S.useRef(null),b=dt(r,j=>p(j)),y=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(l){let j=function(D){if(y.paused||!d)return;const B=D.target;d.contains(B)?x.current=B:Xa(x.current,{select:!0})},T=function(D){if(y.paused||!d)return;const B=D.relatedTarget;B!==null&&(d.contains(B)||Xa(x.current,{select:!0}))},C=function(D){if(document.activeElement===document.body)for(const O of D)O.removedNodes.length>0&&Xa(d)};document.addEventListener("focusin",j),document.addEventListener("focusout",T);const R=new MutationObserver(C);return d&&R.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",T),R.disconnect()}}},[l,d,y.paused]),S.useEffect(()=>{if(d){eb.add(y);const j=document.activeElement;if(!d.contains(j)){const C=new CustomEvent(hh,Jy);d.addEventListener(hh,h),d.dispatchEvent(C),C.defaultPrevented||(VN(QN(n1(d)),{select:!0}),document.activeElement===j&&Xa(d))}return()=>{d.removeEventListener(hh,h),setTimeout(()=>{const C=new CustomEvent(mh,Jy);d.addEventListener(mh,v),d.dispatchEvent(C),C.defaultPrevented||Xa(j??document.body,{select:!0}),d.removeEventListener(mh,v),eb.remove(y)},0)}}},[d,h,v,y]);const k=S.useCallback(j=>{if(!a&&!l||y.paused)return;const T=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,C=document.activeElement;if(T&&C){const R=j.currentTarget,[D,B]=GN(R);D&&B?!j.shiftKey&&C===B?(j.preventDefault(),a&&Xa(D,{select:!0})):j.shiftKey&&C===D&&(j.preventDefault(),a&&Xa(B,{select:!0})):C===R&&j.preventDefault()}},[a,l,y.paused]);return u.jsx(Ge.div,{tabIndex:-1,...f,ref:b,onKeyDown:k})});Sc.displayName=FN;function VN(e,{select:r=!1}={}){const a=document.activeElement;for(const l of e)if(Xa(l,{select:r}),document.activeElement!==a)return}function GN(e){const r=n1(e),a=Wy(r,e),l=Wy(r.reverse(),e);return[a,l]}function n1(e){const r=[],a=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:l=>{const s=l.tagName==="INPUT"&&l.type==="hidden";return l.disabled||l.hidden||s?NodeFilter.FILTER_SKIP:l.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)r.push(a.currentNode);return r}function Wy(e,r){for(const a of e)if(!YN(a,{upTo:r}))return a}function YN(e,{upTo:r}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(r!==void 0&&e===r)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function XN(e){return e instanceof HTMLInputElement&&"select"in e}function Xa(e,{select:r=!1}={}){if(e&&e.focus){const a=document.activeElement;e.focus({preventScroll:!0}),e!==a&&XN(e)&&r&&e.select()}}var eb=KN();function KN(){let e=[];return{add(r){const a=e[0];r!==a&&(a==null||a.pause()),e=tb(e,r),e.unshift(r)},remove(r){var a;e=tb(e,r),(a=e[0])==null||a.resume()}}}function tb(e,r){const a=[...e],l=a.indexOf(r);return l!==-1&&a.splice(l,1),a}function QN(e){return e.filter(r=>r.tagName!=="A")}var ZN="Portal",jc=S.forwardRef((e,r)=>{var d;const{container:a,...l}=e,[s,c]=S.useState(!1);Sn(()=>c(!0),[]);const f=a||s&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return f?G0.createPortal(u.jsx(Ge.div,{...l,ref:r}),f):null});jc.displayName=ZN;function JN(e,r){return S.useReducer((a,l)=>r[a][l]??a,e)}var Ir=e=>{const{present:r,children:a}=e,l=WN(r),s=typeof a=="function"?a({present:l.isPresent}):S.Children.only(a),c=dt(l.ref,eT(s));return typeof a=="function"||l.isPresent?S.cloneElement(s,{ref:c}):null};Ir.displayName="Presence";function WN(e){const[r,a]=S.useState(),l=S.useRef({}),s=S.useRef(e),c=S.useRef("none"),f=e?"mounted":"unmounted",[d,p]=JN(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{const h=Bu(l.current);c.current=d==="mounted"?h:"none"},[d]),Sn(()=>{const h=l.current,v=s.current;if(v!==e){const b=c.current,y=Bu(h);e?p("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?p("UNMOUNT"):p(v&&b!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,p]),Sn(()=>{if(r){let h;const v=r.ownerDocument.defaultView??window,x=y=>{const j=Bu(l.current).includes(y.animationName);if(y.target===r&&j&&(p("ANIMATION_END"),!s.current)){const T=r.style.animationFillMode;r.style.animationFillMode="forwards",h=v.setTimeout(()=>{r.style.animationFillMode==="forwards"&&(r.style.animationFillMode=T)})}},b=y=>{y.target===r&&(c.current=Bu(l.current))};return r.addEventListener("animationstart",b),r.addEventListener("animationcancel",x),r.addEventListener("animationend",x),()=>{v.clearTimeout(h),r.removeEventListener("animationstart",b),r.removeEventListener("animationcancel",x),r.removeEventListener("animationend",x)}}else p("ANIMATION_END")},[r,p]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:S.useCallback(h=>{h&&(l.current=getComputedStyle(h)),a(h)},[])}}function Bu(e){return(e==null?void 0:e.animationName)||"none"}function eT(e){var l,s;let r=(l=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:l.get,a=r&&"isReactWarning"in r&&r.isReactWarning;return a?e.ref:(r=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,a=r&&"isReactWarning"in r&&r.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}var ph=0;function Um(){S.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??nb()),document.body.insertAdjacentElement("beforeend",e[1]??nb()),ph++,()=>{ph===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),ph--}},[])}function nb(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Dr=function(){return Dr=Object.assign||function(r){for(var a,l=1,s=arguments.length;l"u")return xT;var r=vT(e),a=document.documentElement.clientWidth,l=window.innerWidth;return{left:r[0],top:r[1],right:r[2],gap:Math.max(0,l-a+r[2]-r[0])}},bT=i1(),$i="data-scroll-locked",wT=function(e,r,a,l){var s=e.left,c=e.top,f=e.right,d=e.gap;return a===void 0&&(a="margin"),` - .`.concat(nT,` { - overflow: hidden `).concat(l,`; - padding-right: `).concat(d,"px ").concat(l,`; - } - body[`).concat($i,`] { - overflow: hidden `).concat(l,`; - overscroll-behavior: contain; - `).concat([r&&"position: relative ".concat(l,";"),a==="margin"&&` - padding-left: `.concat(s,`px; - padding-top: `).concat(c,`px; - padding-right: `).concat(f,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(d,"px ").concat(l,`; - `),a==="padding"&&"padding-right: ".concat(d,"px ").concat(l,";")].filter(Boolean).join(""),` - } - - .`).concat(Ju,` { - right: `).concat(d,"px ").concat(l,`; - } - - .`).concat(Wu,` { - margin-right: `).concat(d,"px ").concat(l,`; - } - - .`).concat(Ju," .").concat(Ju,` { - right: 0 `).concat(l,`; - } - - .`).concat(Wu," .").concat(Wu,` { - margin-right: 0 `).concat(l,`; - } - - body[`).concat($i,`] { - `).concat(rT,": ").concat(d,`px; - } -`)},ab=function(){var e=parseInt(document.body.getAttribute($i)||"0",10);return isFinite(e)?e:0},ST=function(){S.useEffect(function(){return document.body.setAttribute($i,(ab()+1).toString()),function(){var e=ab()-1;e<=0?document.body.removeAttribute($i):document.body.setAttribute($i,e.toString())}},[])},jT=function(e){var r=e.noRelative,a=e.noImportant,l=e.gapMode,s=l===void 0?"margin":l;ST();var c=S.useMemo(function(){return yT(s)},[s]);return S.createElement(bT,{styles:wT(c,!r,s,a?"":"!important")})},lm=!1;if(typeof window<"u")try{var Iu=Object.defineProperty({},"passive",{get:function(){return lm=!0,!0}});window.addEventListener("test",Iu,Iu),window.removeEventListener("test",Iu,Iu)}catch{lm=!1}var Ui=lm?{passive:!1}:!1,kT=function(e){return e.tagName==="TEXTAREA"},o1=function(e,r){if(!(e instanceof Element))return!1;var a=window.getComputedStyle(e);return a[r]!=="hidden"&&!(a.overflowY===a.overflowX&&!kT(e)&&a[r]==="visible")},CT=function(e){return o1(e,"overflowY")},ET=function(e){return o1(e,"overflowX")},lb=function(e,r){var a=r.ownerDocument,l=r;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var s=s1(e,l);if(s){var c=u1(e,l),f=c[1],d=c[2];if(f>d)return!0}l=l.parentNode}while(l&&l!==a.body);return!1},NT=function(e){var r=e.scrollTop,a=e.scrollHeight,l=e.clientHeight;return[r,a,l]},TT=function(e){var r=e.scrollLeft,a=e.scrollWidth,l=e.clientWidth;return[r,a,l]},s1=function(e,r){return e==="v"?CT(r):ET(r)},u1=function(e,r){return e==="v"?NT(r):TT(r)},AT=function(e,r){return e==="h"&&r==="rtl"?-1:1},_T=function(e,r,a,l,s){var c=AT(e,window.getComputedStyle(r).direction),f=c*l,d=a.target,p=r.contains(d),h=!1,v=f>0,x=0,b=0;do{if(!d)break;var y=u1(e,d),k=y[0],j=y[1],T=y[2],C=j-T-c*k;(k||C)&&s1(e,d)&&(x+=C,b+=k);var R=d.parentNode;d=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!p&&d!==document.body||p&&(r.contains(d)||r===d));return(v&&Math.abs(x)<1||!v&&Math.abs(b)<1)&&(h=!0),h},Hu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ib=function(e){return[e.deltaX,e.deltaY]},ob=function(e){return e&&"current"in e?e.current:e},MT=function(e,r){return e[0]===r[0]&&e[1]===r[1]},RT=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},DT=0,Bi=[];function OT(e){var r=S.useRef([]),a=S.useRef([0,0]),l=S.useRef(),s=S.useState(DT++)[0],c=S.useState(i1)[0],f=S.useRef(e);S.useEffect(function(){f.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var j=tT([e.lockRef.current],(e.shards||[]).map(ob),!0).filter(Boolean);return j.forEach(function(T){return T.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),j.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var d=S.useCallback(function(j,T){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!f.current.allowPinchZoom;var C=Hu(j),R=a.current,D="deltaX"in j?j.deltaX:R[0]-C[0],B="deltaY"in j?j.deltaY:R[1]-C[1],O,_=j.target,A=Math.abs(D)>Math.abs(B)?"h":"v";if("touches"in j&&A==="h"&&_.type==="range")return!1;var I=window.getSelection(),ee=I&&I.anchorNode,q=ee?ee===_||ee.contains(_):!1;if(q)return!1;var $=lb(A,_);if(!$)return!0;if($?O=A:(O=A==="v"?"h":"v",$=lb(A,_)),!$)return!1;if(!l.current&&"changedTouches"in j&&(D||B)&&(l.current=O),!O)return!0;var X=l.current||O;return _T(X,T,j,X==="h"?D:B)},[]),p=S.useCallback(function(j){var T=j;if(!(!Bi.length||Bi[Bi.length-1]!==c)){var C="deltaY"in T?ib(T):Hu(T),R=r.current.filter(function(O){return O.name===T.type&&(O.target===T.target||T.target===O.shadowParent)&&MT(O.delta,C)})[0];if(R&&R.should){T.cancelable&&T.preventDefault();return}if(!R){var D=(f.current.shards||[]).map(ob).filter(Boolean).filter(function(O){return O.contains(T.target)}),B=D.length>0?d(T,D[0]):!f.current.noIsolation;B&&T.cancelable&&T.preventDefault()}}},[]),h=S.useCallback(function(j,T,C,R){var D={name:j,delta:T,target:C,should:R,shadowParent:zT(C)};r.current.push(D),setTimeout(function(){r.current=r.current.filter(function(B){return B!==D})},1)},[]),v=S.useCallback(function(j){a.current=Hu(j),l.current=void 0},[]),x=S.useCallback(function(j){h(j.type,ib(j),j.target,d(j,e.lockRef.current))},[]),b=S.useCallback(function(j){h(j.type,Hu(j),j.target,d(j,e.lockRef.current))},[]);S.useEffect(function(){return Bi.push(c),e.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:b}),document.addEventListener("wheel",p,Ui),document.addEventListener("touchmove",p,Ui),document.addEventListener("touchstart",v,Ui),function(){Bi=Bi.filter(function(j){return j!==c}),document.removeEventListener("wheel",p,Ui),document.removeEventListener("touchmove",p,Ui),document.removeEventListener("touchstart",v,Ui)}},[]);var y=e.removeScrollBar,k=e.inert;return S.createElement(S.Fragment,null,k?S.createElement(c,{styles:RT(s)}):null,y?S.createElement(jT,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function zT(e){for(var r=null;e!==null;)e instanceof ShadowRoot&&(r=e.host,e=e.host),e=e.parentNode;return r}const LT=cT(l1,OT);var Cc=S.forwardRef(function(e,r){return S.createElement(kc,Dr({},e,{ref:r,sideCar:LT}))});Cc.classNames=kc.classNames;var UT=function(e){if(typeof document>"u")return null;var r=Array.isArray(e)?e[0]:e;return r.ownerDocument.body},Ii=new WeakMap,qu=new WeakMap,Pu={},yh=0,c1=function(e){return e&&(e.host||c1(e.parentNode))},BT=function(e,r){return r.map(function(a){if(e.contains(a))return a;var l=c1(a);return l&&e.contains(l)?l:(console.error("aria-hidden",a,"in not contained inside",e,". Doing nothing"),null)}).filter(function(a){return!!a})},IT=function(e,r,a,l){var s=BT(r,Array.isArray(e)?e:[e]);Pu[a]||(Pu[a]=new WeakMap);var c=Pu[a],f=[],d=new Set,p=new Set(s),h=function(x){!x||d.has(x)||(d.add(x),h(x.parentNode))};s.forEach(h);var v=function(x){!x||p.has(x)||Array.prototype.forEach.call(x.children,function(b){if(d.has(b))v(b);else try{var y=b.getAttribute(l),k=y!==null&&y!=="false",j=(Ii.get(b)||0)+1,T=(c.get(b)||0)+1;Ii.set(b,j),c.set(b,T),f.push(b),j===1&&k&&qu.set(b,!0),T===1&&b.setAttribute(a,"true"),k||b.setAttribute(l,"true")}catch(C){console.error("aria-hidden: cannot operate on ",b,C)}})};return v(r),d.clear(),yh++,function(){f.forEach(function(x){var b=Ii.get(x)-1,y=c.get(x)-1;Ii.set(x,b),c.set(x,y),b||(qu.has(x)||x.removeAttribute(l),qu.delete(x)),y||x.removeAttribute(a)}),yh--,yh||(Ii=new WeakMap,Ii=new WeakMap,qu=new WeakMap,Pu={})}},Bm=function(e,r,a){a===void 0&&(a="data-aria-hidden");var l=Array.from(Array.isArray(e)?e:[e]),s=UT(e);return s?(l.push.apply(l,Array.from(s.querySelectorAll("[aria-live], script"))),IT(l,s,a,"aria-hidden")):function(){return null}},Im="Dialog",[f1,d1]=vr(Im),[HT,yr]=f1(Im),h1=e=>{const{__scopeDialog:r,children:a,open:l,defaultOpen:s,onOpenChange:c,modal:f=!0}=e,d=S.useRef(null),p=S.useRef(null),[h=!1,v]=el({prop:l,defaultProp:s,onChange:c});return u.jsx(HT,{scope:r,triggerRef:d,contentRef:p,contentId:zr(),titleId:zr(),descriptionId:zr(),open:h,onOpenChange:v,onOpenToggle:S.useCallback(()=>v(x=>!x),[v]),modal:f,children:a})};h1.displayName=Im;var m1="DialogTrigger",p1=S.forwardRef((e,r)=>{const{__scopeDialog:a,...l}=e,s=yr(m1,a),c=dt(r,s.triggerRef);return u.jsx(Ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Pm(s.open),...l,ref:c,onClick:Te(e.onClick,s.onOpenToggle)})});p1.displayName=m1;var Hm="DialogPortal",[qT,g1]=f1(Hm,{forceMount:void 0}),x1=e=>{const{__scopeDialog:r,forceMount:a,children:l,container:s}=e,c=yr(Hm,r);return u.jsx(qT,{scope:r,forceMount:a,children:S.Children.map(l,f=>u.jsx(Ir,{present:a||c.open,children:u.jsx(jc,{asChild:!0,container:s,children:f})}))})};x1.displayName=Hm;var rc="DialogOverlay",v1=S.forwardRef((e,r)=>{const a=g1(rc,e.__scopeDialog),{forceMount:l=a.forceMount,...s}=e,c=yr(rc,e.__scopeDialog);return c.modal?u.jsx(Ir,{present:l||c.open,children:u.jsx(PT,{...s,ref:r})}):null});v1.displayName=rc;var PT=S.forwardRef((e,r)=>{const{__scopeDialog:a,...l}=e,s=yr(rc,a);return u.jsx(Cc,{as:fa,allowPinchZoom:!0,shards:[s.contentRef],children:u.jsx(Ge.div,{"data-state":Pm(s.open),...l,ref:r,style:{pointerEvents:"auto",...l.style}})})}),Pl="DialogContent",y1=S.forwardRef((e,r)=>{const a=g1(Pl,e.__scopeDialog),{forceMount:l=a.forceMount,...s}=e,c=yr(Pl,e.__scopeDialog);return u.jsx(Ir,{present:l||c.open,children:c.modal?u.jsx($T,{...s,ref:r}):u.jsx(FT,{...s,ref:r})})});y1.displayName=Pl;var $T=S.forwardRef((e,r)=>{const a=yr(Pl,e.__scopeDialog),l=S.useRef(null),s=dt(r,a.contentRef,l);return S.useEffect(()=>{const c=l.current;if(c)return Bm(c)},[]),u.jsx(b1,{...e,ref:s,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Te(e.onCloseAutoFocus,c=>{var f;c.preventDefault(),(f=a.triggerRef.current)==null||f.focus()}),onPointerDownOutside:Te(e.onPointerDownOutside,c=>{const f=c.detail.originalEvent,d=f.button===0&&f.ctrlKey===!0;(f.button===2||d)&&c.preventDefault()}),onFocusOutside:Te(e.onFocusOutside,c=>c.preventDefault())})}),FT=S.forwardRef((e,r)=>{const a=yr(Pl,e.__scopeDialog),l=S.useRef(!1),s=S.useRef(!1);return u.jsx(b1,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{var f,d;(f=e.onCloseAutoFocus)==null||f.call(e,c),c.defaultPrevented||(l.current||(d=a.triggerRef.current)==null||d.focus(),c.preventDefault()),l.current=!1,s.current=!1},onInteractOutside:c=>{var p,h;(p=e.onInteractOutside)==null||p.call(e,c),c.defaultPrevented||(l.current=!0,c.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const f=c.target;((h=a.triggerRef.current)==null?void 0:h.contains(f))&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&s.current&&c.preventDefault()}})}),b1=S.forwardRef((e,r)=>{const{__scopeDialog:a,trapFocus:l,onOpenAutoFocus:s,onCloseAutoFocus:c,...f}=e,d=yr(Pl,a),p=S.useRef(null),h=dt(r,p);return Um(),u.jsxs(u.Fragment,{children:[u.jsx(Sc,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:s,onUnmountAutoFocus:c,children:u.jsx(wc,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":Pm(d.open),...f,ref:h,onDismiss:()=>d.onOpenChange(!1)})}),u.jsxs(u.Fragment,{children:[u.jsx(GT,{titleId:d.titleId}),u.jsx(XT,{contentRef:p,descriptionId:d.descriptionId})]})]})}),qm="DialogTitle",w1=S.forwardRef((e,r)=>{const{__scopeDialog:a,...l}=e,s=yr(qm,a);return u.jsx(Ge.h2,{id:s.titleId,...l,ref:r})});w1.displayName=qm;var S1="DialogDescription",j1=S.forwardRef((e,r)=>{const{__scopeDialog:a,...l}=e,s=yr(S1,a);return u.jsx(Ge.p,{id:s.descriptionId,...l,ref:r})});j1.displayName=S1;var k1="DialogClose",C1=S.forwardRef((e,r)=>{const{__scopeDialog:a,...l}=e,s=yr(k1,a);return u.jsx(Ge.button,{type:"button",...l,ref:r,onClick:Te(e.onClick,()=>s.onOpenChange(!1))})});C1.displayName=k1;function Pm(e){return e?"open":"closed"}var E1="DialogTitleWarning",[VT,N1]=MN(E1,{contentName:Pl,titleName:qm,docsSlug:"dialog"}),GT=({titleId:e})=>{const r=N1(E1),a=`\`${r.contentName}\` requires a \`${r.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${r.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${r.docsSlug}`;return S.useEffect(()=>{e&&(document.getElementById(e)||console.error(a))},[a,e]),null},YT="DialogDescriptionWarning",XT=({contentRef:e,descriptionId:r})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${N1(YT).contentName}}.`;return S.useEffect(()=>{var c;const s=(c=e.current)==null?void 0:c.getAttribute("aria-describedby");r&&s&&(document.getElementById(r)||console.warn(l))},[l,e,r]),null},KT=h1,QT=p1,ZT=x1,JT=v1,WT=y1,eA=w1,tA=j1,T1=C1,A1="AlertDialog",[nA]=vr(A1,[d1]),xa=d1(),_1=e=>{const{__scopeAlertDialog:r,...a}=e,l=xa(r);return u.jsx(KT,{...l,...a,modal:!0})};_1.displayName=A1;var rA="AlertDialogTrigger",M1=S.forwardRef((e,r)=>{const{__scopeAlertDialog:a,...l}=e,s=xa(a);return u.jsx(QT,{...s,...l,ref:r})});M1.displayName=rA;var aA="AlertDialogPortal",R1=e=>{const{__scopeAlertDialog:r,...a}=e,l=xa(r);return u.jsx(ZT,{...l,...a})};R1.displayName=aA;var lA="AlertDialogOverlay",D1=S.forwardRef((e,r)=>{const{__scopeAlertDialog:a,...l}=e,s=xa(a);return u.jsx(JT,{...s,...l,ref:r})});D1.displayName=lA;var Fi="AlertDialogContent",[iA,oA]=nA(Fi),O1=S.forwardRef((e,r)=>{const{__scopeAlertDialog:a,children:l,...s}=e,c=xa(a),f=S.useRef(null),d=dt(r,f),p=S.useRef(null);return u.jsx(VT,{contentName:Fi,titleName:z1,docsSlug:"alert-dialog",children:u.jsx(iA,{scope:a,cancelRef:p,children:u.jsxs(WT,{role:"alertdialog",...c,...s,ref:d,onOpenAutoFocus:Te(s.onOpenAutoFocus,h=>{var v;h.preventDefault(),(v=p.current)==null||v.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[u.jsx(F0,{children:l}),u.jsx(uA,{contentRef:f})]})})})});O1.displayName=Fi;var z1="AlertDialogTitle",L1=S.forwardRef((e,r)=>{const{__scopeAlertDialog:a,...l}=e,s=xa(a);return u.jsx(eA,{...s,...l,ref:r})});L1.displayName=z1;var U1="AlertDialogDescription",B1=S.forwardRef((e,r)=>{const{__scopeAlertDialog:a,...l}=e,s=xa(a);return u.jsx(tA,{...s,...l,ref:r})});B1.displayName=U1;var sA="AlertDialogAction",I1=S.forwardRef((e,r)=>{const{__scopeAlertDialog:a,...l}=e,s=xa(a);return u.jsx(T1,{...s,...l,ref:r})});I1.displayName=sA;var H1="AlertDialogCancel",q1=S.forwardRef((e,r)=>{const{__scopeAlertDialog:a,...l}=e,{cancelRef:s}=oA(H1,a),c=xa(a),f=dt(r,s);return u.jsx(T1,{...c,...l,ref:f})});q1.displayName=H1;var uA=({contentRef:e})=>{const r=`\`${Fi}\` requires a description for the component to be accessible for screen reader users. - -You can add a description to the \`${Fi}\` by passing a \`${U1}\` component as a child, which also benefits sighted users by adding visible context to the dialog. - -Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Fi}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. - -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return S.useEffect(()=>{var l;document.getElementById((l=e.current)==null?void 0:l.getAttribute("aria-describedby"))||console.warn(r)},[r,e]),null},cA=_1,fA=M1,dA=R1,hA=D1,mA=O1,pA=I1,gA=q1,xA=L1,vA=B1;function tl({...e}){return u.jsx(cA,{"data-slot":"alert-dialog",...e})}function nl({...e}){return u.jsx(fA,{"data-slot":"alert-dialog-trigger",...e})}function yA({...e}){return u.jsx(dA,{"data-slot":"alert-dialog-portal",...e})}function bA({className:e,...r}){return u.jsx(hA,{"data-slot":"alert-dialog-overlay",className:_e("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...r})}function rl({className:e,...r}){return u.jsxs(yA,{children:[u.jsx(bA,{}),u.jsx(mA,{"data-slot":"alert-dialog-content",className:_e("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r})]})}function al({className:e,...r}){return u.jsx("div",{"data-slot":"alert-dialog-header",className:_e("flex flex-col gap-2 text-center sm:text-left",e),...r})}function ll({className:e,...r}){return u.jsx("div",{"data-slot":"alert-dialog-footer",className:_e("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...r})}function il({className:e,...r}){return u.jsx(xA,{"data-slot":"alert-dialog-title",className:_e("text-lg font-semibold",e),...r})}function ol({className:e,...r}){return u.jsx(vA,{"data-slot":"alert-dialog-description",className:_e("text-muted-foreground text-sm",e),...r})}function sl({className:e,...r}){return u.jsx(pA,{className:_e(Dm(),e),...r})}function ul({className:e,...r}){return u.jsx(gA,{className:_e(Dm({variant:"outline"}),e),...r})}function wA(){return u.jsxs("div",{className:"flex flex-col gap-6",children:[u.jsx(SA,{}),u.jsx(jA,{})]})}function SA(){const{data:e,loading:r,error:a,reload:l}=Yt(()=>Pe.get("/my/keys")),[s,c]=S.useState(""),[f,d]=S.useState(!1),[p,h]=S.useState(null),v=async b=>{b.preventDefault(),d(!0);try{const y=await Pe.post("/my/keys",{label:s});h(y),c(""),l()}catch(y){Ve.error(String(y instanceof Error?y.message:y))}finally{d(!1)}},x=async b=>{try{await Pe.del(`/my/keys/${b}`),Ve.success("Key deleted"),l()}catch(y){Ve.error(String(y instanceof Error?y.message:y))}};return u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Your API keys"}),u.jsx(ct,{children:"Shown exactly once at creation; only a keyed hash is stored."})]}),u.jsxs(at,{className:"flex flex-col gap-4",children:[u.jsxs("form",{onSubmit:v,className:"flex flex-wrap items-center gap-2",children:[u.jsx(Jt,{className:"w-64",placeholder:"Label (e.g. laptop)",maxLength:120,value:s,onChange:b=>c(b.target.value)}),u.jsxs(ze,{type:"submit",disabled:f,children:[f&&u.jsx(Ot,{}),"Create key"]})]}),p&&u.jsxs("div",{className:"rounded-md border border-primary/40 bg-primary/5 p-4",children:[u.jsxs("p",{className:"mb-2 text-sm font-medium",children:["New key",p.label?` "${p.label}"`:""," โ€” copy it now, it will not be shown again."]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("code",{className:"flex-1 overflow-x-auto rounded bg-background px-2 py-1.5 font-mono text-sm",children:p.key}),u.jsx(ze,{variant:"outline",size:"icon-sm","aria-label":"Copy key",onClick:()=>{navigator.clipboard.writeText(p.key??""),Ve.success("Copied to clipboard")},children:u.jsx(Om,{})})]})]}),r&&!e?u.jsx(Ot,{}):a?u.jsx("p",{className:"text-sm text-destructive",children:a}):u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[u.jsx(ge,{children:"Label"}),u.jsx(ge,{children:"Key"}),u.jsx(ge,{children:"Created"}),u.jsx(ge,{children:"Last used"}),u.jsx(ge,{className:"w-24"})]})}),u.jsxs(xn,{children:[(e==null?void 0:e.keys.length)===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:5,className:"text-muted-foreground",children:"No keys yet."})}),e==null?void 0:e.keys.map(b=>u.jsxs(Ue,{children:[u.jsx(me,{className:"wrap-anywhere",children:b.label||u.jsx("span",{className:"text-muted-foreground",children:"(no label)"})}),u.jsxs(me,{className:"font-mono text-xs",children:["***",b.key_suffix]}),u.jsx(me,{className:"whitespace-nowrap",children:Wa(b.created_at)}),u.jsx(me,{className:"whitespace-nowrap",children:Wa(b.last_used_at)||"never"}),u.jsx(me,{className:"whitespace-nowrap",children:u.jsxs(tl,{children:[u.jsx(nl,{asChild:!0,children:u.jsx(ze,{variant:"ghost",size:"sm",children:"Delete"})}),u.jsxs(rl,{children:[u.jsxs(al,{children:[u.jsx(il,{children:"Delete this key?"}),u.jsxs(ol,{children:["Anything using"," ",b.label?`"${b.label}"`:`***${b.key_suffix}`," ","stops working immediately. This cannot be undone."]})]}),u.jsxs(ll,{children:[u.jsx(ul,{children:"Cancel"}),u.jsx(sl,{onClick:()=>x(b.id),children:"Delete"})]})]})]})})]},b.id))]})]})]})]})}function jA(){const{data:e,loading:r,error:a,reload:l}=Yt(()=>Pe.get("/my/relay-tokens")),[s,c]=S.useState(""),[f,d]=S.useState(!1),[p,h]=S.useState(null),v=async y=>{y.preventDefault(),d(!0);try{const k=await Pe.post("/my/relay-tokens",{label:s});h(k),c(""),l()}catch(k){Ve.error(String(k instanceof Error?k.message:k))}finally{d(!1)}},x=async y=>{try{await Pe.del(`/my/relay-tokens/${y}`),Ve.success("Relay token deleted"),l()}catch(k){Ve.error(String(k instanceof Error?k.message:k))}},b=y=>`export ANTHROPIC_BASE_URL=${window.location.origin}/transparent/anthropic/${y} -claude`;return u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Relay tokens"}),u.jsx(ct,{children:"Tracks your usage on the transparent Anthropic relay. Your Anthropic credentials pass through untouched; the token grants no proxy access."})]}),u.jsxs(at,{className:"flex flex-col gap-4",children:[u.jsxs("form",{onSubmit:v,className:"flex flex-wrap items-center gap-2",children:[u.jsx(Jt,{className:"w-64",placeholder:"Label (e.g. claude-code laptop)",maxLength:120,value:s,onChange:y=>c(y.target.value)}),u.jsxs(ze,{type:"submit",disabled:f,children:[f&&u.jsx(Ot,{}),"Create relay token"]})]}),(p==null?void 0:p.token)&&u.jsxs("div",{className:"rounded-md border border-primary/40 bg-primary/5 p-4",children:[u.jsxs("p",{className:"mb-2 text-sm font-medium",children:["New relay token",p.label?` "${p.label}"`:""," โ€” copy the setup command now, the token will not be shown again."]}),u.jsxs("div",{className:"flex items-start gap-2",children:[u.jsx("pre",{className:"flex-1 overflow-x-auto rounded bg-background px-2 py-1.5 font-mono text-sm",children:b(p.token)}),u.jsx(ze,{variant:"outline",size:"icon-sm","aria-label":"Copy setup command",onClick:()=>{navigator.clipboard.writeText(b(p.token??"")),Ve.success("Copied to clipboard")},children:u.jsx(Om,{})})]}),u.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["Make it permanent via your shell profile or ",'"env"'," in ~/.claude/settings.json."]})]}),r&&!e?u.jsx(Ot,{}):a?u.jsx("p",{className:"text-sm text-destructive",children:a}):u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[u.jsx(ge,{children:"Label"}),u.jsx(ge,{children:"Token"}),u.jsx(ge,{children:"Created"}),u.jsx(ge,{children:"Last used"}),u.jsx(ge,{className:"w-24"})]})}),u.jsxs(xn,{children:[(e==null?void 0:e.relay_tokens.length)===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:5,className:"text-muted-foreground",children:"No relay tokens yet."})}),e==null?void 0:e.relay_tokens.map(y=>u.jsxs(Ue,{children:[u.jsx(me,{className:"wrap-anywhere",children:y.label||u.jsx("span",{className:"text-muted-foreground",children:"(no label)"})}),u.jsxs(me,{className:"font-mono text-xs",children:["***",y.token_suffix]}),u.jsx(me,{className:"whitespace-nowrap",children:Wa(y.created_at)}),u.jsx(me,{className:"whitespace-nowrap",children:Wa(y.last_used_at)||"never"}),u.jsx(me,{className:"whitespace-nowrap",children:u.jsxs(tl,{children:[u.jsx(nl,{asChild:!0,children:u.jsx(ze,{variant:"ghost",size:"sm",children:"Delete"})}),u.jsxs(rl,{children:[u.jsxs(al,{children:[u.jsx(il,{children:"Delete this relay token?"}),u.jsxs(ol,{children:["Anything relaying through"," ",y.label?`"${y.label}"`:`***${y.token_suffix}`," ","stops working immediately. This cannot be undone."]})]}),u.jsxs(ll,{children:[u.jsx(ul,{children:"Cancel"}),u.jsx(sl,{onClick:()=>x(y.id),children:"Delete"})]})]})]})})]},y.id))]})]})]})]})}const Hl={name:"",fill:"fill-chart-1",swatch:"bg-chart-1"},os={name:"",fill:"fill-chart-2 dark:fill-chart-4",swatch:"bg-chart-2 dark:bg-chart-4"},$m={name:"",fill:"fill-chart-3",swatch:"bg-chart-3"},ar=52,kA=22,mr=176,CA=24,EA=2;function NA(){const e=S.useRef(null),[r,a]=S.useState(0);return S.useLayoutEffect(()=>{const l=e.current;if(!l)return;a(l.getBoundingClientRect().width);const s=new ResizeObserver(c=>{a(c[0].contentRect.width)});return s.observe(l),()=>s.disconnect()},[]),[e,r]}function TA(e,r,a=4){if(!(e>0))return[0,1];const l=Math.pow(10,Math.floor(Math.log10(e/a))),s=e/a/l;let c=(s<=1?1:s<=2?2:s<=5?5:10)*l;r&&(c=Math.max(1,Math.round(c)));const f=(Math.floor(e/c)+1)*c,d=[];for(let p=0;p<=f+c/2;p+=c)d.push(Number(p.toFixed(10)));return d}function AA(e,r,a,l,s){const c=s?Math.min(4,a/2,l):0;return`M${e},${r+l} L${e},${r+c} Q${e},${r} ${e+c},${r} L${e+a-c},${r} Q${e+a},${r} ${e+a},${r+c} L${e+a},${r+l} Z`}function Za({points:e,series:r,format:a,integer:l,emptyMessage:s="No usage in this range.",className:c}){var B;const[f,d]=NA(),[p,h]=S.useState(null),v=e.map(O=>O.values.reduce((_,A)=>_+(A??0),0)),x=Math.max(0,...v),b=TA(x,l===!0),y=b[b.length-1]||1,k=Math.max(0,d-ar),j=e.length>0?k/e.length:0,T=Math.max(2,Math.min(CA,j-6)),C=O=>mr-O/y*mr,R=v.indexOf(x),D=Math.max(1,Math.ceil(e.length/8));return u.jsxs("div",{className:_e("flex flex-col gap-2",c),children:[r.length>1&&u.jsx("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:r.map(O=>u.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[u.jsx("span",{className:_e("size-2.5 rounded-xs",O.swatch),"aria-hidden":!0}),O.name]},O.name))}),u.jsxs("div",{ref:f,className:"relative w-full",children:[u.jsxs("svg",{width:d,height:mr+kA,className:"block overflow-visible",onPointerLeave:()=>h(null),children:[b.map(O=>u.jsxs("g",{children:[u.jsx("line",{x1:ar,x2:d,y1:C(O),y2:C(O),className:"stroke-border",strokeWidth:1}),u.jsx("text",{x:ar-8,y:C(O)+3,textAnchor:"end",className:"fill-muted-foreground text-[10px] tabular-nums",children:a(O)})]},O)),p!==null&&u.jsx("rect",{x:ar+p*j,y:0,width:Math.max(j,1),height:mr,className:"fill-foreground/5"}),e.map((O,_)=>{const A=ar+_*j+(j-T)/2;let I=-1;O.values.forEach((q,$)=>{q!==null&&q>0&&(I=$)});let ee=mr;return u.jsx("g",{children:O.values.map((q,$)=>{if(q===null||q<=0)return null;const X=q/y*mr,ce=Math.max(1,X-(ee0&&j>=30&&u.jsx("text",{x:ar+R*j+j/2,y:C(x)-6,textAnchor:"middle",className:"fill-foreground text-[10px] font-medium tabular-nums",children:a(x)}),e.map((O,_)=>_%D===0?u.jsx("text",{x:ar+_*j+j/2,y:mr+15,textAnchor:"middle",className:"fill-muted-foreground text-[10px]",children:O.label},_):null),u.jsx("line",{x1:ar,x2:d,y1:mr,y2:mr,className:"stroke-border",strokeWidth:1}),e.map((O,_)=>u.jsx("rect",{x:ar+_*j,y:0,width:Math.max(j,1),height:mr,fill:"transparent",tabIndex:0,role:"button","aria-label":`${O.title}: ${O.values.map((A,I)=>`${r[I].name||"value"} ${A===null?"unpriced":a(A)}`).join(", ")}`,onPointerEnter:()=>h(_),onFocus:()=>h(_),onBlur:()=>h(null),className:"outline-none focus-visible:stroke-ring focus-visible:[stroke-width:2]"},_))]}),x===0&&u.jsx("p",{className:"pointer-events-none absolute inset-x-0 top-1/2 -translate-y-1/2 text-center text-sm text-muted-foreground",children:s}),p!==null&&e[p]&&u.jsxs("div",{className:"pointer-events-none absolute z-10 min-w-36 -translate-x-1/2 rounded-md border bg-popover p-2 text-xs shadow-md",style:{left:Math.min(Math.max(ar+p*j+j/2,ar+70),Math.max(d-70,ar+70)),top:0},children:[u.jsx("p",{className:"mb-1 text-muted-foreground",children:e[p].title}),e[p].values.map((O,_)=>u.jsxs("p",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:_e("h-0.5 w-3 rounded-full",r[_].swatch),"aria-hidden":!0}),u.jsx("span",{className:"font-medium tabular-nums",children:O===null?"unpriced":a(O)}),r[_].name&&u.jsx("span",{className:"text-muted-foreground",children:r[_].name})]},_)),(B=e[p].rows)==null?void 0:B.map(O=>u.jsxs("p",{className:"flex items-center gap-1.5 pl-[18px]",children:[u.jsx("span",{className:"font-medium tabular-nums",children:O.value}),u.jsx("span",{className:"text-muted-foreground",children:O.label})]},O.label))]})]})]})}const Bl=[{fill:"fill-chart-1",swatch:"bg-chart-1"},{fill:"fill-chart-5",swatch:"bg-chart-5"},{fill:"fill-chart-3",swatch:"bg-chart-3"},{fill:"fill-border",swatch:"bg-border"}],bh=Bl.length;function Ec(e,r,a){if(e.length<=bh)return{slices:e.map(r),overflow:[]};const l=e.slice(bh-1);return{slices:[...e.slice(0,bh-1).map(r),a(l)],overflow:l.map(r)}}function _A(e,r,a,l,s,c){const f=(p,h)=>`${e+p*Math.sin(h)},${r-p*Math.cos(h)}`;if(c-s>=Math.PI*2-1e-9){const p=(h,v)=>`M${e},${r-h} A${h},${h} 0 1 ${v} ${e},${r+h} A${h},${h} 0 1 ${v} ${e},${r-h} Z`;return`${p(a,1)} ${p(l,0)}`}const d=c-s>Math.PI?1:0;return`M${f(a,s)} A${a},${a} 0 ${d} 1 ${f(a,c)} L${f(l,c)} A${l},${l} 0 ${d} 0 ${f(l,s)} Z`}const wh=20;function rs({slices:e,overflow:r=[],format:a,emptyMessage:l="No usage in this range."}){var D;const[s,c]=S.useState(null),[f,d]=S.useState(0),p=r.length>0?e.length-1:-1,h=()=>d(B=>B===0?Math.min(wh,r.length):0),v=e.reduce((B,O)=>B+O.value,0),x=168,b=82,y=50,k=x/2,j=x/2;if(v<=0)return u.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:l});const T=e.length>1?2/((y+b)/2):0;let C=0;const R=e.map((B,O)=>{const _=B.value/v*Math.PI*2,A=C+T/2,I=Math.max(A,C+_-T/2);return C+=_,{slice:B,a0:A,a1:I,i:O}});return u.jsxs("div",{className:"flex flex-wrap items-center gap-x-8 gap-y-4",children:[u.jsxs("div",{className:"relative shrink-0",children:[u.jsx("svg",{width:x,height:x,className:"block",onPointerLeave:()=>c(null),children:R.map(({slice:B,a0:O,a1:_,i:A})=>u.jsx("path",{d:_A(k,j,b,y,O,_),className:_e(Bl[A%Bl.length].fill,"outline-none transition-opacity focus-visible:stroke-ring focus-visible:[stroke-width:2]",s!==null&&s!==A&&"opacity-50",A===p&&"cursor-pointer"),tabIndex:0,role:A===p?"button":"img","aria-label":`${B.label}: ${a(B.value)} (${Math.round(B.value/v*100)}%)`+(A===p?f===0?"; activate to expand":"; activate to collapse":""),onClick:A===p?h:void 0,onKeyDown:A===p?I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),h())}:void 0,onPointerEnter:()=>c(A),onFocus:()=>c(A),onBlur:()=>c(null)},A))}),s!==null&&e[s]&&u.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-0 z-10 min-w-32 -translate-x-1/2 rounded-md border bg-popover p-2 text-xs shadow-md",children:[u.jsx("p",{className:"mb-1 text-muted-foreground",children:e[s].label}),u.jsxs("p",{className:"font-medium tabular-nums",children:[a(e[s].value)," ",u.jsxs("span",{className:"font-normal text-muted-foreground",children:["ยท ",(e[s].value/v*100).toFixed(1),"%"]})]}),(D=e[s].rows)==null?void 0:D.map(B=>u.jsxs("p",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:"font-medium tabular-nums",children:B.value}),u.jsx("span",{className:"text-muted-foreground",children:B.label})]},B.label))]})]}),u.jsxs("ul",{className:"min-w-48 flex-1",children:[e.map((B,O)=>u.jsx("li",{className:_e("rounded-sm text-sm",s===O&&"bg-foreground/5"),onPointerEnter:()=>c(O),onPointerLeave:()=>c(null),children:O===p?u.jsxs("button",{type:"button",className:"flex w-full cursor-pointer items-center gap-2 rounded-sm px-1 py-1 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-expanded":f>0,onClick:h,children:[u.jsx("span",{className:_e("size-2.5 shrink-0 rounded-xs",Bl[O%Bl.length].swatch),"aria-hidden":!0}),u.jsx("span",{className:"truncate font-mono text-xs",children:B.label}),f>0?u.jsx(Xi,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":!0}):u.jsx(tm,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":!0}),u.jsx("span",{className:"ml-auto tabular-nums text-muted-foreground",children:a(B.value)}),u.jsxs("span",{className:"w-12 text-right tabular-nums",children:[(B.value/v*100).toFixed(1),"%"]})]}):u.jsxs("span",{className:"flex items-center gap-2 px-1 py-1",children:[u.jsx("span",{className:_e("size-2.5 shrink-0 rounded-xs",Bl[O%Bl.length].swatch),"aria-hidden":!0}),u.jsx("span",{className:"truncate font-mono text-xs",title:B.label,children:B.label}),u.jsx("span",{className:"ml-auto tabular-nums text-muted-foreground",children:a(B.value)}),u.jsxs("span",{className:"w-12 text-right tabular-nums",children:[(B.value/v*100).toFixed(1),"%"]})]})},O)),r.slice(0,f).map((B,O)=>u.jsxs("li",{className:"flex items-center gap-2 py-1 pl-[26px] pr-1 text-sm",onPointerEnter:()=>c(p),onPointerLeave:()=>c(null),children:[u.jsx("span",{className:"truncate font-mono text-xs",title:B.label,children:B.label}),u.jsx("span",{className:"ml-auto tabular-nums text-muted-foreground",children:a(B.value)}),u.jsxs("span",{className:"w-12 text-right tabular-nums",children:[(B.value/v*100).toFixed(1),"%"]})]},`overflow-${O}`)),f>0&&fd(B=>Math.min(B+wh,r.length)),children:["Show ",Math.min(wh,r.length-f)," more"]})})]})]})}function Vi({rows:e,format:r,emptyMessage:a="No usage in this range."}){const l=Math.max(0,...e.map(c=>c.value));if(e.length===0||l<=0)return u.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:a});const s=e.reduce((c,f)=>c+f.value,0);return u.jsx("ul",{className:"flex flex-col gap-2",children:e.map((c,f)=>u.jsxs("li",{className:"grid grid-cols-[minmax(6rem,14rem)_1fr_auto] items-center gap-3 text-sm",children:[u.jsx("span",{className:"truncate font-mono text-xs",title:c.title??c.label,children:c.label}),u.jsx("span",{className:"h-2 overflow-hidden rounded-full bg-muted","aria-hidden":!0,children:u.jsx("span",{className:"block h-full rounded-full bg-chart-1",style:{width:`${Math.max(1,c.value/l*100)}%`}})}),u.jsxs("span",{className:"tabular-nums text-muted-foreground",children:[r(c.value),c.note&&u.jsx("span",{className:"ml-2 text-xs",children:c.note}),u.jsxs("span",{className:"ml-2 inline-block w-12 text-right text-foreground",children:[(c.value/s*100).toFixed(1),"%"]})]})]},f))})}function gr({label:e,value:r,secondary:a,delta:l,hint:s}){return u.jsxs("div",{className:"flex flex-col gap-1 rounded-lg border bg-card p-4",children:[u.jsx("span",{className:"text-xs text-muted-foreground",children:e}),u.jsxs("span",{className:"text-2xl font-semibold",children:[r,a&&u.jsx("span",{className:"ml-2 text-sm font-normal text-muted-foreground",children:a})]}),u.jsx("span",{className:"text-xs text-muted-foreground",children:l==null?s??"ย ":u.jsxs(u.Fragment,{children:[l>=0?"+":"",Math.round(l*100),"% vs previous"]})})]})}function sb(e,[r,a]){return Math.min(a,Math.max(r,e))}function Fm(e){const r=e+"CollectionProvider",[a,l]=vr(r),[s,c]=a(r,{collectionRef:{current:null},itemMap:new Map}),f=y=>{const{scope:k,children:j}=y,T=ve.useRef(null),C=ve.useRef(new Map).current;return u.jsx(s,{scope:k,itemMap:C,collectionRef:T,children:j})};f.displayName=r;const d=e+"CollectionSlot",p=ve.forwardRef((y,k)=>{const{scope:j,children:T}=y,C=c(d,j),R=dt(k,C.collectionRef);return u.jsx(fa,{ref:R,children:T})});p.displayName=d;const h=e+"CollectionItemSlot",v="data-radix-collection-item",x=ve.forwardRef((y,k)=>{const{scope:j,children:T,...C}=y,R=ve.useRef(null),D=dt(k,R),B=c(h,j);return ve.useEffect(()=>(B.itemMap.set(R,{ref:R,...C}),()=>void B.itemMap.delete(R))),u.jsx(fa,{[v]:"",ref:D,children:T})});x.displayName=h;function b(y){const k=c(e+"CollectionConsumer",y);return ve.useCallback(()=>{const T=k.collectionRef.current;if(!T)return[];const C=Array.from(T.querySelectorAll(`[${v}]`));return Array.from(k.itemMap.values()).sort((B,O)=>C.indexOf(B.ref.current)-C.indexOf(O.ref.current))},[k.collectionRef,k.itemMap])}return[{Provider:f,Slot:p,ItemSlot:x},b,l]}var MA=S.createContext(void 0);function Nc(e){const r=S.useContext(MA);return e||r||"ltr"}const RA=["top","right","bottom","left"],cl=Math.min,sa=Math.max,ac=Math.round,$u=Math.floor,ua=e=>({x:e,y:e}),DA={left:"right",right:"left",bottom:"top",top:"bottom"};function P1(e,r,a){return sa(e,cl(r,a))}function da(e,r){return typeof e=="function"?e(r):e}function fl(e){return e.split("-")[0]}function Qi(e){return e.split("-")[1]}function Vm(e){return e==="x"?"y":"x"}function Gm(e){return e==="y"?"height":"width"}function Or(e){const r=e[0];return r==="t"||r==="b"?"y":"x"}function Ym(e){return Vm(Or(e))}function OA(e,r,a){a===void 0&&(a=!1);const l=Qi(e),s=Ym(e),c=Gm(s);let f=s==="x"?l===(a?"end":"start")?"right":"left":l==="start"?"bottom":"top";return r.reference[c]>r.floating[c]&&(f=lc(f)),[f,lc(f)]}function zA(e){const r=lc(e);return[im(e),r,im(r)]}function im(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ub=["left","right"],cb=["right","left"],LA=["top","bottom"],UA=["bottom","top"];function BA(e,r,a){switch(e){case"top":case"bottom":return a?r?cb:ub:r?ub:cb;case"left":case"right":return r?LA:UA;default:return[]}}function IA(e,r,a,l){const s=Qi(e);let c=BA(fl(e),a==="start",l);return s&&(c=c.map(f=>f+"-"+s),r&&(c=c.concat(c.map(im)))),c}function lc(e){const r=fl(e);return DA[r]+e.slice(r.length)}function HA(e){var r,a,l,s;return{top:(r=e.top)!=null?r:0,right:(a=e.right)!=null?a:0,bottom:(l=e.bottom)!=null?l:0,left:(s=e.left)!=null?s:0}}function $1(e){return typeof e!="number"?HA(e):{top:e,right:e,bottom:e,left:e}}function ic(e){const{x:r,y:a,width:l,height:s}=e;return{width:l,height:s,top:a,left:r,right:r+l,bottom:a+s,x:r,y:a}}function fb(e,r,a){let{reference:l,floating:s}=e;const c=Or(r),f=Ym(r),d=Gm(f),p=fl(r),h=c==="y",v=l.x+l.width/2-s.width/2,x=l.y+l.height/2-s.height/2,b=l[d]/2-s[d]/2;let y;switch(p){case"top":y={x:v,y:l.y-s.height};break;case"bottom":y={x:v,y:l.y+l.height};break;case"right":y={x:l.x+l.width,y:x};break;case"left":y={x:l.x-s.width,y:x};break;default:y={x:l.x,y:l.y}}const k=Qi(r);return k&&(y[f]+=b*(k==="end"?1:-1)*(a&&h?-1:1)),y}async function qA(e,r){var a;r===void 0&&(r={});const{x:l,y:s,platform:c,rects:f,elements:d,strategy:p}=e,{boundary:h="clippingAncestors",rootBoundary:v="viewport",elementContext:x="floating",altBoundary:b=!1,padding:y=0}=da(r,e),k=$1(y),T=d[b?x==="floating"?"reference":"floating":x],C=ic(await c.getClippingRect({element:(a=await(c.isElement==null?void 0:c.isElement(T)))==null||a?T:T.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(d.floating)),boundary:h,rootBoundary:v,strategy:p})),R=x==="floating"?{x:l,y:s,width:f.floating.width,height:f.floating.height}:f.reference,D=await(c.getOffsetParent==null?void 0:c.getOffsetParent(d.floating)),B=await(c.isElement==null?void 0:c.isElement(D))&&await(c.getScale==null?void 0:c.getScale(D))||{x:1,y:1},O=ic(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:R,offsetParent:D,strategy:p}):R);return{top:(C.top-O.top+k.top)/B.y,bottom:(O.bottom-C.bottom+k.bottom)/B.y,left:(C.left-O.left+k.left)/B.x,right:(O.right-C.right+k.right)/B.x}}const PA=50,$A=async(e,r,a)=>{const{placement:l="bottom",strategy:s="absolute",middleware:c=[],platform:f}=a,d=f.detectOverflow?f:{...f,detectOverflow:qA},p=await(f.isRTL==null?void 0:f.isRTL(r));let h=await f.getElementRects({reference:e,floating:r,strategy:s}),{x:v,y:x}=fb(h,l,p),b=l,y=0;const k={};for(let j=0;j({name:"arrow",options:e,async fn(r){const{x:a,y:l,placement:s,rects:c,platform:f,elements:d,middlewareData:p}=r,{element:h,padding:v=0}=da(e,r)||{};if(h==null)return{};const x=$1(v),b={x:a,y:l},y=Ym(s),k=Gm(y),j=await f.getDimensions(h),T=y==="y",C=T?"top":"left",R=T?"bottom":"right",D=T?"clientHeight":"clientWidth",B=c.reference[k]+c.reference[y]-b[y]-c.floating[k],O=b[y]-c.reference[y],_=await(f.getOffsetParent==null?void 0:f.getOffsetParent(h));let A=_?_[D]:0;(!A||!await(f.isElement==null?void 0:f.isElement(_)))&&(A=d.floating[D]||c.floating[k]);const I=B/2-O/2,ee=A/2-j[k]/2-1,q=cl(x[C],ee),$=cl(x[R],ee),X=A-j[k]-$,ce=A/2-j[k]/2+I,le=P1(q,ce,X),W=!p.arrow&&Qi(s)!=null&&ce!==le&&c.reference[k]/2-(cele<=0)){var $,X;const le=((($=c.flip)==null?void 0:$.index)||0)+1,W=A[le];if(W&&(!(x==="alignment"?R!==Or(W):!1)||q.every(ie=>Or(ie.placement)===R?ie.overflows[0]>0:!0)))return{data:{index:le,overflows:q},reset:{placement:W}};let U=(X=q.filter(Z=>Z.overflows[0]<=0).sort((Z,ie)=>Z.overflows[1]-ie.overflows[1])[0])==null?void 0:X.placement;if(!U)switch(y){case"bestFit":{var ce;const Z=(ce=q.filter(ie=>{if(_){const K=Or(ie.placement);return K===R||K==="y"}return!0}).map(ie=>[ie.placement,ie.overflows.filter(K=>K>0).reduce((K,E)=>K+E,0)]).sort((ie,K)=>ie[1]-K[1])[0])==null?void 0:ce[0];Z&&(U=Z);break}case"initialPlacement":U=d;break}if(s!==U)return{reset:{placement:U}}}return{}}}};function db(e,r){return{top:e.top-r.height,right:e.right-r.width,bottom:e.bottom-r.height,left:e.left-r.width}}function hb(e){return RA.some(r=>e[r]>=0)}const GA=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(r){const{rects:a,platform:l}=r,{strategy:s="referenceHidden",...c}=da(e,r);switch(s){case"referenceHidden":{const f=await l.detectOverflow(r,{...c,elementContext:"reference"}),d=db(f,a.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:hb(d)}}}case"escaped":{const f=await l.detectOverflow(r,{...c,altBoundary:!0}),d=db(f,a.floating);return{data:{escapedOffsets:d,escaped:hb(d)}}}default:return{}}}}},F1=new Set(["left","top"]);async function YA(e,r){const{placement:a,platform:l,elements:s}=e,c=await(l.isRTL==null?void 0:l.isRTL(s.floating)),f=fl(a),d=Qi(a),p=Or(a)==="y",h=F1.has(f)?-1:1,v=c&&p?-1:1,x=da(r,e);let{mainAxis:b,crossAxis:y,alignmentAxis:k}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return d&&typeof k=="number"&&(y=d==="end"?k*-1:k),p?{x:y*v,y:b*h}:{x:b*h,y:y*v}}const XA=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(r){var a,l;const{x:s,y:c,placement:f,middlewareData:d}=r,p=await YA(r,e);return f===((a=d.offset)==null?void 0:a.placement)&&(l=d.arrow)!=null&&l.alignmentOffset?{}:{x:s+p.x,y:c+p.y,data:{...p,placement:f}}}}},KA=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(r){const{x:a,y:l,placement:s,platform:c}=r,{mainAxis:f=!0,crossAxis:d=!1,limiter:p={fn:R=>{let{x:D,y:B}=R;return{x:D,y:B}}},...h}=da(e,r),v={x:a,y:l},x=await c.detectOverflow(r,h),b=Or(s),y=Vm(b);let k=v[y],j=v[b];const T=(R,D)=>P1(D+x[R==="y"?"top":"left"],D,D-x[R==="y"?"bottom":"right"]);f&&(k=T(y,k)),d&&(j=T(b,j));const C=p.fn({...r,[y]:k,[b]:j});return{...C,data:{x:C.x-a,y:C.y-l,enabled:{[y]:f,[b]:d}}}}}},QA=function(e){return e===void 0&&(e={}),{options:e,fn(r){var a,l;const{x:s,y:c,placement:f,rects:d,middlewareData:p}=r,{offset:h=0,mainAxis:v=!0,crossAxis:x=!0}=da(e,r),b={x:s,y:c},y=Or(f),k=Vm(y);let j=b[k],T=b[y];const C=da(h,r),R=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:(a=C.mainAxis)!=null?a:0,crossAxis:(l=C.crossAxis)!=null?l:0};if(v){const O=k==="y"?"height":"width",_=d.reference[k]-d.floating[O]+R.mainAxis,A=d.reference[k]+d.reference[O]-R.mainAxis;j<_?j=_:j>A&&(j=A)}if(x){var D,B;const O=k==="y"?"width":"height",_=F1.has(fl(f)),A=d.reference[y]-d.floating[O]+(_&&((D=p.offset)==null?void 0:D[y])||0)+(_?0:R.crossAxis),I=d.reference[y]+d.reference[O]+(_?0:((B=p.offset)==null?void 0:B[y])||0)-(_?R.crossAxis:0);TI&&(T=I)}return{[k]:j,[y]:T}}}},ZA=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(r){const{placement:a,rects:l,platform:s,elements:c}=r,{apply:f=()=>{},...d}=da(e,r),p=await s.detectOverflow(r,d),h=fl(a),v=Qi(a),x=Or(a)==="y",{width:b,height:y}=l.floating;let k,j;h==="top"||h==="bottom"?(k=h,j=v===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(j=h,k=v==="end"?"top":"bottom");const T=y-p.top-p.bottom,C=b-p.left-p.right,R=cl(y-p[k],T),D=cl(b-p[j],C),B=r.middlewareData.shift,O=!B;let _=R,A=D;B!=null&&B.enabled.x&&(A=C),B!=null&&B.enabled.y&&(_=T),O&&!v&&(x?A=b-2*sa(p.left,p.right):_=y-2*sa(p.top,p.bottom)),await f({...r,availableWidth:A,availableHeight:_});const I=await s.getDimensions(c.floating);return b!==I.width||y!==I.height?{reset:{rects:!0}}:{}}}};function Tc(){return typeof window<"u"}function Zi(e){return V1(e)?(e.nodeName||"").toLowerCase():"#document"}function Ln(e){var r;return(e==null||(r=e.ownerDocument)==null?void 0:r.defaultView)||window}function va(e){var r;return(r=(V1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:r.documentElement}function V1(e){return Tc()?e instanceof Node||e instanceof Ln(e).Node:!1}function Lr(e){return Tc()?e instanceof Element||e instanceof Ln(e).Element:!1}function hl(e){return Tc()?e instanceof HTMLElement||e instanceof Ln(e).HTMLElement:!1}function mb(e){return!Tc()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ln(e).ShadowRoot}function Ac(e){const{overflow:r,overflowX:a,overflowY:l,display:s}=Ur(e);return/auto|scroll|overlay|hidden|clip/.test(r+l+a)&&s!=="inline"&&s!=="contents"}function JA(e){return/^(table|td|th)$/.test(Zi(e))}function _c(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const WA=/transform|translate|scale|rotate|perspective|filter/,e_=/paint|layout|strict|content/,Ll=e=>!!e&&e!=="none";let Sh;function Xm(e){const r=Lr(e)?Ur(e):e;return Ll(r.transform)||Ll(r.translate)||Ll(r.scale)||Ll(r.rotate)||Ll(r.perspective)||!Km()&&(Ll(r.backdropFilter)||Ll(r.filter))||WA.test(r.willChange||"")||e_.test(r.contain||"")}function t_(e){let r=$l(e);for(;hl(r)&&!ss(r);){if(Xm(r))return r;if(_c(r))return null;r=$l(r)}return null}function Km(){return Sh==null&&(Sh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Sh}function ss(e){return/^(html|body|#document)$/.test(Zi(e))}function Ur(e){return Ln(e).getComputedStyle(e)}function Mc(e){return Lr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function $l(e){if(Zi(e)==="html")return e;const r=e.assignedSlot||e.parentNode||mb(e)&&e.host||va(e);return mb(r)?r.host:r}function G1(e){const r=$l(e);return ss(r)?(e.ownerDocument||e).body:hl(r)&&Ac(r)?r:G1(r)}function us(e,r,a){var l;r===void 0&&(r=[]),a===void 0&&(a=!0);const s=G1(e),c=s===((l=e.ownerDocument)==null?void 0:l.body),f=Ln(s);if(c){const d=om(f);return r.concat(f,f.visualViewport||[],Ac(s)?s:[],d&&a?us(d):[])}else return r.concat(s,us(s,[],a))}function om(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Y1(e){const r=Ur(e);let a=parseFloat(r.width)||0,l=parseFloat(r.height)||0;const s=hl(e),c=s?e.offsetWidth:a,f=s?e.offsetHeight:l,d=ac(a)!==c||ac(l)!==f;return d&&(a=c,l=f),{width:a,height:l,$:d}}function Qm(e){return Lr(e)?e:e.contextElement}function Gi(e){const r=Qm(e);if(!hl(r))return ua(1);const a=r.getBoundingClientRect(),{width:l,height:s,$:c}=Y1(r);let f=(c?ac(a.width):a.width)/l,d=(c?ac(a.height):a.height)/s;return(!f||!Number.isFinite(f))&&(f=1),(!d||!Number.isFinite(d))&&(d=1),{x:f,y:d}}const n_=ua(0);function X1(e){const r=Ln(e);return!Km()||!r.visualViewport?n_:{x:r.visualViewport.offsetLeft,y:r.visualViewport.offsetTop}}function r_(e,r,a){return r===void 0&&(r=!1),!!a&&r&&a===Ln(e)}function Fl(e,r,a,l){r===void 0&&(r=!1),a===void 0&&(a=!1);const s=e.getBoundingClientRect(),c=Qm(e);let f=ua(1);r&&(l?Lr(l)&&(f=Gi(l)):f=Gi(e));const d=r_(c,a,l)?X1(c):ua(0);let p=(s.left+d.x)/f.x,h=(s.top+d.y)/f.y,v=s.width/f.x,x=s.height/f.y;if(c&&l){const b=Ln(c),y=Lr(l)?Ln(l):l;let k=b,j=om(k);for(;j&&y!==k;){const T=Gi(j),C=j.getBoundingClientRect(),R=Ur(j),D=C.left+(j.clientLeft+parseFloat(R.paddingLeft))*T.x,B=C.top+(j.clientTop+parseFloat(R.paddingTop))*T.y;p*=T.x,h*=T.y,v*=T.x,x*=T.y,p+=D,h+=B,k=Ln(j),j=om(k)}}return ic({width:v,height:x,x:p,y:h})}function Rc(e,r){const a=Mc(e).scrollLeft;return r?r.left+a:Fl(va(e)).left+a}function K1(e,r){const a=e.getBoundingClientRect(),l=a.left+r.scrollLeft-Rc(e,a),s=a.top+r.scrollTop;return{x:l,y:s}}function a_(e){let{elements:r,rect:a,offsetParent:l,strategy:s}=e;const c=s==="fixed",f=va(l),d=r?_c(r.floating):!1;if(l===f||d&&c)return a;let p={scrollLeft:0,scrollTop:0},h=ua(1);const v=ua(0),x=hl(l);if((x||!c)&&((Zi(l)!=="body"||Ac(f))&&(p=Mc(l)),x)){const y=Fl(l);h=Gi(l),v.x=y.x+l.clientLeft,v.y=y.y+l.clientTop}const b=f&&!x&&!c?K1(f,p):ua(0);return{width:a.width*h.x,height:a.height*h.y,x:a.x*h.x-p.scrollLeft*h.x+v.x+b.x,y:a.y*h.y-p.scrollTop*h.y+v.y+b.y}}function l_(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function i_(e){const r=Mc(e),a=e.ownerDocument.body,l=sa(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),s=sa(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight);let c=-r.scrollLeft+Rc(e);const f=-r.scrollTop;return Ur(a).direction==="rtl"&&(c+=sa(e.clientWidth,a.clientWidth)-l),{width:l,height:s,x:c,y:f}}const o_=25;function s_(e,r,a){a===void 0&&(a="viewport");const l=a==="layoutViewport",s=Ln(e),c=va(e),f=s.visualViewport;let d=c.clientWidth,p=c.clientHeight,h=0,v=0;if(f){const b=!Km()||r==="fixed";l?b||(h=-f.offsetLeft,v=-f.offsetTop):(d=f.width,p=f.height,b&&(h=f.offsetLeft,v=f.offsetTop))}if(Rc(c)<=0){const b=c.ownerDocument,y=b.body,k=getComputedStyle(y),j=b.compatMode==="CSS1Compat"&&parseFloat(k.marginLeft)+parseFloat(k.marginRight)||0,T=Math.abs(c.clientWidth-y.clientWidth-j),C=getComputedStyle(c).scrollbarGutter==="stable both-edges"?T/2:T;C<=o_&&(d-=C)}return{width:d,height:p,x:h,y:v}}function u_(e,r){const a=Fl(e,!0,r==="fixed"),l=a.top+e.clientTop,s=a.left+e.clientLeft,c=Gi(e),f=e.clientWidth*c.x,d=e.clientHeight*c.y,p=s*c.x,h=l*c.y;return{width:f,height:d,x:p,y:h}}function pb(e,r,a){let l;if(r==="viewport"||r==="layoutViewport")l=s_(e,a,r);else if(r==="document")l=i_(va(e));else if(Lr(r))l=u_(r,a);else{const s=X1(e);l={x:r.x-s.x,y:r.y-s.y,width:r.width,height:r.height}}return ic(l)}function c_(e,r){const a=r.get(e);if(a)return a;let l=us(e,[],!1).filter(d=>Lr(d)&&Zi(d)!=="body"),s=null;const c=Ur(e).position==="fixed";let f=c?$l(e):e;for(;Lr(f)&&!ss(f);){const d=Ur(f),p=Xm(f),h=s?s.position:c?"fixed":"";!p&&(h==="fixed"||h==="absolute"&&d.position==="static")?l=l.filter(x=>x!==f):s=d,f=$l(f)}return r.set(e,l),l}function f_(e){let{element:r,boundary:a,rootBoundary:l,strategy:s}=e;const f=[...a==="clippingAncestors"?_c(r)?[]:c_(r,this._c):[].concat(a),l],d=pb(r,f[0],s);let p=d.top,h=d.right,v=d.bottom,x=d.left;for(let b=1;b{d(!1,1e-7)},1e3)}A=!1}try{l=new IntersectionObserver(I,{..._,root:c.ownerDocument})}catch{l=new IntersectionObserver(I,_)}l.observe(e)}const p=Ln(e),h=()=>d(a);return p.addEventListener("resize",h),d(!0),()=>{p.removeEventListener("resize",h),f()}}function v_(e,r,a,l){l===void 0&&(l={});const{ancestorScroll:s=!0,ancestorResize:c=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:p=!1}=l,h=Qm(e),v=s||c?[...h?us(h):[],...r?us(r):[]]:[];v.forEach(C=>{s&&C.addEventListener("scroll",a),c&&C.addEventListener("resize",a)});const x=h&&d?x_(h,a,c):null;let b=-1,y=null;f&&(y=new ResizeObserver(C=>{let[R]=C;R&&R.target===h&&y&&r&&(y.unobserve(r),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var D;(D=y)==null||D.observe(r)})),a()}),h&&!p&&y.observe(h),r&&y.observe(r));let k,j=p?Fl(e):null;p&&T();function T(){const C=Fl(e);j&&!Z1(j,C)&&a(),j=C,k=requestAnimationFrame(T)}return a(),()=>{var C;v.forEach(R=>{s&&R.removeEventListener("scroll",a),c&&R.removeEventListener("resize",a)}),x==null||x(),(C=y)==null||C.disconnect(),y=null,p&&cancelAnimationFrame(k)}}const y_=XA,b_=KA,w_=VA,S_=ZA,j_=GA,xb=FA,k_=QA,C_=(e,r,a)=>{const l=new Map,s=a??{},c={...g_,...s.platform,_c:l};return $A(e,r,{...s,platform:c})};var E_=typeof document<"u",N_=function(){},ec=E_?S.useLayoutEffect:N_;function oc(e,r){if(e===r)return!0;if(typeof e!=typeof r)return!1;if(typeof e=="function"&&e.toString()===r.toString())return!0;let a,l,s;if(e&&r&&typeof e=="object"){if(Array.isArray(e)){if(a=e.length,a!==r.length)return!1;for(l=a;l--!==0;)if(!oc(e[l],r[l]))return!1;return!0}if(s=Object.keys(e),a=s.length,a!==Object.keys(r).length)return!1;for(l=a;l--!==0;)if(!{}.hasOwnProperty.call(r,s[l]))return!1;for(l=a;l--!==0;){const c=s[l];if(!(c==="_owner"&&e.$$typeof)&&!oc(e[c],r[c]))return!1}return!0}return e!==e&&r!==r}function J1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vb(e,r){const a=J1(e);return Math.round(r*a)/a}function kh(e){const r=S.useRef(e);return ec(()=>{r.current=e}),r}function T_(e){e===void 0&&(e={});const{placement:r="bottom",strategy:a="absolute",middleware:l=[],platform:s,elements:{reference:c,floating:f}={},transform:d=!0,whileElementsMounted:p,open:h}=e,[v,x]=S.useState({x:0,y:0,strategy:a,placement:r,middlewareData:{},isPositioned:!1}),[b,y]=S.useState(l);oc(b,l)||y(l);const[k,j]=S.useState(null),[T,C]=S.useState(null),R=S.useCallback(ie=>{ie!==_.current&&(_.current=ie,j(ie))},[]),D=S.useCallback(ie=>{ie!==A.current&&(A.current=ie,C(ie))},[]),B=c||k,O=f||T,_=S.useRef(null),A=S.useRef(null),I=S.useRef(v),ee=p!=null,q=kh(p),$=kh(s),X=kh(h),ce=S.useCallback(()=>{if(!_.current||!A.current)return;const ie={placement:r,strategy:a,middleware:b};$.current&&(ie.platform=$.current),C_(_.current,A.current,ie).then(K=>{const E={...K,isPositioned:X.current!==!1};le.current&&!oc(I.current,E)&&(I.current=E,ms.flushSync(()=>{x(E)}))})},[b,r,a,$,X]);ec(()=>{h===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,x(ie=>({...ie,isPositioned:!1})))},[h]);const le=S.useRef(!1);ec(()=>(le.current=!0,()=>{le.current=!1}),[]),ec(()=>{if(B&&(_.current=B),O&&(A.current=O),B&&O){if(q.current)return q.current(B,O,ce);ce()}},[B,O,ce,q,ee]);const W=S.useMemo(()=>({reference:_,floating:A,setReference:R,setFloating:D}),[R,D]),U=S.useMemo(()=>({reference:B,floating:O}),[B,O]),Z=S.useMemo(()=>{const ie={position:a,left:0,top:0};if(!U.floating)return ie;const K=vb(U.floating,v.x),E=vb(U.floating,v.y);return d?{...ie,transform:"translate("+K+"px, "+E+"px)",...J1(U.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:K,top:E}},[a,d,U.floating,v.x,v.y]);return S.useMemo(()=>({...v,update:ce,refs:W,elements:U,floatingStyles:Z}),[v,ce,W,U,Z])}const A_=e=>{function r(a){return{}.hasOwnProperty.call(a,"current")}return{name:"arrow",options:e,fn(a){const{element:l,padding:s}=typeof e=="function"?e(a):e;return l&&r(l)?l.current!=null?xb({element:l.current,padding:s}).fn(a):{}:l?xb({element:l,padding:s}).fn(a):{}}}},__=(e,r)=>{const a=y_(e);return{name:a.name,fn:a.fn,options:[e,r]}},M_=(e,r)=>{const a=b_(e);return{name:a.name,fn:a.fn,options:[e,r]}},R_=(e,r)=>({fn:k_(e).fn,options:[e,r]}),D_=(e,r)=>{const a=w_(e);return{name:a.name,fn:a.fn,options:[e,r]}},O_=(e,r)=>{const a=S_(e);return{name:a.name,fn:a.fn,options:[e,r]}},z_=(e,r)=>{const a=j_(e);return{name:a.name,fn:a.fn,options:[e,r]}},L_=(e,r)=>{const a=A_(e);return{name:a.name,fn:a.fn,options:[e,r]}};var U_="Arrow",W1=S.forwardRef((e,r)=>{const{children:a,width:l=10,height:s=5,...c}=e;return u.jsx(Ge.svg,{...c,ref:r,width:l,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?a:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});W1.displayName=U_;var B_=W1;function Zm(e){const[r,a]=S.useState(void 0);return Sn(()=>{if(e){a({width:e.offsetWidth,height:e.offsetHeight});const l=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const c=s[0];let f,d;if("borderBoxSize"in c){const p=c.borderBoxSize,h=Array.isArray(p)?p[0]:p;f=h.inlineSize,d=h.blockSize}else f=e.offsetWidth,d=e.offsetHeight;a({width:f,height:d})});return l.observe(e,{box:"border-box"}),()=>l.unobserve(e)}else a(void 0)},[e]),r}var Jm="Popper",[ew,Dc]=vr(Jm),[I_,tw]=ew(Jm),nw=e=>{const{__scopePopper:r,children:a}=e,[l,s]=S.useState(null);return u.jsx(I_,{scope:r,anchor:l,onAnchorChange:s,children:a})};nw.displayName=Jm;var rw="PopperAnchor",aw=S.forwardRef((e,r)=>{const{__scopePopper:a,virtualRef:l,...s}=e,c=tw(rw,a),f=S.useRef(null),d=dt(r,f);return S.useEffect(()=>{c.onAnchorChange((l==null?void 0:l.current)||f.current)}),l?null:u.jsx(Ge.div,{...s,ref:d})});aw.displayName=rw;var Wm="PopperContent",[H_,q_]=ew(Wm),lw=S.forwardRef((e,r)=>{var re,ye,fe,be,Ee,Se;const{__scopePopper:a,side:l="bottom",sideOffset:s=0,align:c="center",alignOffset:f=0,arrowPadding:d=0,avoidCollisions:p=!0,collisionBoundary:h=[],collisionPadding:v=0,sticky:x="partial",hideWhenDetached:b=!1,updatePositionStrategy:y="optimized",onPlaced:k,...j}=e,T=tw(Wm,a),[C,R]=S.useState(null),D=dt(r,Ie=>R(Ie)),[B,O]=S.useState(null),_=Zm(B),A=(_==null?void 0:_.width)??0,I=(_==null?void 0:_.height)??0,ee=l+(c!=="center"?"-"+c:""),q=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},$=Array.isArray(h)?h:[h],X=$.length>0,ce={padding:q,boundary:$.filter($_),altBoundary:X},{refs:le,floatingStyles:W,placement:U,isPositioned:Z,middlewareData:ie}=T_({strategy:"fixed",placement:ee,whileElementsMounted:(...Ie)=>v_(...Ie,{animationFrame:y==="always"}),elements:{reference:T.anchor},middleware:[__({mainAxis:s+I,alignmentAxis:f}),p&&M_({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?R_():void 0,...ce}),p&&D_({...ce}),O_({...ce,apply:({elements:Ie,rects:Be,availableWidth:_t,availableHeight:Ct})=>{const{width:Et,height:Lt}=Be.reference,Mt=Ie.floating.style;Mt.setProperty("--radix-popper-available-width",`${_t}px`),Mt.setProperty("--radix-popper-available-height",`${Ct}px`),Mt.setProperty("--radix-popper-anchor-width",`${Et}px`),Mt.setProperty("--radix-popper-anchor-height",`${Lt}px`)}}),B&&L_({element:B,padding:d}),F_({arrowWidth:A,arrowHeight:I}),b&&z_({strategy:"referenceHidden",...ce})]}),[K,E]=sw(U),L=sr(k);Sn(()=>{Z&&(L==null||L())},[Z,L]);const F=(re=ie.arrow)==null?void 0:re.x,M=(ye=ie.arrow)==null?void 0:ye.y,oe=((fe=ie.arrow)==null?void 0:fe.centerOffset)!==0,[G,ue]=S.useState();return Sn(()=>{C&&ue(window.getComputedStyle(C).zIndex)},[C]),u.jsx("div",{ref:le.setFloating,"data-radix-popper-content-wrapper":"",style:{...W,transform:Z?W.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:G,"--radix-popper-transform-origin":[(be=ie.transformOrigin)==null?void 0:be.x,(Ee=ie.transformOrigin)==null?void 0:Ee.y].join(" "),...((Se=ie.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(H_,{scope:a,placedSide:K,onArrowChange:O,arrowX:F,arrowY:M,shouldHideArrow:oe,children:u.jsx(Ge.div,{"data-side":K,"data-align":E,...j,ref:D,style:{...j.style,animation:Z?void 0:"none"}})})})});lw.displayName=Wm;var iw="PopperArrow",P_={top:"bottom",right:"left",bottom:"top",left:"right"},ow=S.forwardRef(function(r,a){const{__scopePopper:l,...s}=r,c=q_(iw,l),f=P_[c.placedSide];return u.jsx("span",{ref:c.onArrowChange,style:{position:"absolute",left:c.arrowX,top:c.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[c.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[c.placedSide],visibility:c.shouldHideArrow?"hidden":void 0},children:u.jsx(B_,{...s,ref:a,style:{...s.style,display:"block"}})})});ow.displayName=iw;function $_(e){return e!==null}var F_=e=>({name:"transformOrigin",options:e,fn(r){var T,C,R;const{placement:a,rects:l,middlewareData:s}=r,f=((T=s.arrow)==null?void 0:T.centerOffset)!==0,d=f?0:e.arrowWidth,p=f?0:e.arrowHeight,[h,v]=sw(a),x={start:"0%",center:"50%",end:"100%"}[v],b=(((C=s.arrow)==null?void 0:C.x)??0)+d/2,y=(((R=s.arrow)==null?void 0:R.y)??0)+p/2;let k="",j="";return h==="bottom"?(k=f?x:`${b}px`,j=`${-p}px`):h==="top"?(k=f?x:`${b}px`,j=`${l.floating.height+p}px`):h==="right"?(k=`${-p}px`,j=f?x:`${y}px`):h==="left"&&(k=`${l.floating.width+p}px`,j=f?x:`${y}px`),{data:{x:k,y:j}}}});function sw(e){const[r,a="center"]=e.split("-");return[r,a]}var uw=nw,cw=aw,fw=lw,dw=ow;function ep(e){const r=S.useRef({value:e,previous:e});return S.useMemo(()=>(r.current.value!==e&&(r.current.previous=r.current.value,r.current.value=e),r.current.previous),[e])}var V_="VisuallyHidden",hw=S.forwardRef((e,r)=>u.jsx(Ge.span,{...e,ref:r,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));hw.displayName=V_;var G_=[" ","Enter","ArrowUp","ArrowDown"],Y_=[" ","Enter"],ps="Select",[Oc,zc,X_]=Fm(ps),[Ji]=vr(ps,[X_,Dc]),Lc=Dc(),[K_,ml]=Ji(ps),[Q_,Z_]=Ji(ps),mw=e=>{const{__scopeSelect:r,children:a,open:l,defaultOpen:s,onOpenChange:c,value:f,defaultValue:d,onValueChange:p,dir:h,name:v,autoComplete:x,disabled:b,required:y,form:k}=e,j=Lc(r),[T,C]=S.useState(null),[R,D]=S.useState(null),[B,O]=S.useState(!1),_=Nc(h),[A=!1,I]=el({prop:l,defaultProp:s,onChange:c}),[ee,q]=el({prop:f,defaultProp:d,onChange:p}),$=S.useRef(null),X=T?k||!!T.closest("form"):!0,[ce,le]=S.useState(new Set),W=Array.from(ce).map(U=>U.props.value).join(";");return u.jsx(uw,{...j,children:u.jsxs(K_,{required:y,scope:r,trigger:T,onTriggerChange:C,valueNode:R,onValueNodeChange:D,valueNodeHasChildren:B,onValueNodeHasChildrenChange:O,contentId:zr(),value:ee,onValueChange:q,open:A,onOpenChange:I,dir:_,triggerPointerDownPosRef:$,disabled:b,children:[u.jsx(Oc.Provider,{scope:r,children:u.jsx(Q_,{scope:e.__scopeSelect,onNativeOptionAdd:S.useCallback(U=>{le(Z=>new Set(Z).add(U))},[]),onNativeOptionRemove:S.useCallback(U=>{le(Z=>{const ie=new Set(Z);return ie.delete(U),ie})},[]),children:a})}),X?u.jsxs(Uw,{"aria-hidden":!0,required:y,tabIndex:-1,name:v,autoComplete:x,value:ee,onChange:U=>q(U.target.value),disabled:b,form:k,children:[ee===void 0?u.jsx("option",{value:""}):null,Array.from(ce)]},W):null]})})};mw.displayName=ps;var pw="SelectTrigger",gw=S.forwardRef((e,r)=>{const{__scopeSelect:a,disabled:l=!1,...s}=e,c=Lc(a),f=ml(pw,a),d=f.disabled||l,p=dt(r,f.onTriggerChange),h=zc(a),v=S.useRef("touch"),[x,b,y]=Bw(j=>{const T=h().filter(D=>!D.disabled),C=T.find(D=>D.value===f.value),R=Iw(T,j,C);R!==void 0&&f.onValueChange(R.value)}),k=j=>{d||(f.onOpenChange(!0),y()),j&&(f.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return u.jsx(cw,{asChild:!0,...c,children:u.jsx(Ge.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":Lw(f.value)?"":void 0,...s,ref:p,onClick:Te(s.onClick,j=>{j.currentTarget.focus(),v.current!=="mouse"&&k(j)}),onPointerDown:Te(s.onPointerDown,j=>{v.current=j.pointerType;const T=j.target;T.hasPointerCapture(j.pointerId)&&T.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(k(j),j.preventDefault())}),onKeyDown:Te(s.onKeyDown,j=>{const T=x.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&b(j.key),!(T&&j.key===" ")&&G_.includes(j.key)&&(k(),j.preventDefault())})})})});gw.displayName=pw;var xw="SelectValue",vw=S.forwardRef((e,r)=>{const{__scopeSelect:a,className:l,style:s,children:c,placeholder:f="",...d}=e,p=ml(xw,a),{onValueNodeHasChildrenChange:h}=p,v=c!==void 0,x=dt(r,p.onValueNodeChange);return Sn(()=>{h(v)},[h,v]),u.jsx(Ge.span,{...d,ref:x,style:{pointerEvents:"none"},children:Lw(p.value)?u.jsx(u.Fragment,{children:f}):c})});vw.displayName=xw;var J_="SelectIcon",yw=S.forwardRef((e,r)=>{const{__scopeSelect:a,children:l,...s}=e;return u.jsx(Ge.span,{"aria-hidden":!0,...s,ref:r,children:l||"โ–ผ"})});yw.displayName=J_;var W_="SelectPortal",bw=e=>u.jsx(jc,{asChild:!0,...e});bw.displayName=W_;var Vl="SelectContent",ww=S.forwardRef((e,r)=>{const a=ml(Vl,e.__scopeSelect),[l,s]=S.useState();if(Sn(()=>{s(new DocumentFragment)},[]),!a.open){const c=l;return c?ms.createPortal(u.jsx(Sw,{scope:e.__scopeSelect,children:u.jsx(Oc.Slot,{scope:e.__scopeSelect,children:u.jsx("div",{children:e.children})})}),c):null}return u.jsx(jw,{...e,ref:r})});ww.displayName=Vl;var pr=10,[Sw,pl]=Ji(Vl),eM="SelectContentImpl",jw=S.forwardRef((e,r)=>{const{__scopeSelect:a,position:l="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:c,onPointerDownOutside:f,side:d,sideOffset:p,align:h,alignOffset:v,arrowPadding:x,collisionBoundary:b,collisionPadding:y,sticky:k,hideWhenDetached:j,avoidCollisions:T,...C}=e,R=ml(Vl,a),[D,B]=S.useState(null),[O,_]=S.useState(null),A=dt(r,re=>B(re)),[I,ee]=S.useState(null),[q,$]=S.useState(null),X=zc(a),[ce,le]=S.useState(!1),W=S.useRef(!1);S.useEffect(()=>{if(D)return Bm(D)},[D]),Um();const U=S.useCallback(re=>{const[ye,...fe]=X().map(Se=>Se.ref.current),[be]=fe.slice(-1),Ee=document.activeElement;for(const Se of re)if(Se===Ee||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===ye&&O&&(O.scrollTop=0),Se===be&&O&&(O.scrollTop=O.scrollHeight),Se==null||Se.focus(),document.activeElement!==Ee))return},[X,O]),Z=S.useCallback(()=>U([I,D]),[U,I,D]);S.useEffect(()=>{ce&&Z()},[ce,Z]);const{onOpenChange:ie,triggerPointerDownPosRef:K}=R;S.useEffect(()=>{if(D){let re={x:0,y:0};const ye=be=>{var Ee,Se;re={x:Math.abs(Math.round(be.pageX)-(((Ee=K.current)==null?void 0:Ee.x)??0)),y:Math.abs(Math.round(be.pageY)-(((Se=K.current)==null?void 0:Se.y)??0))}},fe=be=>{re.x<=10&&re.y<=10?be.preventDefault():D.contains(be.target)||ie(!1),document.removeEventListener("pointermove",ye),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",fe,{capture:!0})}}},[D,ie,K]),S.useEffect(()=>{const re=()=>ie(!1);return window.addEventListener("blur",re),window.addEventListener("resize",re),()=>{window.removeEventListener("blur",re),window.removeEventListener("resize",re)}},[ie]);const[E,L]=Bw(re=>{const ye=X().filter(Ee=>!Ee.disabled),fe=ye.find(Ee=>Ee.ref.current===document.activeElement),be=Iw(ye,re,fe);be&&setTimeout(()=>be.ref.current.focus())}),F=S.useCallback((re,ye,fe)=>{const be=!W.current&&!fe;(R.value!==void 0&&R.value===ye||be)&&(ee(re),be&&(W.current=!0))},[R.value]),M=S.useCallback(()=>D==null?void 0:D.focus(),[D]),oe=S.useCallback((re,ye,fe)=>{const be=!W.current&&!fe;(R.value!==void 0&&R.value===ye||be)&&$(re)},[R.value]),G=l==="popper"?sm:kw,ue=G===sm?{side:d,sideOffset:p,align:h,alignOffset:v,arrowPadding:x,collisionBoundary:b,collisionPadding:y,sticky:k,hideWhenDetached:j,avoidCollisions:T}:{};return u.jsx(Sw,{scope:a,content:D,viewport:O,onViewportChange:_,itemRefCallback:F,selectedItem:I,onItemLeave:M,itemTextRefCallback:oe,focusSelectedItem:Z,selectedItemText:q,position:l,isPositioned:ce,searchRef:E,children:u.jsx(Cc,{as:fa,allowPinchZoom:!0,children:u.jsx(Sc,{asChild:!0,trapped:R.open,onMountAutoFocus:re=>{re.preventDefault()},onUnmountAutoFocus:Te(s,re=>{var ye;(ye=R.trigger)==null||ye.focus({preventScroll:!0}),re.preventDefault()}),children:u.jsx(wc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:re=>re.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:u.jsx(G,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:re=>re.preventDefault(),...C,...ue,onPlaced:()=>le(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:Te(C.onKeyDown,re=>{const ye=re.ctrlKey||re.altKey||re.metaKey;if(re.key==="Tab"&&re.preventDefault(),!ye&&re.key.length===1&&L(re.key),["ArrowUp","ArrowDown","Home","End"].includes(re.key)){let be=X().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(re.key)&&(be=be.slice().reverse()),["ArrowUp","ArrowDown"].includes(re.key)){const Ee=re.target,Se=be.indexOf(Ee);be=be.slice(Se+1)}setTimeout(()=>U(be)),re.preventDefault()}})})})})})})});jw.displayName=eM;var tM="SelectItemAlignedPosition",kw=S.forwardRef((e,r)=>{const{__scopeSelect:a,onPlaced:l,...s}=e,c=ml(Vl,a),f=pl(Vl,a),[d,p]=S.useState(null),[h,v]=S.useState(null),x=dt(r,A=>v(A)),b=zc(a),y=S.useRef(!1),k=S.useRef(!0),{viewport:j,selectedItem:T,selectedItemText:C,focusSelectedItem:R}=f,D=S.useCallback(()=>{if(c.trigger&&c.valueNode&&d&&h&&j&&T&&C){const A=c.trigger.getBoundingClientRect(),I=h.getBoundingClientRect(),ee=c.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(c.dir!=="rtl"){const Ee=q.left-I.left,Se=ee.left-Ee,Ie=A.left-Se,Be=A.width+Ie,_t=Math.max(Be,I.width),Ct=window.innerWidth-pr,Et=sb(Se,[pr,Math.max(pr,Ct-_t)]);d.style.minWidth=Be+"px",d.style.left=Et+"px"}else{const Ee=I.right-q.right,Se=window.innerWidth-ee.right-Ee,Ie=window.innerWidth-A.right-Se,Be=A.width+Ie,_t=Math.max(Be,I.width),Ct=window.innerWidth-pr,Et=sb(Se,[pr,Math.max(pr,Ct-_t)]);d.style.minWidth=Be+"px",d.style.right=Et+"px"}const $=b(),X=window.innerHeight-pr*2,ce=j.scrollHeight,le=window.getComputedStyle(h),W=parseInt(le.borderTopWidth,10),U=parseInt(le.paddingTop,10),Z=parseInt(le.borderBottomWidth,10),ie=parseInt(le.paddingBottom,10),K=W+U+ce+ie+Z,E=Math.min(T.offsetHeight*5,K),L=window.getComputedStyle(j),F=parseInt(L.paddingTop,10),M=parseInt(L.paddingBottom,10),oe=A.top+A.height/2-pr,G=X-oe,ue=T.offsetHeight/2,re=T.offsetTop+ue,ye=W+U+re,fe=K-ye;if(ye<=oe){const Ee=$.length>0&&T===$[$.length-1].ref.current;d.style.bottom="0px";const Se=h.clientHeight-j.offsetTop-j.offsetHeight,Ie=Math.max(G,ue+(Ee?M:0)+Se+Z),Be=ye+Ie;d.style.height=Be+"px"}else{const Ee=$.length>0&&T===$[0].ref.current;d.style.top="0px";const Ie=Math.max(oe,W+j.offsetTop+(Ee?F:0)+ue)+fe;d.style.height=Ie+"px",j.scrollTop=ye-oe+j.offsetTop}d.style.margin=`${pr}px 0`,d.style.minHeight=E+"px",d.style.maxHeight=X+"px",l==null||l(),requestAnimationFrame(()=>y.current=!0)}},[b,c.trigger,c.valueNode,d,h,j,T,C,c.dir,l]);Sn(()=>D(),[D]);const[B,O]=S.useState();Sn(()=>{h&&O(window.getComputedStyle(h).zIndex)},[h]);const _=S.useCallback(A=>{A&&k.current===!0&&(D(),R==null||R(),k.current=!1)},[D,R]);return u.jsx(rM,{scope:a,contentWrapper:d,shouldExpandOnScrollRef:y,onScrollButtonChange:_,children:u.jsx("div",{ref:p,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:B},children:u.jsx(Ge.div,{...s,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});kw.displayName=tM;var nM="SelectPopperPosition",sm=S.forwardRef((e,r)=>{const{__scopeSelect:a,align:l="start",collisionPadding:s=pr,...c}=e,f=Lc(a);return u.jsx(fw,{...f,...c,ref:r,align:l,collisionPadding:s,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});sm.displayName=nM;var[rM,tp]=Ji(Vl,{}),um="SelectViewport",Cw=S.forwardRef((e,r)=>{const{__scopeSelect:a,nonce:l,...s}=e,c=pl(um,a),f=tp(um,a),d=dt(r,c.onViewportChange),p=S.useRef(0);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),u.jsx(Oc.Slot,{scope:a,children:u.jsx(Ge.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Te(s.onScroll,h=>{const v=h.currentTarget,{contentWrapper:x,shouldExpandOnScrollRef:b}=f;if(b!=null&&b.current&&x){const y=Math.abs(p.current-v.scrollTop);if(y>0){const k=window.innerHeight-pr*2,j=parseFloat(x.style.minHeight),T=parseFloat(x.style.height),C=Math.max(j,T);if(C0?B:0,x.style.justifyContent="flex-end")}}}p.current=v.scrollTop})})})]})});Cw.displayName=um;var Ew="SelectGroup",[aM,lM]=Ji(Ew),iM=S.forwardRef((e,r)=>{const{__scopeSelect:a,...l}=e,s=zr();return u.jsx(aM,{scope:a,id:s,children:u.jsx(Ge.div,{role:"group","aria-labelledby":s,...l,ref:r})})});iM.displayName=Ew;var Nw="SelectLabel",oM=S.forwardRef((e,r)=>{const{__scopeSelect:a,...l}=e,s=lM(Nw,a);return u.jsx(Ge.div,{id:s.id,...l,ref:r})});oM.displayName=Nw;var sc="SelectItem",[sM,Tw]=Ji(sc),Aw=S.forwardRef((e,r)=>{const{__scopeSelect:a,value:l,disabled:s=!1,textValue:c,...f}=e,d=ml(sc,a),p=pl(sc,a),h=d.value===l,[v,x]=S.useState(c??""),[b,y]=S.useState(!1),k=dt(r,R=>{var D;return(D=p.itemRefCallback)==null?void 0:D.call(p,R,l,s)}),j=zr(),T=S.useRef("touch"),C=()=>{s||(d.onValueChange(l),d.onOpenChange(!1))};if(l==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return u.jsx(sM,{scope:a,value:l,disabled:s,textId:j,isSelected:h,onItemTextChange:S.useCallback(R=>{x(D=>D||((R==null?void 0:R.textContent)??"").trim())},[]),children:u.jsx(Oc.ItemSlot,{scope:a,value:l,disabled:s,textValue:v,children:u.jsx(Ge.div,{role:"option","aria-labelledby":j,"data-highlighted":b?"":void 0,"aria-selected":h&&b,"data-state":h?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...f,ref:k,onFocus:Te(f.onFocus,()=>y(!0)),onBlur:Te(f.onBlur,()=>y(!1)),onClick:Te(f.onClick,()=>{T.current!=="mouse"&&C()}),onPointerUp:Te(f.onPointerUp,()=>{T.current==="mouse"&&C()}),onPointerDown:Te(f.onPointerDown,R=>{T.current=R.pointerType}),onPointerMove:Te(f.onPointerMove,R=>{var D;T.current=R.pointerType,s?(D=p.onItemLeave)==null||D.call(p):T.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Te(f.onPointerLeave,R=>{var D;R.currentTarget===document.activeElement&&((D=p.onItemLeave)==null||D.call(p))}),onKeyDown:Te(f.onKeyDown,R=>{var B;((B=p.searchRef)==null?void 0:B.current)!==""&&R.key===" "||(Y_.includes(R.key)&&C(),R.key===" "&&R.preventDefault())})})})})});Aw.displayName=sc;var Wo="SelectItemText",_w=S.forwardRef((e,r)=>{const{__scopeSelect:a,className:l,style:s,...c}=e,f=ml(Wo,a),d=pl(Wo,a),p=Tw(Wo,a),h=Z_(Wo,a),[v,x]=S.useState(null),b=dt(r,C=>x(C),p.onItemTextChange,C=>{var R;return(R=d.itemTextRefCallback)==null?void 0:R.call(d,C,p.value,p.disabled)}),y=v==null?void 0:v.textContent,k=S.useMemo(()=>u.jsx("option",{value:p.value,disabled:p.disabled,children:y},p.value),[p.disabled,p.value,y]),{onNativeOptionAdd:j,onNativeOptionRemove:T}=h;return Sn(()=>(j(k),()=>T(k)),[j,T,k]),u.jsxs(u.Fragment,{children:[u.jsx(Ge.span,{id:p.textId,...c,ref:b}),p.isSelected&&f.valueNode&&!f.valueNodeHasChildren?ms.createPortal(c.children,f.valueNode):null]})});_w.displayName=Wo;var Mw="SelectItemIndicator",Rw=S.forwardRef((e,r)=>{const{__scopeSelect:a,...l}=e;return Tw(Mw,a).isSelected?u.jsx(Ge.span,{"aria-hidden":!0,...l,ref:r}):null});Rw.displayName=Mw;var cm="SelectScrollUpButton",Dw=S.forwardRef((e,r)=>{const a=pl(cm,e.__scopeSelect),l=tp(cm,e.__scopeSelect),[s,c]=S.useState(!1),f=dt(r,l.onScrollButtonChange);return Sn(()=>{if(a.viewport&&a.isPositioned){let d=function(){const h=p.scrollTop>0;c(h)};const p=a.viewport;return d(),p.addEventListener("scroll",d),()=>p.removeEventListener("scroll",d)}},[a.viewport,a.isPositioned]),s?u.jsx(zw,{...e,ref:f,onAutoScroll:()=>{const{viewport:d,selectedItem:p}=a;d&&p&&(d.scrollTop=d.scrollTop-p.offsetHeight)}}):null});Dw.displayName=cm;var fm="SelectScrollDownButton",Ow=S.forwardRef((e,r)=>{const a=pl(fm,e.__scopeSelect),l=tp(fm,e.__scopeSelect),[s,c]=S.useState(!1),f=dt(r,l.onScrollButtonChange);return Sn(()=>{if(a.viewport&&a.isPositioned){let d=function(){const h=p.scrollHeight-p.clientHeight,v=Math.ceil(p.scrollTop)p.removeEventListener("scroll",d)}},[a.viewport,a.isPositioned]),s?u.jsx(zw,{...e,ref:f,onAutoScroll:()=>{const{viewport:d,selectedItem:p}=a;d&&p&&(d.scrollTop=d.scrollTop+p.offsetHeight)}}):null});Ow.displayName=fm;var zw=S.forwardRef((e,r)=>{const{__scopeSelect:a,onAutoScroll:l,...s}=e,c=pl("SelectScrollButton",a),f=S.useRef(null),d=zc(a),p=S.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return S.useEffect(()=>()=>p(),[p]),Sn(()=>{var v;const h=d().find(x=>x.ref.current===document.activeElement);(v=h==null?void 0:h.ref.current)==null||v.scrollIntoView({block:"nearest"})},[d]),u.jsx(Ge.div,{"aria-hidden":!0,...s,ref:r,style:{flexShrink:0,...s.style},onPointerDown:Te(s.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(l,50))}),onPointerMove:Te(s.onPointerMove,()=>{var h;(h=c.onItemLeave)==null||h.call(c),f.current===null&&(f.current=window.setInterval(l,50))}),onPointerLeave:Te(s.onPointerLeave,()=>{p()})})}),uM="SelectSeparator",cM=S.forwardRef((e,r)=>{const{__scopeSelect:a,...l}=e;return u.jsx(Ge.div,{"aria-hidden":!0,...l,ref:r})});cM.displayName=uM;var dm="SelectArrow",fM=S.forwardRef((e,r)=>{const{__scopeSelect:a,...l}=e,s=Lc(a),c=ml(dm,a),f=pl(dm,a);return c.open&&f.position==="popper"?u.jsx(dw,{...s,...l,ref:r}):null});fM.displayName=dm;function Lw(e){return e===""||e===void 0}var Uw=S.forwardRef((e,r)=>{const{value:a,...l}=e,s=S.useRef(null),c=dt(r,s),f=ep(a);return S.useEffect(()=>{const d=s.current,p=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(p,"value").set;if(f!==a&&v){const x=new Event("change",{bubbles:!0});v.call(d,a),d.dispatchEvent(x)}},[f,a]),u.jsx(hw,{asChild:!0,children:u.jsx("select",{...l,ref:c,defaultValue:a})})});Uw.displayName="BubbleSelect";function Bw(e){const r=sr(e),a=S.useRef(""),l=S.useRef(0),s=S.useCallback(f=>{const d=a.current+f;r(d),(function p(h){a.current=h,window.clearTimeout(l.current),h!==""&&(l.current=window.setTimeout(()=>p(""),1e3))})(d)},[r]),c=S.useCallback(()=>{a.current="",window.clearTimeout(l.current)},[]);return S.useEffect(()=>()=>window.clearTimeout(l.current),[]),[a,s,c]}function Iw(e,r,a){const s=r.length>1&&Array.from(r).every(h=>h===r[0])?r[0]:r,c=a?e.indexOf(a):-1;let f=dM(e,Math.max(c,0));s.length===1&&(f=f.filter(h=>h!==a));const p=f.find(h=>h.textValue.toLowerCase().startsWith(s.toLowerCase()));return p!==a?p:void 0}function dM(e,r){return e.map((a,l)=>e[(r+l)%e.length])}var hM=mw,mM=gw,pM=vw,gM=yw,xM=bw,vM=ww,yM=Cw,bM=Aw,wM=_w,SM=Rw,jM=Dw,kM=Ow;function ha({...e}){return u.jsx(hM,{"data-slot":"select",...e})}function ma({...e}){return u.jsx(pM,{"data-slot":"select-value",...e})}function pa({className:e,size:r="default",children:a,...l}){return u.jsxs(mM,{"data-slot":"select-trigger","data-size":r,className:_e("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...l,children:[a,u.jsx(gM,{asChild:!0,children:u.jsx(Xi,{className:"size-4 opacity-50"})})]})}function ga({className:e,children:r,position:a="popper",...l}){return u.jsx(xM,{children:u.jsxs(vM,{"data-slot":"select-content",className:_e("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...l,children:[u.jsx(CM,{}),u.jsx(yM,{className:_e("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:r}),u.jsx(EM,{})]})})}function Br({className:e,children:r,...a}){return u.jsxs(bM,{"data-slot":"select-item",className:_e("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...a,children:[u.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:u.jsx(SM,{children:u.jsx(yc,{className:"size-4"})})}),u.jsx(wM,{children:r})]})}function CM({className:e,...r}){return u.jsx(jM,{"data-slot":"select-scroll-up-button",className:_e("flex cursor-default items-center justify-center py-1",e),...r,children:u.jsx(IE,{className:"size-4"})})}function EM({className:e,...r}){return u.jsx(kM,{"data-slot":"select-scroll-down-button",className:_e("flex cursor-default items-center justify-center py-1",e),...r,children:u.jsx(Xi,{className:"size-4"})})}const Ch="all";function Wt({label:e,value:r,onChange:a,options:l,allLabel:s}){const c=l.map(f=>typeof f=="string"?{value:f,label:f}:f);return u.jsxs("div",{className:"relative",children:[u.jsxs(ha,{value:r||Ch,onValueChange:f=>a(f===Ch?"":f),children:[u.jsx(pa,{className:"w-44","aria-label":e,children:u.jsx(ma,{className:r?"pr-6":void 0})}),u.jsxs(ga,{children:[u.jsx(Br,{value:Ch,children:s}),c.map(f=>u.jsx(Br,{value:f.value,children:f.label},f.value))]})]}),r&&u.jsx(ze,{variant:"ghost",size:"icon-sm","aria-label":`Clear ${e.toLowerCase()} filter`,title:`Clear ${e.toLowerCase()} filter`,className:"absolute top-1/2 right-8 size-6 -translate-y-1/2",onClick:()=>a(""),children:u.jsx(Lm,{className:"size-3.5"})})]})}function NM({rows:e,withPrincipal:r}){return u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[r&&u.jsx(ge,{children:"User"}),u.jsx(ge,{children:"Model"}),u.jsx(ge,{children:"Endpoint"}),u.jsx(ge,{className:"text-right",children:"Requests"}),u.jsx(ge,{className:"text-right",children:"Input"}),u.jsx(ge,{className:"text-right",children:"Cached"}),u.jsx(ge,{className:"text-right",children:"Output"}),u.jsx(ge,{className:"text-right",children:"Cost"})]})}),u.jsxs(xn,{children:[e.length===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:r?8:7,className:"text-muted-foreground",children:"No usage recorded yet."})}),e.map((a,l)=>u.jsxs(Ue,{children:[r&&u.jsx(me,{className:"wrap-anywhere",children:a.principal}),u.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:a.model}),u.jsx(me,{children:a.endpoint}),u.jsx(me,{className:"text-right tabular-nums",children:qt(a.requests)}),u.jsx(me,{className:"text-right tabular-nums",children:qt(a.units.input_tokens)}),u.jsx(me,{className:"text-right tabular-nums",children:qt(a.units.cached_input_tokens)}),u.jsx(me,{className:"text-right tabular-nums",children:qt(a.units.output_tokens)}),u.jsx(me,{className:"text-right tabular-nums",children:a.cost===null?u.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):_m(a.cost)})]},l))]})]})}const Eh=[{key:"24h",label:"Last 24 hours",bucket:"hour",count:24},{key:"7d",label:"Last 7 days",bucket:"day",count:7},{key:"30d",label:"Last 30 days",bucket:"day",count:30},{key:"12w",label:"Last 12 weeks",bucket:"week",count:12},{key:"12mo",label:"Last 12 months",bucket:"month",count:12},{key:"all",label:"All time",bucket:"month",count:0}];function TM(e,r){const a=new Date(e);return a.setUTCMilliseconds(0),a.setUTCSeconds(0),a.setUTCMinutes(0),r==="hour"?a:(a.setUTCHours(0),r==="month"?(a.setUTCDate(1),a):(r==="week"&&a.setUTCDate(a.getUTCDate()-(a.getUTCDay()+6)%7),a))}function yb(e,r,a){const l=new Date(e);return r==="hour"?l.setUTCHours(l.getUTCHours()+a):r==="day"?l.setUTCDate(l.getUTCDate()+a):r==="week"?l.setUTCDate(l.getUTCDate()+a*7):l.setUTCMonth(l.getUTCMonth()+a),l}const Ka={timeZone:"UTC"};function AM(e,r){const a=new Date(e);return r==="hour"?a.toLocaleTimeString(void 0,{...Ka,hour:"2-digit",minute:"2-digit"}):r==="month"?a.toLocaleDateString(void 0,{...Ka,month:"short",year:"2-digit"}):a.toLocaleDateString(void 0,{...Ka,month:"short",day:"numeric"})}function _M(e,r){const a=new Date(e);switch(r){case"hour":return`${a.toLocaleDateString(void 0,{...Ka,month:"short",day:"numeric"})}, ${a.toLocaleTimeString(void 0,{...Ka,hour:"2-digit",minute:"2-digit"})} UTC`;case"week":return`Week of ${a.toLocaleDateString(void 0,{...Ka,month:"short",day:"numeric",year:"numeric"})}`;case"month":return a.toLocaleDateString(void 0,{...Ka,month:"long",year:"numeric"});default:return a.toLocaleDateString(void 0,{...Ka,month:"short",day:"numeric",year:"numeric"})}}function Tr(e,r){return e.reduce((a,l)=>a+r(l),0)}function Fu(e,r,a){return!a||r===0?null:(e-r)/r}function ia(e){return(e.units.input_tokens??0)+(e.units.output_tokens??0)}function Nh(e,r,a){const l=new Map;for(const s of e){const c=r(s);let f=l.get(c);f||(f=a(s),l.set(c,f)),f.requests+=s.requests,f.cancelled+=s.cancelled,s.cost!==null&&(f.cost=(f.cost??0)+s.cost);for(const[d,p]of Object.entries(s.units))f.units[d]=(f.units[d]??0)+p}return l}function Hw(e){const r={requests:0,cost:null,units:{}};for(const a of e){r.requests+=a.requests,a.cost!==null&&(r.cost=(r.cost??0)+a.cost);for(const[l,s]of Object.entries(a.units))r.units[l]=(r.units[l]??0)+s}return r}function bb(e,r,a){const l=(s,c)=>({label:c??s.principal??"",value:r(s),rows:a(s)});return Ec(e,s=>l(s),s=>l(Hw(s),`Other (${s.length} users)`))}function MM({ssoEnabled:e}){var ne;const[r,a]=S.useState("30d"),[l,s]=S.useState(""),[c,f]=S.useState(""),[d,p]=S.useState(""),[h,v]=S.useState(""),[x,b]=S.useState(!1),[y,k]=S.useState(!1),[j,T]=S.useState(!1),C=Eh.find(z=>z.key===r)??Eh[2],D=TM(new Date,C.bucket),B=C.count?yb(D,C.bucket,-(C.count-1)):null,O=B?yb(B,C.bucket,-C.count):null,_=(l?`&principal=${encodeURIComponent(l)}`:"")+(c?`&provider=${encodeURIComponent(c)}`:"")+(d?`&model=${encodeURIComponent(d)}`:"")+(h?`&client=${encodeURIComponent(h)}`:""),A=Yt(()=>Pe.get(`/stats/series?bucket=${C.bucket}`+(O?`&since=${O.toISOString()}`:"")+_),[r,l,c,d,h]),I=Yt(()=>Pe.get("/stats/summary"+(B?`?since=${B.toISOString()}`:"")),[r]),ee=((ne=A.data)==null?void 0:ne.series)??[],q=B?B.getTime():-1/0,$=ee.filter(z=>new Date(z.start).getTime()>=q),X=ee.filter(z=>new Date(z.start).getTime()0,le=z=>z.units.input_tokens??0,W=z=>z.units.output_tokens??0,U=z=>z.units.cached_input_tokens??0,Z=Tr($,z=>z.requests),ie=Tr($,le),K=Tr($,U),E=Tr($,W),L=Tr($,z=>z.cost??0),F=$.some(z=>z.cost!==null),M=Tr($,z=>z.unpriced_requests),oe=z=>new Date(z.start).getTime()===D.getTime(),G=z=>AM(z.start,C.bucket),ue=z=>_M(z.start,C.bucket)+(oe(z)?" ยท in progress":""),re=$.map(z=>{const de=z.ok+z.cancelled,ke=[...z.cancelled?[{label:"cancelled",value:zn(z.cancelled)}]:[],...de>0?[{label:"avg input / request",value:Re(Math.round(le(z)/de))},{label:"avg output / response",value:Re(Math.round(W(z)/de))}]:[]];return{label:G(z),title:ue(z),values:[de,z.failed],rows:ke.length?ke:void 0}}),ye=$.map(z=>({label:G(z),title:ue(z),values:[le(z),U(z),W(z)]})),fe=$.map(z=>({label:G(z),title:ue(z),values:[z.cost],rows:z.unpriced_requests?[{label:"unpriced requests",value:zn(z.unpriced_requests)}]:void 0})),be=S.useMemo(()=>{var z;return((z=I.data)==null?void 0:z.usage)??[]},[I.data]),Ee=S.useMemo(()=>({principals:[...new Set(be.map(z=>z.principal))].sort(),providers:[...new Set(be.map(z=>z.provider))].sort(),models:[...new Set(be.filter(z=>z.model).map(z=>z.model))].sort(),clients:[...new Set(be.filter(z=>z.client).map(z=>ns(z.client)))].sort()}),[be]),Se=S.useMemo(()=>be.filter(z=>(!l||z.principal===l)&&(!c||z.provider===c)&&(!d||z.model===d)&&(!h||ns(z.client)===h)),[be,l,c,d,h]),Ie=S.useMemo(()=>[...Nh(Se,z=>z.model,z=>({model:z.model,requests:0,cancelled:0,cost:null,units:{}})).values()].sort((z,de)=>ia(de)-ia(z)),[Se]),Be=Ie.reduce((z,de)=>z+ia(de),0),{slices:_t,overflow:Ct}=S.useMemo(()=>{const z=(de,ke)=>({label:ke??(de.model||"(none)"),value:ia(de),rows:[{label:"requests",value:zn(de.requests)},...de.units.cached_input_tokens?[{label:"cached input",value:Re(de.units.cached_input_tokens)}]:[],...de.cost!==null?[{label:"cost",value:Rr(de.cost)}]:[]]});return Ec(Ie,de=>z(de),de=>z(Hw(de),`Other (${de.length} models)`))},[Ie]),Et=S.useMemo(()=>[...Nh(Se,z=>z.principal,z=>({principal:z.principal,requests:0,cancelled:0,cost:null,units:{}})).values()],[Se]),Lt=S.useMemo(()=>bb([...Et].sort((z,de)=>ia(de)-ia(z)),ia,z=>[{label:"requests",value:zn(z.requests)},...z.units.cached_input_tokens?[{label:"cached input",value:Re(z.units.cached_input_tokens)}]:[],...z.cost!==null?[{label:"cost",value:Rr(z.cost)}]:[]]),[Et]),Mt=S.useMemo(()=>bb(Et.filter(z=>z.cost!==null).sort((z,de)=>(de.cost??0)-(z.cost??0)),z=>z.cost??0,z=>[{label:"tokens",value:Re(ia(z))},{label:"requests",value:zn(z.requests)}]),[Et]),Rt=S.useMemo(()=>{const z=new Map;for(const de of Se){const ke=de.client?j?z2(de.client):ns(de.client):"unknown";let De=z.get(ke);De||(De={label:ke,requests:0,cancelled:0,cost:null,units:{},exact:new Set},z.set(ke,De)),De.requests+=de.requests,De.cancelled+=de.cancelled,de.cost!==null&&(De.cost=(De.cost??0)+de.cost);for(const[en,kn]of Object.entries(de.units))De.units[en]=(De.units[en]??0)+kn;de.client&&De.exact.add(de.client)}return[...z.values()].sort((de,ke)=>ke.requests-de.requests)},[Se,j]),zt=Rt.reduce((z,de)=>z+de.requests,0),we=S.useMemo(()=>Rt.map(z=>({label:z.label,title:z.exact.size?[...z.exact].sort().join(` -`):"no User-Agent header",value:z.requests})),[Rt]),mt=S.useMemo(()=>[...Nh(Se,de=>`${de.principal}\0${de.model}\0${de.endpoint}`,de=>({principal:de.principal,model:de.model,endpoint:de.endpoint,requests:0,cancelled:0,cost:null,units:{}})).values()].sort((de,ke)=>de.principal!==ke.principal?de.principal.localeCompare(ke.principal):de.model!==ke.model?de.model.localeCompare(ke.model):de.endpoint.localeCompare(ke.endpoint)),[Se]),Y=A.loading&&!A.data||I.loading&&!I.data,qe=!Y&&(A.loading||I.loading);return u.jsxs("div",{className:"flex flex-col gap-6",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsxs(ha,{value:r,onValueChange:a,children:[u.jsx(pa,{className:"w-44","aria-label":"Time range",children:u.jsx(ma,{})}),u.jsx(ga,{children:Eh.map(z=>u.jsx(Br,{value:z.key,children:z.label},z.key))})]}),u.jsx(Wt,{label:"User",value:l,onChange:s,options:Ee.principals,allLabel:"All users"}),u.jsx(Wt,{label:"Provider",value:c,onChange:f,options:Ee.providers,allLabel:"All providers"}),u.jsx(Wt,{label:"Model",value:d,onChange:p,options:Ee.models,allLabel:"All models"}),u.jsx(Wt,{label:"Client",value:h,onChange:v,options:Ee.clients,allLabel:"All clients"}),(l||c||d||h)&&u.jsxs(ze,{variant:"ghost",size:"sm",onClick:()=>{s(""),f(""),p(""),v("")},children:[u.jsx(bc,{}),"Clear filters"]}),u.jsx(ze,{variant:"outline",size:"icon-sm","aria-label":"Refresh",onClick:()=>{A.reload(),I.reload()},children:u.jsx(Ki,{})})]}),Y?u.jsx(Ot,{}):A.error||I.error?u.jsx("p",{className:"text-sm text-destructive",children:A.error??I.error}):u.jsxs("div",{className:qe?"flex flex-col gap-6 opacity-60":"flex flex-col gap-6",children:[u.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[u.jsx(gr,{label:"Requests",value:Re(Z),delta:Fu(Z,Tr(X,z=>z.requests),ce)}),u.jsx(gr,{label:"Input tokens",value:Re(ie),secondary:K>0?`${Re(K)} cached`:void 0,delta:Fu(ie,Tr(X,le),ce)}),u.jsx(gr,{label:"Output tokens",value:Re(E),delta:Fu(E,Tr(X,W),ce)}),u.jsx(gr,{label:"Cost",value:F?Rr(L):"unpriced",delta:F?Fu(L,Tr(X,z=>z.cost??0),ce):null,hint:M?`${zn(M)} request${M===1?"":"s"} unpriced`:void 0})]}),u.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[u.jsxs(tt,{className:x?"min-w-0 lg:col-span-2":"min-w-0",children:[u.jsxs(nt,{className:"flex flex-row items-start justify-between",children:[u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx(rt,{className:"font-serif",children:"Models"}),u.jsx(ct,{children:"Share of total tokens, cached input excluded."})]}),u.jsx(ze,{variant:"outline",size:"icon-sm","aria-label":x?"Show chart":"Show all models as a table",title:x?"Show chart":"Show all models as a table",onClick:()=>b(z=>!z),children:x?u.jsx(UE,{}):u.jsx(nm,{})})]}),u.jsx(at,{children:x?u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[u.jsx(ge,{children:"Model"}),u.jsx(ge,{className:"text-right",children:"Share"}),u.jsx(ge,{className:"text-right",children:"Requests"}),u.jsx(ge,{className:"text-right",children:"Input"}),u.jsx(ge,{className:"text-right",children:"Cached"}),u.jsx(ge,{className:"text-right",children:"Output"}),u.jsx(ge,{className:"text-right",children:"Cost"})]})}),u.jsxs(xn,{children:[Ie.length===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:7,className:"text-muted-foreground",children:"No usage in this range."})}),Ie.map((z,de)=>u.jsxs(Ue,{children:[u.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:z.model||u.jsx("span",{className:"text-muted-foreground",children:"(none)"})}),u.jsx(me,{className:"text-right tabular-nums",children:Be>0?`${(ia(z)/Be*100).toFixed(1)}%`:""}),u.jsx(me,{className:"text-right tabular-nums",children:Re(z.requests)}),u.jsx(me,{className:"text-right tabular-nums",title:qt(z.units.input_tokens),children:z.units.input_tokens?Re(z.units.input_tokens):""}),u.jsx(me,{className:"text-right tabular-nums",title:qt(z.units.cached_input_tokens),children:z.units.cached_input_tokens?Re(z.units.cached_input_tokens):""}),u.jsx(me,{className:"text-right tabular-nums",title:qt(z.units.output_tokens),children:z.units.output_tokens?Re(z.units.output_tokens):""}),u.jsx(me,{className:"text-right tabular-nums",children:z.cost===null?u.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):Rr(z.cost)})]},de))]})]}):u.jsx(rs,{slices:_t,overflow:Ct,format:Re},`${r} ${l} ${c} ${d} ${h}`)})]}),u.jsxs(tt,{className:y?"min-w-0 lg:col-span-2":"min-w-0",children:[u.jsxs(nt,{className:"flex flex-row items-start justify-between",children:[u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx(rt,{className:"font-serif",children:"Clients"}),u.jsx(ct,{children:j?"Requests per client version, from the User-Agent.":"Requests per client, from the User-Agent."})]}),u.jsxs("div",{className:"flex gap-1",children:[u.jsx(ze,{variant:j?"secondary":"outline",size:"icon-sm","aria-label":j?"Group by tool":"Split by version","aria-pressed":j,title:j?"Group by tool":"Split by version",onClick:()=>T(z=>!z),children:u.jsx(QE,{})}),u.jsx(ze,{variant:"outline",size:"icon-sm","aria-label":y?"Show chart":"Show all clients as a table",title:y?"Show chart":"Show all clients as a table",onClick:()=>k(z=>!z),children:y?u.jsx(Q0,{}):u.jsx(nm,{})})]})]}),u.jsx(at,{children:y?u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[u.jsx(ge,{children:"Client"}),u.jsx(ge,{className:"text-right",children:"Share"}),u.jsx(ge,{className:"text-right",children:"Requests"}),u.jsx(ge,{className:"text-right",children:"Input"}),u.jsx(ge,{className:"text-right",children:"Cached"}),u.jsx(ge,{className:"text-right",children:"Output"}),u.jsx(ge,{className:"text-right",children:"Cost"})]})}),u.jsxs(xn,{children:[Rt.length===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:7,className:"text-muted-foreground",children:"No usage in this range."})}),Rt.map((z,de)=>u.jsxs(Ue,{children:[u.jsx(me,{className:"font-mono text-xs wrap-anywhere",title:z.exact.size?[...z.exact].sort().join(` -`):void 0,children:z.label}),u.jsx(me,{className:"text-right tabular-nums",children:zt>0?`${(z.requests/zt*100).toFixed(1)}%`:""}),u.jsx(me,{className:"text-right tabular-nums",children:Re(z.requests)}),u.jsx(me,{className:"text-right tabular-nums",title:qt(z.units.input_tokens),children:z.units.input_tokens?Re(z.units.input_tokens):""}),u.jsx(me,{className:"text-right tabular-nums",title:qt(z.units.cached_input_tokens),children:z.units.cached_input_tokens?Re(z.units.cached_input_tokens):""}),u.jsx(me,{className:"text-right tabular-nums",title:qt(z.units.output_tokens),children:z.units.output_tokens?Re(z.units.output_tokens):""}),u.jsx(me,{className:"text-right tabular-nums",children:z.cost===null?u.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):Rr(z.cost)})]},de))]})]}):u.jsx(Vi,{rows:we,format:Re})})]}),e&&u.jsxs(u.Fragment,{children:[u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"User tokens"}),u.jsx(ct,{children:"Share of total tokens per user, cached input excluded."})]}),u.jsx(at,{children:u.jsx(rs,{slices:Lt.slices,overflow:Lt.overflow,format:Re},`${r} ${l} ${c} ${d} ${h}`)})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"User cost"}),u.jsx(ct,{children:"Share of total cost per user."})]}),u.jsx(at,{children:u.jsx(rs,{slices:Mt.slices,overflow:Mt.overflow,format:Rr,emptyMessage:"Nothing priced in this range."},`${r} ${l} ${c} ${d} ${h}`)})]})]})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Tokens"}),u.jsxs(ct,{children:["Input, cached input and output per ",C.bucket,"."]})]}),u.jsx(at,{children:u.jsx(Za,{points:ye,series:[{...Hl,name:"input"},{...$m,name:"cached"},{...os,name:"output"}],format:Re})})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Requests"}),u.jsxs(ct,{children:["Per ",C.bucket,", split by outcome."]})]}),u.jsx(at,{children:u.jsx(Za,{points:re,series:[{...Hl,name:"ok"},{...os,name:"failed"}],format:Re,integer:!0})})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Cost"}),u.jsxs(ct,{children:["Per ",C.bucket,", from the model prices; unpriced stays empty, never zero."]})]}),u.jsx(at,{children:u.jsx(Za,{points:fe,series:[{...Hl,name:"cost"}],format:z=>Rr(z),emptyMessage:"Nothing priced in this range."})})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:l?"By model":"By user and model"}),u.jsxs(ct,{children:["Totals by ",l?"":"user, ","model and endpoint."]})]}),u.jsx(at,{children:u.jsx(NM,{rows:mt,withPrincipal:!l})})]})]})]})}const ca=[{key:"24h",label:"Last 24 hours",bucket:"hour",count:24},{key:"7d",label:"Last 7 days",bucket:"day",count:7},{key:"30d",label:"Last 30 days",bucket:"day",count:30},{key:"12w",label:"Last 12 weeks",bucket:"week",count:12},{key:"12mo",label:"Last 12 months",bucket:"month",count:12},{key:"all",label:"All time",bucket:"month",count:0}];function np(e,r){const a=new Date(e);return a.setUTCMilliseconds(0),a.setUTCSeconds(0),a.setUTCMinutes(0),r==="hour"?a:(a.setUTCHours(0),r==="month"?(a.setUTCDate(1),a):(r==="week"&&a.setUTCDate(a.getUTCDate()-(a.getUTCDay()+6)%7),a))}function uc(e,r,a){const l=new Date(e);return r==="hour"?l.setUTCHours(l.getUTCHours()+a):r==="day"?l.setUTCDate(l.getUTCDate()+a):r==="week"?l.setUTCDate(l.getUTCDate()+a*7):l.setUTCMonth(l.getUTCMonth()+a),l}const Qa={timeZone:"UTC"};function qw(e,r){const a=new Date(e);return r==="hour"?a.toLocaleTimeString(void 0,{...Qa,hour:"2-digit",minute:"2-digit"}):r==="month"?a.toLocaleDateString(void 0,{...Qa,month:"short",year:"2-digit"}):a.toLocaleDateString(void 0,{...Qa,month:"short",day:"numeric"})}function Pw(e,r){const a=new Date(e);switch(r){case"hour":return`${a.toLocaleDateString(void 0,{...Qa,month:"short",day:"numeric"})}, ${a.toLocaleTimeString(void 0,{...Qa,hour:"2-digit",minute:"2-digit"})} UTC`;case"week":return`Week of ${a.toLocaleDateString(void 0,{...Qa,month:"short",day:"numeric",year:"numeric"})}`;case"month":return a.toLocaleDateString(void 0,{...Qa,month:"long",year:"numeric"});default:return a.toLocaleDateString(void 0,{...Qa,month:"short",day:"numeric",year:"numeric"})}}const $w="untagged";function Xo(){return{requests:0,cost:null,units:{}}}function RM(e,r){e.requests+=r.requests,r.cost!==null&&(e.cost=(e.cost??0)+r.cost);for(const[a,l]of Object.entries(r.units))e.units[a]=(e.units[a]??0)+l}function Vu(e,r,a){const l=new Map;for(const s of e){const c=r(s);let f=l.get(c);f||(f=a(c),l.set(c,f)),RM(f,s)}return[...l.values()]}function DM(e){return(e.units.input_tokens??0)+(e.units.output_tokens??0)}function Ga(e,r){return e.reduce((a,l)=>a+r(l),0)}function Th(e,r,a){return!a||r===0?null:(e-r)/r}function wb(e){return oa(e.tags,"app")||$w}function OM(e){return oa(e.tags,"context")||$w}function zM(){var mt;const[e,r]=S.useState("30d"),[a,l]=S.useState(""),[s,c]=S.useState(""),[f,d]=S.useState(""),[p,h]=S.useState(""),[v,x]=S.useState(!1),b=ca.find(Y=>Y.key===e)??ca[2],k=np(new Date,b.bucket),j=b.count?uc(k,b.bucket,-(b.count-1)):null,T=j?uc(j,b.bucket,-b.count):null,C="&app_tagged=1"+(a?`&tag=${encodeURIComponent(`app:${a}`)}`:"")+(s?`&tag=${encodeURIComponent(`context:${s}`)}`:"")+(f?`&principal=${encodeURIComponent(f)}`:"")+(p?`&model=${encodeURIComponent(p)}`:""),R=Yt(()=>Pe.get(`/stats/series?bucket=${b.bucket}`+(T?`&since=${T.toISOString()}`:"")+C),[e,a,s,f,p]),D=Yt(()=>Pe.get(`/stats/series?bucket=${b.bucket}`+(T?`&since=${T.toISOString()}`:"")+C+"&endpoint=embeddings"),[e,a,s,f,p]),B=Yt(()=>Pe.get("/stats/summary?app_tagged=1"+(j?`&since=${j.toISOString()}`:"")),[e]),O=((mt=R.data)==null?void 0:mt.series)??[],_=j?j.getTime():-1/0,A=O.filter(Y=>new Date(Y.start).getTime()>=_),I=O.filter(Y=>new Date(Y.start).getTime()<_),ee=I.length>0,q=S.useMemo(()=>{var qe;const Y=new Map;for(const ne of((qe=D.data)==null?void 0:qe.series)??[])Y.set(ne.start,ne);return Y},[D.data]),$=Y=>Y.units.output_tokens??0,X=Y=>Y.units.cached_input_tokens??0,ce=Y=>{var qe;return((qe=q.get(Y.start))==null?void 0:qe.units.input_tokens)??0},le=Y=>Math.max(0,(Y.units.input_tokens??0)-ce(Y)),W=Ga(A,Y=>Y.requests),U=Ga(A,le),Z=Ga(A,$),ie=Ga(A,X),K=U+Z,E=Ga(A,ce),L=Y=>new Date(Y.start).getTime()===k.getTime(),F=Y=>qw(Y.start,b.bucket),M=Y=>Pw(Y.start,b.bucket)+(L(Y)?" ยท in progress":""),oe=A.map(Y=>({label:F(Y),title:M(Y),values:[Y.ok+Y.cancelled,Y.failed],rows:Y.cancelled?[{label:"cancelled",value:zn(Y.cancelled)}]:void 0})),G=A.map(Y=>({label:F(Y),title:M(Y),values:[le(Y),X(Y),$(Y)]})),ue=A.map(Y=>({label:F(Y),title:M(Y),values:[ce(Y)]})),re=S.useMemo(()=>{var Y;return((Y=B.data)==null?void 0:Y.usage)??[]},[B.data]),ye=S.useMemo(()=>[...new Set(re.map(Y=>oa(Y.tags,"app")).filter(Boolean))].sort(),[re]),fe=S.useMemo(()=>[...new Set(re.filter(Y=>!a||oa(Y.tags,"app")===a).map(Y=>oa(Y.tags,"context")).filter(Boolean))].sort(),[re,a]),be=S.useMemo(()=>[...new Set(re.map(Y=>Y.principal))].sort(),[re]),Ee=S.useMemo(()=>[...new Set(re.map(Y=>Y.model))].sort(),[re]),Se=S.useMemo(()=>re.filter(Y=>(!a||oa(Y.tags,"app")===a)&&(!s||oa(Y.tags,"context")===s)&&(!f||Y.principal===f)&&(!p||Y.model===p)),[re,a,s,f,p]),Ie=S.useMemo(()=>Vu(Se,wb,Y=>({name:Y,...Xo()})).sort((Y,qe)=>qe.requests-Y.requests),[Se]),Be=Ie.reduce((Y,qe)=>Y+qe.requests,0),_t=S.useMemo(()=>Ie.map(Y=>({label:Y.name,value:Y.requests})),[Ie]),Ct=S.useMemo(()=>Vu(Se,Y=>Y.principal,Y=>({name:Y,...Xo()})).sort((Y,qe)=>qe.requests-Y.requests),[Se]),Et=S.useMemo(()=>{const Y=(qe,ne)=>({label:ne??qe.name??"",value:qe.requests,rows:[{label:"tokens",value:Re(DM(qe))}]});return Ec(Ct,qe=>Y(qe),qe=>{const ne=Xo();for(const z of qe){ne.requests+=z.requests;for(const[de,ke]of Object.entries(z.units))ne.units[de]=(ne.units[de]??0)+ke}return Y(ne,`Other (${qe.length} users)`)})},[Ct]),Lt=S.useMemo(()=>Vu(Se,OM,Y=>({name:Y,...Xo()})).sort((Y,qe)=>qe.requests-Y.requests),[Se]),Mt=S.useMemo(()=>Lt.map(Y=>({label:Y.name,value:Y.requests})),[Lt]),Rt=S.useMemo(()=>Vu(Se,Y=>`${wb(Y)} ${Y.model}`,Y=>{const qe=Y.indexOf(" ");return{name:Y.slice(0,qe),model:Y.slice(qe+1),...Xo()}}).sort((Y,qe)=>Y.name!==qe.name?Y.name.localeCompare(qe.name):Y.model.localeCompare(qe.model)),[Se]),zt=R.loading&&!R.data||B.loading&&!B.data,we=!zt&&(R.loading||B.loading||D.loading);return u.jsxs("div",{className:"flex flex-col gap-6",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsxs(ha,{value:e,onValueChange:r,children:[u.jsx(pa,{className:"w-44","aria-label":"Time range",children:u.jsx(ma,{})}),u.jsx(ga,{children:ca.map(Y=>u.jsx(Br,{value:Y.key,children:Y.label},Y.key))})]}),u.jsx(Wt,{label:"App",value:a,onChange:Y=>{l(Y),c("")},options:ye,allLabel:"All apps"}),a&&u.jsx(Wt,{label:"Context",value:s,onChange:c,options:fe,allLabel:"All contexts"}),u.jsx(Wt,{label:"User",value:f,onChange:d,options:be,allLabel:"All users"}),u.jsx(Wt,{label:"Model",value:p,onChange:h,options:Ee,allLabel:"All models"}),(a||s||f||p)&&u.jsxs(ze,{variant:"ghost",size:"sm",onClick:()=>{l(""),c(""),d(""),h("")},children:[u.jsx(bc,{}),"Clear filters"]}),u.jsx(ze,{variant:"outline",size:"icon-sm","aria-label":"Refresh",onClick:()=>{R.reload(),B.reload(),D.reload()},children:u.jsx(Ki,{})})]}),zt?u.jsx(Ot,{}):R.error||B.error||D.error?u.jsx("p",{className:"text-sm text-destructive",children:R.error??B.error??D.error}):u.jsxs("div",{className:we?"flex flex-col gap-6 opacity-60":"flex flex-col gap-6",children:[u.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[u.jsx(gr,{label:"Requests",value:Re(W),delta:Th(W,Ga(I,Y=>Y.requests),ee)}),u.jsx(gr,{label:"Tokens",value:Re(K),secondary:`${Re(U)} in ยท ${Re(ie)} cached ยท ${Re(Z)} out`,delta:Th(K,Ga(I,Y=>le(Y)+$(Y)),ee)}),u.jsx(gr,{label:"Embedding",value:Re(E),secondary:"in",delta:Th(E,Ga(I,ce),ee)})]}),u.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[u.jsxs(tt,{className:v?"min-w-0 lg:col-span-2":"min-w-0",children:[u.jsxs(nt,{className:"flex flex-row items-start justify-between",children:[u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx(rt,{className:"font-serif",children:"Apps"}),u.jsx(ct,{children:"Requests per app, from the app tag."})]}),u.jsx(ze,{variant:"outline",size:"icon-sm","aria-label":v?"Show chart":"Show all apps as a table",title:v?"Show chart":"Show all apps as a table",onClick:()=>x(Y=>!Y),children:v?u.jsx(Q0,{}):u.jsx(nm,{})})]}),u.jsx(at,{children:v?u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[u.jsx(ge,{children:"App"}),u.jsx(ge,{className:"text-right",children:"Share"}),u.jsx(ge,{className:"text-right",children:"Requests"}),u.jsx(ge,{className:"text-right",children:"Input"}),u.jsx(ge,{className:"text-right",children:"Cached"}),u.jsx(ge,{className:"text-right",children:"Output"}),u.jsx(ge,{className:"text-right",children:"Spend"})]})}),u.jsxs(xn,{children:[Ie.length===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:7,className:"text-muted-foreground",children:"No usage in this range."})}),Ie.map((Y,qe)=>u.jsxs(Ue,{children:[u.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:Y.name}),u.jsx(me,{className:"text-right tabular-nums",children:Be>0?`${(Y.requests/Be*100).toFixed(1)}%`:""}),u.jsx(me,{className:"text-right tabular-nums",children:Re(Y.requests)}),u.jsx(me,{className:"text-right tabular-nums",title:qt(Y.units.input_tokens),children:Y.units.input_tokens?Re(Y.units.input_tokens):""}),u.jsx(me,{className:"text-right tabular-nums",title:qt(Y.units.cached_input_tokens),children:Y.units.cached_input_tokens?Re(Y.units.cached_input_tokens):""}),u.jsx(me,{className:"text-right tabular-nums",title:qt(Y.units.output_tokens),children:Y.units.output_tokens?Re(Y.units.output_tokens):""}),u.jsx(me,{className:"text-right tabular-nums",children:Y.cost===null?u.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):Rr(Y.cost)})]},qe))]})]}):u.jsx(Vi,{rows:_t,format:Re})})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Users"}),u.jsx(ct,{children:"Share of requests per user."})]}),u.jsx(at,{children:u.jsx(rs,{slices:Et.slices,overflow:Et.overflow,format:Re,emptyMessage:"No usage in this range."},`${e} ${a} ${s} ${f} ${p}`)})]}),a&&u.jsxs(tt,{className:"lg:col-span-2",children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Contexts"}),u.jsxs(ct,{children:["Requests per context in ",a,"."]})]}),u.jsx(at,{children:u.jsx(Vi,{rows:Mt,format:Re})})]})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Tokens"}),u.jsxs(ct,{children:["Chat input, cached input and output per ",b.bucket,"."]})]}),u.jsx(at,{children:u.jsx(Za,{points:G,series:[{...Hl,name:"input"},{...$m,name:"cached"},{...os,name:"output"}],format:Re})})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Embedding"}),u.jsxs(ct,{children:["Input tokens on embeddings per ",b.bucket,"."]})]}),u.jsx(at,{children:u.jsx(Za,{points:ue,series:[{...Hl,name:"input"}],format:Re,emptyMessage:"No embeddings in this range."})})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Requests"}),u.jsxs(ct,{children:["Per ",b.bucket,", split by outcome."]})]}),u.jsx(at,{children:u.jsx(Za,{points:oe,series:[{...Hl,name:"ok"},{...os,name:"failed"}],format:Re,integer:!0})})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:a?"By model":"By app and model"}),u.jsxs(ct,{children:["Totals by ",a?"":"app and ","model."]})]}),u.jsx(at,{children:u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[!a&&u.jsx(ge,{children:"App"}),u.jsx(ge,{children:"Model"}),u.jsx(ge,{className:"text-right",children:"Requests"}),u.jsx(ge,{className:"text-right",children:"Input"}),u.jsx(ge,{className:"text-right",children:"Cached"}),u.jsx(ge,{className:"text-right",children:"Output"}),u.jsx(ge,{className:"text-right",children:"Spend"})]})}),u.jsxs(xn,{children:[Rt.length===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:a?6:7,className:"text-muted-foreground",children:"No usage in this range."})}),Rt.map((Y,qe)=>u.jsxs(Ue,{children:[!a&&u.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:Y.name}),u.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:Y.model}),u.jsx(me,{className:"text-right tabular-nums",children:Re(Y.requests)}),u.jsx(me,{className:"text-right tabular-nums",children:qt(Y.units.input_tokens)}),u.jsx(me,{className:"text-right tabular-nums",children:qt(Y.units.cached_input_tokens)}),u.jsx(me,{className:"text-right tabular-nums",children:qt(Y.units.output_tokens)}),u.jsx(me,{className:"text-right tabular-nums",children:Y.cost===null?u.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):Rr(Y.cost)})]},qe))]})]})})]})]})]})}const LM=V0("inline-flex items-center justify-center rounded-md border font-medium w-fit max-w-full whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",muted:"border-transparent bg-muted text-muted-foreground [a&]:hover:bg-muted/80",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent/10 [a&]:hover:text-accent-foreground",success:"border-transparent bg-[#1a7f37] text-white [a&]:hover:bg-[#1a7f37]/90",warning:"border-transparent bg-[#9a6700] text-white [a&]:hover:bg-[#9a6700]/90",info:"border-transparent bg-[#0969da] text-white [a&]:hover:bg-[#0969da]/90",tag:"border-border bg-card text-foreground [a&]:hover:bg-muted",value:"border-transparent bg-muted text-foreground font-mono [a&]:hover:bg-muted/80",whatsapp:"border-transparent bg-[#22c55e] text-white [a&]:hover:bg-[#22c55e]/90",email:"border-transparent bg-[#4b5563] text-white [a&]:hover:bg-[#4b5563]/90",telegram:"border-transparent bg-[#3b82f6] text-white [a&]:hover:bg-[#3b82f6]/90",zulip:"border-transparent bg-[#a855f7] text-white [a&]:hover:bg-[#a855f7]/90",platform:"border-transparent bg-[#f97316] text-white [a&]:hover:bg-[#f97316]/90"},size:{sm:"text-xs px-1.5 py-0",default:"text-xs px-2 py-0.5",lg:"text-sm px-3 py-1 [&>svg]:size-3.5"}},defaultVariants:{variant:"default",size:"default"}});function fn({className:e,variant:r,size:a,asChild:l=!1,...s}){const c=l?fa:"span";return u.jsx(c,{"data-slot":"badge",className:_e(LM({variant:r,size:a}),e),...s})}const UM=["<1s","1โ€“5s","5โ€“15s","15โ€“30s","30โ€“60s","60โ€“120s","โ‰ฅ120s"],Ah=[{key:"upstream_error",name:"provider error",series:Hl},{key:"unreachable",name:"unreachable",series:$m},{key:"cancelled",name:"cancelled",series:os}],BM="untagged";function rp(e){return e.outcome!=="ok"}function Fw(e){return e.error_kind?e.error_kind:e.outcome==="upstream_error"&&e.status_code?`http ${e.status_code}`:e.outcome}function _h(e,r){const a=new Map;for(const l of e){const s=r(l);let c=a.get(s);c||(c={label:s,errors:0,total:0},a.set(s,c)),c.total+=l.requests,rp(l)&&(c.errors+=l.requests)}return[...a.values()].filter(l=>l.errors>0).sort((l,s)=>s.errors-l.errors)}function Mh(e){return e.map(r=>({label:r.label,value:r.errors,note:`${(r.errors/r.total*100).toFixed(1)}% of ${Re(r.total)} req`}))}function IM(e){const r=new Map;for(const a of e){if(!rp(a))continue;const l=Fw(a),s=`${a.provider}\0${a.model}\0${l}\0${a.status_code??""}`;let c=r.get(s);c||(c={provider:a.provider,model:a.model,outcome:a.outcome,label:l,statusCode:a.status_code,requests:0,weightedMs:0,lastSeen:""},r.set(s,c)),c.requests+=a.requests,c.weightedMs+=a.avg_ms*a.requests,a.last_seen>c.lastSeen&&(c.lastSeen=a.last_seen)}return[...r.values()].sort((a,l)=>l.requests-a.requests)}function HM(e){const r=new URLSearchParams;return e.provider&&r.set("provider",e.provider),e.model&&r.set("model",e.model),r.set("outcome",e.outcome),"/requests?"+r.toString()}function qM(){var L,F,M,oe;const[e,r]=S.useState("7d"),[a,l]=S.useState(""),[s,c]=S.useState(""),[f,d]=S.useState(""),[p,h]=S.useState(""),v=ca.find(G=>G.key===e)??ca[1],x=np(new Date,v.bucket),b=v.count?uc(x,v.bucket,-(v.count-1)):null,y=b?`&since=${b.toISOString()}`:"",k=(a?`&principal=${encodeURIComponent(a)}`:"")+(s?`&provider=${encodeURIComponent(s)}`:"")+(f?`&model=${encodeURIComponent(f)}`:"")+(p?`&tag=${encodeURIComponent(`app:${p}`)}`:""),j=Yt(()=>Pe.get(`/stats/errors?bucket=${v.bucket}`+y+k),[e,a,s,f,p]),T=Yt(()=>Pe.get("/stats/requests/facets"+(y?"?"+y.slice(1):"")),[e]),C=((L=j.data)==null?void 0:L.series)??[],R=S.useMemo(()=>{var G;return((G=j.data)==null?void 0:G.breakdown)??[]},[j.data]),D=C.reduce((G,ue)=>G+ue.requests,0),B=C.reduce((G,ue)=>G+ue.upstream_error+ue.unreachable,0),O=C.reduce((G,ue)=>G+ue.cancelled,0),_=G=>D>0?`${(G/D*100).toFixed(1)}% of requests`:void 0,A=S.useMemo(()=>R.filter(rp),[R]),I=A.reduce((G,ue)=>G+ue.requests,0),ee=I>0?A.reduce((G,ue)=>G+ue.avg_ms*ue.requests,0)/I:null,q=G=>new Date(G).getTime()===x.getTime(),$=C.map(G=>({label:qw(G.start,v.bucket),title:Pw(G.start,v.bucket)+(q(G.start)?" ยท in progress":""),values:[G.upstream_error,G.unreachable,G.cancelled],rows:[{label:"requests total",value:zn(G.requests)}]})),X=UM.map((G,ue)=>{const re=ye=>A.filter(fe=>fe.outcome===ye).reduce((fe,be)=>fe+(be.bands[ue]??0),0);return{label:G,title:`Time to failure ${G}`,values:Ah.map(ye=>re(ye.key))}}),ce=S.useMemo(()=>Mh(_h(R,G=>G.provider||"(none)")),[R]),le=S.useMemo(()=>Mh(_h(R,G=>oa(G.tags,"app")||BM)),[R]),W=S.useMemo(()=>Mh(_h(R,G=>G.model||"(none)")),[R]),U=S.useMemo(()=>{const G=new Map;for(const re of A){const ye=Fw(re);G.set(ye,(G.get(ye)??0)+re.requests)}const ue=[...G.entries()].sort((re,ye)=>ye[1]-re[1]);return Ec(ue,([re,ye])=>({label:re,value:ye}),re=>({label:`Other (${re.length} kinds)`,value:re.reduce((ye,[,fe])=>ye+fe,0)}))},[A]),Z=S.useMemo(()=>IM(R).slice(0,50),[R]),ie=S.useMemo(()=>{var G;return[...new Set((((G=T.data)==null?void 0:G.tags)??[]).filter(ue=>ue.startsWith("app:")).map(ue=>ue.slice(4)))].sort()},[T.data]),K=j.loading&&!j.data,E=!K&&j.loading;return u.jsxs("div",{className:"flex flex-col gap-6",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsxs(ha,{value:e,onValueChange:r,children:[u.jsx(pa,{className:"w-44","aria-label":"Time range",children:u.jsx(ma,{})}),u.jsx(ga,{children:ca.map(G=>u.jsx(Br,{value:G.key,children:G.label},G.key))})]}),u.jsx(Wt,{label:"User",value:a,onChange:l,options:((F=T.data)==null?void 0:F.principals)??[],allLabel:"All users"}),u.jsx(Wt,{label:"Provider",value:s,onChange:c,options:((M=T.data)==null?void 0:M.providers)??[],allLabel:"All providers"}),u.jsx(Wt,{label:"Model",value:f,onChange:d,options:((oe=T.data)==null?void 0:oe.models)??[],allLabel:"All models"}),u.jsx(Wt,{label:"App",value:p,onChange:h,options:ie,allLabel:"All apps"}),(a||s||f||p)&&u.jsxs(ze,{variant:"ghost",size:"sm",onClick:()=>{l(""),c(""),d(""),h("")},children:[u.jsx(bc,{}),"Clear filters"]}),u.jsx(ze,{variant:"outline",size:"icon-sm","aria-label":"Refresh",onClick:()=>j.reload(),children:u.jsx(Ki,{})})]}),K?u.jsx(Ot,{}):j.error?u.jsx("p",{className:"text-sm text-destructive",children:j.error}):u.jsxs("div",{className:E?"flex flex-col gap-6 opacity-60":"flex flex-col gap-6",children:[u.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[u.jsx(gr,{label:"Requests",value:Re(D)}),u.jsx(gr,{label:"Failed",value:Re(B),hint:_(B)}),u.jsx(gr,{label:"Cancelled",value:Re(O),hint:_(O)}),u.jsx(gr,{label:"Avg time to failure",value:ee===null?"โ€”":Jh(Math.round(ee))})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Failures over time"}),u.jsxs(ct,{children:["Per ",v.bucket,", split by class."]})]}),u.jsx(at,{children:u.jsx(Za,{points:$,series:Ah.map(G=>({...G.series,name:G.name})),format:Re,integer:!0,emptyMessage:"No failures in this range."})})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Time to failure"}),u.jsx(ct,{children:"How long requests ran before failing. A pile-up near a round number is a timeout."})]}),u.jsx(at,{children:u.jsx(Za,{points:X,series:Ah.map(G=>({...G.series,name:G.name})),format:Re,integer:!0,emptyMessage:"No failures in this range."})})]}),u.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Failures by provider"}),u.jsx(ct,{children:"Each bar with the provider's own failure rate."})]}),u.jsx(at,{children:u.jsx(Vi,{rows:ce,format:Re,emptyMessage:"No failures in this range."})})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Failures by app"}),u.jsx(ct,{children:"From the app tag; untagged traffic grouped."})]}),u.jsx(at,{children:u.jsx(Vi,{rows:le,format:Re,emptyMessage:"No failures in this range."})})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Failures by model"}),u.jsx(ct,{children:"Each bar with the model's own failure rate."})]}),u.jsx(at,{children:u.jsx(Vi,{rows:W,format:Re,emptyMessage:"No failures in this range."})})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Failure kinds"}),u.jsx(ct,{children:"Provider error codes and transport classes."})]}),u.jsx(at,{children:u.jsx(rs,{slices:U.slices,overflow:U.overflow,format:Re,emptyMessage:"No failures in this range."},`${e} ${a} ${s} ${f} ${p}`)})]})]}),u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Error signatures"}),u.jsx(ct,{children:"Each distinct failure, newest last seen. Open one in the request explorer."})]}),u.jsx(at,{children:u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[u.jsx(ge,{children:"Error"}),u.jsx(ge,{children:"Provider"}),u.jsx(ge,{children:"Model"}),u.jsx(ge,{className:"text-right",children:"Requests"}),u.jsx(ge,{className:"text-right",children:"Avg time"}),u.jsx(ge,{className:"text-right",children:"Last seen"}),u.jsx(ge,{})]})}),u.jsxs(xn,{children:[Z.length===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:7,className:"text-muted-foreground",children:"No failures in this range."})}),Z.map((G,ue)=>u.jsxs(Ue,{children:[u.jsx(me,{children:u.jsxs(fn,{variant:G.outcome==="cancelled"?"warning":"destructive",children:[G.label,G.outcome!=="cancelled"&&G.statusCode&&G.label!==`http ${G.statusCode}`?` ยท ${G.statusCode}`:""]})}),u.jsx(me,{className:"font-mono text-xs",children:G.provider||"โ€”"}),u.jsx(me,{className:"font-mono text-xs",children:G.model||"โ€”"}),u.jsx(me,{className:"text-right tabular-nums",children:zn(G.requests)}),u.jsx(me,{className:"text-right tabular-nums",children:Jh(Math.round(G.weightedMs/G.requests))}),u.jsx(me,{className:"whitespace-nowrap text-right text-xs",children:E0(G.lastSeen)}),u.jsx(me,{className:"text-right",children:u.jsxs("a",{href:HM(G),className:"inline-flex items-center gap-1 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:["explore",u.jsx(LE,{className:"size-3"})]})})]},ue))]})]})})]})]})]})}var ap="Checkbox",[PM]=vr(ap),[$M,FM]=PM(ap),Vw=S.forwardRef((e,r)=>{const{__scopeCheckbox:a,name:l,checked:s,defaultChecked:c,required:f,disabled:d,value:p="on",onCheckedChange:h,form:v,...x}=e,[b,y]=S.useState(null),k=dt(r,B=>y(B)),j=S.useRef(!1),T=b?v||!!b.closest("form"):!0,[C=!1,R]=el({prop:s,defaultProp:c,onChange:h}),D=S.useRef(C);return S.useEffect(()=>{const B=b==null?void 0:b.form;if(B){const O=()=>R(D.current);return B.addEventListener("reset",O),()=>B.removeEventListener("reset",O)}},[b,R]),u.jsxs($M,{scope:a,state:C,disabled:d,children:[u.jsx(Ge.button,{type:"button",role:"checkbox","aria-checked":Ja(C)?"mixed":C,"aria-required":f,"data-state":Xw(C),"data-disabled":d?"":void 0,disabled:d,value:p,...x,ref:k,onKeyDown:Te(e.onKeyDown,B=>{B.key==="Enter"&&B.preventDefault()}),onClick:Te(e.onClick,B=>{R(O=>Ja(O)?!0:!O),T&&(j.current=B.isPropagationStopped(),j.current||B.stopPropagation())})}),T&&u.jsx(VM,{control:b,bubbles:!j.current,name:l,value:p,checked:C,required:f,disabled:d,form:v,style:{transform:"translateX(-100%)"},defaultChecked:Ja(c)?!1:c})]})});Vw.displayName=ap;var Gw="CheckboxIndicator",Yw=S.forwardRef((e,r)=>{const{__scopeCheckbox:a,forceMount:l,...s}=e,c=FM(Gw,a);return u.jsx(Ir,{present:l||Ja(c.state)||c.state===!0,children:u.jsx(Ge.span,{"data-state":Xw(c.state),"data-disabled":c.disabled?"":void 0,...s,ref:r,style:{pointerEvents:"none",...e.style}})})});Yw.displayName=Gw;var VM=e=>{const{control:r,checked:a,bubbles:l=!0,defaultChecked:s,...c}=e,f=S.useRef(null),d=ep(a),p=Zm(r);S.useEffect(()=>{const v=f.current,x=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(x,"checked").set;if(d!==a&&y){const k=new Event("click",{bubbles:l});v.indeterminate=Ja(a),y.call(v,Ja(a)?!1:a),v.dispatchEvent(k)}},[d,a,l]);const h=S.useRef(Ja(a)?!1:a);return u.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:s??h.current,...c,tabIndex:-1,ref:f,style:{...e.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Ja(e){return e==="indeterminate"}function Xw(e){return Ja(e)?"indeterminate":e?"checked":"unchecked"}var GM=Vw,YM=Yw;function lp({className:e,...r}){return u.jsx(GM,{"data-slot":"checkbox",className:_e("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:u.jsx(YM,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:u.jsx(yc,{className:"size-3.5"})})})}function Gu({label:e,sortKey:r,active:a,onSort:l,numeric:s}){return u.jsx(ge,{className:s?"text-right":void 0,children:u.jsxs("button",{type:"button",onClick:()=>l(r),"aria-label":`Sort by ${e.toLowerCase()}`,className:_e("cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring",a?"font-medium text-foreground":"hover:text-foreground"),children:[e,a&&u.jsxs("span",{"aria-hidden":!0,children:[" ",r==="name"?"โ†‘":"โ†“"]})]})})}function XM(){var j;const[e,r]=S.useState("30d"),[a,l]=S.useState("name"),[s,c]=S.useState(!1),f=ca.find(T=>T.key===e)??ca[2],d=np(new Date,f.bucket),p=f.count?uc(d,f.bucket,-(f.count-1)):null,h=Yt(()=>Pe.get("/v1/models?include_hidden=1"),[]),v=Yt(()=>Pe.get("/stats/summary"+(p?`?since=${p.toISOString()}`:"")),[e]),x=S.useMemo(()=>{var D,B;const T=new Map;for(const O of((D=v.data)==null?void 0:D.usage)??[]){let _=T.get(O.model);_||(_={requests:0,tokens:0,cost:null},T.set(O.model,_)),_.requests+=O.requests,_.tokens+=(O.units.input_tokens??0)+(O.units.output_tokens??0),O.cost!==null&&(_.cost=(_.cost??0)+O.cost)}const C=(((B=h.data)==null?void 0:B.data)??[]).filter(O=>s||!O.hidden).map(O=>{var _,A,I;return{model:O,requests:((_=T.get(O.id))==null?void 0:_.requests)??0,tokens:((A=T.get(O.id))==null?void 0:A.tokens)??0,cost:((I=T.get(O.id))==null?void 0:I.cost)??null}}),R=(O,_)=>O.model.id.localeCompare(_.model.id);return C.sort((O,_)=>a==="name"?R(O,_):a==="cost"?(_.cost??-1)-(O.cost??-1)||R(O,_):_[a]-O[a]||R(O,_))},[h.data,v.data,a,s]),b=(((j=h.data)==null?void 0:j.data)??[]).filter(T=>T.hidden).length,y=h.loading&&!h.data,k=!y&&(h.loading||v.loading);return u.jsxs("div",{className:"flex flex-col gap-6",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsxs(ha,{value:e,onValueChange:r,children:[u.jsx(pa,{className:"w-44","aria-label":"Time range",children:u.jsx(ma,{})}),u.jsx(ga,{children:ca.map(T=>u.jsx(Br,{value:T.key,children:T.label},T.key))})]}),u.jsx(ze,{variant:"outline",size:"icon-sm","aria-label":"Refresh",onClick:()=>{h.reload(),v.reload()},children:u.jsx(Ki,{})}),b>0&&u.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[u.jsx(lp,{checked:s,onCheckedChange:T=>c(T===!0)}),"Show hidden"]})]}),y?u.jsx(Ot,{}):h.error||v.error?u.jsx("p",{className:"text-sm text-destructive",children:h.error??v.error}):u.jsxs(tt,{className:k?"opacity-60":void 0,children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Models"}),u.jsx(ct,{children:"Every model you can call, and how much it is used."})]}),u.jsx(at,{children:u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[u.jsx(Gu,{label:"Model",sortKey:"name",active:a==="name",onSort:l}),u.jsx(ge,{children:"Capabilities"}),u.jsx(Gu,{label:"Requests",sortKey:"requests",active:a==="requests",onSort:l,numeric:!0}),u.jsx(Gu,{label:"Tokens",sortKey:"tokens",active:a==="tokens",onSort:l,numeric:!0}),u.jsx(Gu,{label:"Spend",sortKey:"cost",active:a==="cost",onSort:l,numeric:!0})]})}),u.jsxs(xn,{children:[x.length===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:5,className:"text-muted-foreground",children:"No models available yet."})}),x.map(T=>u.jsxs(Ue,{children:[u.jsx(me,{className:"font-medium wrap-anywhere",children:u.jsxs("span",{className:"flex flex-col",children:[u.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[T.model.id,T.model.hidden&&u.jsx(fn,{variant:"muted",children:"hidden"})]}),T.model.alias_of&&u.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["โ†’ ",T.model.alias_of]})]})}),u.jsx(me,{children:u.jsx("div",{className:"flex flex-wrap gap-1",children:T.model.capabilities.map(C=>u.jsx(fn,{variant:"muted",children:C},C))})}),u.jsx(me,{className:"text-right tabular-nums",children:T.requests?Re(T.requests):""}),u.jsx(me,{className:"text-right tabular-nums",title:qt(T.tokens),children:T.tokens?Re(T.tokens):""}),u.jsx(me,{className:"text-right tabular-nums",children:T.requests?T.cost===null?u.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):Rr(T.cost):""})]},T.model.id))]})]})})]})]})}const KM=[{key:"overview",label:"Overview"},{key:"apps",label:"Apps"},{key:"models",label:"Models"},{key:"errors",label:"Errors"}];function QM({value:e,onChange:r}){return u.jsx("nav",{className:"-mt-2 flex items-center gap-4 border-b text-sm",children:KM.map(a=>u.jsx("button",{type:"button","aria-current":e===a.key?"page":void 0,onClick:()=>r(a.key),className:_e("cursor-pointer border-b-2 px-0.5 pb-2 outline-none focus-visible:ring-2 focus-visible:ring-ring",e===a.key?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:a.label},a.key))})}function ZM({ssoEnabled:e,sub:r,onSubChange:a}){return u.jsxs("div",{className:"flex flex-col gap-6",children:[u.jsx(QM,{value:r,onChange:a}),r==="apps"?u.jsx(zM,{}):r==="models"?u.jsx(XM,{}):r==="errors"?u.jsx(qM,{}):u.jsx(MM,{ssoEnabled:e})]})}var ip="Switch",[JM]=vr(ip),[WM,eR]=JM(ip),Kw=S.forwardRef((e,r)=>{const{__scopeSwitch:a,name:l,checked:s,defaultChecked:c,required:f,disabled:d,value:p="on",onCheckedChange:h,form:v,...x}=e,[b,y]=S.useState(null),k=dt(r,D=>y(D)),j=S.useRef(!1),T=b?v||!!b.closest("form"):!0,[C=!1,R]=el({prop:s,defaultProp:c,onChange:h});return u.jsxs(WM,{scope:a,checked:C,disabled:d,children:[u.jsx(Ge.button,{type:"button",role:"switch","aria-checked":C,"aria-required":f,"data-state":Jw(C),"data-disabled":d?"":void 0,disabled:d,value:p,...x,ref:k,onClick:Te(e.onClick,D=>{R(B=>!B),T&&(j.current=D.isPropagationStopped(),j.current||D.stopPropagation())})}),T&&u.jsx(tR,{control:b,bubbles:!j.current,name:l,value:p,checked:C,required:f,disabled:d,form:v,style:{transform:"translateX(-100%)"}})]})});Kw.displayName=ip;var Qw="SwitchThumb",Zw=S.forwardRef((e,r)=>{const{__scopeSwitch:a,...l}=e,s=eR(Qw,a);return u.jsx(Ge.span,{"data-state":Jw(s.checked),"data-disabled":s.disabled?"":void 0,...l,ref:r})});Zw.displayName=Qw;var tR=e=>{const{control:r,checked:a,bubbles:l=!0,...s}=e,c=S.useRef(null),f=ep(a),d=Zm(r);return S.useEffect(()=>{const p=c.current,h=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(h,"checked").set;if(f!==a&&x){const b=new Event("click",{bubbles:l});x.call(p,a),p.dispatchEvent(b)}},[f,a,l]),u.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...s,tabIndex:-1,ref:c,style:{...e.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Jw(e){return e?"checked":"unchecked"}var nR=Kw,rR=Zw;function Sb({className:e,...r}){return u.jsx(nR,{"data-slot":"switch",className:_e("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-[#7F7F79] focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:u.jsx(rR,{"data-slot":"switch-thumb",className:"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"})})}function Hi(e){return e instanceof Error?e.message:String(e)}function aR(e){return{name:e.name,base_url:e.base_url,api_key:"",remove_credential:!1,verify_tls:e.verify_tls,timeout_connect:String(e.timeout_connect),timeout_read:String(e.timeout_read),max_concurrency:e.max_concurrency===null?"":String(e.max_concurrency)}}function lR(){const{data:e,loading:r,error:a,reload:l}=Yt(()=>Pe.get("/admin/v1/providers")),[s,c]=S.useState({name:"",base_url:"",api_key:""}),[f,d]=S.useState(!1),[p,h]=S.useState(null),[v,x]=S.useState(!1),[b,y]=S.useState(null),[k,j]=S.useState(null),T=async _=>{_.preventDefault(),d(!0);try{await Pe.post("/admin/v1/providers",{name:s.name.trim(),wire_format:"openai",base_url:s.base_url.trim(),...s.api_key!==""?{api_key:s.api_key}:{}}),Ve.success(`Provider "${s.name.trim()}" registered`),c({name:"",base_url:"",api_key:""}),l()}catch(A){Ve.error(Hi(A))}finally{d(!1)}},C=async()=>{if(!p)return;const _=Number(p.timeout_connect),A=Number(p.timeout_read);if(!(_>0)||!(A>0)){Ve.error("Timeouts must be positive seconds");return}const I=p.max_concurrency.trim()===""?0:Number(p.max_concurrency);if(!Number.isInteger(I)||I<0){Ve.error("Max concurrency must be a whole number, or empty for unlimited");return}x(!0);try{await Pe.patch(`/admin/v1/providers/${encodeURIComponent(p.name)}`,{base_url:p.base_url.trim(),verify_tls:p.verify_tls,timeout_connect:_,timeout_read:A,max_concurrency:I,...p.api_key!==""?{api_key:p.api_key}:{},...p.remove_credential?{remove_credential:!0}:{}}),Ve.success(`Provider "${p.name}" updated`),h(null),l()}catch(ee){Ve.error(Hi(ee))}finally{x(!1)}},R=async _=>{try{await Pe.patch(`/admin/v1/providers/${encodeURIComponent(_.name)}`,{enabled:!_.enabled}),l()}catch(A){Ve.error(Hi(A))}},D=async _=>{try{await Pe.del(`/admin/v1/providers/${encodeURIComponent(_)}`),Ve.success(`Provider "${_}" deleted`),(k==null?void 0:k.provider)===_&&j(null),l()}catch(A){Ve.error(Hi(A))}},B=async _=>{y(_);try{const A=await Pe.get(`/admin/v1/providers/${encodeURIComponent(_)}/discover`);j({provider:_,models:A.models})}catch(A){Ve.error(Hi(A))}finally{y(null)}},O=async(_,A)=>{try{await Pe.post("/admin/v1/models",{alias:A,provider:_,upstream_name:A,capabilities:["chat","chat_stream"]}),Ve.success(`Bound "${A}" (chat capabilities; adjust in Models)`),B(_)}catch(I){Ve.error(Hi(I))}};return u.jsxs("div",{className:"flex flex-col gap-6",children:[u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Register a provider"}),u.jsxs(ct,{children:["An upstream OpenAI-compatible endpoint (vLLM, SGLang, OpenAI, ...). The base URL includes ",u.jsx("code",{className:"font-mono",children:"/v1"}),"."]})]}),u.jsx(at,{children:u.jsxs("form",{onSubmit:T,className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:"p-name",children:"Name"}),u.jsx(Jt,{id:"p-name",placeholder:"vllm-1",value:s.name,onChange:_=>c({...s,name:_.target.value}),required:!0})]}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:"p-url",children:"Base URL"}),u.jsx(Jt,{id:"p-url",placeholder:"http://10.0.0.5:8000/v1",value:s.base_url,onChange:_=>c({...s,base_url:_.target.value}),required:!0})]}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:"p-key",children:"Upstream API key (optional)"}),u.jsx(Jt,{id:"p-key",type:"password",autoComplete:"off",value:s.api_key,onChange:_=>c({...s,api_key:_.target.value})})]}),u.jsx("div",{className:"flex items-end",children:u.jsxs(ze,{type:"submit",disabled:f,children:[f&&u.jsx(Ot,{}),"Register"]})})]})})]}),u.jsxs(tt,{children:[u.jsx(nt,{children:u.jsx(rt,{className:"font-serif",children:"Providers"})}),u.jsx(at,{children:r&&!e?u.jsx(Ot,{}):a?u.jsx("p",{className:"text-sm text-destructive",children:a}):u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[u.jsx(ge,{children:"Name"}),u.jsx(ge,{children:"Base URL"}),u.jsx(ge,{children:"Credential"}),u.jsx(ge,{title:"Read timeout ยท max concurrency",children:"Limits"}),u.jsx(ge,{children:"Enabled"}),u.jsx(ge,{className:"w-56"})]})}),u.jsxs(xn,{children:[(e==null?void 0:e.providers.length)===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:6,className:"text-muted-foreground",children:"No providers registered yet."})}),e==null?void 0:e.providers.map(_=>(p==null?void 0:p.name)===_.name?u.jsxs(Ue,{className:"bg-muted/30 hover:bg-muted/30",children:[u.jsx(me,{className:"align-top font-medium",children:_.name}),u.jsx(me,{colSpan:5,children:u.jsxs("div",{className:"flex flex-col gap-4 py-1",children:[u.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:"e-url",children:"Base URL"}),u.jsx(Jt,{id:"e-url",value:p.base_url,onChange:A=>h({...p,base_url:A.target.value})})]}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:"e-key",children:"Upstream API key"}),u.jsx(Jt,{id:"e-key",type:"password",autoComplete:"off",placeholder:_.has_credential?"unchanged":"none",value:p.api_key,disabled:p.remove_credential,onChange:A=>h({...p,api_key:A.target.value})}),_.has_credential&&u.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[u.jsx(lp,{checked:p.remove_credential,onCheckedChange:A=>h({...p,remove_credential:A===!0})}),"Remove the stored key"]})]}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:"e-conc",children:"Max concurrency"}),u.jsx(Jt,{id:"e-conc",inputMode:"numeric",placeholder:"unlimited",value:p.max_concurrency,onChange:A=>h({...p,max_concurrency:A.target.value})})]}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:"e-connect",children:"Connect timeout (s)"}),u.jsx(Jt,{id:"e-connect",inputMode:"decimal",value:p.timeout_connect,onChange:A=>h({...p,timeout_connect:A.target.value})})]}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:"e-read",children:"Read timeout (s)"}),u.jsx(Jt,{id:"e-read",inputMode:"decimal",value:p.timeout_read,onChange:A=>h({...p,timeout_read:A.target.value})}),u.jsx("p",{className:"text-xs text-muted-foreground",children:"Caps the wait for a response; whole request on non-streaming calls."})]}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:"e-tls",children:"Verify TLS"}),u.jsx(Sb,{id:"e-tls",checked:p.verify_tls,onCheckedChange:A=>h({...p,verify_tls:A})})]})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsxs(ze,{size:"sm",disabled:v,onClick:C,children:[v&&u.jsx(Ot,{}),"Save"]}),u.jsx(ze,{variant:"outline",size:"sm",onClick:()=>h(null),children:"Cancel"})]})]})})]},_.name):u.jsxs(Ue,{children:[u.jsx(me,{className:"font-medium wrap-anywhere",children:_.name}),u.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:_.base_url}),u.jsx(me,{children:_.has_credential?u.jsx(fn,{variant:"secondary",children:"set"}):u.jsx(fn,{variant:"muted",children:"none"})}),u.jsxs(me,{className:"whitespace-nowrap text-xs text-muted-foreground",title:"Read timeout ยท max concurrency",children:[_.timeout_read,"s ยท"," ",_.max_concurrency===null?"unlimited":_.max_concurrency]}),u.jsx(me,{children:u.jsx(Sb,{checked:_.enabled,onCheckedChange:()=>R(_),"aria-label":`Enable ${_.name}`})}),u.jsxs(me,{className:"flex items-center justify-end gap-1 whitespace-nowrap",children:[u.jsxs(ze,{variant:"outline",size:"sm",disabled:b===_.name,onClick:()=>B(_.name),children:[b===_.name?u.jsx(Ot,{}):u.jsx(Ki,{}),"Discover models"]}),u.jsx(ze,{variant:"ghost",size:"icon-sm","aria-label":`Edit ${_.name}`,onClick:()=>h(aR(_)),children:u.jsx(J0,{})}),u.jsxs(tl,{children:[u.jsx(nl,{asChild:!0,children:u.jsx(ze,{variant:"ghost",size:"icon-sm","aria-label":`Delete ${_.name}`,children:u.jsx(zm,{})})}),u.jsxs(rl,{children:[u.jsxs(al,{children:[u.jsxs(il,{children:['Delete provider "',_.name,'"?']}),u.jsx(ol,{children:"All model bindings on this provider are deleted with it, and calls to those aliases start failing immediately."})]}),u.jsxs(ll,{children:[u.jsx(ul,{children:"Cancel"}),u.jsx(sl,{onClick:()=>D(_.name),children:"Delete"})]})]})]})]})]},_.name))]})]})})]}),k&&u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsxs(rt,{className:"font-serif",children:['Models on "',k.provider,'"']}),u.jsx(ct,{children:"Read from the upstream's own model list. Binding uses the upstream name as the alias with chat capabilities; refine aliases and capabilities in the Models tab."})]}),u.jsx(at,{children:u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[u.jsx(ge,{children:"Upstream name"}),u.jsx(ge,{children:"Bound alias"}),u.jsx(ge,{className:"w-24"})]})}),u.jsxs(xn,{children:[k.models.length===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:3,className:"text-muted-foreground",children:"The upstream reported no models."})}),k.models.map(_=>u.jsxs(Ue,{children:[u.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:_.upstream_name}),u.jsx(me,{children:_.bound_alias?u.jsx(fn,{variant:"secondary",children:_.bound_alias}):u.jsx("span",{className:"text-muted-foreground",children:"not bound"})}),u.jsx(me,{children:!_.bound_alias&&u.jsx(ze,{variant:"outline",size:"sm",onClick:()=>O(k.provider,_.upstream_name),children:"Bind"})})]},_.upstream_name))]})]})})]})]})}function Yu({id:e,value:r,onChange:a,options:l,loading:s,note:c,placeholder:f,className:d}){const[p,h]=S.useState(!1),[v,x]=S.useState(0),[b,y]=S.useState(!1),k=S.useRef(null),j=S.useRef(null),T=S.useRef(!1),C=S.useMemo(()=>{if(!b)return l.slice(0,50);const O=r.trim().toLowerCase();return l.filter(A=>A.value.toLowerCase().includes(O)).slice(0,50)},[l,r,b]),R=()=>{y(!1);const _=l.slice(0,50).findIndex(A=>A.value===r);x(_>=0?_:0),h(!0)};S.useEffect(()=>{const O=_=>{var A;(A=k.current)!=null&&A.contains(_.target)||h(!1)};return document.addEventListener("pointerdown",O),()=>document.removeEventListener("pointerdown",O)},[]);const D=O=>{a(O.value),y(!1),h(!1)},B=O=>{if(O.key==="ArrowDown"||O.key==="ArrowUp"){if(O.preventDefault(),!p){R();return}const _=O.key==="ArrowDown"?1:-1;x(A=>(A+_+C.length)%Math.max(C.length,1))}else O.key==="Enter"&&p&&C[v]?(O.preventDefault(),D(C[v])):O.key==="Escape"&&h(!1)};return u.jsxs("div",{ref:k,className:_e("relative",d),children:[u.jsx(Jt,{ref:j,id:e,role:"combobox","aria-expanded":p,"aria-autocomplete":"list",autoComplete:"off",className:"pr-14 font-mono text-xs",placeholder:f,value:r,onChange:O=>{a(O.target.value),y(!0),x(0),h(!0)},onFocus:R,onKeyDown:B}),u.jsxs("div",{className:"absolute inset-y-0 right-1 flex items-center",children:[s?u.jsx(Ot,{className:"text-muted-foreground mr-1"}):r!==""&&u.jsx("button",{type:"button","aria-label":"Clear",tabIndex:-1,className:"text-muted-foreground hover:text-foreground rounded p-1",onPointerDown:O=>O.preventDefault(),onClick:()=>{var O;a(""),y(!1),x(0),h(!0),(O=j.current)==null||O.focus()},children:u.jsx(Lm,{className:"size-3.5"})}),u.jsx("button",{type:"button","aria-label":"Show options",tabIndex:-1,className:"text-muted-foreground hover:text-foreground rounded p-1",onPointerDown:O=>{O.preventDefault(),T.current=p},onClick:()=>{var O;(O=j.current)==null||O.focus(),T.current?h(!1):R()},children:u.jsx(Xi,{className:_e("size-4 transition-transform",p&&"rotate-180")})})]}),p&&(C.length>0||c)&&u.jsxs("div",{className:"bg-popover absolute z-20 mt-1 max-h-64 w-full overflow-y-auto rounded-md border p-1 shadow-md",children:[c&&u.jsx("p",{className:"text-muted-foreground px-2 py-1.5 text-xs",children:c}),C.map((O,_)=>u.jsxs("button",{type:"button",role:"option","aria-selected":_===v,className:_e("flex w-full items-center justify-between gap-3 rounded-sm px-2 py-1.5 text-left text-xs",_===v&&"bg-accent text-accent-foreground"),onPointerEnter:()=>x(_),onClick:()=>D(O),children:[u.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[u.jsx(yc,{className:_e("size-3.5 shrink-0",O.value!==r&&"invisible")}),u.jsx("span",{className:"truncate font-mono",children:O.value})]}),O.hint&&u.jsx("span",{className:"text-muted-foreground shrink-0",children:O.hint})]},O.value))]})]})}var Rh="rovingFocusGroup.onEntryFocus",iR={bubbles:!1,cancelable:!0},Uc="RovingFocusGroup",[hm,Ww,oR]=Fm(Uc),[sR,Bc]=vr(Uc,[oR]),[uR,cR]=sR(Uc),eS=S.forwardRef((e,r)=>u.jsx(hm.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(hm.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(fR,{...e,ref:r})})}));eS.displayName=Uc;var fR=S.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,orientation:l,loop:s=!1,dir:c,currentTabStopId:f,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:p,onEntryFocus:h,preventScrollOnEntryFocus:v=!1,...x}=e,b=S.useRef(null),y=dt(r,b),k=Nc(c),[j=null,T]=el({prop:f,defaultProp:d,onChange:p}),[C,R]=S.useState(!1),D=sr(h),B=Ww(a),O=S.useRef(!1),[_,A]=S.useState(0);return S.useEffect(()=>{const I=b.current;if(I)return I.addEventListener(Rh,D),()=>I.removeEventListener(Rh,D)},[D]),u.jsx(uR,{scope:a,orientation:l,dir:k,loop:s,currentTabStopId:j,onItemFocus:S.useCallback(I=>T(I),[T]),onItemShiftTab:S.useCallback(()=>R(!0),[]),onFocusableItemAdd:S.useCallback(()=>A(I=>I+1),[]),onFocusableItemRemove:S.useCallback(()=>A(I=>I-1),[]),children:u.jsx(Ge.div,{tabIndex:C||_===0?-1:0,"data-orientation":l,...x,ref:y,style:{outline:"none",...e.style},onMouseDown:Te(e.onMouseDown,()=>{O.current=!0}),onFocus:Te(e.onFocus,I=>{const ee=!O.current;if(I.target===I.currentTarget&&ee&&!C){const q=new CustomEvent(Rh,iR);if(I.currentTarget.dispatchEvent(q),!q.defaultPrevented){const $=B().filter(U=>U.focusable),X=$.find(U=>U.active),ce=$.find(U=>U.id===j),W=[X,ce,...$].filter(Boolean).map(U=>U.ref.current);rS(W,v)}}O.current=!1}),onBlur:Te(e.onBlur,()=>R(!1))})})}),tS="RovingFocusGroupItem",nS=S.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,focusable:l=!0,active:s=!1,tabStopId:c,...f}=e,d=zr(),p=c||d,h=cR(tS,a),v=h.currentTabStopId===p,x=Ww(a),{onFocusableItemAdd:b,onFocusableItemRemove:y}=h;return S.useEffect(()=>{if(l)return b(),()=>y()},[l,b,y]),u.jsx(hm.ItemSlot,{scope:a,id:p,focusable:l,active:s,children:u.jsx(Ge.span,{tabIndex:v?0:-1,"data-orientation":h.orientation,...f,ref:r,onMouseDown:Te(e.onMouseDown,k=>{l?h.onItemFocus(p):k.preventDefault()}),onFocus:Te(e.onFocus,()=>h.onItemFocus(p)),onKeyDown:Te(e.onKeyDown,k=>{if(k.key==="Tab"&&k.shiftKey){h.onItemShiftTab();return}if(k.target!==k.currentTarget)return;const j=mR(k,h.orientation,h.dir);if(j!==void 0){if(k.metaKey||k.ctrlKey||k.altKey||k.shiftKey)return;k.preventDefault();let C=x().filter(R=>R.focusable).map(R=>R.ref.current);if(j==="last")C.reverse();else if(j==="prev"||j==="next"){j==="prev"&&C.reverse();const R=C.indexOf(k.currentTarget);C=h.loop?pR(C,R+1):C.slice(R+1)}setTimeout(()=>rS(C))}})})})});nS.displayName=tS;var dR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hR(e,r){return r!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mR(e,r,a){const l=hR(e.key,a);if(!(r==="vertical"&&["ArrowLeft","ArrowRight"].includes(l))&&!(r==="horizontal"&&["ArrowUp","ArrowDown"].includes(l)))return dR[l]}function rS(e,r=!1){const a=document.activeElement;for(const l of e)if(l===a||(l.focus({preventScroll:r}),document.activeElement!==a))return}function pR(e,r){return e.map((a,l)=>e[(r+l)%e.length])}var aS=eS,lS=nS,op="Tabs",[gR]=vr(op,[Bc]),iS=Bc(),[xR,sp]=gR(op),oS=S.forwardRef((e,r)=>{const{__scopeTabs:a,value:l,onValueChange:s,defaultValue:c,orientation:f="horizontal",dir:d,activationMode:p="automatic",...h}=e,v=Nc(d),[x,b]=el({prop:l,onChange:s,defaultProp:c});return u.jsx(xR,{scope:a,baseId:zr(),value:x,onValueChange:b,orientation:f,dir:v,activationMode:p,children:u.jsx(Ge.div,{dir:v,"data-orientation":f,...h,ref:r})})});oS.displayName=op;var sS="TabsList",uS=S.forwardRef((e,r)=>{const{__scopeTabs:a,loop:l=!0,...s}=e,c=sp(sS,a),f=iS(a);return u.jsx(aS,{asChild:!0,...f,orientation:c.orientation,dir:c.dir,loop:l,children:u.jsx(Ge.div,{role:"tablist","aria-orientation":c.orientation,...s,ref:r})})});uS.displayName=sS;var cS="TabsTrigger",fS=S.forwardRef((e,r)=>{const{__scopeTabs:a,value:l,disabled:s=!1,...c}=e,f=sp(cS,a),d=iS(a),p=mS(f.baseId,l),h=pS(f.baseId,l),v=l===f.value;return u.jsx(lS,{asChild:!0,...d,focusable:!s,active:v,children:u.jsx(Ge.button,{type:"button",role:"tab","aria-selected":v,"aria-controls":h,"data-state":v?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:p,...c,ref:r,onMouseDown:Te(e.onMouseDown,x=>{!s&&x.button===0&&x.ctrlKey===!1?f.onValueChange(l):x.preventDefault()}),onKeyDown:Te(e.onKeyDown,x=>{[" ","Enter"].includes(x.key)&&f.onValueChange(l)}),onFocus:Te(e.onFocus,()=>{const x=f.activationMode!=="manual";!v&&!s&&x&&f.onValueChange(l)})})})});fS.displayName=cS;var dS="TabsContent",hS=S.forwardRef((e,r)=>{const{__scopeTabs:a,value:l,forceMount:s,children:c,...f}=e,d=sp(dS,a),p=mS(d.baseId,l),h=pS(d.baseId,l),v=l===d.value,x=S.useRef(v);return S.useEffect(()=>{const b=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(b)},[]),u.jsx(Ir,{present:s||v,children:({present:b})=>u.jsx(Ge.div,{"data-state":v?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":p,hidden:!b,id:h,tabIndex:0,...f,ref:r,style:{...e.style,animationDuration:x.current?"0s":void 0},children:b&&c})})});hS.displayName=dS;function mS(e,r){return`${e}-trigger-${r}`}function pS(e,r){return`${e}-content-${r}`}var vR=oS,yR=uS,bR=fS,wR=hS;function mm({className:e,...r}){return u.jsx(vR,{"data-slot":"tabs",className:_e("flex flex-col gap-2",e),...r})}function pm({className:e,...r}){return u.jsx(yR,{"data-slot":"tabs-list",className:_e("bg-[rgb(var(--border))] text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...r})}function lr({className:e,...r}){return u.jsx(bR,{"data-slot":"tabs-trigger",className:_e("data-[state=active]:bg-card dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function Ar({className:e,...r}){return u.jsx(wR,{"data-slot":"tabs-content",className:_e("flex-1 outline-none",e),...r})}const SR=["chat","chat_stream","completions","embeddings","transcription","vision"],Ic=[{unit:"input_tokens",label:"Input $/M",short:"in"},{unit:"output_tokens",label:"Output $/M",short:"out"},{unit:"cached_input_tokens",label:"Cached input $/M",short:"cached"}];function es(e){return e instanceof Error?e.message:String(e)}function jR(e){const r={};for(const{unit:a}of Ic)e[a]!==void 0&&(r[a]=String(e[a]));return r}function jb(e){const r={};for(const{unit:a}of Ic){const l=(e[a]??"").trim();if(l==="")continue;const s=Number(l);if(!isFinite(s)||s<0)return null;r[a]=s}return r}function kb({id:e,value:r,onChange:a,inherited:l}){return u.jsx(u.Fragment,{children:Ic.map(({unit:s,label:c})=>u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:`${e}-${s}`,children:c}),u.jsx(Jt,{id:`${e}-${s}`,type:"number",min:"0",step:"any",placeholder:l?"inherited":"unpriced",value:r[s]??"",onChange:f=>a({...r,[s]:f.target.value})})]},s))})}function kR({model:e}){const r=Ic.filter(({unit:a})=>e.pricing[a]!==void 0).map(({unit:a,short:l})=>`${l} ${e.pricing[a]}`);return r.length===0?u.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):u.jsxs("span",{className:"tabular-nums",children:[r.map((a,l)=>u.jsxs("span",{className:"whitespace-nowrap",children:[l>0&&" ยท ",a]},a)),e.pricing_inherited&&u.jsx(fn,{variant:"muted",className:"ml-2",title:"Priced under the upstream model name",children:"inherited"})]})}function Cb({value:e,onChange:r}){return u.jsx(u.Fragment,{children:SR.map(a=>u.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[u.jsx(lp,{checked:e.includes(a),onCheckedChange:l=>r(l===!0?[...e,a]:e.filter(s=>s!==a))}),a]},a))})}function Eb(e,r){return e.filter(a=>a.target===null&&a.alias!==r).map(a=>({value:a.alias,hint:`${a.provider} ยท ${a.upstream_name}`}))}function Nb({value:e,onChange:r}){return u.jsx(mm,{value:e,onValueChange:a=>r(a),children:u.jsxs(pm,{children:[u.jsx(lr,{value:"provider",children:"Provider model"}),u.jsx(lr,{value:"alias",children:"Alias โ†’ model"})]})})}const Tb=new Map;function Ab(e){const[r,a]=S.useState([]),[l,s]=S.useState(!1),[c,f]=S.useState(null);S.useEffect(()=>{if(e===""){a([]),f(null);return}const h=Tb.get(e);if(h){a(h),f(null);return}let v=!0;return s(!0),f(null),Pe.get(`/admin/v1/providers/${encodeURIComponent(e)}/discover`).then(x=>{v&&(Tb.set(e,x.models),a(x.models))}).catch(x=>v&&f(es(x))).finally(()=>v&&s(!1)),()=>{v=!1}},[e]);const d=r.map(h=>({value:h.upstream_name,hint:h.bound_alias?`bound to ${h.bound_alias}`:void 0})),p=e?c?`Could not list this provider's models (${c}). Type the name.`:l?"Asking the provider what it servesโ€ฆ":r.length===0?"The provider listed no models. Type the name.":void 0:"Select a provider to list its models.";return{options:d,loading:l,note:p}}function CR(){var D,B,O,_;const e=Yt(()=>Pe.get("/admin/v1/models")),r=Yt(()=>Pe.get("/admin/v1/providers")),[a,l]=S.useState({kind:"provider",alias:"",provider:"",upstream_name:"",target:"",capabilities:["chat","chat_stream"],prices:{}}),[s,c]=S.useState(!1),[f,d]=S.useState(null),p=Ab(a.kind==="provider"?a.provider:""),h=Ab((f==null?void 0:f.kind)==="provider"?f.provider:""),v=((D=e.data)==null?void 0:D.models)??[],x=S.useRef("");S.useEffect(()=>{if(!(a.kind!=="provider"||a.provider==="")&&x.current!==a.provider&&!(p.loading||p.options.length===0)&&(x.current=a.provider,a.upstream_name.trim()==="")){const A=p.options.find(I=>!I.hint)??p.options[0];l(I=>({...I,upstream_name:A.value}))}},[a.kind,a.provider,a.upstream_name,p.loading,p.options]);const b=A=>A.kind==="alias"?{target:A.target.trim()}:{provider:A.provider,upstream_name:A.upstream_name.trim(),capabilities:A.capabilities},y=A=>A.kind==="alias"?A.target.trim()===""?"Pick the model this one points at":A.alias.trim()===""?"An alias for another model needs its own name":null:A.upstream_name.trim()===""?"Upstream model name is required":A.capabilities.length===0?"Pick at least one capability":null,k=async A=>{A.preventDefault();const I=y(a);if(I){Ve.error(I);return}const ee=jb(a.prices);if(ee===null){Ve.error("Prices must be non-negative numbers");return}const q=a.alias.trim()||a.upstream_name.trim();c(!0);try{await Pe.post("/admin/v1/models",{alias:q,...b(a),pricing:Object.keys(ee).length>0?ee:void 0}),Ve.success(`Model "${q}" bound`),l({...a,alias:"",upstream_name:"",target:"",prices:{}}),e.reload()}catch($){Ve.error(es($))}finally{c(!1)}},j=async()=>{if(!f)return;if(f.alias.trim()===""){Ve.error("Alias is required");return}const A=y(f);if(A){Ve.error(A);return}const I=jb(f.prices);if(I===null){Ve.error("Prices must be non-negative numbers");return}try{await Pe.patch(`/admin/v1/models/${encodeURIComponent(f.original)}`,{alias:f.alias.trim(),target:f.kind==="alias"?f.target.trim():"",...f.kind==="alias"?{}:b(f),pricing:I}),Ve.success(f.alias.trim()===f.original?`Model "${f.original}" updated`:`Model "${f.original}" renamed to "${f.alias.trim()}"`),d(null),e.reload()}catch(ee){Ve.error(es(ee))}},T=async(A,I)=>{try{await Pe.patch(`/admin/v1/models/${encodeURIComponent(A)}`,{hidden:I}),Ve.success(I?`Model "${A}" hidden`:`Model "${A}" shown`),e.reload()}catch(ee){Ve.error(es(ee))}},C=async A=>{try{await Pe.del(`/admin/v1/models/${encodeURIComponent(A)}`),Ve.success(`Model "${A}" deleted`),e.reload()}catch(I){Ve.error(es(I))}},R=u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:"m-alias",children:a.kind==="alias"?"Name":"Alias"}),u.jsx(Jt,{id:"m-alias",placeholder:a.kind==="alias"?"a new name for it":a.upstream_name.trim()||"same as the upstream name",value:a.alias,onChange:A=>l({...a,alias:A.target.value})})]});return u.jsxs("div",{className:"flex flex-col gap-6",children:[u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Bind a model"}),u.jsxs(ct,{children:["A model name is what callers pass as ",u.jsx("code",{className:"font-mono",children:"model"}),"; names are globally unique and serve as soon as they exist (disable the provider to take its models offline). It either points at a provider's model, or at another model already bound, in which case it inherits that one's provider, capabilities and prices. Prices are per million units: a unit left blank records usage as unpriced rather than free."]})]}),u.jsx(at,{children:u.jsxs("form",{onSubmit:k,className:"flex flex-col gap-4",children:[u.jsx(Nb,{value:a.kind,onChange:A=>l({...a,kind:A})}),u.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[a.kind==="alias"&&R,a.kind==="provider"?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{children:"Provider"}),u.jsxs(ha,{value:a.provider,onValueChange:A=>l({...a,provider:A}),required:!0,children:[u.jsx(pa,{className:"w-full",children:u.jsx(ma,{placeholder:"Select a provider"})}),u.jsx(ga,{children:(B=r.data)==null?void 0:B.providers.map(A=>u.jsx(Br,{value:A.name,children:A.name},A.name))})]})]}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:"m-upstream",children:"Upstream model name"}),u.jsx(Yu,{id:"m-upstream",value:a.upstream_name,onChange:A=>l({...a,upstream_name:A}),...p})]})]}):u.jsxs("div",{className:"flex flex-col gap-2 sm:col-span-2",children:[u.jsx(Zt,{htmlFor:"m-target",children:"Model it points at"}),u.jsx(Yu,{id:"m-target",value:a.target,onChange:A=>l({...a,target:A}),options:Eb(v),note:v.some(A=>A.target===null)?void 0:"Bind a provider model first; an alias points at one of those."})]}),a.kind==="provider"&&R]}),u.jsx("div",{className:"grid gap-4 sm:grid-cols-3",children:u.jsx(kb,{id:"new",value:a.prices,onChange:A=>l({...a,prices:A}),inherited:a.kind==="alias"})}),u.jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-2",children:[a.kind==="provider"?u.jsx(Cb,{value:a.capabilities,onChange:A=>l({...a,capabilities:A})}):u.jsx("span",{className:"text-sm text-muted-foreground",children:"Capabilities are inherited from the model it points at."}),u.jsxs(ze,{type:"submit",disabled:s||(a.kind==="provider"?a.provider===""||a.upstream_name.trim()==="":a.target.trim()===""||a.alias.trim()===""),children:[s&&u.jsx(Ot,{}),"Bind model"]})]})]})})]}),u.jsxs(tt,{children:[u.jsx(nt,{children:u.jsx(rt,{className:"font-serif",children:"Models"})}),u.jsx(at,{children:e.loading&&!e.data?u.jsx(Ot,{}):e.error?u.jsx("p",{className:"text-sm text-destructive",children:e.error}):u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[u.jsx(ge,{children:"Alias"}),u.jsx(ge,{children:"Provider"}),u.jsx(ge,{children:"Upstream name"}),u.jsx(ge,{children:"Capabilities"}),u.jsx(ge,{children:"Pricing ($/M)"}),u.jsx(ge,{className:"w-32"})]})}),u.jsxs(xn,{children:[((O=e.data)==null?void 0:O.models.length)===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:6,className:"text-muted-foreground",children:"No model bindings yet. Register a provider first, then bind models here or from provider discovery."})}),(_=e.data)==null?void 0:_.models.map(A=>{var I;return(f==null?void 0:f.original)===A.alias?u.jsx(Ue,{children:u.jsx(me,{colSpan:6,children:u.jsxs("div",{className:"flex flex-col gap-4 py-2",children:[u.jsx(Nb,{value:f.kind,onChange:ee=>d({...f,kind:ee})}),u.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[f.kind==="provider"?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{children:"Provider"}),u.jsxs(ha,{value:f.provider,onValueChange:ee=>d({...f,provider:ee}),children:[u.jsx(pa,{className:"w-full",children:u.jsx(ma,{})}),u.jsx(ga,{children:(I=r.data)==null?void 0:I.providers.map(ee=>u.jsx(Br,{value:ee.name,children:ee.name},ee.name))})]})]}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:"edit-upstream",children:"Upstream model name"}),u.jsx(Yu,{id:"edit-upstream",value:f.upstream_name,onChange:ee=>d({...f,upstream_name:ee}),...h})]})]}):u.jsxs("div",{className:"flex flex-col gap-2 sm:col-span-2",children:[u.jsx(Zt,{htmlFor:"edit-target",children:"Model it points at"}),u.jsx(Yu,{id:"edit-target",value:f.target,onChange:ee=>d({...f,target:ee}),options:Eb(v,f.original)})]}),u.jsxs("div",{className:"flex flex-col gap-2",children:[u.jsx(Zt,{htmlFor:"edit-alias",children:"Name"}),u.jsx(Jt,{id:"edit-alias",value:f.alias,onChange:ee=>d({...f,alias:ee.target.value})})]})]}),u.jsx("div",{className:"grid gap-4 sm:grid-cols-3",children:u.jsx(kb,{id:"edit",value:f.prices,onChange:ee=>d({...f,prices:ee}),inherited:f.kind==="alias"})}),u.jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-2",children:[f.kind==="provider"?u.jsx(Cb,{value:f.capabilities,onChange:ee=>d({...f,capabilities:ee})}):u.jsx("span",{className:"text-sm text-muted-foreground",children:"Capabilities are inherited from the model it points at."}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(ze,{size:"sm",onClick:j,children:"Save"}),u.jsx(ze,{variant:"ghost",size:"sm",onClick:()=>d(null),children:"Cancel"})]})]})]})})},A.alias):u.jsxs(Ue,{children:[u.jsx(me,{className:"font-medium wrap-anywhere",children:u.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[A.alias,A.hidden&&u.jsx(fn,{variant:"muted",children:"hidden"})]})}),u.jsx(me,{className:"wrap-anywhere",children:A.provider}),u.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:A.target?u.jsxs("span",{className:"flex flex-col",children:[u.jsxs("span",{children:["โ†’ ",A.target]}),u.jsx("span",{className:"text-muted-foreground",children:A.upstream_name})]}):A.upstream_name}),u.jsx(me,{children:u.jsx("div",{className:"flex flex-wrap gap-1",children:A.capabilities.map(ee=>u.jsx(fn,{variant:"muted",children:ee},ee))})}),u.jsx(me,{className:"text-sm",children:u.jsx(kR,{model:A})}),u.jsxs(me,{className:"whitespace-nowrap",children:[u.jsx(ze,{variant:"ghost",size:"icon-sm","aria-label":A.hidden?`Show ${A.alias}`:`Hide ${A.alias}`,title:"Hidden from the model list. It still answers calls.",onClick:()=>T(A.alias,!A.hidden),children:A.hidden?u.jsx(qE,{}):u.jsx(PE,{})}),u.jsx(ze,{variant:"ghost",size:"icon-sm","aria-label":`Edit ${A.alias}`,onClick:()=>d({original:A.alias,kind:A.target?"alias":"provider",alias:A.alias,provider:A.provider,upstream_name:A.upstream_name,target:A.target??"",capabilities:[...A.capabilities],prices:A.pricing_inherited?{}:jR(A.pricing)}),children:u.jsx(J0,{})}),u.jsxs(tl,{children:[u.jsx(nl,{asChild:!0,children:u.jsx(ze,{variant:"ghost",size:"icon-sm","aria-label":`Delete ${A.alias}`,children:u.jsx(zm,{})})}),u.jsxs(rl,{children:[u.jsxs(al,{children:[u.jsxs(il,{children:['Delete model "',A.alias,'"?']}),u.jsx(ol,{children:"Callers using this name get model_not_found immediately. Usage history is kept, and a model other names point at cannot be deleted until they are."})]}),u.jsxs(ll,{children:[u.jsx(ul,{children:"Cancel"}),u.jsx(sl,{onClick:()=>C(A.alias),children:"Delete"})]})]})]})]})]},A.alias)})]})]})})]})]})}const Dh=[{key:"24h",label:"Last 24 hours",hours:24},{key:"7d",label:"Last 7 days",hours:168},{key:"30d",label:"Last 30 days",hours:720},{key:"all",label:"All time",hours:0},{key:"custom",label:"Custom range",hours:0}],ER=[25,50,100,200],NR=[{value:"failed",label:"Errors only"},{value:"upstream_error",label:"Provider errors"},{value:"unreachable",label:"Unreachable"},{value:"cancelled",label:"Cancelled"},{value:"ok",label:"OK only"}];function TR(e){return e?`${e}T00:00:00Z`:null}function AR(e){if(!e)return null;const r=new Date(`${e}T00:00:00Z`);return r.setUTCDate(r.getUTCDate()+1),r.toISOString()}function _R(e){const r=new Date(e);return isNaN(r.getTime())?e:r.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function MR({row:e}){return e.cancelled?u.jsx(fn,{variant:"warning",children:"cancelled"}):e.outcome==="ok"?u.jsx(fn,{variant:"success",children:"ok"}):u.jsxs(fn,{variant:"destructive",children:[e.error_kind||e.outcome,e.status_code?` ยท ${e.status_code}`:""]})}function RR({row:e}){return u.jsxs("span",{className:"flex items-baseline",children:[u.jsx("span",{className:"max-w-36 truncate",title:e.principal,children:e.principal}),e.key_suffix&&u.jsxs("span",{className:"ml-1.5 shrink-0 font-mono text-xs text-muted-foreground",title:e.key_label||void 0,children:["ยทยทยท",e.key_suffix]})]})}function DR({row:e}){const r=oa(e.tags,"app");return r?u.jsx(fn,{variant:"tag",size:"sm",className:"max-w-full font-mono",title:r,children:u.jsx("span",{className:"min-w-0 truncate",children:r})}):e.client?u.jsx("span",{className:"font-mono text-xs text-muted-foreground",title:e.client,children:ns(e.client)}):u.jsx("span",{className:"text-muted-foreground",children:"โ€”"})}function OR({row:e}){const r=e.units.input_tokens,a=e.units.output_tokens;return!r&&!a?u.jsx("span",{className:"text-muted-foreground",children:"โ€”"}):u.jsxs("span",{className:"whitespace-nowrap tabular-nums",children:[Re(r??0),u.jsx("span",{className:"text-muted-foreground",children:" โ†’ "}),Re(a??0)]})}function _r({label:e,children:r}){return u.jsxs("div",{className:"flex flex-col gap-0.5",children:[u.jsx("span",{className:"text-xs text-muted-foreground",children:e}),u.jsx("span",{className:"text-sm",children:r})]})}function zR({row:e}){const r=Object.entries(e.units).sort();return u.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-3 py-2 md:grid-cols-4",children:[u.jsx(_r,{label:"Provider",children:u.jsx("span",{className:"font-mono text-xs",children:e.provider||"โ€”"})}),u.jsx(_r,{label:"Endpoint",children:e.endpoint}),u.jsx(_r,{label:"Key",children:e.key_suffix?u.jsxs("span",{className:"font-mono text-xs",children:[e.key_label?`${e.key_label} `:"","ยทยทยท",e.key_suffix]}):"โ€”"}),u.jsx(_r,{label:"Recorded (UTC)",children:u.jsx("span",{className:"font-mono text-xs",children:e.ts.replace("T"," ").slice(0,19)})}),u.jsx(_r,{label:"Client",children:u.jsx("span",{className:"break-all font-mono text-xs",children:e.client||"โ€”"})}),u.jsx(_r,{label:"Tags",children:e.tags?u.jsx("span",{className:"flex flex-wrap gap-1",children:O2(e.tags).map(a=>u.jsx(fn,{variant:"tag",size:"sm",className:"font-mono",children:a},a))}):"โ€”"}),u.jsxs(_r,{label:"Outcome",children:[e.outcome,e.error_kind?` ยท ${e.error_kind}`:"",e.status_code?` ยท http ${e.status_code}`:"",e.streamed?" ยท streamed":""]}),u.jsx(_r,{label:"Cost",children:e.cost!==null?u.jsx("span",{className:"tabular-nums",children:_m(e.cost)}):e.unpriced?u.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):"โ€”"}),r.map(([a,l])=>u.jsx(_r,{label:a.replaceAll("_"," "),children:u.jsx("span",{className:"tabular-nums",children:qt(l)||"0"})},a)),u.jsx(_r,{label:"Duration",children:u.jsxs("span",{className:"tabular-nums",children:[zn(e.duration_ms)," ms"]})})]})}function LR(){var Ie,Be,_t,Ct,Et,Lt,Mt,Rt,zt;const e=S.useMemo(()=>new URLSearchParams(window.location.search),[]),[r,a]=S.useState("7d"),[l,s]=S.useState(""),[c,f]=S.useState(""),[d,p]=S.useState(e.get("principal")??""),[h,v]=S.useState(""),[x,b]=S.useState(""),[y,k]=S.useState(e.get("model")??""),[j,T]=S.useState(e.get("provider")??""),[C,R]=S.useState(e.get("app")??""),[D,B]=S.useState(e.get("outcome")??""),[O,_]=S.useState(50),[A,I]=S.useState(0),[ee,q]=S.useState(null),[$,X]=S.useState(0),ce=()=>X(we=>we+1),le=r==="custom",W=Dh.find(we=>we.key===r)??Dh[1],{since:U,until:Z}=S.useMemo(()=>le?{since:TR(l),until:AR(c)}:W.hours?{since:new Date(Date.now()-W.hours*36e5).toISOString(),until:null}:{since:null,until:null},[r,le,l,c,$]),ie=(U?`&since=${encodeURIComponent(U)}`:"")+(Z?`&until=${encodeURIComponent(Z)}`:""),K=(d?`&principal=${encodeURIComponent(d)}`:"")+(h?`&key=${encodeURIComponent(h)}`:"")+(x?`&client=${encodeURIComponent(x)}`:"")+(y?`&model=${encodeURIComponent(y)}`:"")+(j?`&provider=${encodeURIComponent(j)}`:"")+(C?`&tag=${encodeURIComponent(`app:${C}`)}`:"")+(D?`&outcome=${encodeURIComponent(D)}`:""),E=Yt(()=>Pe.get(`/stats/requests?limit=${O}&offset=${A*O}`+ie+K),[$,U,Z,d,h,x,y,j,C,D,O,A]),L=Yt(()=>Pe.get("/stats/requests/facets"+(ie?"?"+ie.slice(1):"")),[$,U,Z]),F=A===0&&!le;S.useEffect(()=>{if(!F)return;const we=setInterval(ce,3e4);return()=>clearInterval(we)},[F]);function M(we){return mt=>{we(mt),I(0),q(null)}}const oe=(((Ie=L.data)==null?void 0:Ie.keys)??[]).map(we=>({value:we.id,label:`${we.principal} ยท ${we.label||`โ€ฆ${we.key_suffix}`}`})),G=[...new Set((((Be=L.data)==null?void 0:Be.clients)??[]).map(we=>ns(we)))].sort(),ue=[...new Set((((_t=L.data)==null?void 0:_t.tags)??[]).filter(we=>we.startsWith("app:")).map(we=>we.slice(4)))].sort(),re=d||h||x||y||j||C||D;function ye(){p(""),v(""),b(""),k(""),T(""),R(""),B(""),I(0),q(null)}const fe=((Ct=E.data)==null?void 0:Ct.total)??0,be=((Et=E.data)==null?void 0:Et.requests.length)??0,Ee=fe===0?0:A*O+1,Se=Math.max(1,Math.ceil(fe/O));return u.jsxs(tt,{children:[u.jsxs(nt,{className:"flex flex-row items-start justify-between",children:[u.jsxs("div",{className:"flex flex-col gap-1.5",children:[u.jsx(rt,{className:"font-serif",children:"Request explorer"}),u.jsx(ct,{children:"Metadata only; content is never stored. Click a row for details."})]}),u.jsx(ze,{variant:"outline",size:"icon-sm","aria-label":"Refresh",onClick:ce,children:u.jsx(Ki,{})})]}),u.jsxs(at,{className:"space-y-4",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsxs(ha,{value:r,onValueChange:M(a),children:[u.jsx(pa,{className:"w-44","aria-label":"Range",children:u.jsx(ma,{})}),u.jsx(ga,{children:Dh.map(we=>u.jsx(Br,{value:we.key,children:we.label},we.key))})]}),le&&u.jsxs(u.Fragment,{children:[u.jsx(Jt,{type:"date",className:"w-40","aria-label":"From (UTC)",value:l,onChange:we=>M(s)(we.target.value)}),u.jsx(Jt,{type:"date",className:"w-40","aria-label":"To (UTC)",value:c,onChange:we=>M(f)(we.target.value)})]}),u.jsx(Wt,{label:"User",value:d,onChange:M(p),options:((Lt=L.data)==null?void 0:Lt.principals)??[],allLabel:"All users"}),u.jsx(Wt,{label:"Key",value:h,onChange:M(v),options:oe,allLabel:"All keys"}),u.jsx(Wt,{label:"Client",value:x,onChange:M(b),options:G,allLabel:"All clients"}),u.jsx(Wt,{label:"App",value:C,onChange:M(R),options:ue,allLabel:"All apps"}),u.jsx(Wt,{label:"Model",value:y,onChange:M(k),options:((Mt=L.data)==null?void 0:Mt.models)??[],allLabel:"All models"}),u.jsx(Wt,{label:"Provider",value:j,onChange:M(T),options:((Rt=L.data)==null?void 0:Rt.providers)??[],allLabel:"All providers"}),u.jsx(Wt,{label:"Outcome",value:D,onChange:M(B),options:NR,allLabel:"All outcomes"}),re&&u.jsxs(ze,{variant:"ghost",size:"sm",onClick:ye,children:[u.jsx(bc,{})," Clear filters"]})]}),E.loading&&!E.data?u.jsx(Ot,{}):E.error?u.jsx("p",{className:"text-sm text-destructive",children:E.error}):u.jsxs(u.Fragment,{children:[u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[u.jsx(ge,{className:"w-6"}),u.jsx(ge,{children:"Time"}),u.jsx(ge,{children:"User"}),u.jsx(ge,{children:"App"}),u.jsx(ge,{children:"Model"}),u.jsx(ge,{children:"Status"}),u.jsx(ge,{className:"text-right",children:"Tokens"}),u.jsx(ge,{className:"text-right",children:"Cost"}),u.jsx(ge,{className:"text-right",children:"Duration"})]})}),u.jsxs(xn,{children:[be===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:9,className:"text-muted-foreground",children:re||U?"No requests match these filters.":"No requests recorded yet."})}),(zt=E.data)==null?void 0:zt.requests.map(we=>u.jsxs(S.Fragment,{children:[u.jsxs(Ue,{className:"cursor-pointer",onClick:()=>q(ee===we.id?null:we.id),children:[u.jsx(me,{className:"pr-0",children:u.jsx("button",{type:"button","aria-label":ee===we.id?"Hide details":"Show details","aria-expanded":ee===we.id,className:"flex cursor-pointer items-center rounded-sm text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring",children:ee===we.id?u.jsx(Xi,{className:"size-3.5"}):u.jsx(tm,{className:"size-3.5"})})}),u.jsx(me,{className:"whitespace-nowrap text-xs",title:E0(we.ts),children:_R(we.ts)}),u.jsx(me,{children:u.jsx(RR,{row:we})}),u.jsx(me,{className:"max-w-44",children:u.jsx(DR,{row:we})}),u.jsx(me,{className:"max-w-44 truncate font-mono text-xs",title:we.model||void 0,children:we.model||u.jsx("span",{className:"text-muted-foreground",children:"โ€”"})}),u.jsx(me,{children:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(MR,{row:we}),we.streamed&&u.jsx("span",{title:"streamed",children:u.jsx(ZE,{className:"size-3 text-muted-foreground","aria-label":"streamed"})})]})}),u.jsx(me,{className:"text-right",title:we.units.input_tokens||we.units.output_tokens?`${qt(we.units.input_tokens)||0} in ยท ${qt(we.units.output_tokens)||0} out`+(we.units.cached_input_tokens?` ยท ${qt(we.units.cached_input_tokens)} cached`:""):void 0,children:u.jsx(OR,{row:we})}),u.jsx(me,{className:"text-right tabular-nums",children:we.cost!==null?_m(we.cost):we.unpriced?u.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):u.jsx("span",{className:"text-muted-foreground",children:"โ€”"})}),u.jsx(me,{className:"text-right tabular-nums",children:Jh(we.duration_ms)})]}),ee===we.id&&u.jsxs(Ue,{className:"bg-muted/30 hover:bg-muted/30",children:[u.jsx(me,{}),u.jsx(me,{colSpan:8,children:u.jsx(zR,{row:we})})]})]},we.id))]})]}),u.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[u.jsx("p",{className:"text-sm text-muted-foreground",children:fe===0?"No requests":`Showing ${zn(Ee)}โ€“${zn(Ee+be-1)} of ${zn(fe)}`}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs(ha,{value:String(O),onValueChange:we=>M(_)(Number(we)),children:[u.jsx(pa,{className:"w-32","aria-label":"Page size",children:u.jsx(ma,{})}),u.jsx(ga,{children:ER.map(we=>u.jsxs(Br,{value:String(we),children:[we," per page"]},we))})]}),u.jsxs("span",{className:"text-sm text-muted-foreground",children:["Page ",A+1," of ",zn(Se)]}),u.jsx(ze,{variant:"outline",size:"icon-sm","aria-label":"Previous page",disabled:A===0,onClick:()=>{I(A-1),q(null)},children:u.jsx(BE,{})}),u.jsx(ze,{variant:"outline",size:"icon-sm","aria-label":"Next page",disabled:A+1>=Se,onClick:()=>{I(A+1),q(null)},children:u.jsx(tm,{})})]})]})]})]})]})}function UR(e){return e instanceof Error?e.message:String(e)}function BR(){const{data:e,loading:r,error:a}=Yt(()=>Pe.get("/admin/v1/principals?limit=500")),l=(e==null?void 0:e.principals.filter(s=>s.kind==="user"))??[];return u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Users"}),u.jsx(ct,{children:"People appear after their first sign-in."})]}),u.jsx(at,{children:r&&!e?u.jsx(Ot,{}):a?u.jsx("p",{className:"text-sm text-destructive",children:a}):u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[u.jsx(ge,{children:"Name"}),u.jsx(ge,{children:"Role"}),u.jsx(ge,{className:"w-24"})]})}),u.jsxs(xn,{children:[l.length===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:3,className:"text-muted-foreground",children:"No users yet."})}),l.map(s=>u.jsxs(Ue,{children:[u.jsx(me,{className:"wrap-anywhere",children:s.name}),u.jsx(me,{children:s.role==="admin"?u.jsx(fn,{variant:"secondary",children:"admin"}):"member"}),u.jsx(me,{className:"text-right whitespace-nowrap",children:u.jsx(IR,{principal:s})})]},s.id))]})]})})]})}function IR({principal:e}){const r=async()=>{try{await Pe.post(`/admin/v1/principals/${e.id}/revoke-sessions`),Ve.success(`Signed out ${e.name}`)}catch(a){Ve.error(UR(a))}};return u.jsxs(tl,{children:[u.jsx(nl,{asChild:!0,children:u.jsx(ze,{variant:"ghost",size:"sm",children:"Sign out"})}),u.jsxs(rl,{children:[u.jsxs(al,{children:[u.jsxs(il,{children:["Sign out ",e.name," everywhere?"]}),u.jsx(ol,{children:"Their sessions end now. API keys keep working."})]}),u.jsxs(ll,{children:[u.jsx(ul,{children:"Cancel"}),u.jsx(sl,{onClick:r,children:"Sign out"})]})]})]})}function Oh(e){return e instanceof Error?e.message:String(e)}function HR(){const{data:e,loading:r,error:a,reload:l}=Yt(async()=>{const[{principals:k},{keys:j}]=await Promise.all([Pe.get("/admin/v1/principals?limit=500"),Pe.get("/admin/v1/keys?limit=500")]),T=new Set(k.filter(C=>C.kind==="service").map(C=>C.name));return{users:new Set(k.filter(C=>C.kind==="user").map(C=>C.name)),services:T,keys:j.filter(C=>C.principal&&T.has(C.principal))}}),[s,c]=S.useState(""),[f,d]=S.useState(!1),[p,h]=S.useState(null),v=async k=>{const j=await Pe.post("/admin/v1/keys",{principal:k,label:""});h(j),l()},x=async k=>{if(k.preventDefault(),e!=null&&e.users.has(s)){Ve.error(`"${s}" is a user, not a service`);return}d(!0);try{if(!(e!=null&&e.services.has(s)))try{await Pe.post("/admin/v1/principals",{name:s,kind:"service",role:"member"})}catch(j){if(!(j instanceof xc&&j.code==="principal_exists"))throw j}await v(s),c("")}catch(j){Ve.error(Oh(j))}finally{d(!1)}},b=async k=>{try{await v(k.principal??""),await Pe.del(`/admin/v1/keys/${k.id}`),l()}catch(j){Ve.error(Oh(j))}},y=async k=>{try{await Pe.del(`/admin/v1/keys/${k}`),Ve.success("Key deleted"),l()}catch(j){Ve.error(Oh(j))}};return u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Services"}),u.jsx(ct,{children:"API keys for machines and shared tools rather than people."})]}),u.jsxs(at,{className:"flex flex-col gap-4",children:[u.jsxs("form",{onSubmit:x,className:"flex flex-wrap items-center gap-2",children:[u.jsx(Jt,{className:"w-64",placeholder:"Name (e.g. batch-service)",maxLength:120,pattern:"[a-z0-9][a-z0-9._\\-]*",title:"lowercase letters, digits, dots, dashes, underscores",required:!0,value:s,onChange:k=>c(k.target.value)}),u.jsxs(ze,{type:"submit",disabled:f,children:[f&&u.jsx(Ot,{}),"Create service"]})]}),p&&u.jsxs("div",{className:"rounded-md border border-primary/40 bg-primary/5 p-4",children:[u.jsxs("p",{className:"mb-2 text-sm font-medium",children:["Key for ",p.principal," โ€” copy it now, it will not be shown again."]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("code",{className:"flex-1 overflow-x-auto rounded bg-background px-2 py-1.5 font-mono text-sm",children:p.key}),u.jsx(ze,{variant:"outline",size:"icon-sm","aria-label":"Copy key",onClick:()=>{navigator.clipboard.writeText(p.key??""),Ve.success("Copied to clipboard")},children:u.jsx(Om,{})})]})]}),r&&!e?u.jsx(Ot,{}):a?u.jsx("p",{className:"text-sm text-destructive",children:a}):u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[u.jsx(ge,{children:"Service"}),u.jsx(ge,{children:"Key"}),u.jsx(ge,{children:"Created"}),u.jsx(ge,{children:"Last used"}),u.jsx(ge,{className:"w-40"})]})}),u.jsxs(xn,{children:[(e==null?void 0:e.keys.length)===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:5,className:"text-muted-foreground",children:"No services yet."})}),e==null?void 0:e.keys.map(k=>u.jsxs(Ue,{children:[u.jsx(me,{className:"wrap-anywhere",children:k.principal}),u.jsxs(me,{className:"font-mono text-xs",children:["***",k.key_suffix]}),u.jsx(me,{className:"whitespace-nowrap",children:Wa(k.created_at)}),u.jsx(me,{className:"whitespace-nowrap",children:Wa(k.last_used_at)||"never"}),u.jsxs(me,{className:"text-right whitespace-nowrap",children:[u.jsxs(tl,{children:[u.jsx(nl,{asChild:!0,children:u.jsx(ze,{variant:"ghost",size:"sm",children:"Rotate"})}),u.jsxs(rl,{children:[u.jsxs(al,{children:[u.jsxs(il,{children:["Rotate the key of ",k.principal,"?"]}),u.jsx(ol,{children:"The old key stops working immediately."})]}),u.jsxs(ll,{children:[u.jsx(ul,{children:"Cancel"}),u.jsx(sl,{onClick:()=>b(k),children:"Rotate"})]})]})]}),u.jsxs(tl,{children:[u.jsx(nl,{asChild:!0,children:u.jsx(ze,{variant:"ghost",size:"sm",children:"Delete"})}),u.jsxs(rl,{children:[u.jsxs(al,{children:[u.jsxs(il,{children:["Delete ",k.principal,"?"]}),u.jsx(ol,{children:"Its key stops working immediately."})]}),u.jsxs(ll,{children:[u.jsx(ul,{children:"Cancel"}),u.jsx(sl,{onClick:()=>y(k.id),children:"Delete"})]})]})]})]})]},k.id))]})]})]})]})}function qR(){const{data:e,loading:r,error:a,reload:l}=Yt(()=>Pe.get("/admin/v1/keys?limit=500")),[s,c]=S.useState(""),f=s.trim().toLowerCase(),d=((e==null?void 0:e.keys)??[]).filter(h=>`${h.principal} ${h.label} ${h.key_suffix}`.toLowerCase().includes(f)),p=async h=>{try{await Pe.del(`/admin/v1/keys/${h}`),Ve.success("Key deleted"),l()}catch(v){Ve.error(v instanceof Error?v.message:String(v))}};return u.jsxs(tt,{children:[u.jsx(nt,{children:u.jsx(rt,{className:"font-serif",children:"All keys"})}),u.jsxs(at,{className:"flex flex-col gap-4",children:[u.jsx(Jt,{className:"w-64",placeholder:"Filter by owner, label or suffix",value:s,onChange:h=>c(h.target.value)}),r&&!e?u.jsx(Ot,{}):a?u.jsx("p",{className:"text-sm text-destructive",children:a}):u.jsxs(pn,{children:[u.jsx(gn,{children:u.jsxs(Ue,{children:[u.jsx(ge,{children:"Owner"}),u.jsx(ge,{children:"Label"}),u.jsx(ge,{children:"Key"}),u.jsx(ge,{children:"Created"}),u.jsx(ge,{children:"Last used"}),u.jsx(ge,{className:"w-24"})]})}),u.jsxs(xn,{children:[d.length===0&&u.jsx(Ue,{children:u.jsx(me,{colSpan:6,className:"text-muted-foreground",children:e!=null&&e.keys.length?"No match.":"No keys yet."})}),d.map(h=>u.jsxs(Ue,{children:[u.jsx(me,{className:"wrap-anywhere",children:h.principal}),u.jsx(me,{className:"wrap-anywhere",children:h.label||u.jsx("span",{className:"text-muted-foreground",children:"(no label)"})}),u.jsxs(me,{className:"font-mono text-xs",children:["***",h.key_suffix]}),u.jsx(me,{className:"whitespace-nowrap",children:Wa(h.created_at)}),u.jsx(me,{className:"whitespace-nowrap",children:Wa(h.last_used_at)||"never"}),u.jsx(me,{className:"whitespace-nowrap",children:u.jsxs(tl,{children:[u.jsx(nl,{asChild:!0,children:u.jsx(ze,{variant:"ghost",size:"sm",children:"Delete"})}),u.jsxs(rl,{children:[u.jsxs(al,{children:[u.jsxs(il,{children:["Delete this key of ",h.principal,"?"]}),u.jsx(ol,{children:"It stops working immediately."})]}),u.jsxs(ll,{children:[u.jsx(ul,{children:"Cancel"}),u.jsx(sl,{onClick:()=>p(h.id),children:"Delete"})]})]})]})})]},h.id))]})]})]})]})}function PR(e,r){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const $R=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,FR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,VR={};function _b(e,r){return(VR.jsx?FR:$R).test(e)}const GR=/[ \t\n\f\r]/g;function YR(e){return typeof e=="object"?e.type==="text"?Mb(e.value):!1:Mb(e)}function Mb(e){return e.replace(GR,"")===""}class gs{constructor(r,a,l){this.normal=a,this.property=r,l&&(this.space=l)}}gs.prototype.normal={};gs.prototype.property={};gs.prototype.space=void 0;function gS(e,r){const a={},l={};for(const s of e)Object.assign(a,s.property),Object.assign(l,s.normal);return new gs(a,l,r)}function gm(e){return e.toLowerCase()}class Un{constructor(r,a){this.attribute=a,this.property=r}}Un.prototype.attribute="";Un.prototype.booleanish=!1;Un.prototype.boolean=!1;Un.prototype.commaOrSpaceSeparated=!1;Un.prototype.commaSeparated=!1;Un.prototype.defined=!1;Un.prototype.mustUseProperty=!1;Un.prototype.number=!1;Un.prototype.overloadedBoolean=!1;Un.prototype.property="";Un.prototype.spaceSeparated=!1;Un.prototype.space=void 0;let XR=0;const $e=Xl(),Gt=Xl(),xm=Xl(),xe=Xl(),jt=Xl(),ql=Xl(),Gn=Xl();function Xl(){return 2**++XR}const vm=Object.freeze(Object.defineProperty({__proto__:null,boolean:$e,booleanish:Gt,commaOrSpaceSeparated:Gn,commaSeparated:ql,number:xe,overloadedBoolean:xm,spaceSeparated:jt},Symbol.toStringTag,{value:"Module"})),zh=Object.keys(vm);class up extends Un{constructor(r,a,l,s){let c=-1;if(super(r,a),Rb(this,"space",s),typeof l=="number")for(;++c4&&a.slice(0,4)==="data"&&WR.test(r)){if(r.charAt(4)==="-"){const c=r.slice(5).replace(Db,nD);l="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=r.slice(4);if(!Db.test(c)){let f=c.replace(JR,tD);f.charAt(0)!=="-"&&(f="-"+f),r="data"+f}}s=up}return new s(l,r)}function tD(e){return"-"+e.toLowerCase()}function nD(e){return e.charAt(1).toUpperCase()}const rD=gS([xS,KR,bS,wS,SS],"html"),cp=gS([xS,QR,bS,wS,SS],"svg");function aD(e){return e.join(" ").trim()}var qi={},Lh,Ob;function lD(){if(Ob)return Lh;Ob=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,a=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,d=/^\s+|\s+$/g,p=` -`,h="/",v="*",x="",b="comment",y="declaration";function k(T,C){if(typeof T!="string")throw new TypeError("First argument must be a string");if(!T)return[];C=C||{};var R=1,D=1;function B(le){var W=le.match(r);W&&(R+=W.length);var U=le.lastIndexOf(p);D=~U?le.length-U:D+le.length}function O(){var le={line:R,column:D};return function(W){return W.position=new _(le),ee(),W}}function _(le){this.start=le,this.end={line:R,column:D},this.source=C.source}_.prototype.content=T;function A(le){var W=new Error(C.source+":"+R+":"+D+": "+le);if(W.reason=le,W.filename=C.source,W.line=R,W.column=D,W.source=T,!C.silent)throw W}function I(le){var W=le.exec(T);if(W){var U=W[0];return B(U),T=T.slice(U.length),W}}function ee(){I(a)}function q(le){var W;for(le=le||[];W=$();)W!==!1&&le.push(W);return le}function $(){var le=O();if(!(h!=T.charAt(0)||v!=T.charAt(1))){for(var W=2;x!=T.charAt(W)&&(v!=T.charAt(W)||h!=T.charAt(W+1));)++W;if(W+=2,x===T.charAt(W-1))return A("End of comment missing");var U=T.slice(2,W-2);return D+=2,B(U),T=T.slice(W),D+=2,le({type:b,comment:U})}}function X(){var le=O(),W=I(l);if(W){if($(),!I(s))return A("property missing ':'");var U=I(c),Z=le({type:y,property:j(W[0].replace(e,x)),value:U?j(U[0].replace(e,x)):x});return I(f),Z}}function ce(){var le=[];q(le);for(var W;W=X();)W!==!1&&(le.push(W),q(le));return le}return ee(),ce()}function j(T){return T?T.replace(d,x):x}return Lh=k,Lh}var zb;function iD(){if(zb)return qi;zb=1;var e=qi&&qi.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(qi,"__esModule",{value:!0}),qi.default=a;const r=e(lD());function a(l,s){let c=null;if(!l||typeof l!="string")return c;const f=(0,r.default)(l),d=typeof s=="function";return f.forEach(p=>{if(p.type!=="declaration")return;const{property:h,value:v}=p;d?s(h,v,p):v&&(c=c||{},c[h]=v)}),c}return qi}var Ko={},Lb;function oD(){if(Lb)return Ko;Lb=1,Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,a=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,c=function(h){return!h||a.test(h)||e.test(h)},f=function(h,v){return v.toUpperCase()},d=function(h,v){return"".concat(v,"-")},p=function(h,v){return v===void 0&&(v={}),c(h)?h:(h=h.toLowerCase(),v.reactCompat?h=h.replace(s,d):h=h.replace(l,d),h.replace(r,f))};return Ko.camelCase=p,Ko}var Qo,Ub;function sD(){if(Ub)return Qo;Ub=1;var e=Qo&&Qo.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},r=e(iD()),a=oD();function l(s,c){var f={};return!s||typeof s!="string"||(0,r.default)(s,function(d,p){d&&p&&(f[(0,a.camelCase)(d,c)]=p)}),f}return l.default=l,Qo=l,Qo}var uD=sD();const cD=gc(uD),jS=kS("end"),fp=kS("start");function kS(e){return r;function r(a){const l=a&&a.position&&a.position[e]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function fD(e){const r=fp(e),a=jS(e);if(r&&a)return{start:r,end:a}}function as(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Bb(e.position):"start"in e||"end"in e?Bb(e):"line"in e||"column"in e?ym(e):""}function ym(e){return Ib(e&&e.line)+":"+Ib(e&&e.column)}function Bb(e){return ym(e&&e.start)+"-"+ym(e&&e.end)}function Ib(e){return e&&typeof e=="number"?e:1}class vn extends Error{constructor(r,a,l){super(),typeof a=="string"&&(l=a,a=void 0);let s="",c={},f=!1;if(a&&("line"in a&&"column"in a?c={place:a}:"start"in a&&"end"in a?c={place:a}:"type"in a?c={ancestors:[a],place:a.position}:c={...a}),typeof r=="string"?s=r:!c.cause&&r&&(f=!0,s=r.message,c.cause=r),!c.ruleId&&!c.source&&typeof l=="string"){const p=l.indexOf(":");p===-1?c.ruleId=l:(c.source=l.slice(0,p),c.ruleId=l.slice(p+1))}if(!c.place&&c.ancestors&&c.ancestors){const p=c.ancestors[c.ancestors.length-1];p&&(c.place=p.position)}const d=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=d?d.line:void 0,this.name=as(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=f&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}vn.prototype.file="";vn.prototype.name="";vn.prototype.reason="";vn.prototype.message="";vn.prototype.stack="";vn.prototype.column=void 0;vn.prototype.line=void 0;vn.prototype.ancestors=void 0;vn.prototype.cause=void 0;vn.prototype.fatal=void 0;vn.prototype.place=void 0;vn.prototype.ruleId=void 0;vn.prototype.source=void 0;const dp={}.hasOwnProperty,dD=new Map,hD=/[A-Z]/g,mD=new Set(["table","tbody","thead","tfoot","tr"]),pD=new Set(["td","th"]),CS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function gD(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=r.filePath||void 0;let l;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=kD(a,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");l=jD(a,r.jsx,r.jsxs)}const s={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:l,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?cp:rD,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},c=ES(s,e,void 0);return c&&typeof c!="string"?c:s.create(e,s.Fragment,{children:c||void 0},void 0)}function ES(e,r,a){if(r.type==="element")return xD(e,r,a);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return vD(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return bD(e,r,a);if(r.type==="mdxjsEsm")return yD(e,r);if(r.type==="root")return wD(e,r,a);if(r.type==="text")return SD(e,r)}function xD(e,r,a){const l=e.schema;let s=l;r.tagName.toLowerCase()==="svg"&&l.space==="html"&&(s=cp,e.schema=s),e.ancestors.push(r);const c=TS(e,r.tagName,!1),f=CD(e,r);let d=mp(e,r);return mD.has(r.tagName)&&(d=d.filter(function(p){return typeof p=="string"?!YR(p):!0})),NS(e,f,c,r),hp(f,d),e.ancestors.pop(),e.schema=l,e.create(r,c,f,a)}function vD(e,r){if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];return l.type,e.evaluater.evaluateExpression(l.expression)}cs(e,r.position)}function yD(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);cs(e,r.position)}function bD(e,r,a){const l=e.schema;let s=l;r.name==="svg"&&l.space==="html"&&(s=cp,e.schema=s),e.ancestors.push(r);const c=r.name===null?e.Fragment:TS(e,r.name,!0),f=ED(e,r),d=mp(e,r);return NS(e,f,c,r),hp(f,d),e.ancestors.pop(),e.schema=l,e.create(r,c,f,a)}function wD(e,r,a){const l={};return hp(l,mp(e,r)),e.create(r,e.Fragment,l,a)}function SD(e,r){return r.value}function NS(e,r,a,l){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(r.node=l)}function hp(e,r){if(r.length>0){const a=r.length>1?r:r[0];a&&(e.children=a)}}function jD(e,r,a){return l;function l(s,c,f,d){const h=Array.isArray(f.children)?a:r;return d?h(c,f,d):h(c,f)}}function kD(e,r){return a;function a(l,s,c,f){const d=Array.isArray(c.children),p=fp(l);return r(s,c,f,d,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function CD(e,r){const a={};let l,s;for(s in r.properties)if(s!=="children"&&dp.call(r.properties,s)){const c=ND(e,s,r.properties[s]);if(c){const[f,d]=c;e.tableCellAlignToStyle&&f==="align"&&typeof d=="string"&&pD.has(r.tagName)?l=d:a[f]=d}}if(l){const c=a.style||(a.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return a}function ED(e,r){const a={};for(const l of r.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&e.evaluater){const c=l.data.estree.body[0];c.type;const f=c.expression;f.type;const d=f.properties[0];d.type,Object.assign(a,e.evaluater.evaluateExpression(d.argument))}else cs(e,r.position);else{const s=l.name;let c;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const d=l.value.data.estree.body[0];d.type,c=e.evaluater.evaluateExpression(d.expression)}else cs(e,r.position);else c=l.value===null?!0:l.value;a[s]=c}return a}function mp(e,r){const a=[];let l=-1;const s=e.passKeys?new Map:dD;for(;++ls?0:s+r:r=r>s?s:r,a=a>0?a:0,l.length<1e4)f=Array.from(l),f.unshift(r,a),e.splice(...f);else for(a&&e.splice(r,a);c0?(Yn(e,e.length,0,r),e):r}const Pb={}.hasOwnProperty;function _S(e){const r={};let a=-1;for(;++a13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"๏ฟฝ":String.fromCodePoint(a)}function xr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const wn=gl(/[A-Za-z]/),mn=gl(/[\dA-Za-z]/),LD=gl(/[#-'*+\--9=?A-Z^-~]/);function cc(e){return e!==null&&(e<32||e===127)}const bm=gl(/\d/),UD=gl(/[\dA-Fa-f]/),BD=gl(/[!-/:-@[-`{-~]/);function Oe(e){return e!==null&&e<-2}function kt(e){return e!==null&&(e<0||e===32)}function Je(e){return e===-2||e===-1||e===32}const Hc=gl(new RegExp("\\p{P}|\\p{S}","u")),Gl=gl(/\s/);function gl(e){return r;function r(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function eo(e){const r=[];let a=-1,l=0,s=0;for(;++a55295&&c<57344){const d=e.charCodeAt(a+1);c<56320&&d>56319&&d<57344?(f=String.fromCharCode(c,d),s=1):f="๏ฟฝ"}else f=String.fromCharCode(c);f&&(r.push(e.slice(l,a),encodeURIComponent(f)),l=a+s+1,f=""),s&&(a+=s,s=0)}return r.join("")+e.slice(l)}function ot(e,r,a,l){const s=l?l-1:Number.POSITIVE_INFINITY;let c=0;return f;function f(p){return Je(p)?(e.enter(a),d(p)):r(p)}function d(p){return Je(p)&&c++f))return;const A=r.events.length;let I=A,ee,q;for(;I--;)if(r.events[I][0]==="exit"&&r.events[I][1].type==="chunkFlow"){if(ee){q=r.events[I][1].end;break}ee=!0}for(C(l),_=A;_D;){const O=a[B];r.containerState=O[1],O[0].exit.call(r,e)}a.length=D}function R(){s.write([null]),c=void 0,s=void 0,r.containerState._closeFlow=void 0}}function $D(e,r,a){return ot(e,e.attempt(this.parser.constructs.document,r,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Yi(e){if(e===null||kt(e)||Gl(e))return 1;if(Hc(e))return 2}function qc(e,r,a){const l=[];let s=-1;for(;++s1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1;const x={...e[l][1].end},b={...e[a][1].start};Fb(x,-p),Fb(b,p),f={type:p>1?"strongSequence":"emphasisSequence",start:x,end:{...e[l][1].end}},d={type:p>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:b},c={type:p>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[a][1].start}},s={type:p>1?"strong":"emphasis",start:{...f.start},end:{...d.end}},e[l][1].end={...f.start},e[a][1].start={...d.end},h=[],e[l][1].end.offset-e[l][1].start.offset&&(h=ir(h,[["enter",e[l][1],r],["exit",e[l][1],r]])),h=ir(h,[["enter",s,r],["enter",f,r],["exit",f,r],["enter",c,r]]),h=ir(h,qc(r.parser.constructs.insideSpan.null,e.slice(l+1,a),r)),h=ir(h,[["exit",c,r],["enter",d,r],["exit",d,r],["exit",s,r]]),e[a][1].end.offset-e[a][1].start.offset?(v=2,h=ir(h,[["enter",e[a][1],r],["exit",e[a][1],r]])):v=0,Yn(e,l-1,a-l+3,h),a=l+h.length-v-2;break}}for(a=-1;++a0&&Je(_)?ot(e,R,"linePrefix",c+1)(_):R(_)}function R(_){return _===null||Oe(_)?e.check(Vb,j,B)(_):(e.enter("codeFlowValue"),D(_))}function D(_){return _===null||Oe(_)?(e.exit("codeFlowValue"),R(_)):(e.consume(_),D)}function B(_){return e.exit("codeFenced"),r(_)}function O(_,A,I){let ee=0;return q;function q(W){return _.enter("lineEnding"),_.consume(W),_.exit("lineEnding"),$}function $(W){return _.enter("codeFencedFence"),Je(W)?ot(_,X,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):X(W)}function X(W){return W===d?(_.enter("codeFencedFenceSequence"),ce(W)):I(W)}function ce(W){return W===d?(ee++,_.consume(W),ce):ee>=f?(_.exit("codeFencedFenceSequence"),Je(W)?ot(_,le,"whitespace")(W):le(W)):I(W)}function le(W){return W===null||Oe(W)?(_.exit("codeFencedFence"),A(W)):I(W)}}}function tO(e,r,a){const l=this;return s;function s(f){return f===null?a(f):(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c)}function c(f){return l.parser.lazy[l.now().line]?a(f):r(f)}}const Bh={name:"codeIndented",tokenize:rO},nO={partial:!0,tokenize:aO};function rO(e,r,a){const l=this;return s;function s(h){return e.enter("codeIndented"),ot(e,c,"linePrefix",5)(h)}function c(h){const v=l.events[l.events.length-1];return v&&v[1].type==="linePrefix"&&v[2].sliceSerialize(v[1],!0).length>=4?f(h):a(h)}function f(h){return h===null?p(h):Oe(h)?e.attempt(nO,f,p)(h):(e.enter("codeFlowValue"),d(h))}function d(h){return h===null||Oe(h)?(e.exit("codeFlowValue"),f(h)):(e.consume(h),d)}function p(h){return e.exit("codeIndented"),r(h)}}function aO(e,r,a){const l=this;return s;function s(f){return l.parser.lazy[l.now().line]?a(f):Oe(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),s):ot(e,c,"linePrefix",5)(f)}function c(f){const d=l.events[l.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?r(f):Oe(f)?s(f):a(f)}}const lO={name:"codeText",previous:oO,resolve:iO,tokenize:sO};function iO(e){let r=e.length-4,a=3,l,s;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(l=a;++l=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return rthis.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(r,a,l){const s=a||0;this.setCursor(Math.trunc(r));const c=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return l&&Zo(this.left,l),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),Zo(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Zo(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r=4?r(f):e.interrupt(l.parser.constructs.flow,a,r)(f)}}function LS(e,r,a,l,s,c,f,d,p){const h=p||Number.POSITIVE_INFINITY;let v=0;return x;function x(C){return C===60?(e.enter(l),e.enter(s),e.enter(c),e.consume(C),e.exit(c),b):C===null||C===32||C===41||cc(C)?a(C):(e.enter(l),e.enter(f),e.enter(d),e.enter("chunkString",{contentType:"string"}),j(C))}function b(C){return C===62?(e.enter(c),e.consume(C),e.exit(c),e.exit(s),e.exit(l),r):(e.enter(d),e.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===62?(e.exit("chunkString"),e.exit(d),b(C)):C===null||C===60||Oe(C)?a(C):(e.consume(C),C===92?k:y)}function k(C){return C===60||C===62||C===92?(e.consume(C),y):y(C)}function j(C){return!v&&(C===null||C===41||kt(C))?(e.exit("chunkString"),e.exit(d),e.exit(f),e.exit(l),r(C)):v999||y===null||y===91||y===93&&!p||y===94&&!d&&"_hiddenFootnoteSupport"in f.parser.constructs?a(y):y===93?(e.exit(c),e.enter(s),e.consume(y),e.exit(s),e.exit(l),r):Oe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),v):(e.enter("chunkString",{contentType:"string"}),x(y))}function x(y){return y===null||y===91||y===93||Oe(y)||d++>999?(e.exit("chunkString"),v(y)):(e.consume(y),p||(p=!Je(y)),y===92?b:x)}function b(y){return y===91||y===92||y===93?(e.consume(y),d++,x):x(y)}}function BS(e,r,a,l,s,c){let f;return d;function d(b){return b===34||b===39||b===40?(e.enter(l),e.enter(s),e.consume(b),e.exit(s),f=b===40?41:b,p):a(b)}function p(b){return b===f?(e.enter(s),e.consume(b),e.exit(s),e.exit(l),r):(e.enter(c),h(b))}function h(b){return b===f?(e.exit(c),p(f)):b===null?a(b):Oe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),ot(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),v(b))}function v(b){return b===f||b===null||Oe(b)?(e.exit("chunkString"),h(b)):(e.consume(b),b===92?x:v)}function x(b){return b===f||b===92?(e.consume(b),v):v(b)}}function ls(e,r){let a;return l;function l(s){return Oe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a=!0,l):Je(s)?ot(e,l,a?"linePrefix":"lineSuffix")(s):r(s)}}const gO={name:"definition",tokenize:vO},xO={partial:!0,tokenize:yO};function vO(e,r,a){const l=this;let s;return c;function c(y){return e.enter("definition"),f(y)}function f(y){return US.call(l,e,d,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function d(y){return s=xr(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),p):a(y)}function p(y){return kt(y)?ls(e,h)(y):h(y)}function h(y){return LS(e,v,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function v(y){return e.attempt(xO,x,x)(y)}function x(y){return Je(y)?ot(e,b,"whitespace")(y):b(y)}function b(y){return y===null||Oe(y)?(e.exit("definition"),l.parser.defined.push(s),r(y)):a(y)}}function yO(e,r,a){return l;function l(d){return kt(d)?ls(e,s)(d):a(d)}function s(d){return BS(e,c,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function c(d){return Je(d)?ot(e,f,"whitespace")(d):f(d)}function f(d){return d===null||Oe(d)?r(d):a(d)}}const bO={name:"hardBreakEscape",tokenize:wO};function wO(e,r,a){return l;function l(c){return e.enter("hardBreakEscape"),e.consume(c),s}function s(c){return Oe(c)?(e.exit("hardBreakEscape"),r(c)):a(c)}}const SO={name:"headingAtx",resolve:jO,tokenize:kO};function jO(e,r){let a=e.length-2,l=3,s,c;return e[l][1].type==="whitespace"&&(l+=2),a-2>l&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(l===a-1||a-4>l&&e[a-2][1].type==="whitespace")&&(a-=l+1===a?2:4),a>l&&(s={type:"atxHeadingText",start:e[l][1].start,end:e[a][1].end},c={type:"chunkText",start:e[l][1].start,end:e[a][1].end,contentType:"text"},Yn(e,l,a-l+1,[["enter",s,r],["enter",c,r],["exit",c,r],["exit",s,r]])),e}function kO(e,r,a){let l=0;return s;function s(v){return e.enter("atxHeading"),c(v)}function c(v){return e.enter("atxHeadingSequence"),f(v)}function f(v){return v===35&&l++<6?(e.consume(v),f):v===null||kt(v)?(e.exit("atxHeadingSequence"),d(v)):a(v)}function d(v){return v===35?(e.enter("atxHeadingSequence"),p(v)):v===null||Oe(v)?(e.exit("atxHeading"),r(v)):Je(v)?ot(e,d,"whitespace")(v):(e.enter("atxHeadingText"),h(v))}function p(v){return v===35?(e.consume(v),p):(e.exit("atxHeadingSequence"),d(v))}function h(v){return v===null||v===35||kt(v)?(e.exit("atxHeadingText"),d(v)):(e.consume(v),h)}}const CO=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Yb=["pre","script","style","textarea"],EO={concrete:!0,name:"htmlFlow",resolveTo:AO,tokenize:_O},NO={partial:!0,tokenize:RO},TO={partial:!0,tokenize:MO};function AO(e){let r=e.length;for(;r--&&!(e[r][0]==="enter"&&e[r][1].type==="htmlFlow"););return r>1&&e[r-2][1].type==="linePrefix"&&(e[r][1].start=e[r-2][1].start,e[r+1][1].start=e[r-2][1].start,e.splice(r-2,2)),e}function _O(e,r,a){const l=this;let s,c,f,d,p;return h;function h(M){return v(M)}function v(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),x}function x(M){return M===33?(e.consume(M),b):M===47?(e.consume(M),c=!0,j):M===63?(e.consume(M),s=3,l.interrupt?r:E):wn(M)?(e.consume(M),f=String.fromCharCode(M),T):a(M)}function b(M){return M===45?(e.consume(M),s=2,y):M===91?(e.consume(M),s=5,d=0,k):wn(M)?(e.consume(M),s=4,l.interrupt?r:E):a(M)}function y(M){return M===45?(e.consume(M),l.interrupt?r:E):a(M)}function k(M){const oe="CDATA[";return M===oe.charCodeAt(d++)?(e.consume(M),d===oe.length?l.interrupt?r:X:k):a(M)}function j(M){return wn(M)?(e.consume(M),f=String.fromCharCode(M),T):a(M)}function T(M){if(M===null||M===47||M===62||kt(M)){const oe=M===47,G=f.toLowerCase();return!oe&&!c&&Yb.includes(G)?(s=1,l.interrupt?r(M):X(M)):CO.includes(f.toLowerCase())?(s=6,oe?(e.consume(M),C):l.interrupt?r(M):X(M)):(s=7,l.interrupt&&!l.parser.lazy[l.now().line]?a(M):c?R(M):D(M))}return M===45||mn(M)?(e.consume(M),f+=String.fromCharCode(M),T):a(M)}function C(M){return M===62?(e.consume(M),l.interrupt?r:X):a(M)}function R(M){return Je(M)?(e.consume(M),R):q(M)}function D(M){return M===47?(e.consume(M),q):M===58||M===95||wn(M)?(e.consume(M),B):Je(M)?(e.consume(M),D):q(M)}function B(M){return M===45||M===46||M===58||M===95||mn(M)?(e.consume(M),B):O(M)}function O(M){return M===61?(e.consume(M),_):Je(M)?(e.consume(M),O):D(M)}function _(M){return M===null||M===60||M===61||M===62||M===96?a(M):M===34||M===39?(e.consume(M),p=M,A):Je(M)?(e.consume(M),_):I(M)}function A(M){return M===p?(e.consume(M),p=null,ee):M===null||Oe(M)?a(M):(e.consume(M),A)}function I(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||kt(M)?O(M):(e.consume(M),I)}function ee(M){return M===47||M===62||Je(M)?D(M):a(M)}function q(M){return M===62?(e.consume(M),$):a(M)}function $(M){return M===null||Oe(M)?X(M):Je(M)?(e.consume(M),$):a(M)}function X(M){return M===45&&s===2?(e.consume(M),U):M===60&&s===1?(e.consume(M),Z):M===62&&s===4?(e.consume(M),L):M===63&&s===3?(e.consume(M),E):M===93&&s===5?(e.consume(M),K):Oe(M)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(NO,F,ce)(M)):M===null||Oe(M)?(e.exit("htmlFlowData"),ce(M)):(e.consume(M),X)}function ce(M){return e.check(TO,le,F)(M)}function le(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),W}function W(M){return M===null||Oe(M)?ce(M):(e.enter("htmlFlowData"),X(M))}function U(M){return M===45?(e.consume(M),E):X(M)}function Z(M){return M===47?(e.consume(M),f="",ie):X(M)}function ie(M){if(M===62){const oe=f.toLowerCase();return Yb.includes(oe)?(e.consume(M),L):X(M)}return wn(M)&&f.length<8?(e.consume(M),f+=String.fromCharCode(M),ie):X(M)}function K(M){return M===93?(e.consume(M),E):X(M)}function E(M){return M===62?(e.consume(M),L):M===45&&s===2?(e.consume(M),E):X(M)}function L(M){return M===null||Oe(M)?(e.exit("htmlFlowData"),F(M)):(e.consume(M),L)}function F(M){return e.exit("htmlFlow"),r(M)}}function MO(e,r,a){const l=this;return s;function s(f){return Oe(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):a(f)}function c(f){return l.parser.lazy[l.now().line]?a(f):r(f)}}function RO(e,r,a){return l;function l(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(xs,r,a)}}const DO={name:"htmlText",tokenize:OO};function OO(e,r,a){const l=this;let s,c,f;return d;function d(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),p}function p(E){return E===33?(e.consume(E),h):E===47?(e.consume(E),O):E===63?(e.consume(E),D):wn(E)?(e.consume(E),I):a(E)}function h(E){return E===45?(e.consume(E),v):E===91?(e.consume(E),c=0,k):wn(E)?(e.consume(E),R):a(E)}function v(E){return E===45?(e.consume(E),y):a(E)}function x(E){return E===null?a(E):E===45?(e.consume(E),b):Oe(E)?(f=x,Z(E)):(e.consume(E),x)}function b(E){return E===45?(e.consume(E),y):x(E)}function y(E){return E===62?U(E):E===45?b(E):x(E)}function k(E){const L="CDATA[";return E===L.charCodeAt(c++)?(e.consume(E),c===L.length?j:k):a(E)}function j(E){return E===null?a(E):E===93?(e.consume(E),T):Oe(E)?(f=j,Z(E)):(e.consume(E),j)}function T(E){return E===93?(e.consume(E),C):j(E)}function C(E){return E===62?U(E):E===93?(e.consume(E),C):j(E)}function R(E){return E===null||E===62?U(E):Oe(E)?(f=R,Z(E)):(e.consume(E),R)}function D(E){return E===null?a(E):E===63?(e.consume(E),B):Oe(E)?(f=D,Z(E)):(e.consume(E),D)}function B(E){return E===62?U(E):D(E)}function O(E){return wn(E)?(e.consume(E),_):a(E)}function _(E){return E===45||mn(E)?(e.consume(E),_):A(E)}function A(E){return Oe(E)?(f=A,Z(E)):Je(E)?(e.consume(E),A):U(E)}function I(E){return E===45||mn(E)?(e.consume(E),I):E===47||E===62||kt(E)?ee(E):a(E)}function ee(E){return E===47?(e.consume(E),U):E===58||E===95||wn(E)?(e.consume(E),q):Oe(E)?(f=ee,Z(E)):Je(E)?(e.consume(E),ee):U(E)}function q(E){return E===45||E===46||E===58||E===95||mn(E)?(e.consume(E),q):$(E)}function $(E){return E===61?(e.consume(E),X):Oe(E)?(f=$,Z(E)):Je(E)?(e.consume(E),$):ee(E)}function X(E){return E===null||E===60||E===61||E===62||E===96?a(E):E===34||E===39?(e.consume(E),s=E,ce):Oe(E)?(f=X,Z(E)):Je(E)?(e.consume(E),X):(e.consume(E),le)}function ce(E){return E===s?(e.consume(E),s=void 0,W):E===null?a(E):Oe(E)?(f=ce,Z(E)):(e.consume(E),ce)}function le(E){return E===null||E===34||E===39||E===60||E===61||E===96?a(E):E===47||E===62||kt(E)?ee(E):(e.consume(E),le)}function W(E){return E===47||E===62||kt(E)?ee(E):a(E)}function U(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),r):a(E)}function Z(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),ie}function ie(E){return Je(E)?ot(e,K,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):K(E)}function K(E){return e.enter("htmlTextData"),f(E)}}const xp={name:"labelEnd",resolveAll:BO,resolveTo:IO,tokenize:HO},zO={tokenize:qO},LO={tokenize:PO},UO={tokenize:$O};function BO(e){let r=-1;const a=[];for(;++r=3&&(h===null||Oe(h))?(e.exit("thematicBreak"),r(h)):a(h)}function p(h){return h===s?(e.consume(h),l++,p):(e.exit("thematicBreakSequence"),Je(h)?ot(e,d,"whitespace")(h):d(h))}}const Dn={continuation:{tokenize:WO},exit:tz,name:"list",tokenize:JO},QO={partial:!0,tokenize:nz},ZO={partial:!0,tokenize:ez};function JO(e,r,a){const l=this,s=l.events[l.events.length-1];let c=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,f=0;return d;function d(y){const k=l.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!l.containerState.marker||y===l.containerState.marker:bm(y)){if(l.containerState.type||(l.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(tc,a,h)(y):h(y);if(!l.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(y)}return a(y)}function p(y){return bm(y)&&++f<10?(e.consume(y),p):(!l.interrupt||f<2)&&(l.containerState.marker?y===l.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),h(y)):a(y)}function h(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||y,e.check(xs,l.interrupt?a:v,e.attempt(QO,b,x))}function v(y){return l.containerState.initialBlankLine=!0,c++,b(y)}function x(y){return Je(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):a(y)}function b(y){return l.containerState.size=c+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(y)}}function WO(e,r,a){const l=this;return l.containerState._closeFlow=void 0,e.check(xs,s,c);function s(d){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,ot(e,r,"listItemIndent",l.containerState.size+1)(d)}function c(d){return l.containerState.furtherBlankLines||!Je(d)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,f(d)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt(ZO,r,f)(d))}function f(d){return l.containerState._closeFlow=!0,l.interrupt=void 0,ot(e,e.attempt(Dn,r,a),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function ez(e,r,a){const l=this;return ot(e,s,"listItemIndent",l.containerState.size+1);function s(c){const f=l.events[l.events.length-1];return f&&f[1].type==="listItemIndent"&&f[2].sliceSerialize(f[1],!0).length===l.containerState.size?r(c):a(c)}}function tz(e){e.exit(this.containerState.type)}function nz(e,r,a){const l=this;return ot(e,s,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(c){const f=l.events[l.events.length-1];return!Je(c)&&f&&f[1].type==="listItemPrefixWhitespace"?r(c):a(c)}}const Xb={name:"setextUnderline",resolveTo:rz,tokenize:az};function rz(e,r){let a=e.length,l,s,c;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){l=a;break}e[a][1].type==="paragraph"&&(s=a)}else e[a][1].type==="content"&&e.splice(a,1),!c&&e[a][1].type==="definition"&&(c=a);const f={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",c?(e.splice(s,0,["enter",f,r]),e.splice(c+1,0,["exit",e[l][1],r]),e[l][1].end={...e[c][1].end}):e[l][1]=f,e.push(["exit",f,r]),e}function az(e,r,a){const l=this;let s;return c;function c(h){let v=l.events.length,x;for(;v--;)if(l.events[v][1].type!=="lineEnding"&&l.events[v][1].type!=="linePrefix"&&l.events[v][1].type!=="content"){x=l.events[v][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||x)?(e.enter("setextHeadingLine"),s=h,f(h)):a(h)}function f(h){return e.enter("setextHeadingLineSequence"),d(h)}function d(h){return h===s?(e.consume(h),d):(e.exit("setextHeadingLineSequence"),Je(h)?ot(e,p,"lineSuffix")(h):p(h))}function p(h){return h===null||Oe(h)?(e.exit("setextHeadingLine"),r(h)):a(h)}}const lz={tokenize:iz};function iz(e){const r=this,a=e.attempt(xs,l,e.attempt(this.parser.constructs.flowInitial,s,ot(e,e.attempt(this.parser.constructs.flow,s,e.attempt(fO,s)),"linePrefix")));return a;function l(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),r.currentConstruct=void 0,a}function s(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),r.currentConstruct=void 0,a}}const oz={resolveAll:HS()},sz=IS("string"),uz=IS("text");function IS(e){return{resolveAll:HS(e==="text"?cz:void 0),tokenize:r};function r(a){const l=this,s=this.parser.constructs[e],c=a.attempt(s,f,d);return f;function f(v){return h(v)?c(v):d(v)}function d(v){if(v===null){a.consume(v);return}return a.enter("data"),a.consume(v),p}function p(v){return h(v)?(a.exit("data"),c(v)):(a.consume(v),p)}function h(v){if(v===null)return!0;const x=s[v];let b=-1;if(x)for(;++b-1){const d=f[0];typeof d=="string"?f[0]=d.slice(l):f.shift()}c>0&&f.push(e[s].slice(0,c))}return f}function jz(e,r){let a=-1;const l=[];let s;for(;++a0){const en=de.tokenStack[de.tokenStack.length-1];(en[1]||Qb).call(de,void 0,en[0])}for(z.position={start:Ya(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Ya(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},De=-1;++De0&&(l.className=["language-"+s[0]]);let c={type:"element",tagName:"code",properties:l,children:[{type:"text",value:a}]};return r.meta&&(c.data={meta:r.meta}),e.patch(r,c),c=e.applyData(r,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(r,c),c}function Uz(e,r){const a={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,a),e.applyData(r,a)}function Bz(e,r){const a={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,a),e.applyData(r,a)}function Iz(e,r){const a=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(r.identifier).toUpperCase(),s=eo(l.toLowerCase()),c=e.footnoteOrder.indexOf(l);let f,d=e.footnoteCounts.get(l);d===void 0?(d=0,e.footnoteOrder.push(l),f=e.footnoteOrder.length):f=c+1,d+=1,e.footnoteCounts.set(l,d);const p={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+s,id:a+"fnref-"+s+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(f)}]};e.patch(r,p);const h={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(r,h),e.applyData(r,h)}function Hz(e,r){const a={type:"element",tagName:"h"+r.depth,properties:{},children:e.all(r)};return e.patch(r,a),e.applyData(r,a)}function qz(e,r){if(e.options.allowDangerousHtml){const a={type:"raw",value:r.value};return e.patch(r,a),e.applyData(r,a)}}function $S(e,r){const a=r.referenceType;let l="]";if(a==="collapsed"?l+="[]":a==="full"&&(l+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+l}];const s=e.all(r),c=s[0];c&&c.type==="text"?c.value="["+c.value:s.unshift({type:"text",value:"["});const f=s[s.length-1];return f&&f.type==="text"?f.value+=l:s.push({type:"text",value:l}),s}function Pz(e,r){const a=String(r.identifier).toUpperCase(),l=e.definitionById.get(a);if(!l)return $S(e,r);const s={src:eo(l.url||""),alt:r.alt};l.title!==null&&l.title!==void 0&&(s.title=l.title);const c={type:"element",tagName:"img",properties:s,children:[]};return e.patch(r,c),e.applyData(r,c)}function $z(e,r){const a={src:eo(r.url)};r.alt!==null&&r.alt!==void 0&&(a.alt=r.alt),r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"img",properties:a,children:[]};return e.patch(r,l),e.applyData(r,l)}function Fz(e,r){const a={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};e.patch(r,a);const l={type:"element",tagName:"code",properties:{},children:[a]};return e.patch(r,l),e.applyData(r,l)}function Vz(e,r){const a=String(r.identifier).toUpperCase(),l=e.definitionById.get(a);if(!l)return $S(e,r);const s={href:eo(l.url||"")};l.title!==null&&l.title!==void 0&&(s.title=l.title);const c={type:"element",tagName:"a",properties:s,children:e.all(r)};return e.patch(r,c),e.applyData(r,c)}function Gz(e,r){const a={href:eo(r.url)};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"a",properties:a,children:e.all(r)};return e.patch(r,l),e.applyData(r,l)}function Yz(e,r,a){const l=e.all(r),s=a?Xz(a):FS(r),c={},f=[];if(typeof r.checked=="boolean"){const v=l[0];let x;v&&v.type==="element"&&v.tagName==="p"?x=v:(x={type:"element",tagName:"p",properties:{},children:[]},l.unshift(x)),x.children.length>0&&x.children.unshift({type:"text",value:" "}),x.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let d=-1;for(;++d1}function Kz(e,r){const a={},l=e.all(r);let s=-1;for(typeof r.start=="number"&&r.start!==1&&(a.start=r.start);++s0){const f={type:"element",tagName:"tbody",properties:{},children:e.wrap(a,!0)},d=fp(r.children[1]),p=jS(r.children[r.children.length-1]);d&&p&&(f.position={start:d,end:p}),s.push(f)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(r,c),e.applyData(r,c)}function e4(e,r,a){const l=a?a.children:void 0,c=(l?l.indexOf(r):1)===0?"th":"td",f=a&&a.type==="table"?a.align:void 0,d=f?f.length:r.children.length;let p=-1;const h=[];for(;++p0,!0),l[0]),s=l.index+l[0].length,l=a.exec(r);return c.push(Wb(r.slice(s),s>0,!1)),c.join("")}function Wb(e,r,a){let l=0,s=e.length;if(r){let c=e.codePointAt(l);for(;c===Zb||c===Jb;)l++,c=e.codePointAt(l)}if(a){let c=e.codePointAt(s-1);for(;c===Zb||c===Jb;)s--,c=e.codePointAt(s-1)}return s>l?e.slice(l,s):""}function r4(e,r){const a={type:"text",value:n4(String(r.value))};return e.patch(r,a),e.applyData(r,a)}function a4(e,r){const a={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,a),e.applyData(r,a)}const l4={blockquote:Oz,break:zz,code:Lz,delete:Uz,emphasis:Bz,footnoteReference:Iz,heading:Hz,html:qz,imageReference:Pz,image:$z,inlineCode:Fz,linkReference:Vz,link:Gz,listItem:Yz,list:Kz,paragraph:Qz,root:Zz,strong:Jz,table:Wz,tableCell:t4,tableRow:e4,text:r4,thematicBreak:a4,toml:Xu,yaml:Xu,definition:Xu,footnoteDefinition:Xu};function Xu(){}const VS=-1,Pc=0,is=1,fc=2,vp=3,yp=4,bp=5,wp=6,GS=7,YS=8,XS=typeof self=="object"?self:globalThis,e0=(e,r)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new XS[e](r)},i4=(e,r)=>{const a=(s,c)=>(e.set(c,s),s),l=s=>{if(e.has(s))return e.get(s);const[c,f]=r[s];switch(c){case Pc:case VS:return a(f,s);case is:{const d=a([],s);for(const p of f)d.push(l(p));return d}case fc:{const d=a({},s);for(const[p,h]of f)d[l(p)]=l(h);return d}case vp:return a(new Date(f),s);case yp:{const{source:d,flags:p}=f;return a(new RegExp(d,p),s)}case bp:{const d=a(new Map,s);for(const[p,h]of f)d.set(l(p),l(h));return d}case wp:{const d=a(new Set,s);for(const p of f)d.add(l(p));return d}case GS:{const{name:d,message:p}=f;return a(typeof XS[d]=="function"?e0(d,p):new Error(p),s)}case YS:return a(BigInt(f),s);case"BigInt":return a(Object(BigInt(f)),s);case"ArrayBuffer":return a(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:d}=new Uint8Array(f);return a(new DataView(d),f)}}return a(e0(c,f),s)};return l},t0=e=>i4(new Map,e)(0),Il="",{toString:o4}={},{keys:s4}=Object,Jo=e=>{const r=typeof e;if(r!=="object"||!e)return[Pc,r];const a=o4.call(e).slice(8,-1);switch(a){case"Array":return[is,Il];case"Object":return[fc,Il];case"Date":return[vp,Il];case"RegExp":return[yp,Il];case"Map":return[bp,Il];case"Set":return[wp,Il];case"DataView":return[is,a]}return a.includes("Array")?[is,a]:e instanceof Error?[GS,e.name||"Error"]:[fc,a]},Ku=([e,r])=>e===Pc&&(r==="function"||r==="symbol"),u4=(e,r,a,l)=>{const s=(f,d)=>{const p=l.push(f)-1;return a.set(d,p),p},c=f=>{if(a.has(f))return a.get(f);let[d,p]=Jo(f);switch(d){case Pc:{let v=f;switch(p){case"bigint":d=YS,v=f.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);v=null;break;case"undefined":return s([VS],f)}return s([d,v],f)}case is:{if(p){let b=f;return p==="DataView"?b=new Uint8Array(f.buffer):p==="ArrayBuffer"&&(b=new Uint8Array(f)),s([p,[...b]],f)}const v=[],x=s([d,v],f);for(const b of f)v.push(c(b));return x}case fc:{if(p)switch(p){case"BigInt":return s([p,f.toString()],f);case"Boolean":case"Number":case"String":return s([p,f.valueOf()],f)}if(r&&"toJSON"in f)return c(f.toJSON());const v=[],x=s([d,v],f);for(const b of s4(f))(e||!Ku(Jo(f[b])))&&v.push([c(b),c(f[b])]);return x}case vp:return s([d,isNaN(f.getTime())?Il:f.toISOString()],f);case yp:{const{source:v,flags:x}=f;return s([d,{source:v,flags:x}],f)}case bp:{const v=[],x=s([d,v],f);for(const[b,y]of f)(e||!(Ku(Jo(b))||Ku(Jo(y))))&&v.push([c(b),c(y)]);return x}case wp:{const v=[],x=s([d,v],f);for(const b of f)(e||!Ku(Jo(b)))&&v.push(c(b));return x}}const{message:h}=f;return s([d,{name:p,message:h}],f)};return c},n0=(e,{json:r,lossy:a}={})=>{const l=[];return u4(!(r||a),!!r,new Map,l)(e),l},dc=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?t0(n0(e,r)):structuredClone(e):(e,r)=>t0(n0(e,r));function c4(e,r){const a=[{type:"text",value:"โ†ฉ"}];return r>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),a}function f4(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function d4(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=e.options.footnoteBackContent||c4,l=e.options.footnoteBackLabel||f4,s=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",f=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let p=-1;for(;++p0&&k.push({type:"text",value:" "});let R=typeof a=="string"?a:a(p,y);typeof R=="string"&&(R={type:"text",value:R}),k.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+b+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(p,y),className:["data-footnote-backref"]},children:Array.isArray(R)?R:[R]})}const T=v[v.length-1];if(T&&T.type==="element"&&T.tagName==="p"){const R=T.children[T.children.length-1];R&&R.type==="text"?R.value+=" ":T.children.push({type:"text",value:" "}),T.children.push(...k)}else v.push(...k);const C={type:"element",tagName:"li",properties:{id:r+"fn-"+b},children:e.wrap(v,!0)};e.patch(h,C),d.push(C)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...dc(f),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:` -`}]}}const $c=(function(e){if(e==null)return g4;if(typeof e=="function")return Fc(e);if(typeof e=="object")return Array.isArray(e)?h4(e):m4(e);if(typeof e=="string")return p4(e);throw new Error("Expected function, string, or object as test")});function h4(e){const r=[];let a=-1;for(;++a":""))+")"})}return b;function b(){let y=KS,k,j,T;if((!r||c(p,h,v[v.length-1]||void 0))&&(y=b4(a(p,v)),y[0]===Sm))return y;if("children"in p&&p.children){const C=p;if(C.children&&y[0]!==y4)for(j=(l?C.children.length:-1)+f,T=v.concat(C);j>-1&&j0&&a.push({type:"text",value:` -`}),a}function r0(e){let r=0,a=e.charCodeAt(r);for(;a===9||a===32;)r++,a=e.charCodeAt(r);return e.slice(r)}function a0(e,r){const a=S4(e,r),l=a.one(e,void 0),s=d4(a),c=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return s&&c.children.push({type:"text",value:` -`},s),c}function N4(e,r){return e&&"run"in e?async function(a,l){const s=a0(a,{file:l,...r});await e.run(s,l)}:function(a,l){return a0(a,{file:l,...e||r})}}function l0(e){if(e)throw e}var Hh,i0;function T4(){if(i0)return Hh;i0=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):r.call(h)==="[object Array]"},c=function(h){if(!h||r.call(h)!=="[object Object]")return!1;var v=e.call(h,"constructor"),x=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!v&&!x)return!1;var b;for(b in h);return typeof b>"u"||e.call(h,b)},f=function(h,v){a&&v.name==="__proto__"?a(h,v.name,{enumerable:!0,configurable:!0,value:v.newValue,writable:!0}):h[v.name]=v.newValue},d=function(h,v){if(v==="__proto__")if(e.call(h,v)){if(l)return l(h,v).value}else return;return h[v]};return Hh=function p(){var h,v,x,b,y,k,j=arguments[0],T=1,C=arguments.length,R=!1;for(typeof j=="boolean"&&(R=j,j=arguments[1]||{},T=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});Tf.length;let p;d&&f.push(s);try{p=e.apply(this,f)}catch(h){const v=h;if(d&&a)throw v;return s(v)}d||(p&&p.then&&typeof p.then=="function"?p.then(c,s):p instanceof Error?s(p):c(p))}function s(f,...d){a||(a=!0,r(f,...d))}function c(f){s(null,f)}}const Mr={basename:R4,dirname:D4,extname:O4,join:z4,sep:"/"};function R4(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');vs(e);let a=0,l=-1,s=e.length,c;if(r===void 0||r.length===0||r.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(c){a=s+1;break}}else l<0&&(c=!0,l=s+1);return l<0?"":e.slice(a,l)}if(r===e)return"";let f=-1,d=r.length-1;for(;s--;)if(e.codePointAt(s)===47){if(c){a=s+1;break}}else f<0&&(c=!0,f=s+1),d>-1&&(e.codePointAt(s)===r.codePointAt(d--)?d<0&&(l=s):(d=-1,l=f));return a===l?l=f:l<0&&(l=e.length),e.slice(a,l)}function D4(e){if(vs(e),e.length===0)return".";let r=-1,a=e.length,l;for(;--a;)if(e.codePointAt(a)===47){if(l){r=a;break}}else l||(l=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function O4(e){vs(e);let r=e.length,a=-1,l=0,s=-1,c=0,f;for(;r--;){const d=e.codePointAt(r);if(d===47){if(f){l=r+1;break}continue}a<0&&(f=!0,a=r+1),d===46?s<0?s=r:c!==1&&(c=1):s>-1&&(c=-1)}return s<0||a<0||c===0||c===1&&s===a-1&&s===l+1?"":e.slice(s,a)}function z4(...e){let r=-1,a;for(;++r0&&e.codePointAt(e.length-1)===47&&(a+="/"),r?"/"+a:a}function U4(e,r){let a="",l=0,s=-1,c=0,f=-1,d,p;for(;++f<=e.length;){if(f2){if(p=a.lastIndexOf("/"),p!==a.length-1){p<0?(a="",l=0):(a=a.slice(0,p),l=a.length-1-a.lastIndexOf("/")),s=f,c=0;continue}}else if(a.length>0){a="",l=0,s=f,c=0;continue}}r&&(a=a.length>0?a+"/..":"..",l=2)}else a.length>0?a+="/"+e.slice(s+1,f):a=e.slice(s+1,f),l=f-s-1;s=f,c=0}else d===46&&c>-1?c++:c=-1}return a}function vs(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const B4={cwd:I4};function I4(){return"/"}function Cm(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function H4(e){if(typeof e=="string")e=new URL(e);else if(!Cm(e)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(e.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return q4(e)}function q4(e){if(e.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const r=e.pathname;let a=-1;for(;++a0){let[y,...k]=v;const j=l[b][1];km(j)&&km(y)&&(y=qh(!0,j,y)),l[b]=[h,y,...k]}}}}const V4=new jp().freeze();function Vh(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Gh(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Yh(e,r){if(r)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function s0(e){if(!km(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function u0(e,r,a){if(!a)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Qu(e){return G4(e)?e:new ZS(e)}function G4(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Y4(e){return typeof e=="string"||X4(e)}function X4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const K4="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",c0=[],f0={allowDangerousHtml:!0},Q4=/^(https?|ircs?|mailto|xmpp)$/i,Z4=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function J4(e){const r=W4(e),a=e3(e);return t3(r.runSync(r.parse(a),a),e)}function W4(e){const r=e.rehypePlugins||c0,a=e.remarkPlugins||c0,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...f0}:f0;return V4().use(Dz).use(a).use(N4,l).use(r)}function e3(e){const r=e.children||"",a=new ZS;return typeof r=="string"&&(a.value=r),a}function t3(e,r){const a=r.allowedElements,l=r.allowElement,s=r.components,c=r.disallowedElements,f=r.skipHtml,d=r.unwrapDisallowed,p=r.urlTransform||n3;for(const v of Z4)Object.hasOwn(r,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+K4+v.id,void 0);return Sp(e,h),gD(e,{Fragment:u.Fragment,components:s,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function h(v,x,b){if(v.type==="raw"&&b&&typeof x=="number")return f?b.children.splice(x,1):b.children[x]={type:"text",value:v.value},x;if(v.type==="element"){let y;for(y in Uh)if(Object.hasOwn(Uh,y)&&Object.hasOwn(v.properties,y)){const k=v.properties[y],j=Uh[y];(j===null||j.includes(v.tagName))&&(v.properties[y]=p(String(k||""),y,v))}}if(v.type==="element"){let y=a?!a.includes(v.tagName):c?c.includes(v.tagName):!1;if(!y&&l&&typeof x=="number"&&(y=!l(v,x,b)),y&&b&&typeof x=="number")return d&&v.children?b.children.splice(x,1,...v.children):b.children.splice(x,1),x}}}function n3(e){const r=e.indexOf(":"),a=e.indexOf("?"),l=e.indexOf("#"),s=e.indexOf("/");return r===-1||s!==-1&&r>s||a!==-1&&r>a||l!==-1&&r>l||Q4.test(e.slice(0,r))?e:""}function r3(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function JS(e,r,a){const s=$c((a||{}).ignore||[]),c=a3(r);let f=-1;for(;++f0?{type:"text",value:_}:void 0),_===!1?b.lastIndex=B+1:(k!==B&&R.push({type:"text",value:h.value.slice(k,B)}),Array.isArray(_)?R.push(..._):_&&R.push(_),k=B+D[0].length,C=!0),!b.global)break;D=b.exec(h.value)}return C?(k?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let a=r[0],l=a.indexOf(")");const s=d0(e,"(");let c=d0(e,")");for(;l!==-1&&s>c;)e+=a.slice(0,l+1),a=a.slice(l+1),l=a.indexOf(")"),c++;return[e,a]}function WS(e,r){const a=e.input.charCodeAt(e.index-1);return(e.index===0||Gl(a)||Hc(a))&&(!r||a!==47)}ej.peek=_3;function S3(){this.buffer()}function j3(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function k3(){this.buffer()}function C3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function E3(e){const r=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=xr(this.sliceSerialize(e)).toLowerCase(),a.label=r}function N3(e){this.exit(e)}function T3(e){const r=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=xr(this.sliceSerialize(e)).toLowerCase(),a.label=r}function A3(e){this.exit(e)}function _3(){return"["}function ej(e,r,a,l){const s=a.createTracker(l);let c=s.move("[^");const f=a.enter("footnoteReference"),d=a.enter("reference");return c+=s.move(a.safe(a.associationId(e),{after:"]",before:c})),d(),f(),c+=s.move("]"),c}function M3(){return{enter:{gfmFootnoteCallString:S3,gfmFootnoteCall:j3,gfmFootnoteDefinitionLabelString:k3,gfmFootnoteDefinition:C3},exit:{gfmFootnoteCallString:E3,gfmFootnoteCall:N3,gfmFootnoteDefinitionLabelString:T3,gfmFootnoteDefinition:A3}}}function R3(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:a,footnoteReference:ej},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(l,s,c,f){const d=c.createTracker(f);let p=d.move("[^");const h=c.enter("footnoteDefinition"),v=c.enter("label");return p+=d.move(c.safe(c.associationId(l),{before:p,after:"]"})),v(),p+=d.move("]:"),l.children&&l.children.length>0&&(d.shift(4),p+=d.move((r?` -`:" ")+c.indentLines(c.containerFlow(l,d.current()),r?tj:D3))),h(),p}}function D3(e,r,a){return r===0?e:tj(e,r,a)}function tj(e,r,a){return(a?"":" ")+e}const O3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];nj.peek=I3;function z3(){return{canContainEols:["delete"],enter:{strikethrough:U3},exit:{strikethrough:B3}}}function L3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:O3}],handlers:{delete:nj}}}function U3(e){this.enter({type:"delete",children:[]},e)}function B3(e){this.exit(e)}function nj(e,r,a,l){const s=a.createTracker(l),c=a.enter("strikethrough");let f=s.move("~~");return f+=a.containerPhrasing(e,{...s.current(),before:f,after:"~"}),f+=s.move("~~"),c(),f}function I3(){return"~"}function H3(e){return e.length}function q3(e,r){const a=r||{},l=(a.align||[]).concat(),s=a.stringLength||H3,c=[],f=[],d=[],p=[];let h=0,v=-1;for(;++vh&&(h=e[v].length);++Cp[C])&&(p[C]=D)}j.push(R)}f[v]=j,d[v]=T}let x=-1;if(typeof l=="object"&&"length"in l)for(;++xp[x]&&(p[x]=R),y[x]=R),b[x]=D}f.splice(1,0,b),d.splice(1,0,y),v=-1;const k=[];for(;++v "),c.shift(2);const f=a.indentLines(a.containerFlow(e,c.current()),F3);return s(),f}function F3(e,r,a){return">"+(a?"":" ")+e}function V3(e,r){return m0(e,r.inConstruct,!0)&&!m0(e,r.notInConstruct,!1)}function m0(e,r,a){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return a;let l=-1;for(;++lf&&(f=c):c=1,s=l+r.length,l=a.indexOf(r,s);return f}function Y3(e,r){return!!(r.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function X3(e){const r=e.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function K3(e,r,a,l){const s=X3(a),c=e.value||"",f=s==="`"?"GraveAccent":"Tilde";if(Y3(e,a)){const x=a.enter("codeIndented"),b=a.indentLines(c,Q3);return x(),b}const d=a.createTracker(l),p=s.repeat(Math.max(G3(c,s)+1,3)),h=a.enter("codeFenced");let v=d.move(p);if(e.lang){const x=a.enter(`codeFencedLang${f}`);v+=d.move(a.safe(e.lang,{before:v,after:" ",encode:["`"],...d.current()})),x()}if(e.lang&&e.meta){const x=a.enter(`codeFencedMeta${f}`);v+=d.move(" "),v+=d.move(a.safe(e.meta,{before:v,after:` -`,encode:["`"],...d.current()})),x()}return v+=d.move(` -`),c&&(v+=d.move(c+` -`)),v+=d.move(p),h(),v}function Q3(e,r,a){return(a?"":" ")+e}function kp(e){const r=e.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function Z3(e,r,a,l){const s=kp(a),c=s==='"'?"Quote":"Apostrophe",f=a.enter("definition");let d=a.enter("label");const p=a.createTracker(l);let h=p.move("[");return h+=p.move(a.safe(a.associationId(e),{before:h,after:"]",...p.current()})),h+=p.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=a.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(a.safe(e.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(d=a.enter("destinationRaw"),h+=p.move(a.safe(e.url,{before:h,after:e.title?" ":` -`,...p.current()}))),d(),e.title&&(d=a.enter(`title${c}`),h+=p.move(" "+s),h+=p.move(a.safe(e.title,{before:h,after:s,...p.current()})),h+=p.move(s),d()),f(),h}function J3(e){const r=e.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function fs(e){return"&#x"+e.toString(16).toUpperCase()+";"}function hc(e,r,a){const l=Yi(e),s=Yi(r);return l===void 0?s===void 0?a==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:l===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}rj.peek=W3;function rj(e,r,a,l){const s=J3(a),c=a.enter("emphasis"),f=a.createTracker(l),d=f.move(s);let p=f.move(a.containerPhrasing(e,{after:s,before:d,...f.current()}));const h=p.charCodeAt(0),v=hc(l.before.charCodeAt(l.before.length-1),h,s);v.inside&&(p=fs(h)+p.slice(1));const x=p.charCodeAt(p.length-1),b=hc(l.after.charCodeAt(0),x,s);b.inside&&(p=p.slice(0,-1)+fs(x));const y=f.move(s);return c(),a.attentionEncodeSurroundingInfo={after:b.outside,before:v.outside},d+p+y}function W3(e,r,a){return a.options.emphasis||"*"}function e5(e,r){let a=!1;return Sp(e,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return a=!0,Sm}),!!((!e.depth||e.depth<3)&&pp(e)&&(r.options.setext||a))}function t5(e,r,a,l){const s=Math.max(Math.min(6,e.depth||1),1),c=a.createTracker(l);if(e5(e,a)){const v=a.enter("headingSetext"),x=a.enter("phrasing"),b=a.containerPhrasing(e,{...c.current(),before:` -`,after:` -`});return x(),v(),b+` -`+(s===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(` -`))+1))}const f="#".repeat(s),d=a.enter("headingAtx"),p=a.enter("phrasing");c.move(f+" ");let h=a.containerPhrasing(e,{before:"# ",after:` -`,...c.current()});return/^[\t ]/.test(h)&&(h=fs(h.charCodeAt(0))+h.slice(1)),h=h?f+" "+h:f,a.options.closeAtx&&(h+=" "+f),p(),d(),h}aj.peek=n5;function aj(e){return e.value||""}function n5(){return"<"}lj.peek=r5;function lj(e,r,a,l){const s=kp(a),c=s==='"'?"Quote":"Apostrophe",f=a.enter("image");let d=a.enter("label");const p=a.createTracker(l);let h=p.move("![");return h+=p.move(a.safe(e.alt,{before:h,after:"]",...p.current()})),h+=p.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=a.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(a.safe(e.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(d=a.enter("destinationRaw"),h+=p.move(a.safe(e.url,{before:h,after:e.title?" ":")",...p.current()}))),d(),e.title&&(d=a.enter(`title${c}`),h+=p.move(" "+s),h+=p.move(a.safe(e.title,{before:h,after:s,...p.current()})),h+=p.move(s),d()),h+=p.move(")"),f(),h}function r5(){return"!"}ij.peek=a5;function ij(e,r,a,l){const s=e.referenceType,c=a.enter("imageReference");let f=a.enter("label");const d=a.createTracker(l);let p=d.move("![");const h=a.safe(e.alt,{before:p,after:"]",...d.current()});p+=d.move(h+"]["),f();const v=a.stack;a.stack=[],f=a.enter("reference");const x=a.safe(a.associationId(e),{before:p,after:"]",...d.current()});return f(),a.stack=v,c(),s==="full"||!h||h!==x?p+=d.move(x+"]"):s==="shortcut"?p=p.slice(0,-1):p+=d.move("]"),p}function a5(){return"!"}oj.peek=l5;function oj(e,r,a){let l=e.value||"",s="`",c=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(l);)s+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++c\u007F]/.test(e.url))}uj.peek=i5;function uj(e,r,a,l){const s=kp(a),c=s==='"'?"Quote":"Apostrophe",f=a.createTracker(l);let d,p;if(sj(e,a)){const v=a.stack;a.stack=[],d=a.enter("autolink");let x=f.move("<");return x+=f.move(a.containerPhrasing(e,{before:x,after:">",...f.current()})),x+=f.move(">"),d(),a.stack=v,x}d=a.enter("link"),p=a.enter("label");let h=f.move("[");return h+=f.move(a.containerPhrasing(e,{before:h,after:"](",...f.current()})),h+=f.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=a.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(a.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(p=a.enter("destinationRaw"),h+=f.move(a.safe(e.url,{before:h,after:e.title?" ":")",...f.current()}))),p(),e.title&&(p=a.enter(`title${c}`),h+=f.move(" "+s),h+=f.move(a.safe(e.title,{before:h,after:s,...f.current()})),h+=f.move(s),p()),h+=f.move(")"),d(),h}function i5(e,r,a){return sj(e,a)?"<":"["}cj.peek=o5;function cj(e,r,a,l){const s=e.referenceType,c=a.enter("linkReference");let f=a.enter("label");const d=a.createTracker(l);let p=d.move("[");const h=a.containerPhrasing(e,{before:p,after:"]",...d.current()});p+=d.move(h+"]["),f();const v=a.stack;a.stack=[],f=a.enter("reference");const x=a.safe(a.associationId(e),{before:p,after:"]",...d.current()});return f(),a.stack=v,c(),s==="full"||!h||h!==x?p+=d.move(x+"]"):s==="shortcut"?p=p.slice(0,-1):p+=d.move("]"),p}function o5(){return"["}function Cp(e){const r=e.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function s5(e){const r=Cp(e),a=e.options.bulletOther;if(!a)return r==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+a+"`) to be different");return a}function u5(e){const r=e.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function fj(e){const r=e.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function c5(e,r,a,l){const s=a.enter("list"),c=a.bulletCurrent;let f=e.ordered?u5(a):Cp(a);const d=e.ordered?f==="."?")":".":s5(a);let p=r&&a.bulletLastUsed?f===a.bulletLastUsed:!1;if(!e.ordered){const v=e.children?e.children[0]:void 0;if((f==="*"||f==="-")&&v&&(!v.children||!v.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(p=!0),fj(a)===f&&v){let x=-1;for(;++x-1?r.start:1)+(a.options.incrementListMarker===!1?0:r.children.indexOf(e))+c);let f=c.length+1;(s==="tab"||s==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(f=Math.ceil(f/4)*4);const d=a.createTracker(l);d.move(c+" ".repeat(f-c.length)),d.shift(f);const p=a.enter("listItem"),h=a.indentLines(a.containerFlow(e,d.current()),v);return p(),h;function v(x,b,y){return b?(y?"":" ".repeat(f))+x:(y?c:c+" ".repeat(f-c.length))+x}}function h5(e,r,a,l){const s=a.enter("paragraph"),c=a.enter("phrasing"),f=a.containerPhrasing(e,l);return c(),s(),f}const m5=$c(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function p5(e,r,a,l){return(e.children.some(function(f){return m5(f)})?a.containerPhrasing:a.containerFlow).call(a,e,l)}function g5(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}dj.peek=x5;function dj(e,r,a,l){const s=g5(a),c=a.enter("strong"),f=a.createTracker(l),d=f.move(s+s);let p=f.move(a.containerPhrasing(e,{after:s,before:d,...f.current()}));const h=p.charCodeAt(0),v=hc(l.before.charCodeAt(l.before.length-1),h,s);v.inside&&(p=fs(h)+p.slice(1));const x=p.charCodeAt(p.length-1),b=hc(l.after.charCodeAt(0),x,s);b.inside&&(p=p.slice(0,-1)+fs(x));const y=f.move(s+s);return c(),a.attentionEncodeSurroundingInfo={after:b.outside,before:v.outside},d+p+y}function x5(e,r,a){return a.options.strong||"*"}function v5(e,r,a,l){return a.safe(e.value,l)}function y5(e){const r=e.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function b5(e,r,a){const l=(fj(a)+(a.options.ruleSpaces?" ":"")).repeat(y5(a));return a.options.ruleSpaces?l.slice(0,-1):l}const hj={blockquote:$3,break:p0,code:K3,definition:Z3,emphasis:rj,hardBreak:p0,heading:t5,html:aj,image:lj,imageReference:ij,inlineCode:oj,link:uj,linkReference:cj,list:c5,listItem:d5,paragraph:h5,root:p5,strong:dj,text:v5,thematicBreak:b5};function w5(){return{enter:{table:S5,tableData:g0,tableHeader:g0,tableRow:k5},exit:{codeText:C5,table:j5,tableData:Zh,tableHeader:Zh,tableRow:Zh}}}function S5(e){const r=e._align;this.enter({type:"table",align:r.map(function(a){return a==="none"?null:a}),children:[]},e),this.data.inTable=!0}function j5(e){this.exit(e),this.data.inTable=void 0}function k5(e){this.enter({type:"tableRow",children:[]},e)}function Zh(e){this.exit(e)}function g0(e){this.enter({type:"tableCell",children:[]},e)}function C5(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,E5));const a=this.stack[this.stack.length-1];a.type,a.value=r,this.exit(e)}function E5(e,r){return r==="|"?r:e}function N5(e){const r=e||{},a=r.tableCellPadding,l=r.tablePipeAlign,s=r.stringLength,c=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` -`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:f,tableCell:p,tableRow:d}};function f(y,k,j,T){return h(v(y,j,T),y.align)}function d(y,k,j,T){const C=x(y,j,T),R=h([C]);return R.slice(0,R.indexOf(` -`))}function p(y,k,j,T){const C=j.enter("tableCell"),R=j.enter("phrasing"),D=j.containerPhrasing(y,{...T,before:c,after:c});return R(),C(),D}function h(y,k){return q3(y,{align:k,alignDelimiters:l,padding:a,stringLength:s})}function v(y,k,j){const T=y.children;let C=-1;const R=[],D=k.enter("table");for(;++C0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const V5={tokenize:W5,partial:!0};function G5(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Q5,continuation:{tokenize:Z5},exit:J5}},text:{91:{name:"gfmFootnoteCall",tokenize:K5},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Y5,resolveTo:X5}}}}function Y5(e,r,a){const l=this;let s=l.events.length;const c=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let f;for(;s--;){const p=l.events[s][1];if(p.type==="labelImage"){f=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return d;function d(p){if(!f||!f._balanced)return a(p);const h=xr(l.sliceSerialize({start:f.end,end:l.now()}));return h.codePointAt(0)!==94||!c.includes(h.slice(1))?a(p):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),r(p))}}function X5(e,r){let a=e.length;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";const l={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},f={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},d=[e[a+1],e[a+2],["enter",l,r],e[a+3],e[a+4],["enter",s,r],["exit",s,r],["enter",c,r],["enter",f,r],["exit",f,r],["exit",c,r],e[e.length-2],e[e.length-1],["exit",l,r]];return e.splice(a,e.length-a+1,...d),e}function K5(e,r,a){const l=this,s=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let c=0,f;return d;function d(x){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),p}function p(x){return x!==94?a(x):(e.enter("gfmFootnoteCallMarker"),e.consume(x),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(x){if(c>999||x===93&&!f||x===null||x===91||kt(x))return a(x);if(x===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return s.includes(xr(l.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):a(x)}return kt(x)||(f=!0),c++,e.consume(x),x===92?v:h}function v(x){return x===91||x===92||x===93?(e.consume(x),c++,h):h(x)}}function Q5(e,r,a){const l=this,s=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let c,f=0,d;return p;function p(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",v):a(k)}function v(k){if(f>999||k===93&&!d||k===null||k===91||kt(k))return a(k);if(k===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return c=xr(l.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return kt(k)||(d=!0),f++,e.consume(k),k===92?x:v}function x(k){return k===91||k===92||k===93?(e.consume(k),f++,v):v(k)}function b(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),s.includes(c)||s.push(c),ot(e,y,"gfmFootnoteDefinitionWhitespace")):a(k)}function y(k){return r(k)}}function Z5(e,r,a){return e.check(xs,r,e.attempt(V5,r,a))}function J5(e){e.exit("gfmFootnoteDefinition")}function W5(e,r,a){const l=this;return ot(e,s,"gfmFootnoteDefinitionIndent",5);function s(c){const f=l.events[l.events.length-1];return f&&f[1].type==="gfmFootnoteDefinitionIndent"&&f[2].sliceSerialize(f[1],!0).length===4?r(c):a(c)}}function e6(e){let a=(e||{}).singleTilde;const l={name:"strikethrough",tokenize:c,resolveAll:s};return a==null&&(a=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function s(f,d){let p=-1;for(;++p1?p(k):(f.consume(k),x++,y);if(x<2&&!a)return p(k);const T=f.exit("strikethroughSequenceTemporary"),C=Yi(k);return T._open=!C||C===2&&!!j,T._close=!j||j===2&&!!C,d(k)}}}class t6{constructor(){this.map=[]}add(r,a,l){n6(this,r,a,l)}consume(r){if(this.map.sort(function(c,f){return c[0]-f[0]}),this.map.length===0)return;let a=this.map.length;const l=[];for(;a>0;)a-=1,l.push(r.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),r.length=this.map[a][0];l.push(r.slice()),r.length=0;let s=l.pop();for(;s;){for(const c of s)r.push(c);s=l.pop()}this.map.length=0}}function n6(e,r,a,l){let s=0;if(!(a===0&&l.length===0)){for(;s-1;){const le=l.events[$][1].type;if(le==="lineEnding"||le==="linePrefix")$--;else break}const X=$>-1?l.events[$][1].type:null,ce=X==="tableHead"||X==="tableRow"?_:p;return ce===_&&l.parser.lazy[l.now().line]?a(q):ce(q)}function p(q){return e.enter("tableHead"),e.enter("tableRow"),h(q)}function h(q){return q===124||(f=!0,c+=1),v(q)}function v(q){return q===null?a(q):Oe(q)?c>1?(c=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(q),e.exit("lineEnding"),y):a(q):Je(q)?ot(e,v,"whitespace")(q):(c+=1,f&&(f=!1,s+=1),q===124?(e.enter("tableCellDivider"),e.consume(q),e.exit("tableCellDivider"),f=!0,v):(e.enter("data"),x(q)))}function x(q){return q===null||q===124||kt(q)?(e.exit("data"),v(q)):(e.consume(q),q===92?b:x)}function b(q){return q===92||q===124?(e.consume(q),x):x(q)}function y(q){return l.interrupt=!1,l.parser.lazy[l.now().line]?a(q):(e.enter("tableDelimiterRow"),f=!1,Je(q)?ot(e,k,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):k(q))}function k(q){return q===45||q===58?T(q):q===124?(f=!0,e.enter("tableCellDivider"),e.consume(q),e.exit("tableCellDivider"),j):O(q)}function j(q){return Je(q)?ot(e,T,"whitespace")(q):T(q)}function T(q){return q===58?(c+=1,f=!0,e.enter("tableDelimiterMarker"),e.consume(q),e.exit("tableDelimiterMarker"),C):q===45?(c+=1,C(q)):q===null||Oe(q)?B(q):O(q)}function C(q){return q===45?(e.enter("tableDelimiterFiller"),R(q)):O(q)}function R(q){return q===45?(e.consume(q),R):q===58?(f=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(q),e.exit("tableDelimiterMarker"),D):(e.exit("tableDelimiterFiller"),D(q))}function D(q){return Je(q)?ot(e,B,"whitespace")(q):B(q)}function B(q){return q===124?k(q):q===null||Oe(q)?!f||s!==c?O(q):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(q)):O(q)}function O(q){return a(q)}function _(q){return e.enter("tableRow"),A(q)}function A(q){return q===124?(e.enter("tableCellDivider"),e.consume(q),e.exit("tableCellDivider"),A):q===null||Oe(q)?(e.exit("tableRow"),r(q)):Je(q)?ot(e,A,"whitespace")(q):(e.enter("data"),I(q))}function I(q){return q===null||q===124||kt(q)?(e.exit("data"),A(q)):(e.consume(q),q===92?ee:I)}function ee(q){return q===92||q===124?(e.consume(q),I):I(q)}}function i6(e,r){let a=-1,l=!0,s=0,c=[0,0,0,0],f=[0,0,0,0],d=!1,p=0,h,v,x;const b=new t6;for(;++aa[2]+1){const k=a[2]+1,j=a[3]-a[2]-1;e.add(k,j,[])}}e.add(a[3]+1,0,[["exit",x,r]])}return s!==void 0&&(c.end=Object.assign({},Pi(r.events,s)),e.add(s,0,[["exit",c,r]]),c=void 0),c}function v0(e,r,a,l,s){const c=[],f=Pi(r.events,a);s&&(s.end=Object.assign({},f),c.push(["exit",s,r])),l.end=Object.assign({},f),c.push(["exit",l,r]),e.add(a+1,0,c)}function Pi(e,r){const a=e[r],l=a[0]==="enter"?"start":"end";return a[1][l]}const o6={name:"tasklistCheck",tokenize:u6};function s6(){return{text:{91:o6}}}function u6(e,r,a){const l=this;return s;function s(p){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?a(p):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),c)}function c(p){return kt(p)?(e.enter("taskListCheckValueUnchecked"),e.consume(p),e.exit("taskListCheckValueUnchecked"),f):p===88||p===120?(e.enter("taskListCheckValueChecked"),e.consume(p),e.exit("taskListCheckValueChecked"),f):a(p)}function f(p){return p===93?(e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):a(p)}function d(p){return Oe(p)?r(p):Je(p)?e.check({tokenize:c6},r,a)(p):a(p)}}function c6(e,r,a){return ot(e,l,"whitespace");function l(s){return s===null?a(s):r(s)}}function f6(e){return _S([L5(),G5(),e6(e),a6(),s6()])}const d6={};function h6(e){const r=this,a=e||d6,l=r.data(),s=l.micromarkExtensions||(l.micromarkExtensions=[]),c=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),f=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);s.push(f6(a)),c.push(R5()),f.push(D5(a))}const m6={a:({children:e,...r})=>u.jsx("a",{...r,target:"_blank",rel:"noopener noreferrer",children:e}),img:({alt:e})=>u.jsx("span",{className:"text-muted-foreground",children:e||"(image)"})};function p6({text:e,className:r}){return u.jsx("div",{className:_e("chat-markdown",r),children:u.jsx(J4,{remarkPlugins:[h6,u3],components:m6,children:e})})}function g6({className:e,...r}){return u.jsx("textarea",{"data-slot":"textarea",className:_e("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...r})}var Nm=["Enter"," "],x6=["ArrowDown","PageUp","Home"],Sj=["ArrowUp","PageDown","End"],v6=[...x6,...Sj],y6={ltr:[...Nm,"ArrowRight"],rtl:[...Nm,"ArrowLeft"]},b6={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ys="Menu",[ds,w6,S6]=Fm(ys),[Kl,jj]=vr(ys,[S6,Dc,Bc]),Vc=Dc(),kj=Bc(),[j6,Ql]=Kl(ys),[k6,bs]=Kl(ys),Cj=e=>{const{__scopeMenu:r,open:a=!1,children:l,dir:s,onOpenChange:c,modal:f=!0}=e,d=Vc(r),[p,h]=S.useState(null),v=S.useRef(!1),x=sr(c),b=Nc(s);return S.useEffect(()=>{const y=()=>{v.current=!0,document.addEventListener("pointerdown",k,{capture:!0,once:!0}),document.addEventListener("pointermove",k,{capture:!0,once:!0})},k=()=>v.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",k,{capture:!0}),document.removeEventListener("pointermove",k,{capture:!0})}},[]),u.jsx(uw,{...d,children:u.jsx(j6,{scope:r,open:a,onOpenChange:x,content:p,onContentChange:h,children:u.jsx(k6,{scope:r,onClose:S.useCallback(()=>x(!1),[x]),isUsingKeyboardRef:v,dir:b,modal:f,children:l})})})};Cj.displayName=ys;var C6="MenuAnchor",Np=S.forwardRef((e,r)=>{const{__scopeMenu:a,...l}=e,s=Vc(a);return u.jsx(cw,{...s,...l,ref:r})});Np.displayName=C6;var Tp="MenuPortal",[E6,Ej]=Kl(Tp,{forceMount:void 0}),Nj=e=>{const{__scopeMenu:r,forceMount:a,children:l,container:s}=e,c=Ql(Tp,r);return u.jsx(E6,{scope:r,forceMount:a,children:u.jsx(Ir,{present:a||c.open,children:u.jsx(jc,{asChild:!0,container:s,children:l})})})};Nj.displayName=Tp;var or="MenuContent",[N6,Ap]=Kl(or),Tj=S.forwardRef((e,r)=>{const a=Ej(or,e.__scopeMenu),{forceMount:l=a.forceMount,...s}=e,c=Ql(or,e.__scopeMenu),f=bs(or,e.__scopeMenu);return u.jsx(ds.Provider,{scope:e.__scopeMenu,children:u.jsx(Ir,{present:l||c.open,children:u.jsx(ds.Slot,{scope:e.__scopeMenu,children:f.modal?u.jsx(T6,{...s,ref:r}):u.jsx(A6,{...s,ref:r})})})})}),T6=S.forwardRef((e,r)=>{const a=Ql(or,e.__scopeMenu),l=S.useRef(null),s=dt(r,l);return S.useEffect(()=>{const c=l.current;if(c)return Bm(c)},[]),u.jsx(_p,{...e,ref:s,trapFocus:a.open,disableOutsidePointerEvents:a.open,disableOutsideScroll:!0,onFocusOutside:Te(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>a.onOpenChange(!1)})}),A6=S.forwardRef((e,r)=>{const a=Ql(or,e.__scopeMenu);return u.jsx(_p,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>a.onOpenChange(!1)})}),_p=S.forwardRef((e,r)=>{const{__scopeMenu:a,loop:l=!1,trapFocus:s,onOpenAutoFocus:c,onCloseAutoFocus:f,disableOutsidePointerEvents:d,onEntryFocus:p,onEscapeKeyDown:h,onPointerDownOutside:v,onFocusOutside:x,onInteractOutside:b,onDismiss:y,disableOutsideScroll:k,...j}=e,T=Ql(or,a),C=bs(or,a),R=Vc(a),D=kj(a),B=w6(a),[O,_]=S.useState(null),A=S.useRef(null),I=dt(r,A,T.onContentChange),ee=S.useRef(0),q=S.useRef(""),$=S.useRef(0),X=S.useRef(null),ce=S.useRef("right"),le=S.useRef(0),W=k?Cc:S.Fragment,U=k?{as:fa,allowPinchZoom:!0}:void 0,Z=K=>{var re,ye;const E=q.current+K,L=B().filter(fe=>!fe.disabled),F=document.activeElement,M=(re=L.find(fe=>fe.ref.current===F))==null?void 0:re.textValue,oe=L.map(fe=>fe.textValue),G=q6(oe,E,M),ue=(ye=L.find(fe=>fe.textValue===G))==null?void 0:ye.ref.current;(function fe(be){q.current=be,window.clearTimeout(ee.current),be!==""&&(ee.current=window.setTimeout(()=>fe(""),1e3))})(E),ue&&setTimeout(()=>ue.focus())};S.useEffect(()=>()=>window.clearTimeout(ee.current),[]),Um();const ie=S.useCallback(K=>{var L,F;return ce.current===((L=X.current)==null?void 0:L.side)&&$6(K,(F=X.current)==null?void 0:F.area)},[]);return u.jsx(N6,{scope:a,searchRef:q,onItemEnter:S.useCallback(K=>{ie(K)&&K.preventDefault()},[ie]),onItemLeave:S.useCallback(K=>{var E;ie(K)||((E=A.current)==null||E.focus(),_(null))},[ie]),onTriggerLeave:S.useCallback(K=>{ie(K)&&K.preventDefault()},[ie]),pointerGraceTimerRef:$,onPointerGraceIntentChange:S.useCallback(K=>{X.current=K},[]),children:u.jsx(W,{...U,children:u.jsx(Sc,{asChild:!0,trapped:s,onMountAutoFocus:Te(c,K=>{var E;K.preventDefault(),(E=A.current)==null||E.focus({preventScroll:!0})}),onUnmountAutoFocus:f,children:u.jsx(wc,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:h,onPointerDownOutside:v,onFocusOutside:x,onInteractOutside:b,onDismiss:y,children:u.jsx(aS,{asChild:!0,...D,dir:C.dir,orientation:"vertical",loop:l,currentTabStopId:O,onCurrentTabStopIdChange:_,onEntryFocus:Te(p,K=>{C.isUsingKeyboardRef.current||K.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(fw,{role:"menu","aria-orientation":"vertical","data-state":Fj(T.open),"data-radix-menu-content":"",dir:C.dir,...R,...j,ref:I,style:{outline:"none",...j.style},onKeyDown:Te(j.onKeyDown,K=>{const L=K.target.closest("[data-radix-menu-content]")===K.currentTarget,F=K.ctrlKey||K.altKey||K.metaKey,M=K.key.length===1;L&&(K.key==="Tab"&&K.preventDefault(),!F&&M&&Z(K.key));const oe=A.current;if(K.target!==oe||!v6.includes(K.key))return;K.preventDefault();const ue=B().filter(re=>!re.disabled).map(re=>re.ref.current);Sj.includes(K.key)&&ue.reverse(),I6(ue)}),onBlur:Te(e.onBlur,K=>{K.currentTarget.contains(K.target)||(window.clearTimeout(ee.current),q.current="")}),onPointerMove:Te(e.onPointerMove,hs(K=>{const E=K.target,L=le.current!==K.clientX;if(K.currentTarget.contains(E)&&L){const F=K.clientX>le.current?"right":"left";ce.current=F,le.current=K.clientX}}))})})})})})})});Tj.displayName=or;var _6="MenuGroup",Mp=S.forwardRef((e,r)=>{const{__scopeMenu:a,...l}=e;return u.jsx(Ge.div,{role:"group",...l,ref:r})});Mp.displayName=_6;var M6="MenuLabel",Aj=S.forwardRef((e,r)=>{const{__scopeMenu:a,...l}=e;return u.jsx(Ge.div,{...l,ref:r})});Aj.displayName=M6;var mc="MenuItem",y0="menu.itemSelect",Gc=S.forwardRef((e,r)=>{const{disabled:a=!1,onSelect:l,...s}=e,c=S.useRef(null),f=bs(mc,e.__scopeMenu),d=Ap(mc,e.__scopeMenu),p=dt(r,c),h=S.useRef(!1),v=()=>{const x=c.current;if(!a&&x){const b=new CustomEvent(y0,{bubbles:!0,cancelable:!0});x.addEventListener(y0,y=>l==null?void 0:l(y),{once:!0}),Y0(x,b),b.defaultPrevented?h.current=!1:f.onClose()}};return u.jsx(_j,{...s,ref:p,disabled:a,onClick:Te(e.onClick,v),onPointerDown:x=>{var b;(b=e.onPointerDown)==null||b.call(e,x),h.current=!0},onPointerUp:Te(e.onPointerUp,x=>{var b;h.current||(b=x.currentTarget)==null||b.click()}),onKeyDown:Te(e.onKeyDown,x=>{const b=d.searchRef.current!=="";a||b&&x.key===" "||Nm.includes(x.key)&&(x.currentTarget.click(),x.preventDefault())})})});Gc.displayName=mc;var _j=S.forwardRef((e,r)=>{const{__scopeMenu:a,disabled:l=!1,textValue:s,...c}=e,f=Ap(mc,a),d=kj(a),p=S.useRef(null),h=dt(r,p),[v,x]=S.useState(!1),[b,y]=S.useState("");return S.useEffect(()=>{const k=p.current;k&&y((k.textContent??"").trim())},[c.children]),u.jsx(ds.ItemSlot,{scope:a,disabled:l,textValue:s??b,children:u.jsx(lS,{asChild:!0,...d,focusable:!l,children:u.jsx(Ge.div,{role:"menuitem","data-highlighted":v?"":void 0,"aria-disabled":l||void 0,"data-disabled":l?"":void 0,...c,ref:h,onPointerMove:Te(e.onPointerMove,hs(k=>{l?f.onItemLeave(k):(f.onItemEnter(k),k.defaultPrevented||k.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Te(e.onPointerLeave,hs(k=>f.onItemLeave(k))),onFocus:Te(e.onFocus,()=>x(!0)),onBlur:Te(e.onBlur,()=>x(!1))})})})}),R6="MenuCheckboxItem",Mj=S.forwardRef((e,r)=>{const{checked:a=!1,onCheckedChange:l,...s}=e;return u.jsx(Lj,{scope:e.__scopeMenu,checked:a,children:u.jsx(Gc,{role:"menuitemcheckbox","aria-checked":pc(a)?"mixed":a,...s,ref:r,"data-state":Dp(a),onSelect:Te(s.onSelect,()=>l==null?void 0:l(pc(a)?!0:!a),{checkForDefaultPrevented:!1})})})});Mj.displayName=R6;var Rj="MenuRadioGroup",[D6,O6]=Kl(Rj,{value:void 0,onValueChange:()=>{}}),Dj=S.forwardRef((e,r)=>{const{value:a,onValueChange:l,...s}=e,c=sr(l);return u.jsx(D6,{scope:e.__scopeMenu,value:a,onValueChange:c,children:u.jsx(Mp,{...s,ref:r})})});Dj.displayName=Rj;var Oj="MenuRadioItem",zj=S.forwardRef((e,r)=>{const{value:a,...l}=e,s=O6(Oj,e.__scopeMenu),c=a===s.value;return u.jsx(Lj,{scope:e.__scopeMenu,checked:c,children:u.jsx(Gc,{role:"menuitemradio","aria-checked":c,...l,ref:r,"data-state":Dp(c),onSelect:Te(l.onSelect,()=>{var f;return(f=s.onValueChange)==null?void 0:f.call(s,a)},{checkForDefaultPrevented:!1})})})});zj.displayName=Oj;var Rp="MenuItemIndicator",[Lj,z6]=Kl(Rp,{checked:!1}),Uj=S.forwardRef((e,r)=>{const{__scopeMenu:a,forceMount:l,...s}=e,c=z6(Rp,a);return u.jsx(Ir,{present:l||pc(c.checked)||c.checked===!0,children:u.jsx(Ge.span,{...s,ref:r,"data-state":Dp(c.checked)})})});Uj.displayName=Rp;var L6="MenuSeparator",Bj=S.forwardRef((e,r)=>{const{__scopeMenu:a,...l}=e;return u.jsx(Ge.div,{role:"separator","aria-orientation":"horizontal",...l,ref:r})});Bj.displayName=L6;var U6="MenuArrow",Ij=S.forwardRef((e,r)=>{const{__scopeMenu:a,...l}=e,s=Vc(a);return u.jsx(dw,{...s,...l,ref:r})});Ij.displayName=U6;var B6="MenuSub",[ZL,Hj]=Kl(B6),ts="MenuSubTrigger",qj=S.forwardRef((e,r)=>{const a=Ql(ts,e.__scopeMenu),l=bs(ts,e.__scopeMenu),s=Hj(ts,e.__scopeMenu),c=Ap(ts,e.__scopeMenu),f=S.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:p}=c,h={__scopeMenu:e.__scopeMenu},v=S.useCallback(()=>{f.current&&window.clearTimeout(f.current),f.current=null},[]);return S.useEffect(()=>v,[v]),S.useEffect(()=>{const x=d.current;return()=>{window.clearTimeout(x),p(null)}},[d,p]),u.jsx(Np,{asChild:!0,...h,children:u.jsx(_j,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":s.contentId,"data-state":Fj(a.open),...e,ref:vc(r,s.onTriggerChange),onClick:x=>{var b;(b=e.onClick)==null||b.call(e,x),!(e.disabled||x.defaultPrevented)&&(x.currentTarget.focus(),a.open||a.onOpenChange(!0))},onPointerMove:Te(e.onPointerMove,hs(x=>{c.onItemEnter(x),!x.defaultPrevented&&!e.disabled&&!a.open&&!f.current&&(c.onPointerGraceIntentChange(null),f.current=window.setTimeout(()=>{a.onOpenChange(!0),v()},100))})),onPointerLeave:Te(e.onPointerLeave,hs(x=>{var y,k;v();const b=(y=a.content)==null?void 0:y.getBoundingClientRect();if(b){const j=(k=a.content)==null?void 0:k.dataset.side,T=j==="right",C=T?-5:5,R=b[T?"left":"right"],D=b[T?"right":"left"];c.onPointerGraceIntentChange({area:[{x:x.clientX+C,y:x.clientY},{x:R,y:b.top},{x:D,y:b.top},{x:D,y:b.bottom},{x:R,y:b.bottom}],side:j}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>c.onPointerGraceIntentChange(null),300)}else{if(c.onTriggerLeave(x),x.defaultPrevented)return;c.onPointerGraceIntentChange(null)}})),onKeyDown:Te(e.onKeyDown,x=>{var y;const b=c.searchRef.current!=="";e.disabled||b&&x.key===" "||y6[l.dir].includes(x.key)&&(a.onOpenChange(!0),(y=a.content)==null||y.focus(),x.preventDefault())})})})});qj.displayName=ts;var Pj="MenuSubContent",$j=S.forwardRef((e,r)=>{const a=Ej(or,e.__scopeMenu),{forceMount:l=a.forceMount,...s}=e,c=Ql(or,e.__scopeMenu),f=bs(or,e.__scopeMenu),d=Hj(Pj,e.__scopeMenu),p=S.useRef(null),h=dt(r,p);return u.jsx(ds.Provider,{scope:e.__scopeMenu,children:u.jsx(Ir,{present:l||c.open,children:u.jsx(ds.Slot,{scope:e.__scopeMenu,children:u.jsx(_p,{id:d.contentId,"aria-labelledby":d.triggerId,...s,ref:h,align:"start",side:f.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:v=>{var x;f.isUsingKeyboardRef.current&&((x=p.current)==null||x.focus()),v.preventDefault()},onCloseAutoFocus:v=>v.preventDefault(),onFocusOutside:Te(e.onFocusOutside,v=>{v.target!==d.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:Te(e.onEscapeKeyDown,v=>{f.onClose(),v.preventDefault()}),onKeyDown:Te(e.onKeyDown,v=>{var y;const x=v.currentTarget.contains(v.target),b=b6[f.dir].includes(v.key);x&&b&&(c.onOpenChange(!1),(y=d.trigger)==null||y.focus(),v.preventDefault())})})})})})});$j.displayName=Pj;function Fj(e){return e?"open":"closed"}function pc(e){return e==="indeterminate"}function Dp(e){return pc(e)?"indeterminate":e?"checked":"unchecked"}function I6(e){const r=document.activeElement;for(const a of e)if(a===r||(a.focus(),document.activeElement!==r))return}function H6(e,r){return e.map((a,l)=>e[(r+l)%e.length])}function q6(e,r,a){const s=r.length>1&&Array.from(r).every(h=>h===r[0])?r[0]:r,c=a?e.indexOf(a):-1;let f=H6(e,Math.max(c,0));s.length===1&&(f=f.filter(h=>h!==a));const p=f.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return p!==a?p:void 0}function P6(e,r){const{x:a,y:l}=e;let s=!1;for(let c=0,f=r.length-1;cl!=v>l&&a<(h-d)*(l-p)/(v-p)+d&&(s=!s)}return s}function $6(e,r){if(!r)return!1;const a={x:e.clientX,y:e.clientY};return P6(a,r)}function hs(e){return r=>r.pointerType==="mouse"?e(r):void 0}var F6=Cj,V6=Np,G6=Nj,Y6=Tj,X6=Mp,K6=Aj,Q6=Gc,Z6=Mj,J6=Dj,W6=zj,eL=Uj,tL=Bj,nL=Ij,rL=qj,aL=$j,Op="DropdownMenu",[lL]=vr(Op,[jj]),jn=jj(),[iL,Vj]=lL(Op),Gj=e=>{const{__scopeDropdownMenu:r,children:a,dir:l,open:s,defaultOpen:c,onOpenChange:f,modal:d=!0}=e,p=jn(r),h=S.useRef(null),[v=!1,x]=el({prop:s,defaultProp:c,onChange:f});return u.jsx(iL,{scope:r,triggerId:zr(),triggerRef:h,contentId:zr(),open:v,onOpenChange:x,onOpenToggle:S.useCallback(()=>x(b=>!b),[x]),modal:d,children:u.jsx(F6,{...p,open:v,onOpenChange:x,dir:l,modal:d,children:a})})};Gj.displayName=Op;var Yj="DropdownMenuTrigger",Xj=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,disabled:l=!1,...s}=e,c=Vj(Yj,a),f=jn(a);return u.jsx(V6,{asChild:!0,...f,children:u.jsx(Ge.button,{type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed","data-disabled":l?"":void 0,disabled:l,...s,ref:vc(r,c.triggerRef),onPointerDown:Te(e.onPointerDown,d=>{!l&&d.button===0&&d.ctrlKey===!1&&(c.onOpenToggle(),c.open||d.preventDefault())}),onKeyDown:Te(e.onKeyDown,d=>{l||(["Enter"," "].includes(d.key)&&c.onOpenToggle(),d.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});Xj.displayName=Yj;var oL="DropdownMenuPortal",Kj=e=>{const{__scopeDropdownMenu:r,...a}=e,l=jn(r);return u.jsx(G6,{...l,...a})};Kj.displayName=oL;var Qj="DropdownMenuContent",Zj=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,s=Vj(Qj,a),c=jn(a),f=S.useRef(!1);return u.jsx(Y6,{id:s.contentId,"aria-labelledby":s.triggerId,...c,...l,ref:r,onCloseAutoFocus:Te(e.onCloseAutoFocus,d=>{var p;f.current||(p=s.triggerRef.current)==null||p.focus(),f.current=!1,d.preventDefault()}),onInteractOutside:Te(e.onInteractOutside,d=>{const p=d.detail.originalEvent,h=p.button===0&&p.ctrlKey===!0,v=p.button===2||h;(!s.modal||v)&&(f.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Zj.displayName=Qj;var sL="DropdownMenuGroup",uL=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,s=jn(a);return u.jsx(X6,{...s,...l,ref:r})});uL.displayName=sL;var cL="DropdownMenuLabel",Jj=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,s=jn(a);return u.jsx(K6,{...s,...l,ref:r})});Jj.displayName=cL;var fL="DropdownMenuItem",Wj=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,s=jn(a);return u.jsx(Q6,{...s,...l,ref:r})});Wj.displayName=fL;var dL="DropdownMenuCheckboxItem",ek=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,s=jn(a);return u.jsx(Z6,{...s,...l,ref:r})});ek.displayName=dL;var hL="DropdownMenuRadioGroup",mL=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,s=jn(a);return u.jsx(J6,{...s,...l,ref:r})});mL.displayName=hL;var pL="DropdownMenuRadioItem",gL=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,s=jn(a);return u.jsx(W6,{...s,...l,ref:r})});gL.displayName=pL;var xL="DropdownMenuItemIndicator",tk=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,s=jn(a);return u.jsx(eL,{...s,...l,ref:r})});tk.displayName=xL;var vL="DropdownMenuSeparator",nk=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,s=jn(a);return u.jsx(tL,{...s,...l,ref:r})});nk.displayName=vL;var yL="DropdownMenuArrow",bL=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,s=jn(a);return u.jsx(nL,{...s,...l,ref:r})});bL.displayName=yL;var wL="DropdownMenuSubTrigger",SL=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,s=jn(a);return u.jsx(rL,{...s,...l,ref:r})});SL.displayName=wL;var jL="DropdownMenuSubContent",kL=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,s=jn(a);return u.jsx(aL,{...s,...l,ref:r,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});kL.displayName=jL;var CL=Gj,EL=Xj,NL=Kj,TL=Zj,AL=Jj,_L=Wj,ML=ek,RL=tk,DL=nk;function rk({...e}){return u.jsx(CL,{"data-slot":"dropdown-menu",...e})}function ak({...e}){return u.jsx(EL,{"data-slot":"dropdown-menu-trigger",...e})}function lk({className:e,sideOffset:r=4,...a}){return u.jsx(NL,{children:u.jsx(TL,{"data-slot":"dropdown-menu-content",sideOffset:r,className:_e("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...a})})}function OL({className:e,inset:r,variant:a="default",...l}){return u.jsx(_L,{"data-slot":"dropdown-menu-item","data-inset":r,"data-variant":a,className:_e("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...l})}function zL({className:e,children:r,checked:a,...l}){return u.jsxs(ML,{"data-slot":"dropdown-menu-checkbox-item",className:_e("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:a,...l,children:[u.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:u.jsx(RL,{children:u.jsx(yc,{className:"size-4"})})}),r]})}function Tm({className:e,inset:r,...a}){return u.jsx(AL,{"data-slot":"dropdown-menu-label","data-inset":r,className:_e("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...a})}function ik({className:e,...r}){return u.jsx(DL,{"data-slot":"dropdown-menu-separator",className:_e("bg-border -mx-1 my-1 h-px",e),...r})}const ok="llmproxy.playground.models",b0="llmproxy.playground.webfetch",LL={type:"function",function:{name:"web_fetch",description:"Fetch a public web page over HTTP(S) and return its text content.",parameters:{type:"object",properties:{url:{type:"string",description:"The absolute http(s) URL to fetch."}},required:["url"]}}},UL=5;function BL(){try{const e=JSON.parse(localStorage.getItem(ok)??"[]");return Array.isArray(e)?e.filter(r=>typeof r=="string"):[]}catch{return[]}}function w0(e){return e.images.length===0?e.text:[...e.text?[{type:"text",text:e.text}]:[],...e.images.map(r=>({type:"image_url",image_url:{url:r.dataUrl}}))]}function IL(){var q;const e=Yt(async()=>{const[$,X]=await Promise.all([Pe.get("/v1/models?endpoint=chat"),Pe.get("/v1/models?endpoint=chat_stream")]);return{chat:$,streamable:new Set(X.data.map(ce=>ce.id))}}),[r,a]=S.useState(BL),[l,s]=S.useState(()=>localStorage.getItem(b0)==="1"),[c,f]=S.useState([]),[d,p]=S.useState(""),[h,v]=S.useState([]),[x,b]=S.useState(!1),y=S.useRef(null),k=S.useRef(1),j=S.useRef(null),T=S.useRef(null),C=(((q=e.data)==null?void 0:q.chat.data)??[]).map($=>$.id);S.useEffect(()=>{e.data&&a($=>{const X=$.filter(ce=>C.includes(ce));return X.length===$.length?$:X})},[e.data]),S.useEffect(()=>{localStorage.setItem(ok,JSON.stringify(r))},[r]),S.useEffect(()=>{localStorage.setItem(b0,l?"1":"0")},[l]),S.useEffect(()=>()=>{var $;return($=y.current)==null?void 0:$.abort()},[]);const R=($,X)=>{a(ce=>X?[...ce,$]:ce.filter(le=>le!==$))},D=($,X,ce)=>{f(le=>le.map(W=>W.id===$?{...W,replies:{...W.replies,[X]:{...W.replies[X],...ce}}}:W))},B=async($,X,ce,le,W)=>{var ye;const U=[];for(const fe of X){U.push({role:"user",content:w0(fe)});const be=fe.replies[$];(be==null?void 0:be.status)==="done"&&be.text&&U.push({role:"assistant",content:be.text})}U.push({role:"user",content:w0(ce)});const Z=((ye=e.data)==null?void 0:ye.streamable.has($))??!0,ie=performance.now();let K,E="",L,F;const M=[],oe=(fe,be)=>D(ce.id,$,{status:fe,error:be,text:E,firstTokenMs:K,promptTokens:L,completionTokens:F,totalMs:performance.now()-ie}),G=fe=>{fe&&(fe.prompt_tokens!==void 0&&(L=(L??0)+fe.prompt_tokens),fe.completion_tokens!==void 0&&(F=(F??0)+fe.completion_tokens))},ue=(fe,be)=>{K===void 0&&(K=performance.now()-ie),be&&E&&(E+=` - -`),E+=fe,D(ce.id,$,{text:E})},re=async()=>{var _t,Ct,Et,Lt,Mt,Rt,zt;const fe=await fetch("/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({model:$,messages:U,stream:Z,...le?{tools:[LL]}:{}}),signal:W});if(!fe.ok||!fe.body){let we=`HTTP ${fe.status}`;try{we=((_t=(await fe.json()).error)==null?void 0:_t.message)??we}catch{}return oe("error",we),"error"}if(!Z){const we=await fe.json(),mt=(Et=(Ct=we.choices)==null?void 0:Ct[0])==null?void 0:Et.message,Y=typeof(mt==null?void 0:mt.content)=="string"?mt.content:"";Y&&ue(Y,!0),G(we.usage);const qe=(mt==null?void 0:mt.tool_calls)??[];return qe.length>0&&U.push({role:"assistant",content:Y||null,tool_calls:qe}),qe}const be=fe.body.getReader(),Ee=new TextDecoder,Se=[];let Ie="",Be="";for(;;){const{done:we,value:mt}=await be.read();if(we)break;Be+=Ee.decode(mt,{stream:!0});let Y;for(;(Y=Be.indexOf(` -`))>=0;){const qe=Be.slice(0,Y).trim();if(Be=Be.slice(Y+1),!qe.startsWith("data:"))continue;const ne=qe.slice(5).trim();if(!ne||ne==="[DONE]")continue;let z;try{z=JSON.parse(ne)}catch{continue}const de=(Mt=(Lt=z.choices)==null?void 0:Lt[0])==null?void 0:Mt.delta;de!=null&&de.content&&(ue(de.content,Ie===""),Ie+=de.content);for(const ke of(de==null?void 0:de.tool_calls)??[]){const De=ke.index??0;Se[De]??(Se[De]={id:"",type:"function",function:{name:"",arguments:""}}),ke.id&&(Se[De].id=ke.id),(Rt=ke.function)!=null&&Rt.name&&(Se[De].function.name+=ke.function.name),(zt=ke.function)!=null&&zt.arguments&&(Se[De].function.arguments+=ke.function.arguments)}G(z.usage)}}return Se.length>0&&U.push({role:"assistant",content:Ie||null,tool_calls:Se}),Se};try{for(let fe=0;fe{const $=d.trim();if(!$&&h.length===0||r.length===0||x)return;const X=c,ce={id:k.current++,text:$,images:h,replies:{}};for(const W of r)ce.replies[W]={text:"",status:"streaming"};f([...X,ce]),p(""),v([]),b(!0),requestAnimationFrame(()=>{var W;return(W=T.current)==null?void 0:W.scrollIntoView({behavior:"smooth"})});const le=new AbortController;y.current=le,await Promise.all(r.map(W=>B(W,X,ce,l,le.signal))),b(!1)},_=()=>{var $;return($=y.current)==null?void 0:$.abort()},A=$=>{for(const X of $){if(!X.type.startsWith("image/"))continue;const ce=new FileReader;ce.onload=()=>{const le=ce.result;typeof le=="string"&&v(W=>[...W,{name:X.name,dataUrl:le}])},ce.readAsDataURL(X)}},I=$=>{const X=Array.from($.clipboardData.files);X.length>0&&($.preventDefault(),A(X))},ee=$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),O())};return e.loading&&!e.data?u.jsx(Ot,{}):e.error?u.jsx("p",{className:"text-sm text-destructive",children:e.error}):u.jsxs(tt,{children:[u.jsxs(nt,{children:[u.jsx(rt,{className:"font-serif",children:"Playground"}),u.jsx(ct,{children:"Chat with your models straight from the browser; nothing is saved."}),u.jsxs(nN,{className:"flex flex-wrap items-center justify-end gap-2",children:[u.jsxs(ze,{variant:l?"secondary":"outline","aria-pressed":l,title:"Let the model fetch public web pages",onClick:()=>s($=>!$),children:[u.jsx(Z0,{}),"Web fetch: ",l?"on":"off"]}),u.jsxs(rk,{children:[u.jsx(ak,{asChild:!0,children:u.jsxs(ze,{variant:"outline",children:[r.length===0?"Select models":r.length===1?r[0]:`${r.length} models`,u.jsx(Xi,{})]})}),u.jsxs(lk,{align:"end",className:"max-h-96",children:[u.jsx(Tm,{className:"font-normal text-muted-foreground",children:"Pick several to compare"}),u.jsx(ik,{}),C.length===0&&u.jsx(Tm,{className:"font-normal text-muted-foreground",children:"No chat models configured"}),C.map($=>u.jsx(zL,{checked:r.includes($),onCheckedChange:X=>R($,X===!0),onSelect:X=>X.preventDefault(),children:$},$))]})]}),c.length>0&&u.jsxs(ze,{variant:"outline",disabled:x,onClick:()=>f([]),children:[u.jsx(zm,{}),"Clear chat"]})]})]}),u.jsxs(at,{className:"flex flex-col gap-6",children:[c.length===0&&u.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:r.length===0?"Select a model to start.":"Send a message to start."}),c.map($=>u.jsx(HL,{turn:$},$.id)),u.jsx("div",{ref:T}),u.jsxs("div",{className:"flex flex-col gap-2 border-t pt-4",children:[h.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2",children:h.map(($,X)=>u.jsxs("div",{className:"relative",children:[u.jsx("img",{src:$.dataUrl,alt:$.name,className:"h-16 w-16 rounded-md border object-cover"}),u.jsx(ze,{variant:"secondary",size:"icon-sm","aria-label":`Remove ${$.name}`,className:"absolute -top-2 -right-2 size-5 rounded-full",onClick:()=>v(ce=>ce.filter((le,W)=>W!==X)),children:u.jsx(Lm,{className:"size-3"})})]},X))}),u.jsxs("div",{className:"flex items-end gap-2",children:[u.jsx("input",{ref:j,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:$=>{A($.target.files??[]),$.target.value=""}}),u.jsx(ze,{variant:"outline",size:"icon","aria-label":"Attach image",title:"Attach image",onClick:()=>{var $;return($=j.current)==null?void 0:$.click()},children:u.jsx($E,{})}),u.jsx(g6,{className:"max-h-48 min-h-9",rows:1,placeholder:r.length>1?`Message ${r.length} models`:"Message",value:d,onChange:$=>p($.target.value),onKeyDown:ee,onPaste:I}),x?u.jsx(ze,{variant:"outline",size:"icon","aria-label":"Stop",title:"Stop",onClick:_,children:u.jsx(YE,{})}):u.jsx(ze,{size:"icon","aria-label":"Send",title:"Send",disabled:!d.trim()&&h.length===0||r.length===0,onClick:()=>void O(),children:u.jsx(GE,{})})]})]})]})]})}function HL({turn:e}){const r=Object.keys(e.replies);return u.jsxs("div",{className:"flex flex-col gap-3",children:[u.jsx("div",{className:"ml-auto max-w-[85%]",children:u.jsxs("div",{className:"rounded-lg bg-primary px-3 py-2 text-sm whitespace-pre-wrap text-primary-foreground",children:[e.images.length>0&&u.jsx("div",{className:"mb-1 flex flex-wrap gap-2",children:e.images.map((a,l)=>u.jsx("img",{src:a.dataUrl,alt:a.name,className:"max-h-40 rounded-md"},l))}),e.text]})}),u.jsx("div",{className:"grid gap-3 [grid-template-columns:repeat(auto-fit,minmax(260px,1fr))]",children:r.map(a=>u.jsx(qL,{model:a,reply:e.replies[a],solo:r.length===1},a))})]})}function qL({model:e,reply:r,solo:a}){return u.jsxs("div",{className:a?"":"rounded-lg border p-3",children:[u.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[u.jsx(fn,{variant:"secondary",className:"font-mono",children:e}),r.status==="streaming"&&u.jsx(Ot,{className:"size-3"}),u.jsx(PL,{reply:r})]}),r.tools&&r.tools.length>0&&u.jsx("div",{className:"mb-1 flex flex-col gap-0.5",children:r.tools.map((l,s)=>u.jsxs("span",{className:"flex items-center gap-1 break-all text-xs text-muted-foreground",children:[u.jsx(Z0,{className:"size-3 shrink-0"}),l]},s))}),r.status==="error"?u.jsx("p",{className:"text-sm text-destructive",children:r.error}):u.jsx("div",{className:"text-sm",children:r.text?u.jsx(p6,{text:r.text}):r.status==="done"&&u.jsx("span",{className:"text-muted-foreground",children:"(empty response)"})})]})}function PL({reply:e}){if(e.status!=="done")return null;const r=[];if(e.firstTokenMs!==void 0&&r.push(`${(e.firstTokenMs/1e3).toFixed(2)}s to first token`),e.totalMs!==void 0&&r.push(`${(e.totalMs/1e3).toFixed(2)}s total`),e.completionTokens&&e.totalMs){const a=e.firstTokenMs!==void 0&&e.totalMs-e.firstTokenMs>100?e.totalMs-e.firstTokenMs:e.totalMs;r.push(`${(e.completionTokens/(a/1e3)).toFixed(1)} tok/s`)}return(e.promptTokens!==void 0||e.completionTokens!==void 0)&&r.push(`${e.promptTokens??"?"} in / ${e.completionTokens??"?"} out`),r.length===0?null:u.jsx("span",{className:"text-xs text-muted-foreground",children:r.join(" ยท ")})}const S0="llmproxy-theme",sk=S.createContext({theme:"system",resolvedTheme:"light",setTheme:()=>{}});function j0(){return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function $L({children:e}){const[r,a]=S.useState(()=>{const f=localStorage.getItem(S0);return f==="light"||f==="dark"?f:"system"}),l=r==="system"?j0():r,s=S.useCallback(f=>{const d=f==="system"?j0():f;document.documentElement.classList.toggle("dark",d==="dark")},[]),c=S.useCallback(f=>{a(f),localStorage.setItem(S0,f),s(f)},[s]);return S.useEffect(()=>{s(r);const f=matchMedia("(prefers-color-scheme: dark)"),d=()=>s(r);return f.addEventListener("change",d),()=>f.removeEventListener("change",d)},[r,s]),u.jsx(sk.Provider,{value:{theme:r,resolvedTheme:l,setTheme:c},children:e})}function uk(){return S.useContext(sk)}function FL(){const[e,r]=S.useState(null),[a,l]=S.useState(!1),s=S.useCallback(()=>{Pe.get("/auth/me").then(r).catch(()=>l(!0))},[]);return S.useEffect(s,[s]),a?u.jsx("div",{className:"flex min-h-screen items-center justify-center",children:u.jsx("p",{className:"text-sm text-muted-foreground",children:"The proxy is not reachable. Reload to retry."})}):e===null?u.jsx("div",{className:"flex min-h-screen items-center justify-center",children:u.jsx(Ot,{className:"size-6"})}):e.authenticated?u.jsx(XL,{me:e}):u.jsx(rN,{me:e,onLogin:s})}function VL(){const{theme:e,setTheme:r}=uk(),a={light:"dark",dark:"system",system:"light"},l={light:u.jsx(KE,{}),dark:u.jsx(VE,{}),system:u.jsx(XE,{})};return u.jsx(ze,{variant:"ghost",size:"icon","aria-label":`Theme: ${e}. Switch to ${a[e]}`,title:`Theme: ${e}`,onClick:()=>r(a[e]),children:l[e]})}const GL=["providers","models","users","services","all-keys"],YL=["overview","apps","models","errors"];function k0(e){const r=window.location.pathname.replace(/^\/+/,"").split("/");let a=r[0];if(a==="activity"&&(a="requests"),e&&GL.includes(a))return{tab:"admin",sub:a,usageSub:"overview"};const l=["usage","requests","keys","playground"].includes(a)?a:"usage",s=l==="usage"&&YL.includes(r[1])?r[1]:"overview";return{tab:l,sub:"providers",usageSub:s}}function XL({me:e}){const r=e.role==="admin",[a,l]=S.useState(()=>k0(r));S.useEffect(()=>{const p=()=>l(k0(r));return window.addEventListener("popstate",p),()=>window.removeEventListener("popstate",p)},[r]);const s=p=>{l(p);let h="/"+(p.tab==="admin"?p.sub:p.tab);p.tab==="usage"&&p.usageSub!=="overview"&&(h+="/"+p.usageSub),window.location.pathname!==h&&window.history.pushState(null,"",h)},c=p=>s({...a,tab:p}),f=p=>s({...a,tab:"admin",sub:p}),d=p=>s({...a,tab:"usage",usageSub:p});return u.jsxs(mm,{value:a.tab,onValueChange:c,children:[u.jsx("header",{className:"border-b bg-card",children:u.jsxs("div",{className:"mx-auto flex max-w-6xl flex-wrap items-center gap-x-6 gap-y-2 px-4 py-3",children:[u.jsxs("a",{href:"/usage",onClick:p=>{p.metaKey||p.ctrlKey||p.shiftKey||p.button!==0||(p.preventDefault(),c("usage"))},className:"flex items-center gap-2 rounded-md outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[u.jsx($0,{className:"h-6"}),u.jsx("span",{className:"font-serif text-lg font-semibold",children:"llmproxy"})]}),u.jsxs(pm,{children:[u.jsx(lr,{value:"usage",children:"Usage"}),u.jsx(lr,{value:"requests",children:"Requests"}),u.jsx(lr,{value:"keys",children:"API keys"}),u.jsx(lr,{value:"playground",children:"Playground"}),r&&u.jsx(lr,{value:"admin",children:"Admin"})]}),u.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[u.jsx(VL,{}),u.jsxs(rk,{children:[u.jsx(ak,{asChild:!0,children:u.jsxs(ze,{variant:"ghost",className:"gap-2",children:[u.jsx(HE,{}),u.jsx("span",{className:"max-w-40 truncate",children:e.name}),r&&u.jsx(fn,{variant:"secondary",children:"admin"})]})}),u.jsxs(lk,{align:"end",children:[u.jsxs(Tm,{className:"font-normal text-muted-foreground",children:["Signed in as ",e.name]}),u.jsx(ik,{}),u.jsx(OL,{onClick:()=>window.location.href="/auth/logout",children:"Sign out"})]})]})]})]})}),u.jsxs("main",{className:"mx-auto flex w-full max-w-6xl flex-col gap-6 px-4 py-8",children:[u.jsx(Ar,{value:"usage",children:u.jsx(ZM,{ssoEnabled:e.sso_enabled,sub:a.usageSub,onSubChange:d})}),u.jsx(Ar,{value:"requests",children:u.jsx(LR,{})}),u.jsx(Ar,{value:"keys",children:u.jsx(wA,{})}),u.jsx(Ar,{value:"playground",forceMount:!0,className:"data-[state=inactive]:hidden",children:u.jsx(IL,{})}),r&&u.jsx(Ar,{value:"admin",children:u.jsxs(mm,{value:a.sub,onValueChange:f,className:"gap-6",children:[u.jsxs(pm,{children:[u.jsx(lr,{value:"providers",children:"Providers"}),u.jsx(lr,{value:"models",children:"Models"}),u.jsx(lr,{value:"users",children:"Users"}),u.jsx(lr,{value:"services",children:"Services"}),u.jsx(lr,{value:"all-keys",children:"All keys"})]}),u.jsx(Ar,{value:"providers",children:u.jsx(lR,{})}),u.jsx(Ar,{value:"models",children:u.jsx(CR,{})}),u.jsx(Ar,{value:"users",children:u.jsx(BR,{})}),u.jsx(Ar,{value:"services",children:u.jsx(HR,{})}),u.jsx(Ar,{value:"all-keys",children:u.jsx(qR,{})})]})})]})]})}const KL=({...e})=>{const{resolvedTheme:r}=uk();return u.jsx(_N,{theme:r,className:"toaster group",style:{"--normal-bg":"var(--color-popover)","--normal-text":"var(--color-popover-foreground)","--normal-border":"var(--color-border)"},...e})};D2.createRoot(document.getElementById("root")).render(u.jsx(S.StrictMode,{children:u.jsxs($L,{children:[u.jsx(FL,{}),u.jsx(KL,{position:"bottom-right"})]})})); diff --git a/internal/server/uidist/assets/index-Denc3dV8.css b/internal/server/uidist/assets/index-Denc3dV8.css new file mode 100644 index 0000000..387de6c --- /dev/null +++ b/internal/server/uidist/assets/index-Denc3dV8.css @@ -0,0 +1 @@ +/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:forwards;--tw-animation-iteration-count:1;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--color-red-500:oklch(63.7% .237 25.331);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-green-500:oklch(72.3% .219 149.579);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-lg:32rem;--container-6xl:72rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-widest:.1em;--leading-relaxed:1.625;--radius-xs:.125rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:"Aspekta", ui-sans-serif, system-ui, sans-serif;--default-mono-font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--color-popover:rgb(var(--popover));--color-popover-foreground:rgb(var(--popover-foreground));--color-border:rgb(var(--border))}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:rgb(var(--border));outline-color:rgb(var(--ring))}@supports (color:color-mix(in lab,red,red)){*{outline-color:color-mix(in oklab,rgb(var(--ring)) 50%,transparent)}}body{background-color:rgb(var(--background));color:rgb(var(--foreground));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Aspekta,ui-sans-serif,system-ui,sans-serif}}@layer components;@layer utilities{.\@container\/card-header{container:card-header/inline-size}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{inset-inline:0}.inset-y-0{inset-block:0}.-top-2{top:calc(var(--spacing) * -2)}.top-0{top:0}.top-1\/2,.top-\[50\%\]{top:50%}.-right-2{right:calc(var(--spacing) * -2)}.right-1{right:var(--spacing)}.right-2{right:calc(var(--spacing) * 2)}.right-8{right:calc(var(--spacing) * 8)}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing) * 2)}.left-\[50\%\]{left:50%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.col-start-2{grid-column-start:2}.row-span-2{grid-row:span 2/span 2}.row-start-1{grid-row-start:1}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.mx-auto{margin-inline:auto}.my-1{margin-block:var(--spacing)}.-mt-2{margin-top:calc(var(--spacing) * -2)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mr-1{margin-right:var(--spacing)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.ml-1{margin-left:var(--spacing)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-row{display:table-row}.field-sizing-content{field-sizing:content}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-16{height:calc(var(--spacing) * 16)}.h-\[1\.15rem\]{height:1.15rem}.h-\[calc\(100\%-1px\)\]{height:calc(100% - 1px)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-full{height:100%}.h-px{height:1px}.max-h-\(--radix-dropdown-menu-content-available-height\){max-height:var(--radix-dropdown-menu-content-available-height)}.max-h-\(--radix-select-content-available-height\){max-height:var(--radix-select-content-available-height)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-96{max-height:calc(var(--spacing) * 96)}.min-h-9{min-height:calc(var(--spacing) * 9)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-screen{min-height:100vh}.w-3{width:calc(var(--spacing) * 3)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-12{width:calc(var(--spacing) * 12)}.w-16{width:calc(var(--spacing) * 16)}.w-24{width:calc(var(--spacing) * 24)}.w-32{width:calc(var(--spacing) * 32)}.w-40{width:calc(var(--spacing) * 40)}.w-44{width:calc(var(--spacing) * 44)}.w-56{width:calc(var(--spacing) * 56)}.w-64{width:calc(var(--spacing) * 64)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.max-w-6xl{max-width:var(--container-6xl)}.max-w-36{max-width:calc(var(--spacing) * 36)}.max-w-40{max-width:calc(var(--spacing) * 40)}.max-w-44{max-width:calc(var(--spacing) * 44)}.max-w-\[85\%\]{max-width:85%}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-full{max-width:100%}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:0}.min-w-32{min-width:calc(var(--spacing) * 32)}.min-w-36{min-width:calc(var(--spacing) * 36)}.min-w-48{min-width:calc(var(--spacing) * 48)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.caption-bottom{caption-side:bottom}.origin-\(--radix-dropdown-menu-content-transform-origin\){transform-origin:var(--radix-dropdown-menu-content-transform-origin)}.origin-\(--radix-select-content-transform-origin\){transform-origin:var(--radix-select-content-transform-origin)}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-\[-50\%\]{--tw-translate-x:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[-50\%\]{--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-180{rotate:180deg}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.scroll-my-1{scroll-margin-block:var(--spacing)}.auto-rows-min{grid-auto-rows:min-content}.\[grid-template-columns\:repeat\(auto-fit\,minmax\(260px\,1fr\)\)\]{grid-template-columns:repeat(auto-fit,minmax(260px,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[minmax\(6rem\,14rem\)_1fr_auto\]{grid-template-columns:minmax(6rem,14rem) 1fr auto}.grid-rows-\[auto_auto\]{grid-template-rows:auto auto}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-x-8{column-gap:calc(var(--spacing) * 8)}.gap-y-1{row-gap:var(--spacing)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.gap-y-4{row-gap:calc(var(--spacing) * 4)}.self-start{align-self:flex-start}.justify-self-end{justify-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[4px\]{border-radius:4px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:calc(var(--radius) + 2px)}.rounded-md{border-radius:var(--radius)}.rounded-sm{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-xs{border-radius:var(--radius-xs)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-border{border-color:rgb(var(--border))}.border-foreground{border-color:rgb(var(--foreground))}.border-input{border-color:rgb(var(--input))}.border-primary\/40{border-color:rgb(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/40{border-color:color-mix(in oklab,rgb(var(--primary)) 40%,transparent)}}.border-transparent{border-color:#0000}.bg-\[\#1a7f37\]{background-color:#1a7f37}.bg-\[\#3b82f6\]{background-color:#3b82f6}.bg-\[\#4b5563\]{background-color:#4b5563}.bg-\[\#9a6700\]{background-color:#9a6700}.bg-\[\#22c55e\]{background-color:#22c55e}.bg-\[\#0969da\]{background-color:#0969da}.bg-\[\#a855f7\]{background-color:#a855f7}.bg-\[\#f97316\]{background-color:#f97316}.bg-\[rgb\(var\(--border\)\)\]{background-color:rgb(var(--border))}.bg-accent{background-color:rgb(var(--accent))}.bg-background{background-color:rgb(var(--background))}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-border{background-color:rgb(var(--border))}.bg-card{background-color:rgb(var(--card))}.bg-chart-1{background-color:rgb(var(--chart-1))}.bg-chart-2{background-color:rgb(var(--chart-2))}.bg-chart-3{background-color:rgb(var(--chart-3))}.bg-chart-5{background-color:rgb(var(--chart-5))}.bg-destructive{background-color:rgb(var(--destructive))}.bg-foreground\/5{background-color:rgb(var(--foreground))}@supports (color:color-mix(in lab,red,red)){.bg-foreground\/5{background-color:color-mix(in oklab,rgb(var(--foreground)) 5%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-muted{background-color:rgb(var(--muted))}.bg-muted-foreground{background-color:rgb(var(--muted-foreground))}.bg-muted\/30{background-color:rgb(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/30{background-color:color-mix(in oklab,rgb(var(--muted)) 30%,transparent)}}.bg-muted\/50{background-color:rgb(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/50{background-color:color-mix(in oklab,rgb(var(--muted)) 50%,transparent)}}.bg-popover{background-color:rgb(var(--popover))}.bg-primary,.bg-primary\/5{background-color:rgb(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/5{background-color:color-mix(in oklab,rgb(var(--primary)) 5%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-secondary{background-color:rgb(var(--secondary))}.bg-transparent{background-color:#0000}.bg-yellow-500{background-color:var(--color-yellow-500)}.fill-border{fill:rgb(var(--border))}.fill-chart-1{fill:rgb(var(--chart-1))}.fill-chart-2{fill:rgb(var(--chart-2))}.fill-chart-3{fill:rgb(var(--chart-3))}.fill-chart-5{fill:rgb(var(--chart-5))}.fill-current{fill:currentColor}.fill-foreground,.fill-foreground\/5{fill:rgb(var(--foreground))}@supports (color:color-mix(in lab,red,red)){.fill-foreground\/5{fill:color-mix(in oklab,rgb(var(--foreground)) 5%,transparent)}}.fill-muted-foreground{fill:rgb(var(--muted-foreground))}.stroke-border{stroke:rgb(var(--border))}.object-cover{object-fit:cover}.p-1{padding:var(--spacing)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.p-\[3px\]{padding:3px}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0{padding-block:0}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-0{padding-right:0}.pr-1{padding-right:var(--spacing)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-6{padding-right:calc(var(--spacing) * 6)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-14{padding-right:calc(var(--spacing) * 14)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-\[18px\]{padding-left:18px}.pl-\[26px\]{padding-left:26px}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}.font-serif{font-family:"Source Serif 4",Source Serif Pro,Georgia,serif}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-sm\/relaxed{font-size:var(--text-sm);line-height:var(--leading-relaxed)}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.text-balance{text-wrap:balance}.wrap-anywhere{overflow-wrap:anywhere}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent-foreground{color:rgb(var(--accent-foreground))}.text-card-foreground{color:rgb(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:rgb(var(--destructive))}.text-foreground{color:rgb(var(--foreground))}.text-muted-foreground{color:rgb(var(--muted-foreground))}.text-popover-foreground{color:rgb(var(--popover-foreground))}.text-primary{color:rgb(var(--primary))}.text-primary-foreground{color:rgb(var(--primary-foreground))}.text-secondary-foreground{color:rgb(var(--secondary-foreground))}.text-white{color:var(--color-white)}.text-yellow-600{color:var(--color-yellow-600)}.lowercase{text-transform:lowercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition-\[color\,box-shadow\]{transition-property:color,box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-none{transition-property:none}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.running{animation-play-state:running}.group-data-\[disabled\=true\]\:pointer-events-none:is(:where(.group)[data-disabled=true] *){pointer-events:none}.group-data-\[disabled\=true\]\:opacity-50:is(:where(.group)[data-disabled=true] *){opacity:.5}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-50:is(:where(.peer):disabled~*){opacity:.5}.selection\:bg-primary ::selection{background-color:rgb(var(--primary))}.selection\:bg-primary::selection{background-color:rgb(var(--primary))}.selection\:text-primary-foreground ::selection{color:rgb(var(--primary-foreground))}.selection\:text-primary-foreground::selection{color:rgb(var(--primary-foreground))}.file\:inline-flex::file-selector-button{display:inline-flex}.file\:h-7::file-selector-button{height:calc(var(--spacing) * 7)}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.file\:text-foreground::file-selector-button{color:rgb(var(--foreground))}.placeholder\:text-muted-foreground::placeholder{color:rgb(var(--muted-foreground))}@media(hover:hover){.hover\:bg-accent:hover{background-color:rgb(var(--accent))}.hover\:bg-destructive\/90:hover{background-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,rgb(var(--destructive)) 90%,transparent)}}.hover\:bg-muted\/30:hover{background-color:rgb(var(--muted))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-muted\/30:hover{background-color:color-mix(in oklab,rgb(var(--muted)) 30%,transparent)}}.hover\:bg-muted\/50:hover{background-color:rgb(var(--muted))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab,rgb(var(--muted)) 50%,transparent)}}.hover\:bg-primary\/90:hover{background-color:rgb(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,rgb(var(--primary)) 90%,transparent)}}.hover\:bg-secondary\/80:hover{background-color:rgb(var(--secondary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,rgb(var(--secondary)) 80%,transparent)}}.hover\:text-accent-foreground:hover{color:rgb(var(--accent-foreground))}.hover\:text-foreground:hover{color:rgb(var(--foreground))}.hover\:underline:hover{text-decoration-line:underline}}.focus\:bg-accent:focus{background-color:rgb(var(--accent))}.focus\:text-accent-foreground:focus{color:rgb(var(--accent-foreground))}.focus-visible\:border-ring:focus-visible{border-color:rgb(var(--ring))}.focus-visible\:stroke-ring:focus-visible{stroke:rgb(var(--ring))}.focus-visible\:\[stroke-width\:2\]:focus-visible{stroke-width:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:color-mix(in oklab, rgb(var(--destructive)) 20%, transparent)}}.focus-visible\:ring-ring:focus-visible,.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:rgb(var(--ring))}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, rgb(var(--ring)) 50%, transparent)}}.focus-visible\:outline-1:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\:outline-ring:focus-visible{outline-color:rgb(var(--ring))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.has-data-\[slot\=card-action\]\:grid-cols-\[1fr_auto\]:has([data-slot=card-action]){grid-template-columns:1fr auto}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing) * 2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing) * 3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing) * 4)}.aria-invalid\:border-destructive[aria-invalid=true]{border-color:rgb(var(--destructive))}.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, rgb(var(--destructive)) 20%, transparent)}}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[inset\]\:pl-8[data-inset]{padding-left:calc(var(--spacing) * 8)}.data-\[orientation\=horizontal\]\:h-px[data-orientation=horizontal]{height:1px}.data-\[orientation\=horizontal\]\:w-full[data-orientation=horizontal]{width:100%}.data-\[orientation\=vertical\]\:h-full[data-orientation=vertical]{height:100%}.data-\[orientation\=vertical\]\:w-px[data-orientation=vertical]{width:1px}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:rgb(var(--muted-foreground))}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:var(--spacing);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:calc(2*var(--spacing)*-1)}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:calc(2*var(--spacing))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:var(--spacing);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:calc(2*var(--spacing)*-1)}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:calc(2*var(--spacing))}.data-\[size\=default\]\:h-9[data-size=default]{height:calc(var(--spacing) * 9)}.data-\[size\=sm\]\:h-8[data-size=sm]{height:calc(var(--spacing) * 8)}:is(.\*\:data-\[slot\=select-value\]\:line-clamp-1>*)[data-slot=select-value]{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}:is(.\*\:data-\[slot\=select-value\]\:flex>*)[data-slot=select-value]{display:flex}:is(.\*\:data-\[slot\=select-value\]\:items-center>*)[data-slot=select-value]{align-items:center}:is(.\*\:data-\[slot\=select-value\]\:gap-2>*)[data-slot=select-value]{gap:calc(var(--spacing) * 2)}.data-\[state\=active\]\:bg-card[data-state=active]{background-color:rgb(var(--card))}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-\[calc\(100\%-2px\)\][data-state=checked]{--tw-translate-x: calc(100% - 2px) ;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[state\=checked\]\:border-primary[data-state=checked]{border-color:rgb(var(--primary))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:rgb(var(--primary))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:rgb(var(--primary-foreground))}.data-\[state\=closed\]\:animate-out[data-state=closed]{animation:exit var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,forwards)}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\[state\=inactive\]\:hidden[data-state=inactive]{display:none}.data-\[state\=open\]\:animate-in[data-state=open]{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,forwards)}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:rgb(var(--accent))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:rgb(var(--accent-foreground))}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:rgb(var(--muted))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-\[\#7F7F79\][data-state=unchecked]{background-color:#7f7f79}.data-\[variant\=destructive\]\:text-destructive[data-variant=destructive]{color:rgb(var(--destructive))}.data-\[variant\=destructive\]\:focus\:bg-destructive\/10[data-variant=destructive]:focus{background-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.data-\[variant\=destructive\]\:focus\:bg-destructive\/10[data-variant=destructive]:focus{background-color:color-mix(in oklab,rgb(var(--destructive)) 10%,transparent)}}.data-\[variant\=destructive\]\:focus\:text-destructive[data-variant=destructive]:focus{color:rgb(var(--destructive))}@media(min-width:40rem){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:max-w-lg{max-width:var(--container-lg)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:p-12{padding:calc(var(--spacing) * 12)}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.dark\:border-input:is(.dark *){border-color:rgb(var(--input))}.dark\:bg-chart-4:is(.dark *){background-color:rgb(var(--chart-4))}.dark\:bg-destructive\/60:is(.dark *){background-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.dark\:bg-destructive\/60:is(.dark *){background-color:color-mix(in oklab,rgb(var(--destructive)) 60%,transparent)}}.dark\:bg-input\/30:is(.dark *){background-color:rgb(var(--input))}@supports (color:color-mix(in lab,red,red)){.dark\:bg-input\/30:is(.dark *){background-color:color-mix(in oklab,rgb(var(--input)) 30%,transparent)}}.dark\:fill-chart-4:is(.dark *){fill:rgb(var(--chart-4))}.dark\:text-muted-foreground:is(.dark *){color:rgb(var(--muted-foreground))}.dark\:text-yellow-400:is(.dark *){color:var(--color-yellow-400)}@media(hover:hover){.dark\:hover\:bg-accent\/50:is(.dark *):hover{background-color:rgb(var(--accent))}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-accent\/50:is(.dark *):hover{background-color:color-mix(in oklab,rgb(var(--accent)) 50%,transparent)}}.dark\:hover\:bg-input\/50:is(.dark *):hover{background-color:rgb(var(--input))}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-input\/50:is(.dark *):hover{background-color:color-mix(in oklab,rgb(var(--input)) 50%,transparent)}}}.dark\:focus-visible\:ring-destructive\/40:is(.dark *):focus-visible{--tw-ring-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.dark\:focus-visible\:ring-destructive\/40:is(.dark *):focus-visible{--tw-ring-color:color-mix(in oklab, rgb(var(--destructive)) 40%, transparent)}}.dark\:aria-invalid\:ring-destructive\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.dark\:aria-invalid\:ring-destructive\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, rgb(var(--destructive)) 40%, transparent)}}.dark\:data-\[state\=active\]\:border-input:is(.dark *)[data-state=active]{border-color:rgb(var(--input))}.dark\:data-\[state\=active\]\:bg-input\/30:is(.dark *)[data-state=active]{background-color:rgb(var(--input))}@supports (color:color-mix(in lab,red,red)){.dark\:data-\[state\=active\]\:bg-input\/30:is(.dark *)[data-state=active]{background-color:color-mix(in oklab,rgb(var(--input)) 30%,transparent)}}.dark\:data-\[state\=active\]\:text-foreground:is(.dark *)[data-state=active]{color:rgb(var(--foreground))}.dark\:data-\[state\=checked\]\:bg-primary:is(.dark *)[data-state=checked]{background-color:rgb(var(--primary))}.dark\:data-\[state\=checked\]\:bg-primary-foreground:is(.dark *)[data-state=checked]{background-color:rgb(var(--primary-foreground))}.dark\:data-\[state\=unchecked\]\:bg-foreground:is(.dark *)[data-state=unchecked]{background-color:rgb(var(--foreground))}.dark\:data-\[state\=unchecked\]\:bg-input:is(.dark *)[data-state=unchecked]{background-color:rgb(var(--input))}.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20:is(.dark *)[data-variant=destructive]:focus{background-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20:is(.dark *)[data-variant=destructive]:focus{background-color:color-mix(in oklab,rgb(var(--destructive)) 20%,transparent)}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-6 svg:not([class*=size-]){width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.\[\&_svg\:not\(\[class\*\=\'text-\'\]\)\]\:text-muted-foreground svg:not([class*=text-]){color:rgb(var(--muted-foreground))}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\.border-b\]\:pb-6.border-b{padding-bottom:calc(var(--spacing) * 6)}.\[\.border-t\]\:pt-6.border-t{padding-top:calc(var(--spacing) * 6)}:is(.\*\:\[span\]\:last\:flex>*):is(span):last-child{display:flex}:is(.\*\:\[span\]\:last\:items-center>*):is(span):last-child{align-items:center}:is(.\*\:\[span\]\:last\:gap-2>*):is(span):last-child{gap:calc(var(--spacing) * 2)}:is(.data-\[variant\=destructive\]\:\*\:\[svg\]\:\!text-destructive[data-variant=destructive]>*):is(svg){color:rgb(var(--destructive))!important}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}.\[\&\>a\]\:underline>a{text-decoration-line:underline}.\[\&\>a\]\:underline-offset-4>a{text-underline-offset:4px}.\[\&\>a\:hover\]\:text-primary>a:hover{color:rgb(var(--primary))}.\[\&\>svg\]\:pointer-events-none>svg{pointer-events:none}.\[\&\>svg\]\:size-3>svg{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.\[\&\>svg\]\:size-3\.5>svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\[\&\>tr\]\:last\:border-b-0>tr:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){a.\[a\&\]\:hover\:bg-\[\#1a7f37\]\/90:hover{background-color:#1a7f37e6}a.\[a\&\]\:hover\:bg-\[\#3b82f6\]\/90:hover{background-color:#3b82f6e6}a.\[a\&\]\:hover\:bg-\[\#4b5563\]\/90:hover{background-color:#4b5563e6}a.\[a\&\]\:hover\:bg-\[\#9a6700\]\/90:hover{background-color:#9a6700e6}a.\[a\&\]\:hover\:bg-\[\#22c55e\]\/90:hover{background-color:#22c55ee6}a.\[a\&\]\:hover\:bg-\[\#0969da\]\/90:hover{background-color:#0969dae6}a.\[a\&\]\:hover\:bg-\[\#a855f7\]\/90:hover{background-color:#a855f7e6}a.\[a\&\]\:hover\:bg-\[\#f97316\]\/90:hover{background-color:#f97316e6}a.\[a\&\]\:hover\:bg-accent\/10:hover{background-color:rgb(var(--accent))}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-accent\/10:hover{background-color:color-mix(in oklab,rgb(var(--accent)) 10%,transparent)}}a.\[a\&\]\:hover\:bg-destructive\/90:hover{background-color:rgb(var(--destructive))}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,rgb(var(--destructive)) 90%,transparent)}}a.\[a\&\]\:hover\:bg-muted:hover,a.\[a\&\]\:hover\:bg-muted\/80:hover{background-color:rgb(var(--muted))}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-muted\/80:hover{background-color:color-mix(in oklab,rgb(var(--muted)) 80%,transparent)}}a.\[a\&\]\:hover\:bg-primary\/90:hover{background-color:rgb(var(--primary))}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,rgb(var(--primary)) 90%,transparent)}}a.\[a\&\]\:hover\:bg-secondary\/90:hover{background-color:rgb(var(--secondary))}@supports (color:color-mix(in lab,red,red)){a.\[a\&\]\:hover\:bg-secondary\/90:hover{background-color:color-mix(in oklab,rgb(var(--secondary)) 90%,transparent)}}a.\[a\&\]\:hover\:text-accent-foreground:hover{color:rgb(var(--accent-foreground))}}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:forwards}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}@font-face{font-family:Aspekta;font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/Aspekta-400.woff2)format("woff2")}@font-face{font-family:Aspekta;font-style:normal;font-weight:500;font-display:swap;src:url(/fonts/Aspekta-500.woff2)format("woff2")}@font-face{font-family:Aspekta;font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/Aspekta-600.woff2)format("woff2")}@font-face{font-family:Aspekta;font-style:normal;font-weight:700;font-display:swap;src:url(/fonts/Aspekta-700.woff2)format("woff2")}:root{--background:240 240 236;--foreground:22 22 20;--card:249 249 247;--card-foreground:22 22 20;--popover:249 249 247;--popover-foreground:22 22 20;--primary:217 94 42;--primary-foreground:249 249 247;--secondary:240 240 236;--secondary-foreground:47 47 44;--muted:240 240 236;--muted-foreground:87 87 83;--accent:221 221 215;--accent-foreground:22 22 20;--destructive:180 50 50;--destructive-foreground:249 249 247;--border:196 196 189;--input:196 196 189;--ring:217 94 42;--chart-1:217 94 42;--chart-2:87 87 83;--chart-3:127 127 121;--chart-4:166 166 159;--chart-5:47 47 44;--radius:.375rem}.dark{--background:22 22 20;--foreground:249 249 247;--card:47 47 44;--card-foreground:249 249 247;--popover:47 47 44;--popover-foreground:249 249 247;--primary:217 94 42;--primary-foreground:249 249 247;--secondary:87 87 83;--secondary-foreground:249 249 247;--muted:87 87 83;--muted-foreground:196 196 189;--accent:87 87 83;--accent-foreground:249 249 247;--destructive:180 50 50;--destructive-foreground:249 249 247;--border:87 87 83;--input:87 87 83;--ring:217 94 42;--chart-1:217 94 42;--chart-2:196 196 189;--chart-3:166 166 159;--chart-4:127 127 121;--chart-5:240 240 236}.chat-markdown{overflow-wrap:break-word;line-height:1.55}.chat-markdown>:first-child{margin-top:0}.chat-markdown>:last-child{margin-bottom:0}.chat-markdown p{margin:.5em 0}.chat-markdown h1,.chat-markdown h2,.chat-markdown h3,.chat-markdown h4,.chat-markdown h5,.chat-markdown h6{margin:1em 0 .4em;font-size:1em;font-weight:600;line-height:1.3}.chat-markdown h1{font-size:1.15em}.chat-markdown h2{font-size:1.08em}.chat-markdown ul,.chat-markdown ol{margin:.5em 0;padding-left:1.4em}.chat-markdown ul{list-style:outside}.chat-markdown ol{list-style:decimal}.chat-markdown li,.chat-markdown li>ul,.chat-markdown li>ol{margin:.2em 0}.chat-markdown li::marker{color:rgb(var(--muted-foreground))}.chat-markdown code{font-family:var(--font-mono);background:rgb(var(--muted));border:1px solid rgb(var(--border) / .6);border-radius:4px;padding:.1em .35em;font-size:.9em}.chat-markdown pre{background:rgb(var(--muted));border:1px solid rgb(var(--border) / .6);border-radius:var(--radius);margin:.6em 0;padding:.6em .75em;overflow-x:auto}.chat-markdown pre code{background:0 0;border:none;padding:0;font-size:.85em;line-height:1.5}.chat-markdown blockquote{border-left:3px solid rgb(var(--border));color:rgb(var(--muted-foreground));margin:.6em 0;padding:.1em 0 .1em .9em}.chat-markdown a{color:rgb(var(--primary));text-underline-offset:2px;text-decoration:underline}.chat-markdown table{border-collapse:collapse;margin:.6em 0;font-size:.95em;display:block;overflow-x:auto}.chat-markdown th,.chat-markdown td{border:1px solid rgb(var(--border));text-align:left;padding:4px 10px}.chat-markdown th{background:rgb(var(--muted));font-weight:600}.chat-markdown hr{border:none;border-top:1px solid rgb(var(--border));margin:1em 0}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0)scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1))rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0)scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1))rotate(var(--tw-exit-rotate,0))}} diff --git a/internal/server/uidist/assets/index-mJpD-dF1.js b/internal/server/uidist/assets/index-mJpD-dF1.js new file mode 100644 index 0000000..158c697 --- /dev/null +++ b/internal/server/uidist/assets/index-mJpD-dF1.js @@ -0,0 +1,296 @@ +var j2=Object.defineProperty;var k2=(e,r,a)=>r in e?j2(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a;var lh=(e,r,a)=>k2(e,typeof r!="symbol"?r+"":r,a);function C2(e,r){for(var a=0;al[u]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))l(u);new MutationObserver(u=>{for(const c of u)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function a(u){const c={};return u.integrity&&(c.integrity=u.integrity),u.referrerPolicy&&(c.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?c.credentials="include":u.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function l(u){if(u.ep)return;u.ep=!0;const c=a(u);fetch(u.href,c)}})();function gc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ih={exports:{}},Vo={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Ny;function E2(){if(Ny)return Vo;Ny=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function a(l,u,c){var d=null;if(c!==void 0&&(d=""+c),u.key!==void 0&&(d=""+u.key),"key"in u){c={};for(var f in u)f!=="key"&&(c[f]=u[f])}else c=u;return u=c.ref,{$$typeof:e,type:l,key:d,ref:u!==void 0?u:null,props:c}}return Vo.Fragment=r,Vo.jsx=a,Vo.jsxs=a,Vo}var Ty;function N2(){return Ty||(Ty=1,ih.exports=E2()),ih.exports}var o=N2(),oh={exports:{}},Fe={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Ay;function T2(){if(Ay)return Fe;Ay=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),b=Symbol.iterator;function y(L){return L===null||typeof L!="object"?null:(L=b&&L[b]||L["@@iterator"],typeof L=="function"?L:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,A={};function C(L,F,M){this.props=L,this.context=F,this.refs=A,this.updater=M||k}C.prototype.isReactComponent={},C.prototype.setState=function(L,F){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,F,"setState")},C.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function R(){}R.prototype=C.prototype;function D(L,F,M){this.props=L,this.context=F,this.refs=A,this.updater=M||k}var B=D.prototype=new R;B.constructor=D,j(B,C.prototype),B.isPureReactComponent=!0;var O=Array.isArray;function _(){}var E={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function W(L,F,M){var oe=M.ref;return{$$typeof:e,type:L,key:F,ref:oe!==void 0?oe:null,props:M}}function q(L,F){return W(L.type,F,L.props)}function $(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function X(L){var F={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(M){return F[M]})}var ce=/\/+/g;function le(L,F){return typeof L=="object"&&L!==null&&L.key!=null?X(""+L.key):F.toString(36)}function ee(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(_,_):(L.status="pending",L.then(function(F){L.status==="pending"&&(L.status="fulfilled",L.value=F)},function(F){L.status==="pending"&&(L.status="rejected",L.reason=F)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function U(L,F,M,oe,G){var ue=typeof L;(ue==="undefined"||ue==="boolean")&&(L=null);var re=!1;if(L===null)re=!0;else switch(ue){case"bigint":case"string":case"number":re=!0;break;case"object":switch(L.$$typeof){case e:case r:re=!0;break;case v:return re=L._init,U(re(L._payload),F,M,oe,G)}}if(re)return G=G(L),re=oe===""?"."+le(L,0):oe,O(G)?(M="",re!=null&&(M=re.replace(ce,"$&/")+"/"),U(G,F,M,"",function(be){return be})):G!=null&&($(G)&&(G=q(G,M+(G.key==null||L&&L.key===G.key?"":(""+G.key).replace(ce,"$&/")+"/")+re)),F.push(G)),1;re=0;var ye=oe===""?".":oe+":";if(O(L))for(var de=0;de>>1,N=U[K];if(0>>1;Ku(M,ie))oeu(G,M)?(U[K]=G,U[oe]=ie,K=oe):(U[K]=M,U[F]=ie,K=F);else if(oeu(G,ie))U[K]=G,U[oe]=ie,K=oe;else break e}}return Z}function u(U,Z){var ie=U.sortIndex-Z.sortIndex;return ie!==0?ie:U.id-Z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],h=[],v=1,x=null,b=3,y=!1,k=!1,j=!1,A=!1,C=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function B(U){for(var Z=a(h);Z!==null;){if(Z.callback===null)l(h);else if(Z.startTime<=U)l(h),Z.sortIndex=Z.expirationTime,r(m,Z);else break;Z=a(h)}}function O(U){if(j=!1,B(U),!k)if(a(m)!==null)k=!0,_||(_=!0,X());else{var Z=a(h);Z!==null&&ee(O,Z.startTime-U)}}var _=!1,E=-1,I=5,W=-1;function q(){return A?!0:!(e.unstable_now()-WU&&q());){var K=x.callback;if(typeof K=="function"){x.callback=null,b=x.priorityLevel;var N=K(x.expirationTime<=U);if(U=e.unstable_now(),typeof N=="function"){x.callback=N,B(U),Z=!0;break t}x===a(m)&&l(m),B(U)}else l(m);x=a(m)}if(x!==null)Z=!0;else{var L=a(h);L!==null&&ee(O,L.startTime-U),Z=!1}}break e}finally{x=null,b=ie,y=!1}Z=void 0}}finally{Z?X():_=!1}}}var X;if(typeof D=="function")X=function(){D($)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,le=ce.port2;ce.port1.onmessage=$,X=function(){le.postMessage(null)}}else X=function(){C($,0)};function ee(U,Z){E=C(function(){U(e.unstable_now())},Z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125K?(U.sortIndex=ie,r(h,U),a(m)===null&&U===a(h)&&(j?(R(E),E=-1):j=!0,ee(O,ie-K))):(U.sortIndex=N,r(m,U),k||y||(k=!0,_||(_=!0,X()))),U},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(U){var Z=b;return function(){var ie=b;b=Z;try{return U.apply(this,arguments)}finally{b=ie}}}})(ch)),ch}var Ry;function M2(){return Ry||(Ry=1,uh.exports=_2()),uh.exports}var dh={exports:{}},hn={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Dy;function R2(){if(Dy)return hn;Dy=1;var e=Am();function r(m){var h="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),dh.exports=R2(),dh.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var zy;function D2(){if(zy)return Go;zy=1;var e=M2(),r=Am(),a=N0();function l(t){var n="https://react.dev/errors/"+t;if(1N||(t.current=K[N],K[N]=null,N--)}function M(t,n){N++,K[N]=t.current,t.current=n}var oe=L(null),G=L(null),ue=L(null),re=L(null);function ye(t,n){switch(M(ue,n),M(G,t),M(oe,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?Qv(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Qv(n),t=Zv(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}F(oe),M(oe,t)}function de(){F(oe),F(G),F(ue)}function be(t){t.memoizedState!==null&&M(re,t);var n=oe.current,i=Zv(n,t.type);n!==i&&(M(G,t),M(oe,i))}function Ee(t){G.current===t&&(F(oe),F(G)),re.current===t&&(F(re),qo._currentValue=ie)}var Se,Ie;function Be(t){if(Se===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);Se=n&&n[1]||"",Ie=-1)":-1p||H[s]!==J[p]){var se=` +`+H[s].replace(" at new "," at ");return t.displayName&&se.includes("")&&(se=se.replace("",t.displayName)),se}while(1<=s&&0<=p);break}}}finally{Mt=!1,Error.prepareStackTrace=i}return(i=t?t.displayName||t.name:"")?Be(i):""}function Et(t,n){switch(t.tag){case 26:case 27:case 5:return Be(t.type);case 16:return Be("Lazy");case 13:return t.child!==n&&n!==null?Be("Suspense Fallback"):Be("Suspense");case 19:return Be("SuspenseList");case 0:case 15:return Ct(t.type,!1);case 11:return Ct(t.type.render,!1);case 1:return Ct(t.type,!0);case 31:return Be("Activity");default:return""}}function Lt(t){try{var n="",i=null;do n+=Et(t,i),i=t,t=t.return;while(t);return n}catch(s){return` +Error generating stack: `+s.message+` +`+s.stack}}var Rt=Object.prototype.hasOwnProperty,Dt=e.unstable_scheduleCallback,zt=e.unstable_cancelCallback,we=e.unstable_shouldYield,mt=e.unstable_requestPaint,Y=e.unstable_now,qe=e.unstable_getCurrentPriorityLevel,ne=e.unstable_ImmediatePriority,z=e.unstable_UserBlockingPriority,fe=e.unstable_NormalPriority,ke=e.unstable_LowPriority,Oe=e.unstable_IdlePriority,en=e.log,Cn=e.unstable_setDisableYieldValue,Qt=null,Nt=null;function rn(t){if(typeof en=="function"&&Cn(t),Nt&&typeof Nt.setStrictMode=="function")try{Nt.setStrictMode(Qt,t)}catch{}}var it=Math.clz32?Math.clz32:ws,br=Math.log,Bn=Math.LN2;function ws(t){return t>>>=0,t===0?32:31-(br(t)/Bn|0)|0}var xl=256,Jl=262144,ba=4194304;function fn(t){var n=t&42;if(n!==0)return n;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Wl(t,n,i){var s=t.pendingLanes;if(s===0)return 0;var p=0,g=t.suspendedLanes,w=t.pingedLanes;t=t.warmLanes;var T=s&134217727;return T!==0?(s=T&~g,s!==0?p=fn(s):(w&=T,w!==0?p=fn(w):i||(i=T&~t,i!==0&&(p=fn(i))))):(T=s&~g,T!==0?p=fn(T):w!==0?p=fn(w):i||(i=s&~t,i!==0&&(p=fn(i)))),p===0?0:n!==0&&n!==p&&(n&g)===0&&(g=p&-p,i=n&-n,g>=i||g===32&&(i&4194048)!==0)?n:p}function He(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function ht(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 wt(){var t=ba;return ba<<=1,(ba&62914560)===0&&(ba=4194304),t}function bn(t){for(var n=[],i=0;31>i;i++)n.push(t);return n}function an(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function wr(t,n,i,s,p,g){var w=t.pendingLanes;t.pendingLanes=i,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=i,t.entangledLanes&=i,t.errorRecoveryDisabledLanes&=i,t.shellSuspendCounter=0;var T=t.entanglements,H=t.expirationTimes,J=t.hiddenUpdates;for(i=w&~i;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var xk=/[\n"\\]/g;function Kn(t){return t.replace(xk,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Jc(t,n,i,s,p,g,w,T){t.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.type=w:t.removeAttribute("type"),n!=null?w==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Xn(n)):t.value!==""+Xn(n)&&(t.value=""+Xn(n)):w!=="submit"&&w!=="reset"||t.removeAttribute("value"),n!=null?Wc(t,w,Xn(n)):i!=null?Wc(t,w,Xn(i)):s!=null&&t.removeAttribute("value"),p==null&&g!=null&&(t.defaultChecked=!!g),p!=null&&(t.checked=p&&typeof p!="function"&&typeof p!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?t.name=""+Xn(T):t.removeAttribute("name")}function Fp(t,n,i,s,p,g,w,T){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(t.type=g),n!=null||i!=null){if(!(g!=="submit"&&g!=="reset"||n!=null)){Zc(t);return}i=i!=null?""+Xn(i):"",n=n!=null?""+Xn(n):i,T||n===t.value||(t.value=n),t.defaultValue=n}s=s??p,s=typeof s!="function"&&typeof s!="symbol"&&!!s,t.checked=T?t.checked:!!s,t.defaultChecked=!!s,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(t.name=w),Zc(t)}function Wc(t,n,i){n==="number"&&ks(t.ownerDocument)===t||t.defaultValue===""+i||(t.defaultValue=""+i)}function li(t,n,i,s){if(t=t.options,n){n={};for(var p=0;p"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ad=!1;if($r)try{var ao={};Object.defineProperty(ao,"passive",{get:function(){ad=!0}}),window.addEventListener("test",ao,ao),window.removeEventListener("test",ao,ao)}catch{ad=!1}var Sa=null,ld=null,Es=null;function Zp(){if(Es)return Es;var t,n=ld,i=n.length,s,p="value"in Sa?Sa.value:Sa.textContent,g=p.length;for(t=0;t=oo),rg=" ",ag=!1;function lg(t,n){switch(t){case"keyup":return Vk.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ig(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ui=!1;function Yk(t,n){switch(t){case"compositionend":return ig(n);case"keypress":return n.which!==32?null:(ag=!0,rg);case"textInput":return t=n.data,t===rg&&ag?null:t;default:return null}}function Xk(t,n){if(ui)return t==="compositionend"||!cd&&lg(t,n)?(t=Zp(),Es=ld=Sa=null,ui=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:i,offset:n-t};t=s}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=mg(i)}}function gg(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?gg(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function xg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=ks(t.document);n instanceof t.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)t=n.contentWindow;else break;n=ks(t.document)}return n}function hd(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var nC=$r&&"documentMode"in document&&11>=document.documentMode,ci=null,md=null,fo=null,pd=!1;function vg(t,n,i){var s=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;pd||ci==null||ci!==ks(s)||(s=ci,"selectionStart"in s&&hd(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),fo&&co(fo,s)||(fo=s,s=yu(md,"onSelect"),0>=w,p-=w,jr=1<<32-it(n)+p|i<Xe?(at=Ae,Ae=null):at=Ae.sibling;var ut=te(V,Ae,Q[Xe],he);if(ut===null){Ae===null&&(Ae=at);break}t&&Ae&&ut.alternate===null&&n(V,Ae),P=g(ut,P,Xe),st===null?Me=ut:st.sibling=ut,st=ut,Ae=at}if(Xe===Q.length)return i(V,Ae),lt&&Vr(V,Xe),Me;if(Ae===null){for(;XeXe?(at=Ae,Ae=null):at=Ae.sibling;var Fa=te(V,Ae,ut.value,he);if(Fa===null){Ae===null&&(Ae=at);break}t&&Ae&&Fa.alternate===null&&n(V,Ae),P=g(Fa,P,Xe),st===null?Me=Fa:st.sibling=Fa,st=Fa,Ae=at}if(ut.done)return i(V,Ae),lt&&Vr(V,Xe),Me;if(Ae===null){for(;!ut.done;Xe++,ut=Q.next())ut=pe(V,ut.value,he),ut!==null&&(P=g(ut,P,Xe),st===null?Me=ut:st.sibling=ut,st=ut);return lt&&Vr(V,Xe),Me}for(Ae=s(Ae);!ut.done;Xe++,ut=Q.next())ut=ae(Ae,V,Xe,ut.value,he),ut!==null&&(t&&ut.alternate!==null&&Ae.delete(ut.key===null?Xe:ut.key),P=g(ut,P,Xe),st===null?Me=ut:st.sibling=ut,st=ut);return t&&Ae.forEach(function(S2){return n(V,S2)}),lt&&Vr(V,Xe),Me}function yt(V,P,Q,he){if(typeof Q=="object"&&Q!==null&&Q.type===j&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case y:e:{for(var Me=Q.key;P!==null;){if(P.key===Me){if(Me=Q.type,Me===j){if(P.tag===7){i(V,P.sibling),he=p(P,Q.props.children),he.return=V,V=he;break e}}else if(P.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===I&&Tl(Me)===P.type){i(V,P.sibling),he=p(P,Q.props),vo(he,Q),he.return=V,V=he;break e}i(V,P);break}else n(V,P);P=P.sibling}Q.type===j?(he=jl(Q.props.children,V.mode,he,Q.key),he.return=V,V=he):(he=Ls(Q.type,Q.key,Q.props,null,V.mode,he),vo(he,Q),he.return=V,V=he)}return w(V);case k:e:{for(Me=Q.key;P!==null;){if(P.key===Me)if(P.tag===4&&P.stateNode.containerInfo===Q.containerInfo&&P.stateNode.implementation===Q.implementation){i(V,P.sibling),he=p(P,Q.children||[]),he.return=V,V=he;break e}else{i(V,P);break}else n(V,P);P=P.sibling}he=Sd(Q,V.mode,he),he.return=V,V=he}return w(V);case I:return Q=Tl(Q),yt(V,P,Q,he)}if(ee(Q))return Ne(V,P,Q,he);if(X(Q)){if(Me=X(Q),typeof Me!="function")throw Error(l(150));return Q=Me.call(Q),Le(V,P,Q,he)}if(typeof Q.then=="function")return yt(V,P,$s(Q),he);if(Q.$$typeof===D)return yt(V,P,Is(V,Q),he);Fs(V,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,P!==null&&P.tag===6?(i(V,P.sibling),he=p(P,Q),he.return=V,V=he):(i(V,P),he=wd(Q,V.mode,he),he.return=V,V=he),w(V)):i(V,P)}return function(V,P,Q,he){try{xo=0;var Me=yt(V,P,Q,he);return wi=null,Me}catch(Ae){if(Ae===bi||Ae===qs)throw Ae;var st=Hn(29,Ae,null,V.mode);return st.lanes=he,st.return=V,st}finally{}}}var _l=qg(!0),Pg=qg(!1),Na=!1;function Od(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function zd(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ta(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Aa(t,n,i){var s=t.updateQueue;if(s===null)return null;if(s=s.shared,(dt&2)!==0){var p=s.pending;return p===null?n.next=n:(n.next=p.next,p.next=n),s.pending=n,n=zs(t),Cg(t,null,i),n}return Os(t,s,n,i),zs(t)}function yo(t,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194048)!==0)){var s=n.lanes;s&=t.pendingLanes,i|=s,n.lanes=i,En(t,i)}}function Ld(t,n){var i=t.updateQueue,s=t.alternate;if(s!==null&&(s=s.updateQueue,i===s)){var p=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var w={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};g===null?p=g=w:g=g.next=w,i=i.next}while(i!==null);g===null?p=g=n:g=g.next=n}else p=g=n;i={baseState:s.baseState,firstBaseUpdate:p,lastBaseUpdate:g,shared:s.shared,callbacks:s.callbacks},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=n:t.next=n,i.lastBaseUpdate=n}var Ud=!1;function bo(){if(Ud){var t=yi;if(t!==null)throw t}}function wo(t,n,i,s){Ud=!1;var p=t.updateQueue;Na=!1;var g=p.firstBaseUpdate,w=p.lastBaseUpdate,T=p.shared.pending;if(T!==null){p.shared.pending=null;var H=T,J=H.next;H.next=null,w===null?g=J:w.next=J,w=H;var se=t.alternate;se!==null&&(se=se.updateQueue,T=se.lastBaseUpdate,T!==w&&(T===null?se.firstBaseUpdate=J:T.next=J,se.lastBaseUpdate=H))}if(g!==null){var pe=p.baseState;w=0,se=J=H=null,T=g;do{var te=T.lane&-536870913,ae=te!==T.lane;if(ae?(rt&te)===te:(s&te)===te){te!==0&&te===vi&&(Ud=!0),se!==null&&(se=se.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var Ne=t,Le=T;te=n;var yt=i;switch(Le.tag){case 1:if(Ne=Le.payload,typeof Ne=="function"){pe=Ne.call(yt,pe,te);break e}pe=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Le.payload,te=typeof Ne=="function"?Ne.call(yt,pe,te):Ne,te==null)break e;pe=x({},pe,te);break e;case 2:Na=!0}}te=T.callback,te!==null&&(t.flags|=64,ae&&(t.flags|=8192),ae=p.callbacks,ae===null?p.callbacks=[te]:ae.push(te))}else ae={lane:te,tag:T.tag,payload:T.payload,callback:T.callback,next:null},se===null?(J=se=ae,H=pe):se=se.next=ae,w|=te;if(T=T.next,T===null){if(T=p.shared.pending,T===null)break;ae=T,T=ae.next,ae.next=null,p.lastBaseUpdate=ae,p.shared.pending=null}}while(!0);se===null&&(H=pe),p.baseState=H,p.firstBaseUpdate=J,p.lastBaseUpdate=se,g===null&&(p.shared.lanes=0),Oa|=w,t.lanes=w,t.memoizedState=pe}}function $g(t,n){if(typeof t!="function")throw Error(l(191,t));t.call(n)}function Fg(t,n){var i=t.callbacks;if(i!==null)for(t.callbacks=null,t=0;tg?g:8;var w=U.T,T={};U.T=T,nf(t,!1,n,i);try{var H=p(),J=U.S;if(J!==null&&J(T,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var se=dC(H,s);ko(t,n,se,Vn(t))}else ko(t,n,s,Vn(t))}catch(pe){ko(t,n,{then:function(){},status:"rejected",reason:pe},Vn())}finally{Z.p=g,w!==null&&T.types!==null&&(w.types=T.types),U.T=w}}function xC(){}function ef(t,n,i,s){if(t.tag!==5)throw Error(l(476));var p=Sx(t).queue;wx(t,p,n,ie,i===null?xC:function(){return jx(t),i(s)})}function Sx(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kr,lastRenderedState:ie},next:null};var i={};return n.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kr,lastRenderedState:i},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function jx(t){var n=Sx(t);n.next===null&&(n=t.alternate.memoizedState),ko(t,n.next.queue,{},Vn())}function tf(){return sn(qo)}function kx(){return Ht().memoizedState}function Cx(){return Ht().memoizedState}function vC(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var i=Vn();t=Ta(i);var s=Aa(n,t,i);s!==null&&(Dn(s,n,i),yo(s,n,i)),n={cache:_d()},t.payload=n;return}n=n.return}}function yC(t,n,i){var s=Vn();i={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},eu(t)?Nx(n,i):(i=yd(t,n,i,s),i!==null&&(Dn(i,t,s),Tx(i,n,s)))}function Ex(t,n,i){var s=Vn();ko(t,n,i,s)}function ko(t,n,i,s){var p={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(eu(t))Nx(n,p);else{var g=t.alternate;if(t.lanes===0&&(g===null||g.lanes===0)&&(g=n.lastRenderedReducer,g!==null))try{var w=n.lastRenderedState,T=g(w,i);if(p.hasEagerState=!0,p.eagerState=T,In(T,w))return Os(t,n,p,0),St===null&&Ds(),!1}catch{}finally{}if(i=yd(t,n,p,s),i!==null)return Dn(i,t,s),Tx(i,n,s),!0}return!1}function nf(t,n,i,s){if(s={lane:2,revertLane:zf(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},eu(t)){if(n)throw Error(l(479))}else n=yd(t,i,s,2),n!==null&&Dn(n,t,2)}function eu(t){var n=t.alternate;return t===Ye||n!==null&&n===Ye}function Nx(t,n){ji=Ys=!0;var i=t.pending;i===null?n.next=n:(n.next=i.next,i.next=n),t.pending=n}function Tx(t,n,i){if((i&4194048)!==0){var s=n.lanes;s&=t.pendingLanes,i|=s,n.lanes=i,En(t,i)}}var Co={readContext:sn,use:Qs,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useLayoutEffect:Ut,useInsertionEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useSyncExternalStore:Ut,useId:Ut,useHostTransitionStatus:Ut,useFormState:Ut,useActionState:Ut,useOptimistic:Ut,useMemoCache:Ut,useCacheRefresh:Ut};Co.useEffectEvent=Ut;var Ax={readContext:sn,use:Qs,useCallback:function(t,n){return wn().memoizedState=[t,n===void 0?null:n],t},useContext:sn,useEffect:fx,useImperativeHandle:function(t,n,i){i=i!=null?i.concat([t]):null,Js(4194308,4,gx.bind(null,n,t),i)},useLayoutEffect:function(t,n){return Js(4194308,4,t,n)},useInsertionEffect:function(t,n){Js(4,2,t,n)},useMemo:function(t,n){var i=wn();n=n===void 0?null:n;var s=t();if(Ml){rn(!0);try{t()}finally{rn(!1)}}return i.memoizedState=[s,n],s},useReducer:function(t,n,i){var s=wn();if(i!==void 0){var p=i(n);if(Ml){rn(!0);try{i(n)}finally{rn(!1)}}}else p=n;return s.memoizedState=s.baseState=p,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:p},s.queue=t,t=t.dispatch=yC.bind(null,Ye,t),[s.memoizedState,t]},useRef:function(t){var n=wn();return t={current:t},n.memoizedState=t},useState:function(t){t=Kd(t);var n=t.queue,i=Ex.bind(null,Ye,n);return n.dispatch=i,[t.memoizedState,i]},useDebugValue:Jd,useDeferredValue:function(t,n){var i=wn();return Wd(i,t,n)},useTransition:function(){var t=Kd(!1);return t=wx.bind(null,Ye,t.queue,!0,!1),wn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,i){var s=Ye,p=wn();if(lt){if(i===void 0)throw Error(l(407));i=i()}else{if(i=n(),St===null)throw Error(l(349));(rt&127)!==0||Qg(s,n,i)}p.memoizedState=i;var g={value:i,getSnapshot:n};return p.queue=g,fx(Jg.bind(null,s,g,t),[t]),s.flags|=2048,Ci(9,{destroy:void 0},Zg.bind(null,s,g,i,n),null),i},useId:function(){var t=wn(),n=St.identifierPrefix;if(lt){var i=kr,s=jr;i=(s&~(1<<32-it(s)-1)).toString(32)+i,n="_"+n+"R_"+i,i=Xs++,0<\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof s.is=="string"?w.createElement("select",{is:s.is}):w.createElement("select"),s.multiple?g.multiple=!0:s.size&&(g.size=s.size);break;default:g=typeof s.is=="string"?w.createElement(p,{is:s.is}):w.createElement(p)}}g[ln]=n,g[Nn]=s;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)g.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===n)break e;for(;w.sibling===null;){if(w.return===null||w.return===n)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}n.stateNode=g;e:switch(cn(g,p,s),p){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Zr(n)}}return _t(n),xf(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,i),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==s&&Zr(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(l(166));if(t=ue.current,gi(n)){if(t=n.stateNode,i=n.memoizedProps,s=null,p=on,p!==null)switch(p.tag){case 27:case 5:s=p.memoizedProps}t[ln]=n,t=!!(t.nodeValue===i||s!==null&&s.suppressHydrationWarning===!0||Xv(t.nodeValue,i)),t||Ca(n,!0)}else t=bu(t).createTextNode(s),t[ln]=n,n.stateNode=t}return _t(n),null;case 31:if(i=n.memoizedState,t===null||t.memoizedState!==null){if(s=gi(n),i!==null){if(t===null){if(!s)throw Error(l(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[ln]=n}else kl(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;_t(n),t=!1}else i=Ed(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=i),t=!0;if(!t)return n.flags&256?(Pn(n),n):(Pn(n),null);if((n.flags&128)!==0)throw Error(l(558))}return _t(n),null;case 13:if(s=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(p=gi(n),s!==null&&s.dehydrated!==null){if(t===null){if(!p)throw Error(l(318));if(p=n.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(l(317));p[ln]=n}else kl(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;_t(n),p=!1}else p=Ed(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=p),p=!0;if(!p)return n.flags&256?(Pn(n),n):(Pn(n),null)}return Pn(n),(n.flags&128)!==0?(n.lanes=i,n):(i=s!==null,t=t!==null&&t.memoizedState!==null,i&&(s=n.child,p=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(p=s.alternate.memoizedState.cachePool.pool),g=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(g=s.memoizedState.cachePool.pool),g!==p&&(s.flags|=2048)),i!==t&&i&&(n.child.flags|=8192),lu(n,n.updateQueue),_t(n),null);case 4:return de(),t===null&&If(n.stateNode.containerInfo),_t(n),null;case 10:return Yr(n.type),_t(n),null;case 19:if(F(It),s=n.memoizedState,s===null)return _t(n),null;if(p=(n.flags&128)!==0,g=s.rendering,g===null)if(p)No(s,!1);else{if(Bt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(g=Gs(t),g!==null){for(n.flags|=128,No(s,!1),t=g.updateQueue,n.updateQueue=t,lu(n,t),n.subtreeFlags=0,t=i,i=n.child;i!==null;)Eg(i,t),i=i.sibling;return M(It,It.current&1|2),lt&&Vr(n,s.treeForkCount),n.child}t=t.sibling}s.tail!==null&&Y()>cu&&(n.flags|=128,p=!0,No(s,!1),n.lanes=4194304)}else{if(!p)if(t=Gs(g),t!==null){if(n.flags|=128,p=!0,t=t.updateQueue,n.updateQueue=t,lu(n,t),No(s,!0),s.tail===null&&s.tailMode==="hidden"&&!g.alternate&&!lt)return _t(n),null}else 2*Y()-s.renderingStartTime>cu&&i!==536870912&&(n.flags|=128,p=!0,No(s,!1),n.lanes=4194304);s.isBackwards?(g.sibling=n.child,n.child=g):(t=s.last,t!==null?t.sibling=g:n.child=g,s.last=g)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Y(),t.sibling=null,i=It.current,M(It,p?i&1|2:i&1),lt&&Vr(n,s.treeForkCount),t):(_t(n),null);case 22:case 23:return Pn(n),Id(),s=n.memoizedState!==null,t!==null?t.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(i&536870912)!==0&&(n.flags&128)===0&&(_t(n),n.subtreeFlags&6&&(n.flags|=8192)):_t(n),i=n.updateQueue,i!==null&&lu(n,i.retryQueue),i=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==i&&(n.flags|=2048),t!==null&&F(Nl),null;case 24:return i=null,t!==null&&(i=t.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),Yr($t),_t(n),null;case 25:return null;case 30:return null}throw Error(l(156,n.tag))}function kC(t,n){switch(kd(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return Yr($t),de(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return Ee(n),null;case 31:if(n.memoizedState!==null){if(Pn(n),n.alternate===null)throw Error(l(340));kl()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(Pn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(l(340));kl()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return F(It),null;case 4:return de(),null;case 10:return Yr(n.type),null;case 22:case 23:return Pn(n),Id(),t!==null&&F(Nl),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return Yr($t),null;case 25:return null;default:return null}}function Wx(t,n){switch(kd(n),n.tag){case 3:Yr($t),de();break;case 26:case 27:case 5:Ee(n);break;case 4:de();break;case 31:n.memoizedState!==null&&Pn(n);break;case 13:Pn(n);break;case 19:F(It);break;case 10:Yr(n.type);break;case 22:case 23:Pn(n),Id(),t!==null&&F(Nl);break;case 24:Yr($t)}}function To(t,n){try{var i=n.updateQueue,s=i!==null?i.lastEffect:null;if(s!==null){var p=s.next;i=p;do{if((i.tag&t)===t){s=void 0;var g=i.create,w=i.inst;s=g(),w.destroy=s}i=i.next}while(i!==p)}}catch(T){gt(n,n.return,T)}}function Ra(t,n,i){try{var s=n.updateQueue,p=s!==null?s.lastEffect:null;if(p!==null){var g=p.next;s=g;do{if((s.tag&t)===t){var w=s.inst,T=w.destroy;if(T!==void 0){w.destroy=void 0,p=n;var H=i,J=T;try{J()}catch(se){gt(p,H,se)}}}s=s.next}while(s!==g)}}catch(se){gt(n,n.return,se)}}function ev(t){var n=t.updateQueue;if(n!==null){var i=t.stateNode;try{Fg(n,i)}catch(s){gt(t,t.return,s)}}}function tv(t,n,i){i.props=Rl(t.type,t.memoizedProps),i.state=t.memoizedState;try{i.componentWillUnmount()}catch(s){gt(t,n,s)}}function Ao(t,n){try{var i=t.ref;if(i!==null){switch(t.tag){case 26:case 27:case 5:var s=t.stateNode;break;case 30:s=t.stateNode;break;default:s=t.stateNode}typeof i=="function"?t.refCleanup=i(s):i.current=s}}catch(p){gt(t,n,p)}}function Cr(t,n){var i=t.ref,s=t.refCleanup;if(i!==null)if(typeof s=="function")try{s()}catch(p){gt(t,n,p)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(p){gt(t,n,p)}else i.current=null}function nv(t){var n=t.type,i=t.memoizedProps,s=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":i.autoFocus&&s.focus();break e;case"img":i.src?s.src=i.src:i.srcSet&&(s.srcset=i.srcSet)}}catch(p){gt(t,t.return,p)}}function vf(t,n,i){try{var s=t.stateNode;GC(s,t.type,i,n),s[Nn]=n}catch(p){gt(t,t.return,p)}}function rv(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ia(t.type)||t.tag===4}function yf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||rv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Ia(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function bf(t,n,i){var s=t.tag;if(s===5||s===6)t=t.stateNode,n?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(t,n):(n=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,n.appendChild(t),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=Pr));else if(s!==4&&(s===27&&Ia(t.type)&&(i=t.stateNode,n=null),t=t.child,t!==null))for(bf(t,n,i),t=t.sibling;t!==null;)bf(t,n,i),t=t.sibling}function iu(t,n,i){var s=t.tag;if(s===5||s===6)t=t.stateNode,n?i.insertBefore(t,n):i.appendChild(t);else if(s!==4&&(s===27&&Ia(t.type)&&(i=t.stateNode),t=t.child,t!==null))for(iu(t,n,i),t=t.sibling;t!==null;)iu(t,n,i),t=t.sibling}function av(t){var n=t.stateNode,i=t.memoizedProps;try{for(var s=t.type,p=n.attributes;p.length;)n.removeAttributeNode(p[0]);cn(n,s,i),n[ln]=t,n[Nn]=i}catch(g){gt(t,t.return,g)}}var Jr=!1,Gt=!1,wf=!1,lv=typeof WeakSet=="function"?WeakSet:Set,nn=null;function CC(t,n){if(t=t.containerInfo,Pf=Nu,t=xg(t),hd(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var s=i.getSelection&&i.getSelection();if(s&&s.rangeCount!==0){i=s.anchorNode;var p=s.anchorOffset,g=s.focusNode;s=s.focusOffset;try{i.nodeType,g.nodeType}catch{i=null;break e}var w=0,T=-1,H=-1,J=0,se=0,pe=t,te=null;t:for(;;){for(var ae;pe!==i||p!==0&&pe.nodeType!==3||(T=w+p),pe!==g||s!==0&&pe.nodeType!==3||(H=w+s),pe.nodeType===3&&(w+=pe.nodeValue.length),(ae=pe.firstChild)!==null;)te=pe,pe=ae;for(;;){if(pe===t)break t;if(te===i&&++J===p&&(T=w),te===g&&++se===s&&(H=w),(ae=pe.nextSibling)!==null)break;pe=te,te=pe.parentNode}pe=ae}i=T===-1||H===-1?null:{start:T,end:H}}else i=null}i=i||{start:0,end:0}}else i=null;for($f={focusedElem:t,selectionRange:i},Nu=!1,nn=n;nn!==null;)if(n=nn,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,nn=t;else for(;nn!==null;){switch(n=nn,g=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(i=0;i title"))),cn(g,s,i),g[ln]=t,tn(g),s=g;break e;case"link":var w=dy("link","href",p).get(s+(i.href||""));if(w){for(var T=0;Tyt&&(w=yt,yt=Le,Le=w);var V=pg(T,Le),P=pg(T,yt);if(V&&P&&(ae.rangeCount!==1||ae.anchorNode!==V.node||ae.anchorOffset!==V.offset||ae.focusNode!==P.node||ae.focusOffset!==P.offset)){var Q=pe.createRange();Q.setStart(V.node,V.offset),ae.removeAllRanges(),Le>yt?(ae.addRange(Q),ae.extend(P.node,P.offset)):(Q.setEnd(P.node,P.offset),ae.addRange(Q))}}}}for(pe=[],ae=T;ae=ae.parentNode;)ae.nodeType===1&&pe.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;Ti?32:i,U.T=null,i=Tf,Tf=null;var g=La,w=ra;if(Zt=0,_i=La=null,ra=0,(dt&6)!==0)throw Error(l(331));var T=dt;if(dt|=4,gv(g.current),hv(g,g.current,w,i),dt=T,zo(0,!1),Nt&&typeof Nt.onPostCommitFiberRoot=="function")try{Nt.onPostCommitFiberRoot(Qt,g)}catch{}return!0}finally{Z.p=p,U.T=s,Ov(t,n)}}function Lv(t,n,i){n=Zn(i,n),n=of(t.stateNode,n,2),t=Aa(t,n,2),t!==null&&(an(t,2),Er(t))}function gt(t,n,i){if(t.tag===3)Lv(t,t,i);else for(;n!==null;){if(n.tag===3){Lv(n,t,i);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(za===null||!za.has(s))){t=Zn(i,t),i=Ux(2),s=Aa(n,i,2),s!==null&&(Bx(i,s,n,t),an(s,2),Er(s));break}}n=n.return}}function Rf(t,n,i){var s=t.pingCache;if(s===null){s=t.pingCache=new TC;var p=new Set;s.set(n,p)}else p=s.get(n),p===void 0&&(p=new Set,s.set(n,p));p.has(i)||(kf=!0,p.add(i),t=DC.bind(null,t,n,i),n.then(t,t))}function DC(t,n,i){var s=t.pingCache;s!==null&&s.delete(n),t.pingedLanes|=t.suspendedLanes&i,t.warmLanes&=~i,St===t&&(rt&i)===i&&(Bt===4||Bt===3&&(rt&62914560)===rt&&300>Y()-uu?(dt&2)===0&&Mi(t,0):Cf|=i,Ai===rt&&(Ai=0)),Er(t)}function Uv(t,n){n===0&&(n=wt()),t=Sl(t,n),t!==null&&(an(t,n),Er(t))}function OC(t){var n=t.memoizedState,i=0;n!==null&&(i=n.retryLane),Uv(t,i)}function zC(t,n){var i=0;switch(t.tag){case 31:case 13:var s=t.stateNode,p=t.memoizedState;p!==null&&(i=p.retryLane);break;case 19:s=t.stateNode;break;case 22:s=t.stateNode._retryCache;break;default:throw Error(l(314))}s!==null&&s.delete(n),Uv(t,i)}function LC(t,n){return Dt(t,n)}var gu=null,Di=null,Df=!1,xu=!1,Of=!1,Ba=0;function Er(t){t!==Di&&t.next===null&&(Di===null?gu=Di=t:Di=Di.next=t),xu=!0,Df||(Df=!0,BC())}function zo(t,n){if(!Of&&xu){Of=!0;do for(var i=!1,s=gu;s!==null;){if(t!==0){var p=s.pendingLanes;if(p===0)var g=0;else{var w=s.suspendedLanes,T=s.pingedLanes;g=(1<<31-it(42|t)+1)-1,g&=p&~(w&~T),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(i=!0,qv(s,g))}else g=rt,g=Wl(s,s===St?g:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(g&3)===0||He(s,g)||(i=!0,qv(s,g));s=s.next}while(i);Of=!1}}function UC(){Bv()}function Bv(){xu=Df=!1;var t=0;Ba!==0&&XC()&&(t=Ba);for(var n=Y(),i=null,s=gu;s!==null;){var p=s.next,g=Iv(s,n);g===0?(s.next=null,i===null?gu=p:i.next=p,p===null&&(Di=i)):(i=s,(t!==0||(g&3)!==0)&&(xu=!0)),s=p}Zt!==0&&Zt!==5||zo(t),Ba!==0&&(Ba=0)}function Iv(t,n){for(var i=t.suspendedLanes,s=t.pingedLanes,p=t.expirationTimes,g=t.pendingLanes&-62914561;0T)break;var se=H.transferSize,pe=H.initiatorType;se&&Kv(pe)&&(H=H.responseEnd,w+=se*(H"u"?null:document;function oy(t,n,i){var s=Oi;if(s&&typeof n=="string"&&n){var p=Kn(n);p='link[rel="'+t+'"][href="'+p+'"]',typeof i=="string"&&(p+='[crossorigin="'+i+'"]'),iy.has(p)||(iy.add(p),t={rel:t,crossOrigin:i,href:n},s.querySelector(p)===null&&(n=s.createElement("link"),cn(n,"link",t),tn(n),s.head.appendChild(n)))}}function r2(t){aa.D(t),oy("dns-prefetch",t,null)}function a2(t,n){aa.C(t,n),oy("preconnect",t,n)}function l2(t,n,i){aa.L(t,n,i);var s=Oi;if(s&&t&&n){var p='link[rel="preload"][as="'+Kn(n)+'"]';n==="image"&&i&&i.imageSrcSet?(p+='[imagesrcset="'+Kn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(p+='[imagesizes="'+Kn(i.imageSizes)+'"]')):p+='[href="'+Kn(t)+'"]';var g=p;switch(n){case"style":g=zi(t);break;case"script":g=Li(t)}rr.has(g)||(t=x({rel:"preload",href:n==="image"&&i&&i.imageSrcSet?void 0:t,as:n},i),rr.set(g,t),s.querySelector(p)!==null||n==="style"&&s.querySelector(Io(g))||n==="script"&&s.querySelector(Ho(g))||(n=s.createElement("link"),cn(n,"link",t),tn(n),s.head.appendChild(n)))}}function i2(t,n){aa.m(t,n);var i=Oi;if(i&&t){var s=n&&typeof n.as=="string"?n.as:"script",p='link[rel="modulepreload"][as="'+Kn(s)+'"][href="'+Kn(t)+'"]',g=p;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Li(t)}if(!rr.has(g)&&(t=x({rel:"modulepreload",href:t},n),rr.set(g,t),i.querySelector(p)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Ho(g)))return}s=i.createElement("link"),cn(s,"link",t),tn(s),i.head.appendChild(s)}}}function o2(t,n,i){aa.S(t,n,i);var s=Oi;if(s&&t){var p=ri(s).hoistableStyles,g=zi(t);n=n||"default";var w=p.get(g);if(!w){var T={loading:0,preload:null};if(w=s.querySelector(Io(g)))T.loading=5;else{t=x({rel:"stylesheet",href:t,"data-precedence":n},i),(i=rr.get(g))&&Qf(t,i);var H=w=s.createElement("link");tn(H),cn(H,"link",t),H._p=new Promise(function(J,se){H.onload=J,H.onerror=se}),H.addEventListener("load",function(){T.loading|=1}),H.addEventListener("error",function(){T.loading|=2}),T.loading|=4,Su(w,n,s)}w={type:"stylesheet",instance:w,count:1,state:T},p.set(g,w)}}}function s2(t,n){aa.X(t,n);var i=Oi;if(i&&t){var s=ri(i).hoistableScripts,p=Li(t),g=s.get(p);g||(g=i.querySelector(Ho(p)),g||(t=x({src:t,async:!0},n),(n=rr.get(p))&&Zf(t,n),g=i.createElement("script"),tn(g),cn(g,"link",t),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},s.set(p,g))}}function u2(t,n){aa.M(t,n);var i=Oi;if(i&&t){var s=ri(i).hoistableScripts,p=Li(t),g=s.get(p);g||(g=i.querySelector(Ho(p)),g||(t=x({src:t,async:!0,type:"module"},n),(n=rr.get(p))&&Zf(t,n),g=i.createElement("script"),tn(g),cn(g,"link",t),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},s.set(p,g))}}function sy(t,n,i,s){var p=(p=ue.current)?wu(p):null;if(!p)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(n=zi(i.href),i=ri(p).hoistableStyles,s=i.get(n),s||(s={type:"style",instance:null,count:0,state:null},i.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){t=zi(i.href);var g=ri(p).hoistableStyles,w=g.get(t);if(w||(p=p.ownerDocument||p,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(t,w),(g=p.querySelector(Io(t)))&&!g._p&&(w.instance=g,w.state.loading=5),rr.has(t)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},rr.set(t,i),g||c2(p,t,i,w.state))),n&&s===null)throw Error(l(528,""));return w}if(n&&s!==null)throw Error(l(529,""));return null;case"script":return n=i.async,i=i.src,typeof i=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Li(i),i=ri(p).hoistableScripts,s=i.get(n),s||(s={type:"script",instance:null,count:0,state:null},i.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function zi(t){return'href="'+Kn(t)+'"'}function Io(t){return'link[rel="stylesheet"]['+t+"]"}function uy(t){return x({},t,{"data-precedence":t.precedence,precedence:null})}function c2(t,n,i,s){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?s.loading=1:(n=t.createElement("link"),s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2}),cn(n,"link",i),tn(n),t.head.appendChild(n))}function Li(t){return'[src="'+Kn(t)+'"]'}function Ho(t){return"script[async]"+t}function cy(t,n,i){if(n.count++,n.instance===null)switch(n.type){case"style":var s=t.querySelector('style[data-href~="'+Kn(i.href)+'"]');if(s)return n.instance=s,tn(s),s;var p=x({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return s=(t.ownerDocument||t).createElement("style"),tn(s),cn(s,"style",p),Su(s,i.precedence,t),n.instance=s;case"stylesheet":p=zi(i.href);var g=t.querySelector(Io(p));if(g)return n.state.loading|=4,n.instance=g,tn(g),g;s=uy(i),(p=rr.get(p))&&Qf(s,p),g=(t.ownerDocument||t).createElement("link"),tn(g);var w=g;return w._p=new Promise(function(T,H){w.onload=T,w.onerror=H}),cn(g,"link",s),n.state.loading|=4,Su(g,i.precedence,t),n.instance=g;case"script":return g=Li(i.src),(p=t.querySelector(Ho(g)))?(n.instance=p,tn(p),p):(s=i,(p=rr.get(g))&&(s=x({},i),Zf(s,p)),t=t.ownerDocument||t,p=t.createElement("script"),tn(p),cn(p,"link",s),t.head.appendChild(p),n.instance=p);case"void":return null;default:throw Error(l(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,Su(s,i.precedence,t));return n.instance}function Su(t,n,i){for(var s=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=s.length?s[s.length-1]:null,g=p,w=0;w title"):null)}function d2(t,n,i){if(i===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return t=n.disabled,typeof n.precedence=="string"&&t==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function hy(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function f2(t,n,i,s){if(i.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var p=zi(s.href),g=n.querySelector(Io(p));if(g){n=g._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=ku.bind(t),n.then(t,t)),i.state.loading|=4,i.instance=g,tn(g);return}g=n.ownerDocument||n,s=uy(s),(p=rr.get(p))&&Qf(s,p),g=g.createElement("link"),tn(g);var w=g;w._p=new Promise(function(T,H){w.onload=T,w.onerror=H}),cn(g,"link",s),i.instance=g}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(i,n),(n=i.state.preload)&&(i.state.loading&3)===0&&(t.count++,i=ku.bind(t),n.addEventListener("load",i),n.addEventListener("error",i))}}var Jf=0;function h2(t,n){return t.stylesheets&&t.count===0&&Eu(t,t.stylesheets),0Jf?50:800)+n);return t.unsuspend=i,function(){t.unsuspend=null,clearTimeout(s),clearTimeout(p)}}:null}function ku(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Eu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Cu=null;function Eu(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Cu=new Map,n.forEach(m2,t),Cu=null,ku.call(t))}function m2(t,n){if(!(n.state.loading&4)){var i=Cu.get(t);if(i)var s=i.get(null);else{i=new Map,Cu.set(t,i);for(var p=t.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),sh.exports=D2(),sh.exports}var z2=O2();class xc extends Error{constructor(a,l,u){super(a);lh(this,"code");lh(this,"status");this.code=l,this.status=u}}async function Ou(e,r,a){const l=await fetch(r,{method:e,headers:a!==void 0?{"Content-Type":"application/json"}:void 0,body:a!==void 0?JSON.stringify(a):void 0,credentials:"same-origin"}),u=await l.text();let c=null;try{c=u?JSON.parse(u):null}catch{}if(!l.ok){const d=c==null?void 0:c.error;throw new xc((d==null?void 0:d.message)??`HTTP ${l.status}`,(d==null?void 0:d.code)??"http_error",l.status)}return c}const Pe={get:e=>Ou("GET",e),post:(e,r)=>Ou("POST",e,r),patch:(e,r)=>Ou("PATCH",e,r),del:e=>Ou("DELETE",e)};function oa(e,r){for(const a of e.split(",")){const l=a.indexOf(":");if(l>0&&a.slice(0,l)===r)return a.slice(l+1)}return""}function L2(e){return e?e.split(",").filter(Boolean):[]}function U2(e){return e.trim().split(" ")[0]||"unknown"}function ns(e){return e.trim().split(" ")[0].split("/")[0]||"unknown"}function Jh(e){if(e<1e3)return`${e} ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const r=Math.round(e/1e3),a=Math.floor(r/60),l=r%60;return`${a}m ${String(l).padStart(2,"0")}s`}function _m(e){return e==null?"unpriced":`$${e.toFixed(6)}`}function Rr(e){return e==null?"unpriced":e===0?"$0":e<.01?`$${e.toFixed(5)}`:e<1e3?`$${e.toFixed(2)}`:`$${new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e)}`}function qt(e){return e?new Intl.NumberFormat().format(e):""}function mn(e){return new Intl.NumberFormat().format(e)}function De(e){return Math.abs(e)<1e3?new Intl.NumberFormat().format(e):new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1}).format(e)}function T0(e){if(!e)return"";const r=new Date(e);return isNaN(r.getTime())?e:r.toLocaleString()}function Wa(e){if(!e)return"";const r=new Date(e);return isNaN(r.getTime())?e:r.toLocaleDateString()}function A0(e){var r,a,l="";if(typeof e=="string"||typeof e=="number")l+=e;else if(typeof e=="object")if(Array.isArray(e)){var u=e.length;for(r=0;r{const a=new Array(e.length+r.length);for(let l=0;l({classGroupId:e,validator:r}),M0=(e=new Map,r=null,a)=>({nextPart:e,validators:r,classGroupId:a}),nc="-",Uy=[],H2="arbitrary..",q2=e=>{const r=$2(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:l}=e;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return P2(d);const f=d.split(nc),m=f[0]===""&&f.length>1?1:0;return R0(f,m,r)},getConflictingClassGroupIds:(d,f)=>{if(f){const m=l[d],h=a[d];return m?h?B2(h,m):m:h||Uy}return a[d]||Uy}}},R0=(e,r,a)=>{if(e.length-r===0)return a.classGroupId;const u=e[r],c=a.nextPart.get(u);if(c){const h=R0(e,r+1,c);if(h)return h}const d=a.validators;if(d===null)return;const f=r===0?e.join(nc):e.slice(r).join(nc),m=d.length;for(let h=0;he.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=e.slice(1,-1),a=r.indexOf(":"),l=r.slice(0,a);return l?H2+l:void 0})(),$2=e=>{const{theme:r,classGroups:a}=e;return F2(a,r)},F2=(e,r)=>{const a=M0();for(const l in e){const u=e[l];Mm(u,a,l,r)}return a},Mm=(e,r,a,l)=>{const u=e.length;for(let c=0;c{if(typeof e=="string"){G2(e,r,a);return}if(typeof e=="function"){Y2(e,r,a,l);return}X2(e,r,a,l)},G2=(e,r,a)=>{const l=e===""?r:D0(r,e);l.classGroupId=a},Y2=(e,r,a,l)=>{if(K2(e)){Mm(e(l),r,a,l);return}r.validators===null&&(r.validators=[]),r.validators.push(I2(a,e))},X2=(e,r,a,l)=>{const u=Object.entries(e),c=u.length;for(let d=0;d{let a=e;const l=r.split(nc),u=l.length;for(let c=0;c"isThemeGetter"in e&&e.isThemeGetter===!0,Q2=e=>{if(e<1)return{get:()=>{},set:()=>{}};let r=0,a=Object.create(null),l=Object.create(null);const u=(c,d)=>{a[c]=d,r++,r>e&&(r=0,l=a,a=Object.create(null))};return{get(c){let d=a[c];if(d!==void 0)return d;if((d=l[c])!==void 0)return u(c,d),d},set(c,d){c in a?a[c]=d:u(c,d)}}},Wh="!",By=":",Z2=[],Iy=(e,r,a,l,u)=>({modifiers:e,hasImportantModifier:r,baseClassName:a,maybePostfixModifierPosition:l,isExternal:u}),J2=e=>{const{prefix:r,experimentalParseClassName:a}=e;let l=u=>{const c=[];let d=0,f=0,m=0,h;const v=u.length;for(let j=0;jm?h-m:void 0;return Iy(c,y,b,k)};if(r){const u=r+By,c=l;l=d=>d.startsWith(u)?c(d.slice(u.length)):Iy(Z2,!1,d,void 0,!0)}if(a){const u=l;l=c=>a({className:c,parseClassName:u})}return l},W2=e=>{const r=new Map;return e.orderSensitiveModifiers.forEach((a,l)=>{r.set(a,1e6+l)}),a=>{const l=[];let u=[];for(let c=0;c0&&(u.sort(),l.push(...u),u=[]),l.push(d)):u.push(d)}return u.length>0&&(u.sort(),l.push(...u)),l}},eE=e=>({cache:Q2(e.cacheSize),parseClassName:J2(e),sortModifiers:W2(e),postfixLookupClassGroupIds:tE(e),...q2(e)}),tE=e=>{const r=Object.create(null),a=e.postfixLookupClassGroups;if(a)for(let l=0;l{const{parseClassName:a,getClassGroupId:l,getConflictingClassGroupIds:u,sortModifiers:c,postfixLookupClassGroupIds:d}=r,f=[],m=e.trim().split(nE);let h="";for(let v=m.length-1;v>=0;v-=1){const x=m[v],{isExternal:b,modifiers:y,hasImportantModifier:k,baseClassName:j,maybePostfixModifierPosition:A}=a(x);if(b){h=x+(h.length>0?" "+h:h);continue}let C=!!A,R;if(C){const E=j.substring(0,A);R=l(E);const I=R&&d[R]?l(j):void 0;I&&I!==R&&(R=I,C=!1)}else R=l(j);if(!R){if(!C){h=x+(h.length>0?" "+h:h);continue}if(R=l(j),!R){h=x+(h.length>0?" "+h:h);continue}C=!1}const D=y.length===0?"":y.length===1?y[0]:c(y).join(":"),B=k?D+Wh:D,O=B+R;if(f.indexOf(O)>-1)continue;f.push(O);const _=u(R,C);for(let E=0;E<_.length;++E){const I=_[E];f.push(B+I)}h=x+(h.length>0?" "+h:h)}return h},aE=(...e)=>{let r=0,a,l,u="";for(;r{if(typeof e=="string")return e;let r,a="";for(let l=0;l{let a,l,u,c;const d=m=>{const h=r.reduce((v,x)=>x(v),e());return a=eE(h),l=a.cache.get,u=a.cache.set,c=f,f(m)},f=m=>{const h=l(m);if(h)return h;const v=rE(m,a);return u(m,v),v};return c=d,(...m)=>c(aE(...m))},iE=[],Jt=e=>{const r=a=>a[e]||iE;return r.isThemeGetter=!0,r},z0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,L0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,oE=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,sE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,uE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,cE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Va=e=>oE.test(e),Ke=e=>!!e&&!Number.isNaN(Number(e)),Nr=e=>!!e&&Number.isInteger(Number(e)),fh=e=>e.endsWith("%")&&Ke(e.slice(0,-1)),la=e=>sE.test(e),U0=()=>!0,hE=e=>uE.test(e)&&!cE.test(e),Rm=()=>!1,mE=e=>dE.test(e),pE=e=>fE.test(e),gE=e=>!je(e)&&!Ce(e),xE=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),vE=e=>fl(e,H0,Rm),je=e=>z0.test(e),zl=e=>fl(e,q0,hE),Hy=e=>fl(e,EE,Ke),yE=e=>fl(e,$0,U0),bE=e=>fl(e,P0,Rm),qy=e=>fl(e,B0,Rm),wE=e=>fl(e,I0,pE),zu=e=>fl(e,F0,mE),Ce=e=>L0.test(e),Yo=e=>Yl(e,q0),SE=e=>Yl(e,P0),Py=e=>Yl(e,B0),jE=e=>Yl(e,H0),kE=e=>Yl(e,I0),Lu=e=>Yl(e,F0,!0),CE=e=>Yl(e,$0,!0),fl=(e,r,a)=>{const l=z0.exec(e);return l?l[1]?r(l[1]):a(l[2]):!1},Yl=(e,r,a=!1)=>{const l=L0.exec(e);return l?l[1]?r(l[1]):a:!1},B0=e=>e==="position"||e==="percentage",I0=e=>e==="image"||e==="url",H0=e=>e==="length"||e==="size"||e==="bg-size",q0=e=>e==="length",EE=e=>e==="number",P0=e=>e==="family-name",$0=e=>e==="number"||e==="weight",F0=e=>e==="shadow",NE=()=>{const e=Jt("color"),r=Jt("font"),a=Jt("text"),l=Jt("font-weight"),u=Jt("tracking"),c=Jt("leading"),d=Jt("breakpoint"),f=Jt("container"),m=Jt("spacing"),h=Jt("radius"),v=Jt("shadow"),x=Jt("inset-shadow"),b=Jt("text-shadow"),y=Jt("drop-shadow"),k=Jt("blur"),j=Jt("perspective"),A=Jt("aspect"),C=Jt("ease"),R=Jt("animate"),D=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...B(),Ce,je],_=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],I=()=>[Ce,je,m],W=()=>[Va,"full","auto",...I()],q=()=>[Nr,"none","subgrid",Ce,je],$=()=>["auto",{span:["full",Nr,Ce,je]},Nr,Ce,je],X=()=>[Nr,"auto",Ce,je],ce=()=>["auto","min","max","fr",Ce,je],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ee=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...I()],Z=()=>[Va,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],ie=()=>[Va,"screen","full","dvw","lvw","svw","min","max","fit",...I()],K=()=>[Va,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],N=()=>[e,Ce,je],L=()=>[...B(),Py,qy,{position:[Ce,je]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],M=()=>["auto","cover","contain",jE,vE,{size:[Ce,je]}],oe=()=>[fh,Yo,zl],G=()=>["","none","full",h,Ce,je],ue=()=>["",Ke,Yo,zl],re=()=>["solid","dashed","dotted","double"],ye=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[Ke,fh,Py,qy],be=()=>["","none",k,Ce,je],Ee=()=>["none",Ke,Ce,je],Se=()=>["none",Ke,Ce,je],Ie=()=>[Ke,Ce,je],Be=()=>[Va,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[la],breakpoint:[la],color:[U0],container:[la],"drop-shadow":[la],ease:["in","out","in-out"],font:[gE],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[la],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[la],shadow:[la],spacing:["px",Ke],text:[la],"text-shadow":[la],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Va,je,Ce,A]}],container:["container"],"container-type":[{"@container":["","normal","size",Ce,je]}],"container-named":[xE],columns:[{columns:[Ke,je,Ce,f]}],"break-after":[{"break-after":D()}],"break-before":[{"break-before":D()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:O()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:W()}],"inset-x":[{"inset-x":W()}],"inset-y":[{"inset-y":W()}],start:[{"inset-s":W(),start:W()}],end:[{"inset-e":W(),end:W()}],"inset-bs":[{"inset-bs":W()}],"inset-be":[{"inset-be":W()}],top:[{top:W()}],right:[{right:W()}],bottom:[{bottom:W()}],left:[{left:W()}],visibility:["visible","invisible","collapse"],z:[{z:[Nr,"auto",Ce,je]}],basis:[{basis:[Va,"full","auto",f,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ke,Va,"auto","initial","none",je]}],grow:[{grow:["",Ke,Ce,je]}],shrink:[{shrink:["",Ke,Ce,je]}],order:[{order:[Nr,"first","last","none",Ce,je]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ce()}],"auto-rows":[{"auto-rows":ce()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...ee(),"normal"]}],"justify-self":[{"justify-self":["auto",...ee()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...ee(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ee(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...ee(),"baseline"]}],"place-self":[{"place-self":["auto",...ee()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...ie()]}],"min-inline-size":[{"min-inline":["auto",...ie()]}],"max-inline-size":[{"max-inline":["none",...ie()]}],"block-size":[{block:["auto",...K()]}],"min-block-size":[{"min-block":["auto",...K()]}],"max-block-size":[{"max-block":["none",...K()]}],w:[{w:[f,"screen",...Z()]}],"min-w":[{"min-w":[f,"screen","none",...Z()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[d]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",a,Yo,zl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,CE,yE]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fh,je]}],"font-family":[{font:[SE,bE,r]}],"font-features":[{"font-features":[je]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[u,Ce,je]}],"line-clamp":[{"line-clamp":[Ke,"none",Ce,Hy]}],leading:[{leading:[c,...I()]}],"list-image":[{"list-image":["none",Ce,je]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ce,je]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ke,"from-font","auto",Ce,zl]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[Ke,"auto",Ce,je]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"tab-size":[{tab:[Nr,Ce,je]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ce,je]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ce,je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:M()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Nr,Ce,je],radial:["",Ce,je],conic:[Nr,Ce,je]},kE,wE]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:oe()}],"gradient-via-pos":[{via:oe()}],"gradient-to-pos":[{to:oe()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-bs":[{"border-bs":ue()}],"border-w-be":[{"border-be":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ke,Ce,je]}],"outline-w":[{outline:["",Ke,Yo,zl]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",v,Lu,zu]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",x,Lu,zu]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[Ke,zl]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",b,Lu,zu]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[Ke,Ce,je]}],"mix-blend":[{"mix-blend":[...ye(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ye()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ke]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[Ce,je]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":B()}],"mask-image-conic-pos":[{"mask-conic":[Ke]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:M()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ce,je]}],filter:[{filter:["","none",Ce,je]}],blur:[{blur:be()}],brightness:[{brightness:[Ke,Ce,je]}],contrast:[{contrast:[Ke,Ce,je]}],"drop-shadow":[{"drop-shadow":["","none",y,Lu,zu]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",Ke,Ce,je]}],"hue-rotate":[{"hue-rotate":[Ke,Ce,je]}],invert:[{invert:["",Ke,Ce,je]}],saturate:[{saturate:[Ke,Ce,je]}],sepia:[{sepia:["",Ke,Ce,je]}],"backdrop-filter":[{"backdrop-filter":["","none",Ce,je]}],"backdrop-blur":[{"backdrop-blur":be()}],"backdrop-brightness":[{"backdrop-brightness":[Ke,Ce,je]}],"backdrop-contrast":[{"backdrop-contrast":[Ke,Ce,je]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ke,Ce,je]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ke,Ce,je]}],"backdrop-invert":[{"backdrop-invert":["",Ke,Ce,je]}],"backdrop-opacity":[{"backdrop-opacity":[Ke,Ce,je]}],"backdrop-saturate":[{"backdrop-saturate":[Ke,Ce,je]}],"backdrop-sepia":[{"backdrop-sepia":["",Ke,Ce,je]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ce,je]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ke,"initial",Ce,je]}],ease:[{ease:["linear","initial",C,Ce,je]}],delay:[{delay:[Ke,Ce,je]}],animate:[{animate:["none",R,Ce,je]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Ce,je]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:Se()}],"scale-x":[{"scale-x":Se()}],"scale-y":[{"scale-y":Se()}],"scale-z":[{"scale-z":Se()}],"scale-3d":["scale-3d"],skew:[{skew:Ie()}],"skew-x":[{"skew-x":Ie()}],"skew-y":[{"skew-y":Ie()}],transform:[{transform:[Ce,je,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Be()}],"translate-x":[{"translate-x":Be()}],"translate-y":[{"translate-y":Be()}],"translate-z":[{"translate-z":Be()}],"translate-none":["translate-none"],zoom:[{zoom:[Nr,Ce,je]}],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ce,je]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":N()}],"scrollbar-track-color":[{"scrollbar-track":N()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ce,je]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[Ke,Yo,zl,Hy]}],stroke:[{stroke:["none",...N()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},TE=lE(NE);function _e(...e){return TE(_0(e))}function V0({className:e}){return o.jsx("svg",{viewBox:"0 0 151.08 184",className:_e("h-6 w-auto",e),"aria-hidden":"true",fill:"currentColor",children:o.jsx("path",{d:"M131.08,52.32l-18.67-10.96h-1.01l-16.68,9.79v-20.19s-18.67-10.96-18.67-10.96h-1.01l-18.67,10.96v20.19s-16.68-9.79-16.68-9.79h-1.01l-18.67,10.96v.72s0,78.5,0,78.5l18.67,11.12h1.02l16.67-9.92v20.16s18.67,11.12,18.67,11.12h1.02l18.67-11.12v-20.16s16.67,9.92,16.67,9.92h1.02l18.67-11.12V52.32ZM39.18,43.38l16.7,9.81-16.7,9.94-16.7-9.94,16.7-9.81ZM22,55.23l16.18,9.63v54.28l-16.18,9.5V55.23ZM38.18,121.46v18.57l-15.7-9.35,15.7-9.22ZM40.18,140.03v-18.57l15.7,9.22-15.7,9.35ZM56.36,128.64l-16.18-9.5v-54.28l16.18-9.63v73.41ZM92.72,53.04v19.46l-16.18-9.5v-19.49l16.18-9.63v19.16ZM75.54,84.48l-16.7-9.94,16.7-9.81,16.7,9.81-16.7,9.94ZM76.54,41.18v-18.57l15.7,9.22-15.7,9.35ZM74.54,22.61v18.57l-15.7-9.35,15.7-9.22ZM58.36,33.87l16.18,9.63v19.49l-16.18,9.5v-38.63ZM58.36,76.58l16.18,9.63v54.28l-16.18,9.5v-73.41ZM74.54,142.81v18.57l-15.7-9.35,15.7-9.22ZM76.54,161.38v-18.57l15.7,9.22-15.7,9.35ZM92.72,149.99l-16.18-9.5v-54.28l16.18-9.63v73.41ZM112.9,43.97l15.7,9.22-15.7,9.35v-18.57ZM110.9,43.97v18.57l-15.7-9.35,15.7-9.22ZM94.72,55.23l16.18,9.63v54.28l-16.18,9.5V55.23ZM111.9,140.63l-16.7-9.95,16.7-9.81,16.7,9.81-16.7,9.95ZM129.08,128.64l-16.18-9.5v-54.28l16.18-9.63v73.41Z"})})}function $y(e,r){if(typeof e=="function")return e(r);e!=null&&(e.current=r)}function vc(...e){return r=>{let a=!1;const l=e.map(u=>{const c=$y(u,r);return!a&&typeof c=="function"&&(a=!0),c});if(a)return()=>{for(let u=0;u{const{children:a,...l}=e,u=S.Children.toArray(a),c=u.find(AE);if(c){const d=c.props.children,f=u.map(m=>m===c?S.Children.count(d)>1?S.Children.only(null):S.isValidElement(d)?d.props.children:null:m);return o.jsx(em,{...l,ref:r,children:S.isValidElement(d)?S.cloneElement(d,void 0,f):null})}return o.jsx(em,{...l,ref:r,children:a})});da.displayName="Slot";var em=S.forwardRef((e,r)=>{const{children:a,...l}=e;if(S.isValidElement(a)){const u=ME(a);return S.cloneElement(a,{..._E(l,a.props),ref:r?vc(r,u):u})}return S.Children.count(a)>1?S.Children.only(null):null});em.displayName="SlotClone";var G0=({children:e})=>o.jsx(o.Fragment,{children:e});function AE(e){return S.isValidElement(e)&&e.type===G0}function _E(e,r){const a={...r};for(const l in r){const u=e[l],c=r[l];/^on[A-Z]/.test(l)?u&&c?a[l]=(...f)=>{c(...f),u(...f)}:u&&(a[l]=u):l==="style"?a[l]={...u,...c}:l==="className"&&(a[l]=[u,c].filter(Boolean).join(" "))}return{...e,...a}}function ME(e){var l,u;let r=(l=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:l.get,a=r&&"isReactWarning"in r&&r.isReactWarning;return a?e.ref:(r=(u=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:u.get,a=r&&"isReactWarning"in r&&r.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}const Fy=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Vy=_0,Y0=(e,r)=>a=>{var l;if((r==null?void 0:r.variants)==null)return Vy(e,a==null?void 0:a.class,a==null?void 0:a.className);const{variants:u,defaultVariants:c}=r,d=Object.keys(u).map(h=>{const v=a==null?void 0:a[h],x=c==null?void 0:c[h];if(v===null)return null;const b=Fy(v)||Fy(x);return u[h][b]}),f=a&&Object.entries(a).reduce((h,v)=>{let[x,b]=v;return b===void 0||(h[x]=b),h},{}),m=r==null||(l=r.compoundVariants)===null||l===void 0?void 0:l.reduce((h,v)=>{let{class:x,className:b,...y}=v;return Object.entries(y).every(k=>{let[j,A]=k;return Array.isArray(A)?A.includes({...c,...f}[j]):{...c,...f}[j]===A})?[...h,x,b]:h},[]);return Vy(e,d,m,a==null?void 0:a.class,a==null?void 0:a.className)},Dm=Y0("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Re({className:e,variant:r,size:a,asChild:l=!1,...u}){const c=l?da:"button";return o.jsx(c,{"data-slot":"button",className:_e(Dm({variant:r,size:a,className:e})),...u})}function Kt({className:e,type:r,...a}){return o.jsx("input",{type:r,"data-slot":"input",autoComplete:"off",className:_e("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...a})}var ms=N0();const X0=gc(ms);var RE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ge=RE.reduce((e,r)=>{const a=S.forwardRef((l,u)=>{const{asChild:c,...d}=l,f=c?da:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(f,{...d,ref:u})});return a.displayName=`Primitive.${r}`,{...e,[r]:a}},{});function K0(e,r){e&&ms.flushSync(()=>e.dispatchEvent(r))}var DE="Label",Q0=S.forwardRef((e,r)=>o.jsx(Ge.label,{...e,ref:r,onMouseDown:a=>{var u;a.target.closest("button, input, select, textarea")||((u=e.onMouseDown)==null||u.call(e,a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));Q0.displayName=DE;var OE=Q0;function Xt({className:e,...r}){return o.jsx(OE,{"data-slot":"label",className:_e("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...r})}/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zE=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Z0=(...e)=>e.filter((r,a,l)=>!!r&&r.trim()!==""&&l.indexOf(r)===a).join(" ").trim();/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var LE={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UE=S.forwardRef(({color:e="currentColor",size:r=24,strokeWidth:a=2,absoluteStrokeWidth:l,className:u="",children:c,iconNode:d,...f},m)=>S.createElement("svg",{ref:m,...LE,width:r,height:r,stroke:e,strokeWidth:l?Number(a)*24/Number(r):a,className:Z0("lucide",u),...f},[...d.map(([h,v])=>S.createElement(h,v)),...Array.isArray(c)?c:[c]]));/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bt=(e,r)=>{const a=S.forwardRef(({className:l,...u},c)=>S.createElement(UE,{ref:c,iconNode:r,className:Z0(`lucide-${zE(e)}`,l),...u}));return a.displayName=`${e}`,a};/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BE=bt("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const J0=bt("ChartBar",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const IE=bt("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yc=bt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ki=bt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HE=bt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tm=bt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qE=bt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PE=bt("CircleUserRound",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Om=bt("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $E=bt("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FE=bt("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bc=bt("FilterX",[["path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055",key:"1fi1da"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const W0=bt("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VE=bt("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const GE=bt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const YE=bt("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const e1=bt("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Xl=bt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const XE=bt("SendHorizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const KE=bt("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const QE=bt("SunMoon",[["path",{d:"M12 8a2.83 2.83 0 0 0 4 4 4 4 0 1 1-4-4",key:"1fu5g2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.9 4.9 1.4 1.4",key:"b9915j"}],["path",{d:"m17.7 17.7 1.4 1.4",key:"qc3ed3"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.3 17.7-1.4 1.4",key:"5gca6"}],["path",{d:"m19.1 4.9-1.4 1.4",key:"wpu9u6"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZE=bt("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nm=bt("TableProperties",[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JE=bt("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zm=bt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Lm=bt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.454.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const WE=bt("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Tt({className:e,...r}){return o.jsx(GE,{role:"status","aria-label":"Loading",className:_e("size-4 animate-spin",e),...r})}var eN="Separator",Gy="horizontal",tN=["horizontal","vertical"],t1=S.forwardRef((e,r)=>{const{decorative:a,orientation:l=Gy,...u}=e,c=nN(l)?l:Gy,f=a?{role:"none"}:{"aria-orientation":c==="vertical"?c:void 0,role:"separator"};return o.jsx(Ge.div,{"data-orientation":c,...f,...u,ref:r})});t1.displayName=eN;function nN(e){return tN.includes(e)}var rN=t1;function Yy({className:e,orientation:r="horizontal",decorative:a=!0,...l}){return o.jsx(rN,{"data-slot":"separator",decorative:a,orientation:r,className:_e("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...l})}function Qe({className:e,...r}){return o.jsx("div",{"data-slot":"card",className:_e("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...r})}function et({className:e,...r}){return o.jsx("div",{"data-slot":"card-header",className:_e("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...r})}function tt({className:e,...r}){return o.jsx("div",{"data-slot":"card-title",className:_e("leading-none font-semibold",e),...r})}function ct({className:e,...r}){return o.jsx("div",{"data-slot":"card-description",className:_e("text-muted-foreground text-sm",e),...r})}function aN({className:e,...r}){return o.jsx("div",{"data-slot":"card-action",className:_e("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...r})}function Ze({className:e,...r}){return o.jsx("div",{"data-slot":"card-content",className:_e("px-6",e),...r})}function lN({me:e,onLogin:r}){const[a,l]=S.useState(""),[u,c]=S.useState(null),[d,f]=S.useState(!1),m=async h=>{h.preventDefault(),f(!0),c(null);try{await Pe.post("/auth/password",{password:a}),r()}catch(v){c(v instanceof xc?v.message:"login failed"),f(!1)}};return o.jsx("div",{className:"flex min-h-screen items-center justify-center p-4",children:o.jsxs(Qe,{className:"w-full max-w-sm",children:[o.jsxs(et,{className:"items-center text-center",children:[o.jsx(V0,{className:"mx-auto mb-2 h-10"}),o.jsx(tt,{className:"font-serif text-2xl",children:"llmproxy"})]}),o.jsxs(Ze,{className:"flex flex-col gap-4",children:[e.sso_enabled&&o.jsx(Re,{className:"w-full",onClick:()=>window.location.href="/auth/login",children:"Sign in with SSO"}),e.sso_enabled&&e.password_enabled&&o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Yy,{className:"flex-1"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),o.jsx(Yy,{className:"flex-1"})]}),e.password_enabled&&o.jsxs("form",{onSubmit:m,className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:"admin-password",children:"Admin password"}),o.jsx(Kt,{id:"admin-password",type:"password",autoComplete:"current-password",value:a,onChange:h=>l(h.target.value),"aria-invalid":u!=null}),u&&o.jsx("p",{className:"text-sm text-destructive",children:u})]}),o.jsxs(Re,{type:"submit",variant:e.sso_enabled?"outline":"default",disabled:d||a==="",className:"w-full",children:[d&&o.jsx(Tt,{}),"Sign in as admin"]})]}),!e.sso_enabled&&!e.password_enabled&&o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Password login is disabled and no SSO is configured. Mint a key with ",o.jsx("code",{className:"font-mono",children:"llmproxy key create"})," and use the API directly."]})]})]})})}var iN=e=>{switch(e){case"success":return uN;case"info":return dN;case"warning":return cN;case"error":return fN;default:return null}},oN=Array(12).fill(0),sN=({visible:e,className:r})=>ve.createElement("div",{className:["sonner-loading-wrapper",r].filter(Boolean).join(" "),"data-visible":e},ve.createElement("div",{className:"sonner-spinner"},oN.map((a,l)=>ve.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${l}`})))),uN=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ve.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),cN=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ve.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),dN=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ve.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),fN=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ve.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),hN=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ve.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ve.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),mN=()=>{let[e,r]=ve.useState(document.hidden);return ve.useEffect(()=>{let a=()=>{r(document.hidden)};return document.addEventListener("visibilitychange",a),()=>window.removeEventListener("visibilitychange",a)},[]),e},rm=1,pN=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let r=this.subscribers.indexOf(e);this.subscribers.splice(r,1)}),this.publish=e=>{this.subscribers.forEach(r=>r(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var r;let{message:a,...l}=e,u=typeof(e==null?void 0:e.id)=="number"||((r=e.id)==null?void 0:r.length)>0?e.id:rm++,c=this.toasts.find(f=>f.id===u),d=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(u)&&this.dismissedToasts.delete(u),c?this.toasts=this.toasts.map(f=>f.id===u?(this.publish({...f,...e,id:u,title:a}),{...f,...e,id:u,dismissible:d,title:a}):f):this.addToast({title:a,...l,dismissible:d,id:u}),u},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(r=>{this.subscribers.forEach(a=>a({id:r.id,dismiss:!0}))}),this.subscribers.forEach(r=>r({id:e,dismiss:!0})),e),this.message=(e,r)=>this.create({...r,message:e}),this.error=(e,r)=>this.create({...r,message:e,type:"error"}),this.success=(e,r)=>this.create({...r,type:"success",message:e}),this.info=(e,r)=>this.create({...r,type:"info",message:e}),this.warning=(e,r)=>this.create({...r,type:"warning",message:e}),this.loading=(e,r)=>this.create({...r,type:"loading",message:e}),this.promise=(e,r)=>{if(!r)return;let a;r.loading!==void 0&&(a=this.create({...r,promise:e,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));let l=e instanceof Promise?e:e(),u=a!==void 0,c,d=l.then(async m=>{if(c=["resolve",m],ve.isValidElement(m))u=!1,this.create({id:a,type:"default",message:m});else if(xN(m)&&!m.ok){u=!1;let h=typeof r.error=="function"?await r.error(`HTTP error! status: ${m.status}`):r.error,v=typeof r.description=="function"?await r.description(`HTTP error! status: ${m.status}`):r.description;this.create({id:a,type:"error",message:h,description:v})}else if(r.success!==void 0){u=!1;let h=typeof r.success=="function"?await r.success(m):r.success,v=typeof r.description=="function"?await r.description(m):r.description;this.create({id:a,type:"success",message:h,description:v})}}).catch(async m=>{if(c=["reject",m],r.error!==void 0){u=!1;let h=typeof r.error=="function"?await r.error(m):r.error,v=typeof r.description=="function"?await r.description(m):r.description;this.create({id:a,type:"error",message:h,description:v})}}).finally(()=>{var m;u&&(this.dismiss(a),a=void 0),(m=r.finally)==null||m.call(r)}),f=()=>new Promise((m,h)=>d.then(()=>c[0]==="reject"?h(c[1]):m(c[1])).catch(h));return typeof a!="string"&&typeof a!="number"?{unwrap:f}:Object.assign(a,{unwrap:f})},this.custom=(e,r)=>{let a=(r==null?void 0:r.id)||rm++;return this.create({jsx:e(a),id:a,...r}),a},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},zn=new pN,gN=(e,r)=>{let a=(r==null?void 0:r.id)||rm++;return zn.addToast({title:e,...r,id:a}),a},xN=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",vN=gN,yN=()=>zn.toasts,bN=()=>zn.getActiveToasts(),Ve=Object.assign(vN,{success:zn.success,info:zn.info,warning:zn.warning,error:zn.error,custom:zn.custom,message:zn.message,promise:zn.promise,dismiss:zn.dismiss,loading:zn.loading},{getHistory:yN,getToasts:bN});function wN(e,{insertAt:r}={}){if(typeof document>"u")return;let a=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css",r==="top"&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}wN(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} +`);function Uu(e){return e.label!==void 0}var SN=3,jN="32px",kN="16px",Xy=4e3,CN=356,EN=14,NN=20,TN=200;function hr(...e){return e.filter(Boolean).join(" ")}function AN(e){let[r,a]=e.split("-"),l=[];return r&&l.push(r),a&&l.push(a),l}var _N=e=>{var r,a,l,u,c,d,f,m,h,v,x;let{invert:b,toast:y,unstyled:k,interacting:j,setHeights:A,visibleToasts:C,heights:R,index:D,toasts:B,expanded:O,removeToast:_,defaultRichColors:E,closeButton:I,style:W,cancelButtonStyle:q,actionButtonStyle:$,className:X="",descriptionClassName:ce="",duration:le,position:ee,gap:U,loadingIcon:Z,expandByDefault:ie,classNames:K,icons:N,closeButtonAriaLabel:L="Close toast",pauseWhenPageIsHidden:F}=e,[M,oe]=ve.useState(null),[G,ue]=ve.useState(null),[re,ye]=ve.useState(!1),[de,be]=ve.useState(!1),[Ee,Se]=ve.useState(!1),[Ie,Be]=ve.useState(!1),[Mt,Ct]=ve.useState(!1),[Et,Lt]=ve.useState(0),[Rt,Dt]=ve.useState(0),zt=ve.useRef(y.duration||le||Xy),we=ve.useRef(null),mt=ve.useRef(null),Y=D===0,qe=D+1<=C,ne=y.type,z=y.dismissible!==!1,fe=y.className||"",ke=y.descriptionClassName||"",Oe=ve.useMemo(()=>R.findIndex(He=>He.toastId===y.id)||0,[R,y.id]),en=ve.useMemo(()=>{var He;return(He=y.closeButton)!=null?He:I},[y.closeButton,I]),Cn=ve.useMemo(()=>y.duration||le||Xy,[y.duration,le]),Qt=ve.useRef(0),Nt=ve.useRef(0),rn=ve.useRef(0),it=ve.useRef(null),[br,Bn]=ee.split("-"),ws=ve.useMemo(()=>R.reduce((He,ht,wt)=>wt>=Oe?He:He+ht.height,0),[R,Oe]),xl=mN(),Jl=y.invert||b,ba=ne==="loading";Nt.current=ve.useMemo(()=>Oe*U+ws,[Oe,ws]),ve.useEffect(()=>{zt.current=Cn},[Cn]),ve.useEffect(()=>{ye(!0)},[]),ve.useEffect(()=>{let He=mt.current;if(He){let ht=He.getBoundingClientRect().height;return Dt(ht),A(wt=>[{toastId:y.id,height:ht,position:y.position},...wt]),()=>A(wt=>wt.filter(bn=>bn.toastId!==y.id))}},[A,y.id]),ve.useLayoutEffect(()=>{if(!re)return;let He=mt.current,ht=He.style.height;He.style.height="auto";let wt=He.getBoundingClientRect().height;He.style.height=ht,Dt(wt),A(bn=>bn.find(an=>an.toastId===y.id)?bn.map(an=>an.toastId===y.id?{...an,height:wt}:an):[{toastId:y.id,height:wt,position:y.position},...bn])},[re,y.title,y.description,A,y.id]);let fn=ve.useCallback(()=>{be(!0),Lt(Nt.current),A(He=>He.filter(ht=>ht.toastId!==y.id)),setTimeout(()=>{_(y)},TN)},[y,_,A,Nt]);ve.useEffect(()=>{if(y.promise&&ne==="loading"||y.duration===1/0||y.type==="loading")return;let He;return O||j||F&&xl?(()=>{if(rn.current{var ht;(ht=y.onAutoClose)==null||ht.call(y,y),fn()},zt.current)),()=>clearTimeout(He)},[O,j,y,ne,F,xl,fn]),ve.useEffect(()=>{y.delete&&fn()},[fn,y.delete]);function Wl(){var He,ht,wt;return N!=null&&N.loading?ve.createElement("div",{className:hr(K==null?void 0:K.loader,(He=y==null?void 0:y.classNames)==null?void 0:He.loader,"sonner-loader"),"data-visible":ne==="loading"},N.loading):Z?ve.createElement("div",{className:hr(K==null?void 0:K.loader,(ht=y==null?void 0:y.classNames)==null?void 0:ht.loader,"sonner-loader"),"data-visible":ne==="loading"},Z):ve.createElement(sN,{className:hr(K==null?void 0:K.loader,(wt=y==null?void 0:y.classNames)==null?void 0:wt.loader),visible:ne==="loading"})}return ve.createElement("li",{tabIndex:0,ref:mt,className:hr(X,fe,K==null?void 0:K.toast,(r=y==null?void 0:y.classNames)==null?void 0:r.toast,K==null?void 0:K.default,K==null?void 0:K[ne],(a=y==null?void 0:y.classNames)==null?void 0:a[ne]),"data-sonner-toast":"","data-rich-colors":(l=y.richColors)!=null?l:E,"data-styled":!(y.jsx||y.unstyled||k),"data-mounted":re,"data-promise":!!y.promise,"data-swiped":Mt,"data-removed":de,"data-visible":qe,"data-y-position":br,"data-x-position":Bn,"data-index":D,"data-front":Y,"data-swiping":Ee,"data-dismissible":z,"data-type":ne,"data-invert":Jl,"data-swipe-out":Ie,"data-swipe-direction":G,"data-expanded":!!(O||ie&&re),style:{"--index":D,"--toasts-before":D,"--z-index":B.length-D,"--offset":`${de?Et:Nt.current}px`,"--initial-height":ie?"auto":`${Rt}px`,...W,...y.style},onDragEnd:()=>{Se(!1),oe(null),it.current=null},onPointerDown:He=>{ba||!z||(we.current=new Date,Lt(Nt.current),He.target.setPointerCapture(He.pointerId),He.target.tagName!=="BUTTON"&&(Se(!0),it.current={x:He.clientX,y:He.clientY}))},onPointerUp:()=>{var He,ht,wt,bn;if(Ie||!z)return;it.current=null;let an=Number(((He=mt.current)==null?void 0:He.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),wr=Number(((ht=mt.current)==null?void 0:ht.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Sr=new Date().getTime()-((wt=we.current)==null?void 0:wt.getTime()),En=M==="x"?an:wr,ur=Math.abs(En)/Sr;if(Math.abs(En)>=NN||ur>.11){Lt(Nt.current),(bn=y.onDismiss)==null||bn.call(y,y),ue(M==="x"?an>0?"right":"left":wr>0?"down":"up"),fn(),Be(!0),Ct(!1);return}Se(!1),oe(null)},onPointerMove:He=>{var ht,wt,bn,an;if(!it.current||!z||((ht=window.getSelection())==null?void 0:ht.toString().length)>0)return;let wr=He.clientY-it.current.y,Sr=He.clientX-it.current.x,En=(wt=e.swipeDirections)!=null?wt:AN(ee);!M&&(Math.abs(Sr)>1||Math.abs(wr)>1)&&oe(Math.abs(Sr)>Math.abs(wr)?"x":"y");let ur={x:0,y:0};M==="y"?(En.includes("top")||En.includes("bottom"))&&(En.includes("top")&&wr<0||En.includes("bottom")&&wr>0)&&(ur.y=wr):M==="x"&&(En.includes("left")||En.includes("right"))&&(En.includes("left")&&Sr<0||En.includes("right")&&Sr>0)&&(ur.x=Sr),(Math.abs(ur.x)>0||Math.abs(ur.y)>0)&&Ct(!0),(bn=mt.current)==null||bn.style.setProperty("--swipe-amount-x",`${ur.x}px`),(an=mt.current)==null||an.style.setProperty("--swipe-amount-y",`${ur.y}px`)}},en&&!y.jsx?ve.createElement("button",{"aria-label":L,"data-disabled":ba,"data-close-button":!0,onClick:ba||!z?()=>{}:()=>{var He;fn(),(He=y.onDismiss)==null||He.call(y,y)},className:hr(K==null?void 0:K.closeButton,(u=y==null?void 0:y.classNames)==null?void 0:u.closeButton)},(c=N==null?void 0:N.close)!=null?c:hN):null,y.jsx||S.isValidElement(y.title)?y.jsx?y.jsx:typeof y.title=="function"?y.title():y.title:ve.createElement(ve.Fragment,null,ne||y.icon||y.promise?ve.createElement("div",{"data-icon":"",className:hr(K==null?void 0:K.icon,(d=y==null?void 0:y.classNames)==null?void 0:d.icon)},y.promise||y.type==="loading"&&!y.icon?y.icon||Wl():null,y.type!=="loading"?y.icon||(N==null?void 0:N[ne])||iN(ne):null):null,ve.createElement("div",{"data-content":"",className:hr(K==null?void 0:K.content,(f=y==null?void 0:y.classNames)==null?void 0:f.content)},ve.createElement("div",{"data-title":"",className:hr(K==null?void 0:K.title,(m=y==null?void 0:y.classNames)==null?void 0:m.title)},typeof y.title=="function"?y.title():y.title),y.description?ve.createElement("div",{"data-description":"",className:hr(ce,ke,K==null?void 0:K.description,(h=y==null?void 0:y.classNames)==null?void 0:h.description)},typeof y.description=="function"?y.description():y.description):null),S.isValidElement(y.cancel)?y.cancel:y.cancel&&Uu(y.cancel)?ve.createElement("button",{"data-button":!0,"data-cancel":!0,style:y.cancelButtonStyle||q,onClick:He=>{var ht,wt;Uu(y.cancel)&&z&&((wt=(ht=y.cancel).onClick)==null||wt.call(ht,He),fn())},className:hr(K==null?void 0:K.cancelButton,(v=y==null?void 0:y.classNames)==null?void 0:v.cancelButton)},y.cancel.label):null,S.isValidElement(y.action)?y.action:y.action&&Uu(y.action)?ve.createElement("button",{"data-button":!0,"data-action":!0,style:y.actionButtonStyle||$,onClick:He=>{var ht,wt;Uu(y.action)&&((wt=(ht=y.action).onClick)==null||wt.call(ht,He),!He.defaultPrevented&&fn())},className:hr(K==null?void 0:K.actionButton,(x=y==null?void 0:y.classNames)==null?void 0:x.actionButton)},y.action.label):null))};function Ky(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function MN(e,r){let a={};return[e,r].forEach((l,u)=>{let c=u===1,d=c?"--mobile-offset":"--offset",f=c?kN:jN;function m(h){["top","right","bottom","left"].forEach(v=>{a[`${d}-${v}`]=typeof h=="number"?`${h}px`:h})}typeof l=="number"||typeof l=="string"?m(l):typeof l=="object"?["top","right","bottom","left"].forEach(h=>{l[h]===void 0?a[`${d}-${h}`]=f:a[`${d}-${h}`]=typeof l[h]=="number"?`${l[h]}px`:l[h]}):m(f)}),a}var RN=S.forwardRef(function(e,r){let{invert:a,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:c,closeButton:d,className:f,offset:m,mobileOffset:h,theme:v="light",richColors:x,duration:b,style:y,visibleToasts:k=SN,toastOptions:j,dir:A=Ky(),gap:C=EN,loadingIcon:R,icons:D,containerAriaLabel:B="Notifications",pauseWhenPageIsHidden:O}=e,[_,E]=ve.useState([]),I=ve.useMemo(()=>Array.from(new Set([l].concat(_.filter(F=>F.position).map(F=>F.position)))),[_,l]),[W,q]=ve.useState([]),[$,X]=ve.useState(!1),[ce,le]=ve.useState(!1),[ee,U]=ve.useState(v!=="system"?v:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Z=ve.useRef(null),ie=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),K=ve.useRef(null),N=ve.useRef(!1),L=ve.useCallback(F=>{E(M=>{var oe;return(oe=M.find(G=>G.id===F.id))!=null&&oe.delete||zn.dismiss(F.id),M.filter(({id:G})=>G!==F.id)})},[]);return ve.useEffect(()=>zn.subscribe(F=>{if(F.dismiss){E(M=>M.map(oe=>oe.id===F.id?{...oe,delete:!0}:oe));return}setTimeout(()=>{X0.flushSync(()=>{E(M=>{let oe=M.findIndex(G=>G.id===F.id);return oe!==-1?[...M.slice(0,oe),{...M[oe],...F},...M.slice(oe+1)]:[F,...M]})})})}),[]),ve.useEffect(()=>{if(v!=="system"){U(v);return}if(v==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?U("dark"):U("light")),typeof window>"u")return;let F=window.matchMedia("(prefers-color-scheme: dark)");try{F.addEventListener("change",({matches:M})=>{U(M?"dark":"light")})}catch{F.addListener(({matches:oe})=>{try{U(oe?"dark":"light")}catch(G){console.error(G)}})}},[v]),ve.useEffect(()=>{_.length<=1&&X(!1)},[_]),ve.useEffect(()=>{let F=M=>{var oe,G;u.every(ue=>M[ue]||M.code===ue)&&(X(!0),(oe=Z.current)==null||oe.focus()),M.code==="Escape"&&(document.activeElement===Z.current||(G=Z.current)!=null&&G.contains(document.activeElement))&&X(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[u]),ve.useEffect(()=>{if(Z.current)return()=>{K.current&&(K.current.focus({preventScroll:!0}),K.current=null,N.current=!1)}},[Z.current]),ve.createElement("section",{ref:r,"aria-label":`${B} ${ie}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},I.map((F,M)=>{var oe;let[G,ue]=F.split("-");return _.length?ve.createElement("ol",{key:F,dir:A==="auto"?Ky():A,tabIndex:-1,ref:Z,className:f,"data-sonner-toaster":!0,"data-theme":ee,"data-y-position":G,"data-lifted":$&&_.length>1&&!c,"data-x-position":ue,style:{"--front-toast-height":`${((oe=W[0])==null?void 0:oe.height)||0}px`,"--width":`${CN}px`,"--gap":`${C}px`,...y,...MN(m,h)},onBlur:re=>{N.current&&!re.currentTarget.contains(re.relatedTarget)&&(N.current=!1,K.current&&(K.current.focus({preventScroll:!0}),K.current=null))},onFocus:re=>{re.target instanceof HTMLElement&&re.target.dataset.dismissible==="false"||N.current||(N.current=!0,K.current=re.relatedTarget)},onMouseEnter:()=>X(!0),onMouseMove:()=>X(!0),onMouseLeave:()=>{ce||X(!1)},onDragEnd:()=>X(!1),onPointerDown:re=>{re.target instanceof HTMLElement&&re.target.dataset.dismissible==="false"||le(!0)},onPointerUp:()=>le(!1)},_.filter(re=>!re.position&&M===0||re.position===F).map((re,ye)=>{var de,be;return ve.createElement(_N,{key:re.id,icons:D,index:ye,toast:re,defaultRichColors:x,duration:(de=j==null?void 0:j.duration)!=null?de:b,className:j==null?void 0:j.className,descriptionClassName:j==null?void 0:j.descriptionClassName,invert:a,visibleToasts:k,closeButton:(be=j==null?void 0:j.closeButton)!=null?be:d,interacting:ce,position:F,style:j==null?void 0:j.style,unstyled:j==null?void 0:j.unstyled,classNames:j==null?void 0:j.classNames,cancelButtonStyle:j==null?void 0:j.cancelButtonStyle,actionButtonStyle:j==null?void 0:j.actionButtonStyle,removeToast:L,toasts:_.filter(Ee=>Ee.position==re.position),heights:W.filter(Ee=>Ee.position==re.position),setHeights:q,expandByDefault:c,gap:C,loadingIcon:R,expanded:$,pauseWhenPageIsHidden:O,swipeDirections:e.swipeDirections})})):null}))});function Pt(e,r=[]){const[a,l]=S.useState(null),[u,c]=S.useState(null),[d,f]=S.useState(!0),m=S.useRef(e);m.current=e;const h=S.useCallback(()=>{f(!0),m.current().then(v=>{l(v),c(null)}).catch(v=>{c(v instanceof xc?v.message:String(v))}).finally(()=>f(!1))},r);return S.useEffect(()=>{h()},[h]),{data:a,error:u,loading:d,reload:h}}function gn({className:e,...r}){return o.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:o.jsx("table",{"data-slot":"table",className:_e("w-full caption-bottom text-sm",e),...r})})}function xn({className:e,...r}){return o.jsx("thead",{"data-slot":"table-header",className:_e("[&_tr]:border-b",e),...r})}function vn({className:e,...r}){return o.jsx("tbody",{"data-slot":"table-body",className:_e("[&_tr:last-child]:border-0",e),...r})}function Ue({className:e,...r}){return o.jsx("tr",{"data-slot":"table-row",className:_e("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...r})}function ge({className:e,...r}){return o.jsx("th",{"data-slot":"table-head",className:_e("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...r})}function me({className:e,...r}){return o.jsx("td",{"data-slot":"table-cell",className:_e("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...r})}function DN(e,r){const a=S.createContext(r),l=c=>{const{children:d,...f}=c,m=S.useMemo(()=>f,Object.values(f));return o.jsx(a.Provider,{value:m,children:d})};l.displayName=e+"Provider";function u(c){const d=S.useContext(a);if(d)return d;if(r!==void 0)return r;throw new Error(`\`${c}\` must be used within \`${e}\``)}return[l,u]}function vr(e,r=[]){let a=[];function l(c,d){const f=S.createContext(d),m=a.length;a=[...a,d];const h=x=>{var C;const{scope:b,children:y,...k}=x,j=((C=b==null?void 0:b[e])==null?void 0:C[m])||f,A=S.useMemo(()=>k,Object.values(k));return o.jsx(j.Provider,{value:A,children:y})};h.displayName=c+"Provider";function v(x,b){var j;const y=((j=b==null?void 0:b[e])==null?void 0:j[m])||f,k=S.useContext(y);if(k)return k;if(d!==void 0)return d;throw new Error(`\`${x}\` must be used within \`${c}\``)}return[h,v]}const u=()=>{const c=a.map(d=>S.createContext(d));return function(f){const m=(f==null?void 0:f[e])||c;return S.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return u.scopeName=e,[l,ON(u,...r)]}function ON(...e){const r=e[0];if(e.length===1)return r;const a=()=>{const l=e.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(c){const d=l.reduce((f,{useScope:m,scopeName:h})=>{const x=m(c)[`__scope${h}`];return{...f,...x}},{});return S.useMemo(()=>({[`__scope${r.scopeName}`]:d}),[d])}};return a.scopeName=r.scopeName,a}function Te(e,r,{checkForDefaultPrevented:a=!0}={}){return function(u){if(e==null||e(u),a===!1||!u.defaultPrevented)return r==null?void 0:r(u)}}var jn=globalThis!=null&&globalThis.document?S.useLayoutEffect:()=>{},zN=A2.useId||(()=>{}),LN=0;function zr(e){const[r,a]=S.useState(zN());return jn(()=>{a(l=>l??String(LN++))},[e]),e||(r?`radix-${r}`:"")}function sr(e){const r=S.useRef(e);return S.useEffect(()=>{r.current=e}),S.useMemo(()=>(...a)=>{var l;return(l=r.current)==null?void 0:l.call(r,...a)},[])}function el({prop:e,defaultProp:r,onChange:a=()=>{}}){const[l,u]=UN({defaultProp:r,onChange:a}),c=e!==void 0,d=c?e:l,f=sr(a),m=S.useCallback(h=>{if(c){const x=typeof h=="function"?h(e):h;x!==e&&f(x)}else u(h)},[c,e,u,f]);return[d,m]}function UN({defaultProp:e,onChange:r}){const a=S.useState(e),[l]=a,u=S.useRef(l),c=sr(r);return S.useEffect(()=>{u.current!==l&&(c(l),u.current=l)},[l,u,c]),a}function BN(e,r=globalThis==null?void 0:globalThis.document){const a=sr(e);S.useEffect(()=>{const l=u=>{u.key==="Escape"&&a(u)};return r.addEventListener("keydown",l,{capture:!0}),()=>r.removeEventListener("keydown",l,{capture:!0})},[a,r])}var IN="DismissableLayer",am="dismissableLayer.update",HN="dismissableLayer.pointerDownOutside",qN="dismissableLayer.focusOutside",Qy,n1=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),wc=S.forwardRef((e,r)=>{const{disableOutsidePointerEvents:a=!1,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:c,onInteractOutside:d,onDismiss:f,...m}=e,h=S.useContext(n1),[v,x]=S.useState(null),b=(v==null?void 0:v.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=S.useState({}),k=ft(r,E=>x(E)),j=Array.from(h.layers),[A]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),C=j.indexOf(A),R=v?j.indexOf(v):-1,D=h.layersWithOutsidePointerEventsDisabled.size>0,B=R>=C,O=FN(E=>{const I=E.target,W=[...h.branches].some(q=>q.contains(I));!B||W||(u==null||u(E),d==null||d(E),E.defaultPrevented||f==null||f())},b),_=VN(E=>{const I=E.target;[...h.branches].some(q=>q.contains(I))||(c==null||c(E),d==null||d(E),E.defaultPrevented||f==null||f())},b);return BN(E=>{R===h.layers.size-1&&(l==null||l(E),!E.defaultPrevented&&f&&(E.preventDefault(),f()))},b),S.useEffect(()=>{if(v)return a&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Qy=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(v)),h.layers.add(v),Zy(),()=>{a&&h.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=Qy)}},[v,b,a,h]),S.useEffect(()=>()=>{v&&(h.layers.delete(v),h.layersWithOutsidePointerEventsDisabled.delete(v),Zy())},[v,h]),S.useEffect(()=>{const E=()=>y({});return document.addEventListener(am,E),()=>document.removeEventListener(am,E)},[]),o.jsx(Ge.div,{...m,ref:k,style:{pointerEvents:D?B?"auto":"none":void 0,...e.style},onFocusCapture:Te(e.onFocusCapture,_.onFocusCapture),onBlurCapture:Te(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:Te(e.onPointerDownCapture,O.onPointerDownCapture)})});wc.displayName=IN;var PN="DismissableLayerBranch",$N=S.forwardRef((e,r)=>{const a=S.useContext(n1),l=S.useRef(null),u=ft(r,l);return S.useEffect(()=>{const c=l.current;if(c)return a.branches.add(c),()=>{a.branches.delete(c)}},[a.branches]),o.jsx(Ge.div,{...e,ref:u})});$N.displayName=PN;function FN(e,r=globalThis==null?void 0:globalThis.document){const a=sr(e),l=S.useRef(!1),u=S.useRef(()=>{});return S.useEffect(()=>{const c=f=>{if(f.target&&!l.current){let m=function(){r1(HN,a,h,{discrete:!0})};const h={originalEvent:f};f.pointerType==="touch"?(r.removeEventListener("click",u.current),u.current=m,r.addEventListener("click",u.current,{once:!0})):m()}else r.removeEventListener("click",u.current);l.current=!1},d=window.setTimeout(()=>{r.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(d),r.removeEventListener("pointerdown",c),r.removeEventListener("click",u.current)}},[r,a]),{onPointerDownCapture:()=>l.current=!0}}function VN(e,r=globalThis==null?void 0:globalThis.document){const a=sr(e),l=S.useRef(!1);return S.useEffect(()=>{const u=c=>{c.target&&!l.current&&r1(qN,a,{originalEvent:c},{discrete:!1})};return r.addEventListener("focusin",u),()=>r.removeEventListener("focusin",u)},[r,a]),{onFocusCapture:()=>l.current=!0,onBlurCapture:()=>l.current=!1}}function Zy(){const e=new CustomEvent(am);document.dispatchEvent(e)}function r1(e,r,a,{discrete:l}){const u=a.originalEvent.target,c=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:a});r&&u.addEventListener(e,r,{once:!0}),l?K0(u,c):u.dispatchEvent(c)}var hh="focusScope.autoFocusOnMount",mh="focusScope.autoFocusOnUnmount",Jy={bubbles:!1,cancelable:!0},GN="FocusScope",Sc=S.forwardRef((e,r)=>{const{loop:a=!1,trapped:l=!1,onMountAutoFocus:u,onUnmountAutoFocus:c,...d}=e,[f,m]=S.useState(null),h=sr(u),v=sr(c),x=S.useRef(null),b=ft(r,j=>m(j)),y=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(l){let j=function(D){if(y.paused||!f)return;const B=D.target;f.contains(B)?x.current=B:Xa(x.current,{select:!0})},A=function(D){if(y.paused||!f)return;const B=D.relatedTarget;B!==null&&(f.contains(B)||Xa(x.current,{select:!0}))},C=function(D){if(document.activeElement===document.body)for(const O of D)O.removedNodes.length>0&&Xa(f)};document.addEventListener("focusin",j),document.addEventListener("focusout",A);const R=new MutationObserver(C);return f&&R.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",A),R.disconnect()}}},[l,f,y.paused]),S.useEffect(()=>{if(f){eb.add(y);const j=document.activeElement;if(!f.contains(j)){const C=new CustomEvent(hh,Jy);f.addEventListener(hh,h),f.dispatchEvent(C),C.defaultPrevented||(YN(JN(a1(f)),{select:!0}),document.activeElement===j&&Xa(f))}return()=>{f.removeEventListener(hh,h),setTimeout(()=>{const C=new CustomEvent(mh,Jy);f.addEventListener(mh,v),f.dispatchEvent(C),C.defaultPrevented||Xa(j??document.body,{select:!0}),f.removeEventListener(mh,v),eb.remove(y)},0)}}},[f,h,v,y]);const k=S.useCallback(j=>{if(!a&&!l||y.paused)return;const A=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,C=document.activeElement;if(A&&C){const R=j.currentTarget,[D,B]=XN(R);D&&B?!j.shiftKey&&C===B?(j.preventDefault(),a&&Xa(D,{select:!0})):j.shiftKey&&C===D&&(j.preventDefault(),a&&Xa(B,{select:!0})):C===R&&j.preventDefault()}},[a,l,y.paused]);return o.jsx(Ge.div,{tabIndex:-1,...d,ref:b,onKeyDown:k})});Sc.displayName=GN;function YN(e,{select:r=!1}={}){const a=document.activeElement;for(const l of e)if(Xa(l,{select:r}),document.activeElement!==a)return}function XN(e){const r=a1(e),a=Wy(r,e),l=Wy(r.reverse(),e);return[a,l]}function a1(e){const r=[],a=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:l=>{const u=l.tagName==="INPUT"&&l.type==="hidden";return l.disabled||l.hidden||u?NodeFilter.FILTER_SKIP:l.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)r.push(a.currentNode);return r}function Wy(e,r){for(const a of e)if(!KN(a,{upTo:r}))return a}function KN(e,{upTo:r}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(r!==void 0&&e===r)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function QN(e){return e instanceof HTMLInputElement&&"select"in e}function Xa(e,{select:r=!1}={}){if(e&&e.focus){const a=document.activeElement;e.focus({preventScroll:!0}),e!==a&&QN(e)&&r&&e.select()}}var eb=ZN();function ZN(){let e=[];return{add(r){const a=e[0];r!==a&&(a==null||a.pause()),e=tb(e,r),e.unshift(r)},remove(r){var a;e=tb(e,r),(a=e[0])==null||a.resume()}}}function tb(e,r){const a=[...e],l=a.indexOf(r);return l!==-1&&a.splice(l,1),a}function JN(e){return e.filter(r=>r.tagName!=="A")}var WN="Portal",jc=S.forwardRef((e,r)=>{var f;const{container:a,...l}=e,[u,c]=S.useState(!1);jn(()=>c(!0),[]);const d=a||u&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return d?X0.createPortal(o.jsx(Ge.div,{...l,ref:r}),d):null});jc.displayName=WN;function eT(e,r){return S.useReducer((a,l)=>r[a][l]??a,e)}var Ir=e=>{const{present:r,children:a}=e,l=tT(r),u=typeof a=="function"?a({present:l.isPresent}):S.Children.only(a),c=ft(l.ref,nT(u));return typeof a=="function"||l.isPresent?S.cloneElement(u,{ref:c}):null};Ir.displayName="Presence";function tT(e){const[r,a]=S.useState(),l=S.useRef({}),u=S.useRef(e),c=S.useRef("none"),d=e?"mounted":"unmounted",[f,m]=eT(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{const h=Bu(l.current);c.current=f==="mounted"?h:"none"},[f]),jn(()=>{const h=l.current,v=u.current;if(v!==e){const b=c.current,y=Bu(h);e?m("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?m("UNMOUNT"):m(v&&b!==y?"ANIMATION_OUT":"UNMOUNT"),u.current=e}},[e,m]),jn(()=>{if(r){let h;const v=r.ownerDocument.defaultView??window,x=y=>{const j=Bu(l.current).includes(y.animationName);if(y.target===r&&j&&(m("ANIMATION_END"),!u.current)){const A=r.style.animationFillMode;r.style.animationFillMode="forwards",h=v.setTimeout(()=>{r.style.animationFillMode==="forwards"&&(r.style.animationFillMode=A)})}},b=y=>{y.target===r&&(c.current=Bu(l.current))};return r.addEventListener("animationstart",b),r.addEventListener("animationcancel",x),r.addEventListener("animationend",x),()=>{v.clearTimeout(h),r.removeEventListener("animationstart",b),r.removeEventListener("animationcancel",x),r.removeEventListener("animationend",x)}}else m("ANIMATION_END")},[r,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:S.useCallback(h=>{h&&(l.current=getComputedStyle(h)),a(h)},[])}}function Bu(e){return(e==null?void 0:e.animationName)||"none"}function nT(e){var l,u;let r=(l=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:l.get,a=r&&"isReactWarning"in r&&r.isReactWarning;return a?e.ref:(r=(u=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:u.get,a=r&&"isReactWarning"in r&&r.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}var ph=0;function Um(){S.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??nb()),document.body.insertAdjacentElement("beforeend",e[1]??nb()),ph++,()=>{ph===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),ph--}},[])}function nb(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Dr=function(){return Dr=Object.assign||function(r){for(var a,l=1,u=arguments.length;l"u")return yT;var r=bT(e),a=document.documentElement.clientWidth,l=window.innerWidth;return{left:r[0],top:r[1],right:r[2],gap:Math.max(0,l-a+r[2]-r[0])}},ST=s1(),Fi="data-scroll-locked",jT=function(e,r,a,l){var u=e.left,c=e.top,d=e.right,f=e.gap;return a===void 0&&(a="margin"),` + .`.concat(aT,` { + overflow: hidden `).concat(l,`; + padding-right: `).concat(f,"px ").concat(l,`; + } + body[`).concat(Fi,`] { + overflow: hidden `).concat(l,`; + overscroll-behavior: contain; + `).concat([r&&"position: relative ".concat(l,";"),a==="margin"&&` + padding-left: `.concat(u,`px; + padding-top: `).concat(c,`px; + padding-right: `).concat(d,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(f,"px ").concat(l,`; + `),a==="padding"&&"padding-right: ".concat(f,"px ").concat(l,";")].filter(Boolean).join(""),` + } + + .`).concat(Ju,` { + right: `).concat(f,"px ").concat(l,`; + } + + .`).concat(Wu,` { + margin-right: `).concat(f,"px ").concat(l,`; + } + + .`).concat(Ju," .").concat(Ju,` { + right: 0 `).concat(l,`; + } + + .`).concat(Wu," .").concat(Wu,` { + margin-right: 0 `).concat(l,`; + } + + body[`).concat(Fi,`] { + `).concat(lT,": ").concat(f,`px; + } +`)},ab=function(){var e=parseInt(document.body.getAttribute(Fi)||"0",10);return isFinite(e)?e:0},kT=function(){S.useEffect(function(){return document.body.setAttribute(Fi,(ab()+1).toString()),function(){var e=ab()-1;e<=0?document.body.removeAttribute(Fi):document.body.setAttribute(Fi,e.toString())}},[])},CT=function(e){var r=e.noRelative,a=e.noImportant,l=e.gapMode,u=l===void 0?"margin":l;kT();var c=S.useMemo(function(){return wT(u)},[u]);return S.createElement(ST,{styles:jT(c,!r,u,a?"":"!important")})},lm=!1;if(typeof window<"u")try{var Iu=Object.defineProperty({},"passive",{get:function(){return lm=!0,!0}});window.addEventListener("test",Iu,Iu),window.removeEventListener("test",Iu,Iu)}catch{lm=!1}var Bi=lm?{passive:!1}:!1,ET=function(e){return e.tagName==="TEXTAREA"},u1=function(e,r){if(!(e instanceof Element))return!1;var a=window.getComputedStyle(e);return a[r]!=="hidden"&&!(a.overflowY===a.overflowX&&!ET(e)&&a[r]==="visible")},NT=function(e){return u1(e,"overflowY")},TT=function(e){return u1(e,"overflowX")},lb=function(e,r){var a=r.ownerDocument,l=r;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var u=c1(e,l);if(u){var c=d1(e,l),d=c[1],f=c[2];if(d>f)return!0}l=l.parentNode}while(l&&l!==a.body);return!1},AT=function(e){var r=e.scrollTop,a=e.scrollHeight,l=e.clientHeight;return[r,a,l]},_T=function(e){var r=e.scrollLeft,a=e.scrollWidth,l=e.clientWidth;return[r,a,l]},c1=function(e,r){return e==="v"?NT(r):TT(r)},d1=function(e,r){return e==="v"?AT(r):_T(r)},MT=function(e,r){return e==="h"&&r==="rtl"?-1:1},RT=function(e,r,a,l,u){var c=MT(e,window.getComputedStyle(r).direction),d=c*l,f=a.target,m=r.contains(f),h=!1,v=d>0,x=0,b=0;do{if(!f)break;var y=d1(e,f),k=y[0],j=y[1],A=y[2],C=j-A-c*k;(k||C)&&c1(e,f)&&(x+=C,b+=k);var R=f.parentNode;f=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!m&&f!==document.body||m&&(r.contains(f)||r===f));return(v&&Math.abs(x)<1||!v&&Math.abs(b)<1)&&(h=!0),h},Hu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ib=function(e){return[e.deltaX,e.deltaY]},ob=function(e){return e&&"current"in e?e.current:e},DT=function(e,r){return e[0]===r[0]&&e[1]===r[1]},OT=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},zT=0,Ii=[];function LT(e){var r=S.useRef([]),a=S.useRef([0,0]),l=S.useRef(),u=S.useState(zT++)[0],c=S.useState(s1)[0],d=S.useRef(e);S.useEffect(function(){d.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(u));var j=rT([e.lockRef.current],(e.shards||[]).map(ob),!0).filter(Boolean);return j.forEach(function(A){return A.classList.add("allow-interactivity-".concat(u))}),function(){document.body.classList.remove("block-interactivity-".concat(u)),j.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(u))})}}},[e.inert,e.lockRef.current,e.shards]);var f=S.useCallback(function(j,A){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!d.current.allowPinchZoom;var C=Hu(j),R=a.current,D="deltaX"in j?j.deltaX:R[0]-C[0],B="deltaY"in j?j.deltaY:R[1]-C[1],O,_=j.target,E=Math.abs(D)>Math.abs(B)?"h":"v";if("touches"in j&&E==="h"&&_.type==="range")return!1;var I=window.getSelection(),W=I&&I.anchorNode,q=W?W===_||W.contains(_):!1;if(q)return!1;var $=lb(E,_);if(!$)return!0;if($?O=E:(O=E==="v"?"h":"v",$=lb(E,_)),!$)return!1;if(!l.current&&"changedTouches"in j&&(D||B)&&(l.current=O),!O)return!0;var X=l.current||O;return RT(X,A,j,X==="h"?D:B)},[]),m=S.useCallback(function(j){var A=j;if(!(!Ii.length||Ii[Ii.length-1]!==c)){var C="deltaY"in A?ib(A):Hu(A),R=r.current.filter(function(O){return O.name===A.type&&(O.target===A.target||A.target===O.shadowParent)&&DT(O.delta,C)})[0];if(R&&R.should){A.cancelable&&A.preventDefault();return}if(!R){var D=(d.current.shards||[]).map(ob).filter(Boolean).filter(function(O){return O.contains(A.target)}),B=D.length>0?f(A,D[0]):!d.current.noIsolation;B&&A.cancelable&&A.preventDefault()}}},[]),h=S.useCallback(function(j,A,C,R){var D={name:j,delta:A,target:C,should:R,shadowParent:UT(C)};r.current.push(D),setTimeout(function(){r.current=r.current.filter(function(B){return B!==D})},1)},[]),v=S.useCallback(function(j){a.current=Hu(j),l.current=void 0},[]),x=S.useCallback(function(j){h(j.type,ib(j),j.target,f(j,e.lockRef.current))},[]),b=S.useCallback(function(j){h(j.type,Hu(j),j.target,f(j,e.lockRef.current))},[]);S.useEffect(function(){return Ii.push(c),e.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:b}),document.addEventListener("wheel",m,Bi),document.addEventListener("touchmove",m,Bi),document.addEventListener("touchstart",v,Bi),function(){Ii=Ii.filter(function(j){return j!==c}),document.removeEventListener("wheel",m,Bi),document.removeEventListener("touchmove",m,Bi),document.removeEventListener("touchstart",v,Bi)}},[]);var y=e.removeScrollBar,k=e.inert;return S.createElement(S.Fragment,null,k?S.createElement(c,{styles:OT(u)}):null,y?S.createElement(CT,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function UT(e){for(var r=null;e!==null;)e instanceof ShadowRoot&&(r=e.host,e=e.host),e=e.parentNode;return r}const BT=fT(o1,LT);var Cc=S.forwardRef(function(e,r){return S.createElement(kc,Dr({},e,{ref:r,sideCar:BT}))});Cc.classNames=kc.classNames;var IT=function(e){if(typeof document>"u")return null;var r=Array.isArray(e)?e[0]:e;return r.ownerDocument.body},Hi=new WeakMap,qu=new WeakMap,Pu={},yh=0,f1=function(e){return e&&(e.host||f1(e.parentNode))},HT=function(e,r){return r.map(function(a){if(e.contains(a))return a;var l=f1(a);return l&&e.contains(l)?l:(console.error("aria-hidden",a,"in not contained inside",e,". Doing nothing"),null)}).filter(function(a){return!!a})},qT=function(e,r,a,l){var u=HT(r,Array.isArray(e)?e:[e]);Pu[a]||(Pu[a]=new WeakMap);var c=Pu[a],d=[],f=new Set,m=new Set(u),h=function(x){!x||f.has(x)||(f.add(x),h(x.parentNode))};u.forEach(h);var v=function(x){!x||m.has(x)||Array.prototype.forEach.call(x.children,function(b){if(f.has(b))v(b);else try{var y=b.getAttribute(l),k=y!==null&&y!=="false",j=(Hi.get(b)||0)+1,A=(c.get(b)||0)+1;Hi.set(b,j),c.set(b,A),d.push(b),j===1&&k&&qu.set(b,!0),A===1&&b.setAttribute(a,"true"),k||b.setAttribute(l,"true")}catch(C){console.error("aria-hidden: cannot operate on ",b,C)}})};return v(r),f.clear(),yh++,function(){d.forEach(function(x){var b=Hi.get(x)-1,y=c.get(x)-1;Hi.set(x,b),c.set(x,y),b||(qu.has(x)||x.removeAttribute(l),qu.delete(x)),y||x.removeAttribute(a)}),yh--,yh||(Hi=new WeakMap,Hi=new WeakMap,qu=new WeakMap,Pu={})}},Bm=function(e,r,a){a===void 0&&(a="data-aria-hidden");var l=Array.from(Array.isArray(e)?e:[e]),u=IT(e);return u?(l.push.apply(l,Array.from(u.querySelectorAll("[aria-live], script"))),qT(l,u,a,"aria-hidden")):function(){return null}},Im="Dialog",[h1,m1]=vr(Im),[PT,yr]=h1(Im),p1=e=>{const{__scopeDialog:r,children:a,open:l,defaultOpen:u,onOpenChange:c,modal:d=!0}=e,f=S.useRef(null),m=S.useRef(null),[h=!1,v]=el({prop:l,defaultProp:u,onChange:c});return o.jsx(PT,{scope:r,triggerRef:f,contentRef:m,contentId:zr(),titleId:zr(),descriptionId:zr(),open:h,onOpenChange:v,onOpenToggle:S.useCallback(()=>v(x=>!x),[v]),modal:d,children:a})};p1.displayName=Im;var g1="DialogTrigger",x1=S.forwardRef((e,r)=>{const{__scopeDialog:a,...l}=e,u=yr(g1,a),c=ft(r,u.triggerRef);return o.jsx(Ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":u.open,"aria-controls":u.contentId,"data-state":Pm(u.open),...l,ref:c,onClick:Te(e.onClick,u.onOpenToggle)})});x1.displayName=g1;var Hm="DialogPortal",[$T,v1]=h1(Hm,{forceMount:void 0}),y1=e=>{const{__scopeDialog:r,forceMount:a,children:l,container:u}=e,c=yr(Hm,r);return o.jsx($T,{scope:r,forceMount:a,children:S.Children.map(l,d=>o.jsx(Ir,{present:a||c.open,children:o.jsx(jc,{asChild:!0,container:u,children:d})}))})};y1.displayName=Hm;var rc="DialogOverlay",b1=S.forwardRef((e,r)=>{const a=v1(rc,e.__scopeDialog),{forceMount:l=a.forceMount,...u}=e,c=yr(rc,e.__scopeDialog);return c.modal?o.jsx(Ir,{present:l||c.open,children:o.jsx(FT,{...u,ref:r})}):null});b1.displayName=rc;var FT=S.forwardRef((e,r)=>{const{__scopeDialog:a,...l}=e,u=yr(rc,a);return o.jsx(Cc,{as:da,allowPinchZoom:!0,shards:[u.contentRef],children:o.jsx(Ge.div,{"data-state":Pm(u.open),...l,ref:r,style:{pointerEvents:"auto",...l.style}})})}),Pl="DialogContent",w1=S.forwardRef((e,r)=>{const a=v1(Pl,e.__scopeDialog),{forceMount:l=a.forceMount,...u}=e,c=yr(Pl,e.__scopeDialog);return o.jsx(Ir,{present:l||c.open,children:c.modal?o.jsx(VT,{...u,ref:r}):o.jsx(GT,{...u,ref:r})})});w1.displayName=Pl;var VT=S.forwardRef((e,r)=>{const a=yr(Pl,e.__scopeDialog),l=S.useRef(null),u=ft(r,a.contentRef,l);return S.useEffect(()=>{const c=l.current;if(c)return Bm(c)},[]),o.jsx(S1,{...e,ref:u,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Te(e.onCloseAutoFocus,c=>{var d;c.preventDefault(),(d=a.triggerRef.current)==null||d.focus()}),onPointerDownOutside:Te(e.onPointerDownOutside,c=>{const d=c.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0;(d.button===2||f)&&c.preventDefault()}),onFocusOutside:Te(e.onFocusOutside,c=>c.preventDefault())})}),GT=S.forwardRef((e,r)=>{const a=yr(Pl,e.__scopeDialog),l=S.useRef(!1),u=S.useRef(!1);return o.jsx(S1,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{var d,f;(d=e.onCloseAutoFocus)==null||d.call(e,c),c.defaultPrevented||(l.current||(f=a.triggerRef.current)==null||f.focus(),c.preventDefault()),l.current=!1,u.current=!1},onInteractOutside:c=>{var m,h;(m=e.onInteractOutside)==null||m.call(e,c),c.defaultPrevented||(l.current=!0,c.detail.originalEvent.type==="pointerdown"&&(u.current=!0));const d=c.target;((h=a.triggerRef.current)==null?void 0:h.contains(d))&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&u.current&&c.preventDefault()}})}),S1=S.forwardRef((e,r)=>{const{__scopeDialog:a,trapFocus:l,onOpenAutoFocus:u,onCloseAutoFocus:c,...d}=e,f=yr(Pl,a),m=S.useRef(null),h=ft(r,m);return Um(),o.jsxs(o.Fragment,{children:[o.jsx(Sc,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:u,onUnmountAutoFocus:c,children:o.jsx(wc,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Pm(f.open),...d,ref:h,onDismiss:()=>f.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(XT,{titleId:f.titleId}),o.jsx(QT,{contentRef:m,descriptionId:f.descriptionId})]})]})}),qm="DialogTitle",j1=S.forwardRef((e,r)=>{const{__scopeDialog:a,...l}=e,u=yr(qm,a);return o.jsx(Ge.h2,{id:u.titleId,...l,ref:r})});j1.displayName=qm;var k1="DialogDescription",C1=S.forwardRef((e,r)=>{const{__scopeDialog:a,...l}=e,u=yr(k1,a);return o.jsx(Ge.p,{id:u.descriptionId,...l,ref:r})});C1.displayName=k1;var E1="DialogClose",N1=S.forwardRef((e,r)=>{const{__scopeDialog:a,...l}=e,u=yr(E1,a);return o.jsx(Ge.button,{type:"button",...l,ref:r,onClick:Te(e.onClick,()=>u.onOpenChange(!1))})});N1.displayName=E1;function Pm(e){return e?"open":"closed"}var T1="DialogTitleWarning",[YT,A1]=DN(T1,{contentName:Pl,titleName:qm,docsSlug:"dialog"}),XT=({titleId:e})=>{const r=A1(T1),a=`\`${r.contentName}\` requires a \`${r.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${r.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${r.docsSlug}`;return S.useEffect(()=>{e&&(document.getElementById(e)||console.error(a))},[a,e]),null},KT="DialogDescriptionWarning",QT=({contentRef:e,descriptionId:r})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${A1(KT).contentName}}.`;return S.useEffect(()=>{var c;const u=(c=e.current)==null?void 0:c.getAttribute("aria-describedby");r&&u&&(document.getElementById(r)||console.warn(l))},[l,e,r]),null},ZT=p1,JT=x1,WT=y1,eA=b1,tA=w1,nA=j1,rA=C1,_1=N1,M1="AlertDialog",[aA]=vr(M1,[m1]),xa=m1(),R1=e=>{const{__scopeAlertDialog:r,...a}=e,l=xa(r);return o.jsx(ZT,{...l,...a,modal:!0})};R1.displayName=M1;var lA="AlertDialogTrigger",D1=S.forwardRef((e,r)=>{const{__scopeAlertDialog:a,...l}=e,u=xa(a);return o.jsx(JT,{...u,...l,ref:r})});D1.displayName=lA;var iA="AlertDialogPortal",O1=e=>{const{__scopeAlertDialog:r,...a}=e,l=xa(r);return o.jsx(WT,{...l,...a})};O1.displayName=iA;var oA="AlertDialogOverlay",z1=S.forwardRef((e,r)=>{const{__scopeAlertDialog:a,...l}=e,u=xa(a);return o.jsx(eA,{...u,...l,ref:r})});z1.displayName=oA;var Vi="AlertDialogContent",[sA,uA]=aA(Vi),L1=S.forwardRef((e,r)=>{const{__scopeAlertDialog:a,children:l,...u}=e,c=xa(a),d=S.useRef(null),f=ft(r,d),m=S.useRef(null);return o.jsx(YT,{contentName:Vi,titleName:U1,docsSlug:"alert-dialog",children:o.jsx(sA,{scope:a,cancelRef:m,children:o.jsxs(tA,{role:"alertdialog",...c,...u,ref:f,onOpenAutoFocus:Te(u.onOpenAutoFocus,h=>{var v;h.preventDefault(),(v=m.current)==null||v.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[o.jsx(G0,{children:l}),o.jsx(dA,{contentRef:d})]})})})});L1.displayName=Vi;var U1="AlertDialogTitle",B1=S.forwardRef((e,r)=>{const{__scopeAlertDialog:a,...l}=e,u=xa(a);return o.jsx(nA,{...u,...l,ref:r})});B1.displayName=U1;var I1="AlertDialogDescription",H1=S.forwardRef((e,r)=>{const{__scopeAlertDialog:a,...l}=e,u=xa(a);return o.jsx(rA,{...u,...l,ref:r})});H1.displayName=I1;var cA="AlertDialogAction",q1=S.forwardRef((e,r)=>{const{__scopeAlertDialog:a,...l}=e,u=xa(a);return o.jsx(_1,{...u,...l,ref:r})});q1.displayName=cA;var P1="AlertDialogCancel",$1=S.forwardRef((e,r)=>{const{__scopeAlertDialog:a,...l}=e,{cancelRef:u}=uA(P1,a),c=xa(a),d=ft(r,u);return o.jsx(_1,{...c,...l,ref:d})});$1.displayName=P1;var dA=({contentRef:e})=>{const r=`\`${Vi}\` requires a description for the component to be accessible for screen reader users. + +You can add a description to the \`${Vi}\` by passing a \`${I1}\` component as a child, which also benefits sighted users by adding visible context to the dialog. + +Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Vi}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. + +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return S.useEffect(()=>{var l;document.getElementById((l=e.current)==null?void 0:l.getAttribute("aria-describedby"))||console.warn(r)},[r,e]),null},fA=R1,hA=D1,mA=O1,pA=z1,gA=L1,xA=q1,vA=$1,yA=B1,bA=H1;function tl({...e}){return o.jsx(fA,{"data-slot":"alert-dialog",...e})}function nl({...e}){return o.jsx(hA,{"data-slot":"alert-dialog-trigger",...e})}function wA({...e}){return o.jsx(mA,{"data-slot":"alert-dialog-portal",...e})}function SA({className:e,...r}){return o.jsx(pA,{"data-slot":"alert-dialog-overlay",className:_e("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...r})}function rl({className:e,...r}){return o.jsxs(wA,{children:[o.jsx(SA,{}),o.jsx(gA,{"data-slot":"alert-dialog-content",className:_e("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r})]})}function al({className:e,...r}){return o.jsx("div",{"data-slot":"alert-dialog-header",className:_e("flex flex-col gap-2 text-center sm:text-left",e),...r})}function ll({className:e,...r}){return o.jsx("div",{"data-slot":"alert-dialog-footer",className:_e("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...r})}function il({className:e,...r}){return o.jsx(yA,{"data-slot":"alert-dialog-title",className:_e("text-lg font-semibold",e),...r})}function ol({className:e,...r}){return o.jsx(bA,{"data-slot":"alert-dialog-description",className:_e("text-muted-foreground text-sm",e),...r})}function sl({className:e,...r}){return o.jsx(xA,{className:_e(Dm(),e),...r})}function ul({className:e,...r}){return o.jsx(vA,{className:_e(Dm({variant:"outline"}),e),...r})}function jA(){return o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsx(kA,{}),o.jsx(CA,{})]})}function kA(){const{data:e,loading:r,error:a,reload:l}=Pt(()=>Pe.get("/my/keys")),[u,c]=S.useState(""),[d,f]=S.useState(!1),[m,h]=S.useState(null),v=async b=>{b.preventDefault(),f(!0);try{const y=await Pe.post("/my/keys",{label:u});h(y),c(""),l()}catch(y){Ve.error(String(y instanceof Error?y.message:y))}finally{f(!1)}},x=async b=>{try{await Pe.del(`/my/keys/${b}`),Ve.success("Key deleted"),l()}catch(y){Ve.error(String(y instanceof Error?y.message:y))}};return o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Your API keys"}),o.jsx(ct,{children:"Shown exactly once at creation; only a keyed hash is stored."})]}),o.jsxs(Ze,{className:"flex flex-col gap-4",children:[o.jsxs("form",{onSubmit:v,className:"flex flex-wrap items-center gap-2",children:[o.jsx(Kt,{className:"w-64",placeholder:"Label (e.g. laptop)",maxLength:120,value:u,onChange:b=>c(b.target.value)}),o.jsxs(Re,{type:"submit",disabled:d,children:[d&&o.jsx(Tt,{}),"Create key"]})]}),m&&o.jsxs("div",{className:"rounded-md border border-primary/40 bg-primary/5 p-4",children:[o.jsxs("p",{className:"mb-2 text-sm font-medium",children:["New key",m.label?` "${m.label}"`:""," โ€” copy it now, it will not be shown again."]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 overflow-x-auto rounded bg-background px-2 py-1.5 font-mono text-sm",children:m.key}),o.jsx(Re,{variant:"outline",size:"icon-sm","aria-label":"Copy key",onClick:()=>{navigator.clipboard.writeText(m.key??""),Ve.success("Copied to clipboard")},children:o.jsx(Om,{})})]})]}),r&&!e?o.jsx(Tt,{}):a?o.jsx("p",{className:"text-sm text-destructive",children:a}):o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[o.jsx(ge,{children:"Label"}),o.jsx(ge,{children:"Key"}),o.jsx(ge,{children:"Created"}),o.jsx(ge,{children:"Last used"}),o.jsx(ge,{className:"w-24"})]})}),o.jsxs(vn,{children:[(e==null?void 0:e.keys.length)===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:5,className:"text-muted-foreground",children:"No keys yet."})}),e==null?void 0:e.keys.map(b=>o.jsxs(Ue,{children:[o.jsx(me,{className:"wrap-anywhere",children:b.label||o.jsx("span",{className:"text-muted-foreground",children:"(no label)"})}),o.jsxs(me,{className:"font-mono text-xs",children:["***",b.key_suffix]}),o.jsx(me,{className:"whitespace-nowrap",children:Wa(b.created_at)}),o.jsx(me,{className:"whitespace-nowrap",children:Wa(b.last_used_at)||"never"}),o.jsx(me,{className:"whitespace-nowrap",children:o.jsxs(tl,{children:[o.jsx(nl,{asChild:!0,children:o.jsx(Re,{variant:"ghost",size:"sm",children:"Delete"})}),o.jsxs(rl,{children:[o.jsxs(al,{children:[o.jsx(il,{children:"Delete this key?"}),o.jsxs(ol,{children:["Anything using"," ",b.label?`"${b.label}"`:`***${b.key_suffix}`," ","stops working immediately. This cannot be undone."]})]}),o.jsxs(ll,{children:[o.jsx(ul,{children:"Cancel"}),o.jsx(sl,{onClick:()=>x(b.id),children:"Delete"})]})]})]})})]},b.id))]})]})]})]})}function CA(){const{data:e,loading:r,error:a,reload:l}=Pt(()=>Pe.get("/my/relay-tokens")),[u,c]=S.useState(""),[d,f]=S.useState(!1),[m,h]=S.useState(null),v=async y=>{y.preventDefault(),f(!0);try{const k=await Pe.post("/my/relay-tokens",{label:u});h(k),c(""),l()}catch(k){Ve.error(String(k instanceof Error?k.message:k))}finally{f(!1)}},x=async y=>{try{await Pe.del(`/my/relay-tokens/${y}`),Ve.success("Relay token deleted"),l()}catch(k){Ve.error(String(k instanceof Error?k.message:k))}},b=y=>`export ANTHROPIC_BASE_URL=${window.location.origin}/transparent/anthropic/${y} +claude`;return o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Relay tokens"}),o.jsx(ct,{children:"Tracks your usage on the transparent Anthropic relay. Your Anthropic credentials pass through untouched; the token grants no proxy access."})]}),o.jsxs(Ze,{className:"flex flex-col gap-4",children:[o.jsxs("form",{onSubmit:v,className:"flex flex-wrap items-center gap-2",children:[o.jsx(Kt,{className:"w-64",placeholder:"Label (e.g. claude-code laptop)",maxLength:120,value:u,onChange:y=>c(y.target.value)}),o.jsxs(Re,{type:"submit",disabled:d,children:[d&&o.jsx(Tt,{}),"Create relay token"]})]}),(m==null?void 0:m.token)&&o.jsxs("div",{className:"rounded-md border border-primary/40 bg-primary/5 p-4",children:[o.jsxs("p",{className:"mb-2 text-sm font-medium",children:["New relay token",m.label?` "${m.label}"`:""," โ€” copy the setup command now, the token will not be shown again."]}),o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("pre",{className:"flex-1 overflow-x-auto rounded bg-background px-2 py-1.5 font-mono text-sm",children:b(m.token)}),o.jsx(Re,{variant:"outline",size:"icon-sm","aria-label":"Copy setup command",onClick:()=>{navigator.clipboard.writeText(b(m.token??"")),Ve.success("Copied to clipboard")},children:o.jsx(Om,{})})]}),o.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["Make it permanent via your shell profile or ",'"env"'," in ~/.claude/settings.json."]})]}),r&&!e?o.jsx(Tt,{}):a?o.jsx("p",{className:"text-sm text-destructive",children:a}):o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[o.jsx(ge,{children:"Label"}),o.jsx(ge,{children:"Token"}),o.jsx(ge,{children:"Created"}),o.jsx(ge,{children:"Last used"}),o.jsx(ge,{className:"w-24"})]})}),o.jsxs(vn,{children:[(e==null?void 0:e.relay_tokens.length)===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:5,className:"text-muted-foreground",children:"No relay tokens yet."})}),e==null?void 0:e.relay_tokens.map(y=>o.jsxs(Ue,{children:[o.jsx(me,{className:"wrap-anywhere",children:y.label||o.jsx("span",{className:"text-muted-foreground",children:"(no label)"})}),o.jsxs(me,{className:"font-mono text-xs",children:["***",y.token_suffix]}),o.jsx(me,{className:"whitespace-nowrap",children:Wa(y.created_at)}),o.jsx(me,{className:"whitespace-nowrap",children:Wa(y.last_used_at)||"never"}),o.jsx(me,{className:"whitespace-nowrap",children:o.jsxs(tl,{children:[o.jsx(nl,{asChild:!0,children:o.jsx(Re,{variant:"ghost",size:"sm",children:"Delete"})}),o.jsxs(rl,{children:[o.jsxs(al,{children:[o.jsx(il,{children:"Delete this relay token?"}),o.jsxs(ol,{children:["Anything relaying through"," ",y.label?`"${y.label}"`:`***${y.token_suffix}`," ","stops working immediately. This cannot be undone."]})]}),o.jsxs(ll,{children:[o.jsx(ul,{children:"Cancel"}),o.jsx(sl,{onClick:()=>x(y.id),children:"Delete"})]})]})]})})]},y.id))]})]})]})]})}const Hl={name:"",fill:"fill-chart-1",swatch:"bg-chart-1"},os={name:"",fill:"fill-chart-2 dark:fill-chart-4",swatch:"bg-chart-2 dark:bg-chart-4"},$m={name:"",fill:"fill-chart-3",swatch:"bg-chart-3"},ar=52,EA=22,mr=176,NA=24,TA=2;function AA(){const e=S.useRef(null),[r,a]=S.useState(0);return S.useLayoutEffect(()=>{const l=e.current;if(!l)return;a(l.getBoundingClientRect().width);const u=new ResizeObserver(c=>{a(c[0].contentRect.width)});return u.observe(l),()=>u.disconnect()},[]),[e,r]}function _A(e,r,a=4){if(!(e>0))return[0,1];const l=Math.pow(10,Math.floor(Math.log10(e/a))),u=e/a/l;let c=(u<=1?1:u<=2?2:u<=5?5:10)*l;r&&(c=Math.max(1,Math.round(c)));const d=(Math.floor(e/c)+1)*c,f=[];for(let m=0;m<=d+c/2;m+=c)f.push(Number(m.toFixed(10)));return f}function MA(e,r,a,l,u){const c=u?Math.min(4,a/2,l):0;return`M${e},${r+l} L${e},${r+c} Q${e},${r} ${e+c},${r} L${e+a-c},${r} Q${e+a},${r} ${e+a},${r+c} L${e+a},${r+l} Z`}function Za({points:e,series:r,format:a,integer:l,emptyMessage:u="No usage in this range.",className:c}){var B;const[d,f]=AA(),[m,h]=S.useState(null),v=e.map(O=>O.values.reduce((_,E)=>_+(E??0),0)),x=Math.max(0,...v),b=_A(x,l===!0),y=b[b.length-1]||1,k=Math.max(0,f-ar),j=e.length>0?k/e.length:0,A=Math.max(2,Math.min(NA,j-6)),C=O=>mr-O/y*mr,R=v.indexOf(x),D=Math.max(1,Math.ceil(e.length/8));return o.jsxs("div",{className:_e("flex flex-col gap-2",c),children:[r.length>1&&o.jsx("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:r.map(O=>o.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx("span",{className:_e("size-2.5 rounded-xs",O.swatch),"aria-hidden":!0}),O.name]},O.name))}),o.jsxs("div",{ref:d,className:"relative w-full",children:[o.jsxs("svg",{width:f,height:mr+EA,className:"block overflow-visible",onPointerLeave:()=>h(null),children:[b.map(O=>o.jsxs("g",{children:[o.jsx("line",{x1:ar,x2:f,y1:C(O),y2:C(O),className:"stroke-border",strokeWidth:1}),o.jsx("text",{x:ar-8,y:C(O)+3,textAnchor:"end",className:"fill-muted-foreground text-[10px] tabular-nums",children:a(O)})]},O)),m!==null&&o.jsx("rect",{x:ar+m*j,y:0,width:Math.max(j,1),height:mr,className:"fill-foreground/5"}),e.map((O,_)=>{const E=ar+_*j+(j-A)/2;let I=-1;O.values.forEach((q,$)=>{q!==null&&q>0&&(I=$)});let W=mr;return o.jsx("g",{children:O.values.map((q,$)=>{if(q===null||q<=0)return null;const X=q/y*mr,ce=Math.max(1,X-(W0&&j>=30&&o.jsx("text",{x:ar+R*j+j/2,y:C(x)-6,textAnchor:"middle",className:"fill-foreground text-[10px] font-medium tabular-nums",children:a(x)}),e.map((O,_)=>_%D===0?o.jsx("text",{x:ar+_*j+j/2,y:mr+15,textAnchor:"middle",className:"fill-muted-foreground text-[10px]",children:O.label},_):null),o.jsx("line",{x1:ar,x2:f,y1:mr,y2:mr,className:"stroke-border",strokeWidth:1}),e.map((O,_)=>o.jsx("rect",{x:ar+_*j,y:0,width:Math.max(j,1),height:mr,fill:"transparent",tabIndex:0,role:"button","aria-label":`${O.title}: ${O.values.map((E,I)=>`${r[I].name||"value"} ${E===null?"unpriced":a(E)}`).join(", ")}`,onPointerEnter:()=>h(_),onFocus:()=>h(_),onBlur:()=>h(null),className:"outline-none focus-visible:stroke-ring focus-visible:[stroke-width:2]"},_))]}),x===0&&o.jsx("p",{className:"pointer-events-none absolute inset-x-0 top-1/2 -translate-y-1/2 text-center text-sm text-muted-foreground",children:u}),m!==null&&e[m]&&o.jsxs("div",{className:"pointer-events-none absolute z-10 min-w-36 -translate-x-1/2 rounded-md border bg-popover p-2 text-xs shadow-md",style:{left:Math.min(Math.max(ar+m*j+j/2,ar+70),Math.max(f-70,ar+70)),top:0},children:[o.jsx("p",{className:"mb-1 text-muted-foreground",children:e[m].title}),e[m].values.map((O,_)=>o.jsxs("p",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:_e("h-0.5 w-3 rounded-full",r[_].swatch),"aria-hidden":!0}),o.jsx("span",{className:"font-medium tabular-nums",children:O===null?"unpriced":a(O)}),r[_].name&&o.jsx("span",{className:"text-muted-foreground",children:r[_].name})]},_)),(B=e[m].rows)==null?void 0:B.map(O=>o.jsxs("p",{className:"flex items-center gap-1.5 pl-[18px]",children:[o.jsx("span",{className:"font-medium tabular-nums",children:O.value}),o.jsx("span",{className:"text-muted-foreground",children:O.label})]},O.label))]})]})]})}const Bl=[{fill:"fill-chart-1",swatch:"bg-chart-1"},{fill:"fill-chart-5",swatch:"bg-chart-5"},{fill:"fill-chart-3",swatch:"bg-chart-3"},{fill:"fill-border",swatch:"bg-border"}],bh=Bl.length;function Ec(e,r,a){if(e.length<=bh)return{slices:e.map(r),overflow:[]};const l=e.slice(bh-1);return{slices:[...e.slice(0,bh-1).map(r),a(l)],overflow:l.map(r)}}function RA(e,r,a,l,u,c){const d=(m,h)=>`${e+m*Math.sin(h)},${r-m*Math.cos(h)}`;if(c-u>=Math.PI*2-1e-9){const m=(h,v)=>`M${e},${r-h} A${h},${h} 0 1 ${v} ${e},${r+h} A${h},${h} 0 1 ${v} ${e},${r-h} Z`;return`${m(a,1)} ${m(l,0)}`}const f=c-u>Math.PI?1:0;return`M${d(a,u)} A${a},${a} 0 ${f} 1 ${d(a,c)} L${d(l,c)} A${l},${l} 0 ${f} 0 ${d(l,u)} Z`}const wh=20;function rs({slices:e,overflow:r=[],format:a,emptyMessage:l="No usage in this range."}){var D;const[u,c]=S.useState(null),[d,f]=S.useState(0),m=r.length>0?e.length-1:-1,h=()=>f(B=>B===0?Math.min(wh,r.length):0),v=e.reduce((B,O)=>B+O.value,0),x=168,b=82,y=50,k=x/2,j=x/2;if(v<=0)return o.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:l});const A=e.length>1?2/((y+b)/2):0;let C=0;const R=e.map((B,O)=>{const _=B.value/v*Math.PI*2,E=C+A/2,I=Math.max(E,C+_-A/2);return C+=_,{slice:B,a0:E,a1:I,i:O}});return o.jsxs("div",{className:"flex flex-wrap items-center gap-x-8 gap-y-4",children:[o.jsxs("div",{className:"relative shrink-0",children:[o.jsx("svg",{width:x,height:x,className:"block",onPointerLeave:()=>c(null),children:R.map(({slice:B,a0:O,a1:_,i:E})=>o.jsx("path",{d:RA(k,j,b,y,O,_),className:_e(Bl[E%Bl.length].fill,"outline-none transition-opacity focus-visible:stroke-ring focus-visible:[stroke-width:2]",u!==null&&u!==E&&"opacity-50",E===m&&"cursor-pointer"),tabIndex:0,role:E===m?"button":"img","aria-label":`${B.label}: ${a(B.value)} (${Math.round(B.value/v*100)}%)`+(E===m?d===0?"; activate to expand":"; activate to collapse":""),onClick:E===m?h:void 0,onKeyDown:E===m?I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),h())}:void 0,onPointerEnter:()=>c(E),onFocus:()=>c(E),onBlur:()=>c(null)},E))}),u!==null&&e[u]&&o.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-0 z-10 min-w-32 -translate-x-1/2 rounded-md border bg-popover p-2 text-xs shadow-md",children:[o.jsx("p",{className:"mb-1 text-muted-foreground",children:e[u].label}),o.jsxs("p",{className:"font-medium tabular-nums",children:[a(e[u].value)," ",o.jsxs("span",{className:"font-normal text-muted-foreground",children:["ยท ",(e[u].value/v*100).toFixed(1),"%"]})]}),(D=e[u].rows)==null?void 0:D.map(B=>o.jsxs("p",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"font-medium tabular-nums",children:B.value}),o.jsx("span",{className:"text-muted-foreground",children:B.label})]},B.label))]})]}),o.jsxs("ul",{className:"min-w-48 flex-1",children:[e.map((B,O)=>o.jsx("li",{className:_e("rounded-sm text-sm",u===O&&"bg-foreground/5"),onPointerEnter:()=>c(O),onPointerLeave:()=>c(null),children:O===m?o.jsxs("button",{type:"button",className:"flex w-full cursor-pointer items-center gap-2 rounded-sm px-1 py-1 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-expanded":d>0,onClick:h,children:[o.jsx("span",{className:_e("size-2.5 shrink-0 rounded-xs",Bl[O%Bl.length].swatch),"aria-hidden":!0}),o.jsx("span",{className:"truncate font-mono text-xs",children:B.label}),d>0?o.jsx(Ki,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":!0}):o.jsx(tm,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":!0}),o.jsx("span",{className:"ml-auto tabular-nums text-muted-foreground",children:a(B.value)}),o.jsxs("span",{className:"w-12 text-right tabular-nums",children:[(B.value/v*100).toFixed(1),"%"]})]}):o.jsxs("span",{className:"flex items-center gap-2 px-1 py-1",children:[o.jsx("span",{className:_e("size-2.5 shrink-0 rounded-xs",Bl[O%Bl.length].swatch),"aria-hidden":!0}),o.jsx("span",{className:"truncate font-mono text-xs",title:B.label,children:B.label}),o.jsx("span",{className:"ml-auto tabular-nums text-muted-foreground",children:a(B.value)}),o.jsxs("span",{className:"w-12 text-right tabular-nums",children:[(B.value/v*100).toFixed(1),"%"]})]})},O)),r.slice(0,d).map((B,O)=>o.jsxs("li",{className:"flex items-center gap-2 py-1 pl-[26px] pr-1 text-sm",onPointerEnter:()=>c(m),onPointerLeave:()=>c(null),children:[o.jsx("span",{className:"truncate font-mono text-xs",title:B.label,children:B.label}),o.jsx("span",{className:"ml-auto tabular-nums text-muted-foreground",children:a(B.value)}),o.jsxs("span",{className:"w-12 text-right tabular-nums",children:[(B.value/v*100).toFixed(1),"%"]})]},`overflow-${O}`)),d>0&&df(B=>Math.min(B+wh,r.length)),children:["Show ",Math.min(wh,r.length-d)," more"]})})]})]})}function Gi({rows:e,format:r,emptyMessage:a="No usage in this range."}){const l=Math.max(0,...e.map(c=>c.value));if(e.length===0||l<=0)return o.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:a});const u=e.reduce((c,d)=>c+d.value,0);return o.jsx("ul",{className:"flex flex-col gap-2",children:e.map((c,d)=>o.jsxs("li",{className:"grid grid-cols-[minmax(6rem,14rem)_1fr_auto] items-center gap-3 text-sm",children:[o.jsx("span",{className:"truncate font-mono text-xs",title:c.title??c.label,children:c.label}),o.jsx("span",{className:"h-2 overflow-hidden rounded-full bg-muted","aria-hidden":!0,children:o.jsx("span",{className:"block h-full rounded-full bg-chart-1",style:{width:`${Math.max(1,c.value/l*100)}%`}})}),o.jsxs("span",{className:"tabular-nums text-muted-foreground",children:[r(c.value),c.note&&o.jsx("span",{className:"ml-2 text-xs",children:c.note}),o.jsxs("span",{className:"ml-2 inline-block w-12 text-right text-foreground",children:[(c.value/u*100).toFixed(1),"%"]})]})]},d))})}function gr({label:e,value:r,secondary:a,delta:l,hint:u}){return o.jsxs("div",{className:"flex flex-col gap-1 rounded-lg border bg-card p-4",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:e}),o.jsxs("span",{className:"text-2xl font-semibold",children:[r,a&&o.jsx("span",{className:"ml-2 text-sm font-normal text-muted-foreground",children:a})]}),o.jsx("span",{className:"text-xs text-muted-foreground",children:l==null?u??"ย ":o.jsxs(o.Fragment,{children:[l>=0?"+":"",Math.round(l*100),"% vs previous"]})})]})}function sb(e,[r,a]){return Math.min(a,Math.max(r,e))}function Fm(e){const r=e+"CollectionProvider",[a,l]=vr(r),[u,c]=a(r,{collectionRef:{current:null},itemMap:new Map}),d=y=>{const{scope:k,children:j}=y,A=ve.useRef(null),C=ve.useRef(new Map).current;return o.jsx(u,{scope:k,itemMap:C,collectionRef:A,children:j})};d.displayName=r;const f=e+"CollectionSlot",m=ve.forwardRef((y,k)=>{const{scope:j,children:A}=y,C=c(f,j),R=ft(k,C.collectionRef);return o.jsx(da,{ref:R,children:A})});m.displayName=f;const h=e+"CollectionItemSlot",v="data-radix-collection-item",x=ve.forwardRef((y,k)=>{const{scope:j,children:A,...C}=y,R=ve.useRef(null),D=ft(k,R),B=c(h,j);return ve.useEffect(()=>(B.itemMap.set(R,{ref:R,...C}),()=>void B.itemMap.delete(R))),o.jsx(da,{[v]:"",ref:D,children:A})});x.displayName=h;function b(y){const k=c(e+"CollectionConsumer",y);return ve.useCallback(()=>{const A=k.collectionRef.current;if(!A)return[];const C=Array.from(A.querySelectorAll(`[${v}]`));return Array.from(k.itemMap.values()).sort((B,O)=>C.indexOf(B.ref.current)-C.indexOf(O.ref.current))},[k.collectionRef,k.itemMap])}return[{Provider:d,Slot:m,ItemSlot:x},b,l]}var DA=S.createContext(void 0);function Nc(e){const r=S.useContext(DA);return e||r||"ltr"}const OA=["top","right","bottom","left"],cl=Math.min,sa=Math.max,ac=Math.round,$u=Math.floor,ua=e=>({x:e,y:e}),zA={left:"right",right:"left",bottom:"top",top:"bottom"};function F1(e,r,a){return sa(e,cl(r,a))}function fa(e,r){return typeof e=="function"?e(r):e}function dl(e){return e.split("-")[0]}function Qi(e){return e.split("-")[1]}function Vm(e){return e==="x"?"y":"x"}function Gm(e){return e==="y"?"height":"width"}function Or(e){const r=e[0];return r==="t"||r==="b"?"y":"x"}function Ym(e){return Vm(Or(e))}function LA(e,r,a){a===void 0&&(a=!1);const l=Qi(e),u=Ym(e),c=Gm(u);let d=u==="x"?l===(a?"end":"start")?"right":"left":l==="start"?"bottom":"top";return r.reference[c]>r.floating[c]&&(d=lc(d)),[d,lc(d)]}function UA(e){const r=lc(e);return[im(e),r,im(r)]}function im(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ub=["left","right"],cb=["right","left"],BA=["top","bottom"],IA=["bottom","top"];function HA(e,r,a){switch(e){case"top":case"bottom":return a?r?cb:ub:r?ub:cb;case"left":case"right":return r?BA:IA;default:return[]}}function qA(e,r,a,l){const u=Qi(e);let c=HA(dl(e),a==="start",l);return u&&(c=c.map(d=>d+"-"+u),r&&(c=c.concat(c.map(im)))),c}function lc(e){const r=dl(e);return zA[r]+e.slice(r.length)}function PA(e){var r,a,l,u;return{top:(r=e.top)!=null?r:0,right:(a=e.right)!=null?a:0,bottom:(l=e.bottom)!=null?l:0,left:(u=e.left)!=null?u:0}}function V1(e){return typeof e!="number"?PA(e):{top:e,right:e,bottom:e,left:e}}function ic(e){const{x:r,y:a,width:l,height:u}=e;return{width:l,height:u,top:a,left:r,right:r+l,bottom:a+u,x:r,y:a}}function db(e,r,a){let{reference:l,floating:u}=e;const c=Or(r),d=Ym(r),f=Gm(d),m=dl(r),h=c==="y",v=l.x+l.width/2-u.width/2,x=l.y+l.height/2-u.height/2,b=l[f]/2-u[f]/2;let y;switch(m){case"top":y={x:v,y:l.y-u.height};break;case"bottom":y={x:v,y:l.y+l.height};break;case"right":y={x:l.x+l.width,y:x};break;case"left":y={x:l.x-u.width,y:x};break;default:y={x:l.x,y:l.y}}const k=Qi(r);return k&&(y[d]+=b*(k==="end"?1:-1)*(a&&h?-1:1)),y}async function $A(e,r){var a;r===void 0&&(r={});const{x:l,y:u,platform:c,rects:d,elements:f,strategy:m}=e,{boundary:h="clippingAncestors",rootBoundary:v="viewport",elementContext:x="floating",altBoundary:b=!1,padding:y=0}=fa(r,e),k=V1(y),A=f[b?x==="floating"?"reference":"floating":x],C=ic(await c.getClippingRect({element:(a=await(c.isElement==null?void 0:c.isElement(A)))==null||a?A:A.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:h,rootBoundary:v,strategy:m})),R=x==="floating"?{x:l,y:u,width:d.floating.width,height:d.floating.height}:d.reference,D=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),B=await(c.isElement==null?void 0:c.isElement(D))&&await(c.getScale==null?void 0:c.getScale(D))||{x:1,y:1},O=ic(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:R,offsetParent:D,strategy:m}):R);return{top:(C.top-O.top+k.top)/B.y,bottom:(O.bottom-C.bottom+k.bottom)/B.y,left:(C.left-O.left+k.left)/B.x,right:(O.right-C.right+k.right)/B.x}}const FA=50,VA=async(e,r,a)=>{const{placement:l="bottom",strategy:u="absolute",middleware:c=[],platform:d}=a,f=d.detectOverflow?d:{...d,detectOverflow:$A},m=await(d.isRTL==null?void 0:d.isRTL(r));let h=await d.getElementRects({reference:e,floating:r,strategy:u}),{x:v,y:x}=db(h,l,m),b=l,y=0;const k={};for(let j=0;j({name:"arrow",options:e,async fn(r){const{x:a,y:l,placement:u,rects:c,platform:d,elements:f,middlewareData:m}=r,{element:h,padding:v=0}=fa(e,r)||{};if(h==null)return{};const x=V1(v),b={x:a,y:l},y=Ym(u),k=Gm(y),j=await d.getDimensions(h),A=y==="y",C=A?"top":"left",R=A?"bottom":"right",D=A?"clientHeight":"clientWidth",B=c.reference[k]+c.reference[y]-b[y]-c.floating[k],O=b[y]-c.reference[y],_=await(d.getOffsetParent==null?void 0:d.getOffsetParent(h));let E=_?_[D]:0;(!E||!await(d.isElement==null?void 0:d.isElement(_)))&&(E=f.floating[D]||c.floating[k]);const I=B/2-O/2,W=E/2-j[k]/2-1,q=cl(x[C],W),$=cl(x[R],W),X=E-j[k]-$,ce=E/2-j[k]/2+I,le=F1(q,ce,X),ee=!m.arrow&&Qi(u)!=null&&ce!==le&&c.reference[k]/2-(cele<=0)){var $,X;const le=((($=c.flip)==null?void 0:$.index)||0)+1,ee=E[le];if(ee&&(!(x==="alignment"?R!==Or(ee):!1)||q.every(ie=>Or(ie.placement)===R?ie.overflows[0]>0:!0)))return{data:{index:le,overflows:q},reset:{placement:ee}};let U=(X=q.filter(Z=>Z.overflows[0]<=0).sort((Z,ie)=>Z.overflows[1]-ie.overflows[1])[0])==null?void 0:X.placement;if(!U)switch(y){case"bestFit":{var ce;const Z=(ce=q.filter(ie=>{if(_){const K=Or(ie.placement);return K===R||K==="y"}return!0}).map(ie=>[ie.placement,ie.overflows.filter(K=>K>0).reduce((K,N)=>K+N,0)]).sort((ie,K)=>ie[1]-K[1])[0])==null?void 0:ce[0];Z&&(U=Z);break}case"initialPlacement":U=f;break}if(u!==U)return{reset:{placement:U}}}return{}}}};function fb(e,r){return{top:e.top-r.height,right:e.right-r.width,bottom:e.bottom-r.height,left:e.left-r.width}}function hb(e){return OA.some(r=>e[r]>=0)}const XA=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(r){const{rects:a,platform:l}=r,{strategy:u="referenceHidden",...c}=fa(e,r);switch(u){case"referenceHidden":{const d=await l.detectOverflow(r,{...c,elementContext:"reference"}),f=fb(d,a.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:hb(f)}}}case"escaped":{const d=await l.detectOverflow(r,{...c,altBoundary:!0}),f=fb(d,a.floating);return{data:{escapedOffsets:f,escaped:hb(f)}}}default:return{}}}}},G1=new Set(["left","top"]);async function KA(e,r){const{placement:a,platform:l,elements:u}=e,c=await(l.isRTL==null?void 0:l.isRTL(u.floating)),d=dl(a),f=Qi(a),m=Or(a)==="y",h=G1.has(d)?-1:1,v=c&&m?-1:1,x=fa(r,e);let{mainAxis:b,crossAxis:y,alignmentAxis:k}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return f&&typeof k=="number"&&(y=f==="end"?k*-1:k),m?{x:y*v,y:b*h}:{x:b*h,y:y*v}}const QA=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(r){var a,l;const{x:u,y:c,placement:d,middlewareData:f}=r,m=await KA(r,e);return d===((a=f.offset)==null?void 0:a.placement)&&(l=f.arrow)!=null&&l.alignmentOffset?{}:{x:u+m.x,y:c+m.y,data:{...m,placement:d}}}}},ZA=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(r){const{x:a,y:l,placement:u,platform:c}=r,{mainAxis:d=!0,crossAxis:f=!1,limiter:m={fn:R=>{let{x:D,y:B}=R;return{x:D,y:B}}},...h}=fa(e,r),v={x:a,y:l},x=await c.detectOverflow(r,h),b=Or(u),y=Vm(b);let k=v[y],j=v[b];const A=(R,D)=>F1(D+x[R==="y"?"top":"left"],D,D-x[R==="y"?"bottom":"right"]);d&&(k=A(y,k)),f&&(j=A(b,j));const C=m.fn({...r,[y]:k,[b]:j});return{...C,data:{x:C.x-a,y:C.y-l,enabled:{[y]:d,[b]:f}}}}}},JA=function(e){return e===void 0&&(e={}),{options:e,fn(r){var a,l;const{x:u,y:c,placement:d,rects:f,middlewareData:m}=r,{offset:h=0,mainAxis:v=!0,crossAxis:x=!0}=fa(e,r),b={x:u,y:c},y=Or(d),k=Vm(y);let j=b[k],A=b[y];const C=fa(h,r),R=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:(a=C.mainAxis)!=null?a:0,crossAxis:(l=C.crossAxis)!=null?l:0};if(v){const O=k==="y"?"height":"width",_=f.reference[k]-f.floating[O]+R.mainAxis,E=f.reference[k]+f.reference[O]-R.mainAxis;j<_?j=_:j>E&&(j=E)}if(x){var D,B;const O=k==="y"?"width":"height",_=G1.has(dl(d)),E=f.reference[y]-f.floating[O]+(_&&((D=m.offset)==null?void 0:D[y])||0)+(_?0:R.crossAxis),I=f.reference[y]+f.reference[O]+(_?0:((B=m.offset)==null?void 0:B[y])||0)-(_?R.crossAxis:0);AI&&(A=I)}return{[k]:j,[y]:A}}}},WA=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(r){const{placement:a,rects:l,platform:u,elements:c}=r,{apply:d=()=>{},...f}=fa(e,r),m=await u.detectOverflow(r,f),h=dl(a),v=Qi(a),x=Or(a)==="y",{width:b,height:y}=l.floating;let k,j;h==="top"||h==="bottom"?(k=h,j=v===(await(u.isRTL==null?void 0:u.isRTL(c.floating))?"start":"end")?"left":"right"):(j=h,k=v==="end"?"top":"bottom");const A=y-m.top-m.bottom,C=b-m.left-m.right,R=cl(y-m[k],A),D=cl(b-m[j],C),B=r.middlewareData.shift,O=!B;let _=R,E=D;B!=null&&B.enabled.x&&(E=C),B!=null&&B.enabled.y&&(_=A),O&&!v&&(x?E=b-2*sa(m.left,m.right):_=y-2*sa(m.top,m.bottom)),await d({...r,availableWidth:E,availableHeight:_});const I=await u.getDimensions(c.floating);return b!==I.width||y!==I.height?{reset:{rects:!0}}:{}}}};function Tc(){return typeof window<"u"}function Zi(e){return Y1(e)?(e.nodeName||"").toLowerCase():"#document"}function Ln(e){var r;return(e==null||(r=e.ownerDocument)==null?void 0:r.defaultView)||window}function va(e){var r;return(r=(Y1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:r.documentElement}function Y1(e){return Tc()?e instanceof Node||e instanceof Ln(e).Node:!1}function Lr(e){return Tc()?e instanceof Element||e instanceof Ln(e).Element:!1}function hl(e){return Tc()?e instanceof HTMLElement||e instanceof Ln(e).HTMLElement:!1}function mb(e){return!Tc()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ln(e).ShadowRoot}function Ac(e){const{overflow:r,overflowX:a,overflowY:l,display:u}=Ur(e);return/auto|scroll|overlay|hidden|clip/.test(r+l+a)&&u!=="inline"&&u!=="contents"}function e_(e){return/^(table|td|th)$/.test(Zi(e))}function _c(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const t_=/transform|translate|scale|rotate|perspective|filter/,n_=/paint|layout|strict|content/,Ll=e=>!!e&&e!=="none";let Sh;function Xm(e){const r=Lr(e)?Ur(e):e;return Ll(r.transform)||Ll(r.translate)||Ll(r.scale)||Ll(r.rotate)||Ll(r.perspective)||!Km()&&(Ll(r.backdropFilter)||Ll(r.filter))||t_.test(r.willChange||"")||n_.test(r.contain||"")}function r_(e){let r=$l(e);for(;hl(r)&&!ss(r);){if(Xm(r))return r;if(_c(r))return null;r=$l(r)}return null}function Km(){return Sh==null&&(Sh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Sh}function ss(e){return/^(html|body|#document)$/.test(Zi(e))}function Ur(e){return Ln(e).getComputedStyle(e)}function Mc(e){return Lr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function $l(e){if(Zi(e)==="html")return e;const r=e.assignedSlot||e.parentNode||mb(e)&&e.host||va(e);return mb(r)?r.host:r}function X1(e){const r=$l(e);return ss(r)?(e.ownerDocument||e).body:hl(r)&&Ac(r)?r:X1(r)}function us(e,r,a){var l;r===void 0&&(r=[]),a===void 0&&(a=!0);const u=X1(e),c=u===((l=e.ownerDocument)==null?void 0:l.body),d=Ln(u);if(c){const f=om(d);return r.concat(d,d.visualViewport||[],Ac(u)?u:[],f&&a?us(f):[])}else return r.concat(u,us(u,[],a))}function om(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function K1(e){const r=Ur(e);let a=parseFloat(r.width)||0,l=parseFloat(r.height)||0;const u=hl(e),c=u?e.offsetWidth:a,d=u?e.offsetHeight:l,f=ac(a)!==c||ac(l)!==d;return f&&(a=c,l=d),{width:a,height:l,$:f}}function Qm(e){return Lr(e)?e:e.contextElement}function Yi(e){const r=Qm(e);if(!hl(r))return ua(1);const a=r.getBoundingClientRect(),{width:l,height:u,$:c}=K1(r);let d=(c?ac(a.width):a.width)/l,f=(c?ac(a.height):a.height)/u;return(!d||!Number.isFinite(d))&&(d=1),(!f||!Number.isFinite(f))&&(f=1),{x:d,y:f}}const a_=ua(0);function Q1(e){const r=Ln(e);return!Km()||!r.visualViewport?a_:{x:r.visualViewport.offsetLeft,y:r.visualViewport.offsetTop}}function l_(e,r,a){return r===void 0&&(r=!1),!!a&&r&&a===Ln(e)}function Fl(e,r,a,l){r===void 0&&(r=!1),a===void 0&&(a=!1);const u=e.getBoundingClientRect(),c=Qm(e);let d=ua(1);r&&(l?Lr(l)&&(d=Yi(l)):d=Yi(e));const f=l_(c,a,l)?Q1(c):ua(0);let m=(u.left+f.x)/d.x,h=(u.top+f.y)/d.y,v=u.width/d.x,x=u.height/d.y;if(c&&l){const b=Ln(c),y=Lr(l)?Ln(l):l;let k=b,j=om(k);for(;j&&y!==k;){const A=Yi(j),C=j.getBoundingClientRect(),R=Ur(j),D=C.left+(j.clientLeft+parseFloat(R.paddingLeft))*A.x,B=C.top+(j.clientTop+parseFloat(R.paddingTop))*A.y;m*=A.x,h*=A.y,v*=A.x,x*=A.y,m+=D,h+=B,k=Ln(j),j=om(k)}}return ic({width:v,height:x,x:m,y:h})}function Rc(e,r){const a=Mc(e).scrollLeft;return r?r.left+a:Fl(va(e)).left+a}function Z1(e,r){const a=e.getBoundingClientRect(),l=a.left+r.scrollLeft-Rc(e,a),u=a.top+r.scrollTop;return{x:l,y:u}}function i_(e){let{elements:r,rect:a,offsetParent:l,strategy:u}=e;const c=u==="fixed",d=va(l),f=r?_c(r.floating):!1;if(l===d||f&&c)return a;let m={scrollLeft:0,scrollTop:0},h=ua(1);const v=ua(0),x=hl(l);if((x||!c)&&((Zi(l)!=="body"||Ac(d))&&(m=Mc(l)),x)){const y=Fl(l);h=Yi(l),v.x=y.x+l.clientLeft,v.y=y.y+l.clientTop}const b=d&&!x&&!c?Z1(d,m):ua(0);return{width:a.width*h.x,height:a.height*h.y,x:a.x*h.x-m.scrollLeft*h.x+v.x+b.x,y:a.y*h.y-m.scrollTop*h.y+v.y+b.y}}function o_(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function s_(e){const r=Mc(e),a=e.ownerDocument.body,l=sa(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),u=sa(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight);let c=-r.scrollLeft+Rc(e);const d=-r.scrollTop;return Ur(a).direction==="rtl"&&(c+=sa(e.clientWidth,a.clientWidth)-l),{width:l,height:u,x:c,y:d}}const u_=25;function c_(e,r,a){a===void 0&&(a="viewport");const l=a==="layoutViewport",u=Ln(e),c=va(e),d=u.visualViewport;let f=c.clientWidth,m=c.clientHeight,h=0,v=0;if(d){const b=!Km()||r==="fixed";l?b||(h=-d.offsetLeft,v=-d.offsetTop):(f=d.width,m=d.height,b&&(h=d.offsetLeft,v=d.offsetTop))}if(Rc(c)<=0){const b=c.ownerDocument,y=b.body,k=getComputedStyle(y),j=b.compatMode==="CSS1Compat"&&parseFloat(k.marginLeft)+parseFloat(k.marginRight)||0,A=Math.abs(c.clientWidth-y.clientWidth-j),C=getComputedStyle(c).scrollbarGutter==="stable both-edges"?A/2:A;C<=u_&&(f-=C)}return{width:f,height:m,x:h,y:v}}function d_(e,r){const a=Fl(e,!0,r==="fixed"),l=a.top+e.clientTop,u=a.left+e.clientLeft,c=Yi(e),d=e.clientWidth*c.x,f=e.clientHeight*c.y,m=u*c.x,h=l*c.y;return{width:d,height:f,x:m,y:h}}function pb(e,r,a){let l;if(r==="viewport"||r==="layoutViewport")l=c_(e,a,r);else if(r==="document")l=s_(va(e));else if(Lr(r))l=d_(r,a);else{const u=Q1(e);l={x:r.x-u.x,y:r.y-u.y,width:r.width,height:r.height}}return ic(l)}function f_(e,r){const a=r.get(e);if(a)return a;let l=us(e,[],!1).filter(f=>Lr(f)&&Zi(f)!=="body"),u=null;const c=Ur(e).position==="fixed";let d=c?$l(e):e;for(;Lr(d)&&!ss(d);){const f=Ur(d),m=Xm(d),h=u?u.position:c?"fixed":"";!m&&(h==="fixed"||h==="absolute"&&f.position==="static")?l=l.filter(x=>x!==d):u=f,d=$l(d)}return r.set(e,l),l}function h_(e){let{element:r,boundary:a,rootBoundary:l,strategy:u}=e;const d=[...a==="clippingAncestors"?_c(r)?[]:f_(r,this._c):[].concat(a),l],f=pb(r,d[0],u);let m=f.top,h=f.right,v=f.bottom,x=f.left;for(let b=1;b{f(!1,1e-7)},1e3)}E=!1}try{l=new IntersectionObserver(I,{..._,root:c.ownerDocument})}catch{l=new IntersectionObserver(I,_)}l.observe(e)}const m=Ln(e),h=()=>f(a);return m.addEventListener("resize",h),f(!0),()=>{m.removeEventListener("resize",h),d()}}function b_(e,r,a,l){l===void 0&&(l={});const{ancestorScroll:u=!0,ancestorResize:c=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:m=!1}=l,h=Qm(e),v=u||c?[...h?us(h):[],...r?us(r):[]]:[];v.forEach(C=>{u&&C.addEventListener("scroll",a),c&&C.addEventListener("resize",a)});const x=h&&f?y_(h,a,c):null;let b=-1,y=null;d&&(y=new ResizeObserver(C=>{let[R]=C;R&&R.target===h&&y&&r&&(y.unobserve(r),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var D;(D=y)==null||D.observe(r)})),a()}),h&&!m&&y.observe(h),r&&y.observe(r));let k,j=m?Fl(e):null;m&&A();function A(){const C=Fl(e);j&&!W1(j,C)&&a(),j=C,k=requestAnimationFrame(A)}return a(),()=>{var C;v.forEach(R=>{u&&R.removeEventListener("scroll",a),c&&R.removeEventListener("resize",a)}),x==null||x(),(C=y)==null||C.disconnect(),y=null,m&&cancelAnimationFrame(k)}}const w_=QA,S_=ZA,j_=YA,k_=WA,C_=XA,xb=GA,E_=JA,N_=(e,r,a)=>{const l=new Map,u=a??{},c={...v_,...u.platform,_c:l};return VA(e,r,{...u,platform:c})};var T_=typeof document<"u",A_=function(){},ec=T_?S.useLayoutEffect:A_;function oc(e,r){if(e===r)return!0;if(typeof e!=typeof r)return!1;if(typeof e=="function"&&e.toString()===r.toString())return!0;let a,l,u;if(e&&r&&typeof e=="object"){if(Array.isArray(e)){if(a=e.length,a!==r.length)return!1;for(l=a;l--!==0;)if(!oc(e[l],r[l]))return!1;return!0}if(u=Object.keys(e),a=u.length,a!==Object.keys(r).length)return!1;for(l=a;l--!==0;)if(!{}.hasOwnProperty.call(r,u[l]))return!1;for(l=a;l--!==0;){const c=u[l];if(!(c==="_owner"&&e.$$typeof)&&!oc(e[c],r[c]))return!1}return!0}return e!==e&&r!==r}function ew(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vb(e,r){const a=ew(e);return Math.round(r*a)/a}function kh(e){const r=S.useRef(e);return ec(()=>{r.current=e}),r}function __(e){e===void 0&&(e={});const{placement:r="bottom",strategy:a="absolute",middleware:l=[],platform:u,elements:{reference:c,floating:d}={},transform:f=!0,whileElementsMounted:m,open:h}=e,[v,x]=S.useState({x:0,y:0,strategy:a,placement:r,middlewareData:{},isPositioned:!1}),[b,y]=S.useState(l);oc(b,l)||y(l);const[k,j]=S.useState(null),[A,C]=S.useState(null),R=S.useCallback(ie=>{ie!==_.current&&(_.current=ie,j(ie))},[]),D=S.useCallback(ie=>{ie!==E.current&&(E.current=ie,C(ie))},[]),B=c||k,O=d||A,_=S.useRef(null),E=S.useRef(null),I=S.useRef(v),W=m!=null,q=kh(m),$=kh(u),X=kh(h),ce=S.useCallback(()=>{if(!_.current||!E.current)return;const ie={placement:r,strategy:a,middleware:b};$.current&&(ie.platform=$.current),N_(_.current,E.current,ie).then(K=>{const N={...K,isPositioned:X.current!==!1};le.current&&!oc(I.current,N)&&(I.current=N,ms.flushSync(()=>{x(N)}))})},[b,r,a,$,X]);ec(()=>{h===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,x(ie=>({...ie,isPositioned:!1})))},[h]);const le=S.useRef(!1);ec(()=>(le.current=!0,()=>{le.current=!1}),[]),ec(()=>{if(B&&(_.current=B),O&&(E.current=O),B&&O){if(q.current)return q.current(B,O,ce);ce()}},[B,O,ce,q,W]);const ee=S.useMemo(()=>({reference:_,floating:E,setReference:R,setFloating:D}),[R,D]),U=S.useMemo(()=>({reference:B,floating:O}),[B,O]),Z=S.useMemo(()=>{const ie={position:a,left:0,top:0};if(!U.floating)return ie;const K=vb(U.floating,v.x),N=vb(U.floating,v.y);return f?{...ie,transform:"translate("+K+"px, "+N+"px)",...ew(U.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:K,top:N}},[a,f,U.floating,v.x,v.y]);return S.useMemo(()=>({...v,update:ce,refs:ee,elements:U,floatingStyles:Z}),[v,ce,ee,U,Z])}const M_=e=>{function r(a){return{}.hasOwnProperty.call(a,"current")}return{name:"arrow",options:e,fn(a){const{element:l,padding:u}=typeof e=="function"?e(a):e;return l&&r(l)?l.current!=null?xb({element:l.current,padding:u}).fn(a):{}:l?xb({element:l,padding:u}).fn(a):{}}}},R_=(e,r)=>{const a=w_(e);return{name:a.name,fn:a.fn,options:[e,r]}},D_=(e,r)=>{const a=S_(e);return{name:a.name,fn:a.fn,options:[e,r]}},O_=(e,r)=>({fn:E_(e).fn,options:[e,r]}),z_=(e,r)=>{const a=j_(e);return{name:a.name,fn:a.fn,options:[e,r]}},L_=(e,r)=>{const a=k_(e);return{name:a.name,fn:a.fn,options:[e,r]}},U_=(e,r)=>{const a=C_(e);return{name:a.name,fn:a.fn,options:[e,r]}},B_=(e,r)=>{const a=M_(e);return{name:a.name,fn:a.fn,options:[e,r]}};var I_="Arrow",tw=S.forwardRef((e,r)=>{const{children:a,width:l=10,height:u=5,...c}=e;return o.jsx(Ge.svg,{...c,ref:r,width:l,height:u,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?a:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});tw.displayName=I_;var H_=tw;function Zm(e){const[r,a]=S.useState(void 0);return jn(()=>{if(e){a({width:e.offsetWidth,height:e.offsetHeight});const l=new ResizeObserver(u=>{if(!Array.isArray(u)||!u.length)return;const c=u[0];let d,f;if("borderBoxSize"in c){const m=c.borderBoxSize,h=Array.isArray(m)?m[0]:m;d=h.inlineSize,f=h.blockSize}else d=e.offsetWidth,f=e.offsetHeight;a({width:d,height:f})});return l.observe(e,{box:"border-box"}),()=>l.unobserve(e)}else a(void 0)},[e]),r}var Jm="Popper",[nw,Dc]=vr(Jm),[q_,rw]=nw(Jm),aw=e=>{const{__scopePopper:r,children:a}=e,[l,u]=S.useState(null);return o.jsx(q_,{scope:r,anchor:l,onAnchorChange:u,children:a})};aw.displayName=Jm;var lw="PopperAnchor",iw=S.forwardRef((e,r)=>{const{__scopePopper:a,virtualRef:l,...u}=e,c=rw(lw,a),d=S.useRef(null),f=ft(r,d);return S.useEffect(()=>{c.onAnchorChange((l==null?void 0:l.current)||d.current)}),l?null:o.jsx(Ge.div,{...u,ref:f})});iw.displayName=lw;var Wm="PopperContent",[P_,$_]=nw(Wm),ow=S.forwardRef((e,r)=>{var re,ye,de,be,Ee,Se;const{__scopePopper:a,side:l="bottom",sideOffset:u=0,align:c="center",alignOffset:d=0,arrowPadding:f=0,avoidCollisions:m=!0,collisionBoundary:h=[],collisionPadding:v=0,sticky:x="partial",hideWhenDetached:b=!1,updatePositionStrategy:y="optimized",onPlaced:k,...j}=e,A=rw(Wm,a),[C,R]=S.useState(null),D=ft(r,Ie=>R(Ie)),[B,O]=S.useState(null),_=Zm(B),E=(_==null?void 0:_.width)??0,I=(_==null?void 0:_.height)??0,W=l+(c!=="center"?"-"+c:""),q=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},$=Array.isArray(h)?h:[h],X=$.length>0,ce={padding:q,boundary:$.filter(V_),altBoundary:X},{refs:le,floatingStyles:ee,placement:U,isPositioned:Z,middlewareData:ie}=__({strategy:"fixed",placement:W,whileElementsMounted:(...Ie)=>b_(...Ie,{animationFrame:y==="always"}),elements:{reference:A.anchor},middleware:[R_({mainAxis:u+I,alignmentAxis:d}),m&&D_({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?O_():void 0,...ce}),m&&z_({...ce}),L_({...ce,apply:({elements:Ie,rects:Be,availableWidth:Mt,availableHeight:Ct})=>{const{width:Et,height:Lt}=Be.reference,Rt=Ie.floating.style;Rt.setProperty("--radix-popper-available-width",`${Mt}px`),Rt.setProperty("--radix-popper-available-height",`${Ct}px`),Rt.setProperty("--radix-popper-anchor-width",`${Et}px`),Rt.setProperty("--radix-popper-anchor-height",`${Lt}px`)}}),B&&B_({element:B,padding:f}),G_({arrowWidth:E,arrowHeight:I}),b&&U_({strategy:"referenceHidden",...ce})]}),[K,N]=cw(U),L=sr(k);jn(()=>{Z&&(L==null||L())},[Z,L]);const F=(re=ie.arrow)==null?void 0:re.x,M=(ye=ie.arrow)==null?void 0:ye.y,oe=((de=ie.arrow)==null?void 0:de.centerOffset)!==0,[G,ue]=S.useState();return jn(()=>{C&&ue(window.getComputedStyle(C).zIndex)},[C]),o.jsx("div",{ref:le.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:Z?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:G,"--radix-popper-transform-origin":[(be=ie.transformOrigin)==null?void 0:be.x,(Ee=ie.transformOrigin)==null?void 0:Ee.y].join(" "),...((Se=ie.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(P_,{scope:a,placedSide:K,onArrowChange:O,arrowX:F,arrowY:M,shouldHideArrow:oe,children:o.jsx(Ge.div,{"data-side":K,"data-align":N,...j,ref:D,style:{...j.style,animation:Z?void 0:"none"}})})})});ow.displayName=Wm;var sw="PopperArrow",F_={top:"bottom",right:"left",bottom:"top",left:"right"},uw=S.forwardRef(function(r,a){const{__scopePopper:l,...u}=r,c=$_(sw,l),d=F_[c.placedSide];return o.jsx("span",{ref:c.onArrowChange,style:{position:"absolute",left:c.arrowX,top:c.arrowY,[d]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[c.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[c.placedSide],visibility:c.shouldHideArrow?"hidden":void 0},children:o.jsx(H_,{...u,ref:a,style:{...u.style,display:"block"}})})});uw.displayName=sw;function V_(e){return e!==null}var G_=e=>({name:"transformOrigin",options:e,fn(r){var A,C,R;const{placement:a,rects:l,middlewareData:u}=r,d=((A=u.arrow)==null?void 0:A.centerOffset)!==0,f=d?0:e.arrowWidth,m=d?0:e.arrowHeight,[h,v]=cw(a),x={start:"0%",center:"50%",end:"100%"}[v],b=(((C=u.arrow)==null?void 0:C.x)??0)+f/2,y=(((R=u.arrow)==null?void 0:R.y)??0)+m/2;let k="",j="";return h==="bottom"?(k=d?x:`${b}px`,j=`${-m}px`):h==="top"?(k=d?x:`${b}px`,j=`${l.floating.height+m}px`):h==="right"?(k=`${-m}px`,j=d?x:`${y}px`):h==="left"&&(k=`${l.floating.width+m}px`,j=d?x:`${y}px`),{data:{x:k,y:j}}}});function cw(e){const[r,a="center"]=e.split("-");return[r,a]}var dw=aw,fw=iw,hw=ow,mw=uw;function ep(e){const r=S.useRef({value:e,previous:e});return S.useMemo(()=>(r.current.value!==e&&(r.current.previous=r.current.value,r.current.value=e),r.current.previous),[e])}var Y_="VisuallyHidden",pw=S.forwardRef((e,r)=>o.jsx(Ge.span,{...e,ref:r,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));pw.displayName=Y_;var X_=[" ","Enter","ArrowUp","ArrowDown"],K_=[" ","Enter"],ps="Select",[Oc,zc,Q_]=Fm(ps),[Ji]=vr(ps,[Q_,Dc]),Lc=Dc(),[Z_,ml]=Ji(ps),[J_,W_]=Ji(ps),gw=e=>{const{__scopeSelect:r,children:a,open:l,defaultOpen:u,onOpenChange:c,value:d,defaultValue:f,onValueChange:m,dir:h,name:v,autoComplete:x,disabled:b,required:y,form:k}=e,j=Lc(r),[A,C]=S.useState(null),[R,D]=S.useState(null),[B,O]=S.useState(!1),_=Nc(h),[E=!1,I]=el({prop:l,defaultProp:u,onChange:c}),[W,q]=el({prop:d,defaultProp:f,onChange:m}),$=S.useRef(null),X=A?k||!!A.closest("form"):!0,[ce,le]=S.useState(new Set),ee=Array.from(ce).map(U=>U.props.value).join(";");return o.jsx(dw,{...j,children:o.jsxs(Z_,{required:y,scope:r,trigger:A,onTriggerChange:C,valueNode:R,onValueNodeChange:D,valueNodeHasChildren:B,onValueNodeHasChildrenChange:O,contentId:zr(),value:W,onValueChange:q,open:E,onOpenChange:I,dir:_,triggerPointerDownPosRef:$,disabled:b,children:[o.jsx(Oc.Provider,{scope:r,children:o.jsx(J_,{scope:e.__scopeSelect,onNativeOptionAdd:S.useCallback(U=>{le(Z=>new Set(Z).add(U))},[]),onNativeOptionRemove:S.useCallback(U=>{le(Z=>{const ie=new Set(Z);return ie.delete(U),ie})},[]),children:a})}),X?o.jsxs(Iw,{"aria-hidden":!0,required:y,tabIndex:-1,name:v,autoComplete:x,value:W,onChange:U=>q(U.target.value),disabled:b,form:k,children:[W===void 0?o.jsx("option",{value:""}):null,Array.from(ce)]},ee):null]})})};gw.displayName=ps;var xw="SelectTrigger",vw=S.forwardRef((e,r)=>{const{__scopeSelect:a,disabled:l=!1,...u}=e,c=Lc(a),d=ml(xw,a),f=d.disabled||l,m=ft(r,d.onTriggerChange),h=zc(a),v=S.useRef("touch"),[x,b,y]=Hw(j=>{const A=h().filter(D=>!D.disabled),C=A.find(D=>D.value===d.value),R=qw(A,j,C);R!==void 0&&d.onValueChange(R.value)}),k=j=>{f||(d.onOpenChange(!0),y()),j&&(d.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return o.jsx(fw,{asChild:!0,...c,children:o.jsx(Ge.button,{type:"button",role:"combobox","aria-controls":d.contentId,"aria-expanded":d.open,"aria-required":d.required,"aria-autocomplete":"none",dir:d.dir,"data-state":d.open?"open":"closed",disabled:f,"data-disabled":f?"":void 0,"data-placeholder":Bw(d.value)?"":void 0,...u,ref:m,onClick:Te(u.onClick,j=>{j.currentTarget.focus(),v.current!=="mouse"&&k(j)}),onPointerDown:Te(u.onPointerDown,j=>{v.current=j.pointerType;const A=j.target;A.hasPointerCapture(j.pointerId)&&A.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(k(j),j.preventDefault())}),onKeyDown:Te(u.onKeyDown,j=>{const A=x.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&b(j.key),!(A&&j.key===" ")&&X_.includes(j.key)&&(k(),j.preventDefault())})})})});vw.displayName=xw;var yw="SelectValue",bw=S.forwardRef((e,r)=>{const{__scopeSelect:a,className:l,style:u,children:c,placeholder:d="",...f}=e,m=ml(yw,a),{onValueNodeHasChildrenChange:h}=m,v=c!==void 0,x=ft(r,m.onValueNodeChange);return jn(()=>{h(v)},[h,v]),o.jsx(Ge.span,{...f,ref:x,style:{pointerEvents:"none"},children:Bw(m.value)?o.jsx(o.Fragment,{children:d}):c})});bw.displayName=yw;var eM="SelectIcon",ww=S.forwardRef((e,r)=>{const{__scopeSelect:a,children:l,...u}=e;return o.jsx(Ge.span,{"aria-hidden":!0,...u,ref:r,children:l||"โ–ผ"})});ww.displayName=eM;var tM="SelectPortal",Sw=e=>o.jsx(jc,{asChild:!0,...e});Sw.displayName=tM;var Vl="SelectContent",jw=S.forwardRef((e,r)=>{const a=ml(Vl,e.__scopeSelect),[l,u]=S.useState();if(jn(()=>{u(new DocumentFragment)},[]),!a.open){const c=l;return c?ms.createPortal(o.jsx(kw,{scope:e.__scopeSelect,children:o.jsx(Oc.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),c):null}return o.jsx(Cw,{...e,ref:r})});jw.displayName=Vl;var pr=10,[kw,pl]=Ji(Vl),nM="SelectContentImpl",Cw=S.forwardRef((e,r)=>{const{__scopeSelect:a,position:l="item-aligned",onCloseAutoFocus:u,onEscapeKeyDown:c,onPointerDownOutside:d,side:f,sideOffset:m,align:h,alignOffset:v,arrowPadding:x,collisionBoundary:b,collisionPadding:y,sticky:k,hideWhenDetached:j,avoidCollisions:A,...C}=e,R=ml(Vl,a),[D,B]=S.useState(null),[O,_]=S.useState(null),E=ft(r,re=>B(re)),[I,W]=S.useState(null),[q,$]=S.useState(null),X=zc(a),[ce,le]=S.useState(!1),ee=S.useRef(!1);S.useEffect(()=>{if(D)return Bm(D)},[D]),Um();const U=S.useCallback(re=>{const[ye,...de]=X().map(Se=>Se.ref.current),[be]=de.slice(-1),Ee=document.activeElement;for(const Se of re)if(Se===Ee||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===ye&&O&&(O.scrollTop=0),Se===be&&O&&(O.scrollTop=O.scrollHeight),Se==null||Se.focus(),document.activeElement!==Ee))return},[X,O]),Z=S.useCallback(()=>U([I,D]),[U,I,D]);S.useEffect(()=>{ce&&Z()},[ce,Z]);const{onOpenChange:ie,triggerPointerDownPosRef:K}=R;S.useEffect(()=>{if(D){let re={x:0,y:0};const ye=be=>{var Ee,Se;re={x:Math.abs(Math.round(be.pageX)-(((Ee=K.current)==null?void 0:Ee.x)??0)),y:Math.abs(Math.round(be.pageY)-(((Se=K.current)==null?void 0:Se.y)??0))}},de=be=>{re.x<=10&&re.y<=10?be.preventDefault():D.contains(be.target)||ie(!1),document.removeEventListener("pointermove",ye),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",de,{capture:!0})}}},[D,ie,K]),S.useEffect(()=>{const re=()=>ie(!1);return window.addEventListener("blur",re),window.addEventListener("resize",re),()=>{window.removeEventListener("blur",re),window.removeEventListener("resize",re)}},[ie]);const[N,L]=Hw(re=>{const ye=X().filter(Ee=>!Ee.disabled),de=ye.find(Ee=>Ee.ref.current===document.activeElement),be=qw(ye,re,de);be&&setTimeout(()=>be.ref.current.focus())}),F=S.useCallback((re,ye,de)=>{const be=!ee.current&&!de;(R.value!==void 0&&R.value===ye||be)&&(W(re),be&&(ee.current=!0))},[R.value]),M=S.useCallback(()=>D==null?void 0:D.focus(),[D]),oe=S.useCallback((re,ye,de)=>{const be=!ee.current&&!de;(R.value!==void 0&&R.value===ye||be)&&$(re)},[R.value]),G=l==="popper"?sm:Ew,ue=G===sm?{side:f,sideOffset:m,align:h,alignOffset:v,arrowPadding:x,collisionBoundary:b,collisionPadding:y,sticky:k,hideWhenDetached:j,avoidCollisions:A}:{};return o.jsx(kw,{scope:a,content:D,viewport:O,onViewportChange:_,itemRefCallback:F,selectedItem:I,onItemLeave:M,itemTextRefCallback:oe,focusSelectedItem:Z,selectedItemText:q,position:l,isPositioned:ce,searchRef:N,children:o.jsx(Cc,{as:da,allowPinchZoom:!0,children:o.jsx(Sc,{asChild:!0,trapped:R.open,onMountAutoFocus:re=>{re.preventDefault()},onUnmountAutoFocus:Te(u,re=>{var ye;(ye=R.trigger)==null||ye.focus({preventScroll:!0}),re.preventDefault()}),children:o.jsx(wc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:re=>re.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:o.jsx(G,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:re=>re.preventDefault(),...C,...ue,onPlaced:()=>le(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:Te(C.onKeyDown,re=>{const ye=re.ctrlKey||re.altKey||re.metaKey;if(re.key==="Tab"&&re.preventDefault(),!ye&&re.key.length===1&&L(re.key),["ArrowUp","ArrowDown","Home","End"].includes(re.key)){let be=X().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(re.key)&&(be=be.slice().reverse()),["ArrowUp","ArrowDown"].includes(re.key)){const Ee=re.target,Se=be.indexOf(Ee);be=be.slice(Se+1)}setTimeout(()=>U(be)),re.preventDefault()}})})})})})})});Cw.displayName=nM;var rM="SelectItemAlignedPosition",Ew=S.forwardRef((e,r)=>{const{__scopeSelect:a,onPlaced:l,...u}=e,c=ml(Vl,a),d=pl(Vl,a),[f,m]=S.useState(null),[h,v]=S.useState(null),x=ft(r,E=>v(E)),b=zc(a),y=S.useRef(!1),k=S.useRef(!0),{viewport:j,selectedItem:A,selectedItemText:C,focusSelectedItem:R}=d,D=S.useCallback(()=>{if(c.trigger&&c.valueNode&&f&&h&&j&&A&&C){const E=c.trigger.getBoundingClientRect(),I=h.getBoundingClientRect(),W=c.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(c.dir!=="rtl"){const Ee=q.left-I.left,Se=W.left-Ee,Ie=E.left-Se,Be=E.width+Ie,Mt=Math.max(Be,I.width),Ct=window.innerWidth-pr,Et=sb(Se,[pr,Math.max(pr,Ct-Mt)]);f.style.minWidth=Be+"px",f.style.left=Et+"px"}else{const Ee=I.right-q.right,Se=window.innerWidth-W.right-Ee,Ie=window.innerWidth-E.right-Se,Be=E.width+Ie,Mt=Math.max(Be,I.width),Ct=window.innerWidth-pr,Et=sb(Se,[pr,Math.max(pr,Ct-Mt)]);f.style.minWidth=Be+"px",f.style.right=Et+"px"}const $=b(),X=window.innerHeight-pr*2,ce=j.scrollHeight,le=window.getComputedStyle(h),ee=parseInt(le.borderTopWidth,10),U=parseInt(le.paddingTop,10),Z=parseInt(le.borderBottomWidth,10),ie=parseInt(le.paddingBottom,10),K=ee+U+ce+ie+Z,N=Math.min(A.offsetHeight*5,K),L=window.getComputedStyle(j),F=parseInt(L.paddingTop,10),M=parseInt(L.paddingBottom,10),oe=E.top+E.height/2-pr,G=X-oe,ue=A.offsetHeight/2,re=A.offsetTop+ue,ye=ee+U+re,de=K-ye;if(ye<=oe){const Ee=$.length>0&&A===$[$.length-1].ref.current;f.style.bottom="0px";const Se=h.clientHeight-j.offsetTop-j.offsetHeight,Ie=Math.max(G,ue+(Ee?M:0)+Se+Z),Be=ye+Ie;f.style.height=Be+"px"}else{const Ee=$.length>0&&A===$[0].ref.current;f.style.top="0px";const Ie=Math.max(oe,ee+j.offsetTop+(Ee?F:0)+ue)+de;f.style.height=Ie+"px",j.scrollTop=ye-oe+j.offsetTop}f.style.margin=`${pr}px 0`,f.style.minHeight=N+"px",f.style.maxHeight=X+"px",l==null||l(),requestAnimationFrame(()=>y.current=!0)}},[b,c.trigger,c.valueNode,f,h,j,A,C,c.dir,l]);jn(()=>D(),[D]);const[B,O]=S.useState();jn(()=>{h&&O(window.getComputedStyle(h).zIndex)},[h]);const _=S.useCallback(E=>{E&&k.current===!0&&(D(),R==null||R(),k.current=!1)},[D,R]);return o.jsx(lM,{scope:a,contentWrapper:f,shouldExpandOnScrollRef:y,onScrollButtonChange:_,children:o.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:B},children:o.jsx(Ge.div,{...u,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...u.style}})})})});Ew.displayName=rM;var aM="SelectPopperPosition",sm=S.forwardRef((e,r)=>{const{__scopeSelect:a,align:l="start",collisionPadding:u=pr,...c}=e,d=Lc(a);return o.jsx(hw,{...d,...c,ref:r,align:l,collisionPadding:u,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});sm.displayName=aM;var[lM,tp]=Ji(Vl,{}),um="SelectViewport",Nw=S.forwardRef((e,r)=>{const{__scopeSelect:a,nonce:l,...u}=e,c=pl(um,a),d=tp(um,a),f=ft(r,c.onViewportChange),m=S.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),o.jsx(Oc.Slot,{scope:a,children:o.jsx(Ge.div,{"data-radix-select-viewport":"",role:"presentation",...u,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...u.style},onScroll:Te(u.onScroll,h=>{const v=h.currentTarget,{contentWrapper:x,shouldExpandOnScrollRef:b}=d;if(b!=null&&b.current&&x){const y=Math.abs(m.current-v.scrollTop);if(y>0){const k=window.innerHeight-pr*2,j=parseFloat(x.style.minHeight),A=parseFloat(x.style.height),C=Math.max(j,A);if(C0?B:0,x.style.justifyContent="flex-end")}}}m.current=v.scrollTop})})})]})});Nw.displayName=um;var Tw="SelectGroup",[iM,oM]=Ji(Tw),sM=S.forwardRef((e,r)=>{const{__scopeSelect:a,...l}=e,u=zr();return o.jsx(iM,{scope:a,id:u,children:o.jsx(Ge.div,{role:"group","aria-labelledby":u,...l,ref:r})})});sM.displayName=Tw;var Aw="SelectLabel",uM=S.forwardRef((e,r)=>{const{__scopeSelect:a,...l}=e,u=oM(Aw,a);return o.jsx(Ge.div,{id:u.id,...l,ref:r})});uM.displayName=Aw;var sc="SelectItem",[cM,_w]=Ji(sc),Mw=S.forwardRef((e,r)=>{const{__scopeSelect:a,value:l,disabled:u=!1,textValue:c,...d}=e,f=ml(sc,a),m=pl(sc,a),h=f.value===l,[v,x]=S.useState(c??""),[b,y]=S.useState(!1),k=ft(r,R=>{var D;return(D=m.itemRefCallback)==null?void 0:D.call(m,R,l,u)}),j=zr(),A=S.useRef("touch"),C=()=>{u||(f.onValueChange(l),f.onOpenChange(!1))};if(l==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(cM,{scope:a,value:l,disabled:u,textId:j,isSelected:h,onItemTextChange:S.useCallback(R=>{x(D=>D||((R==null?void 0:R.textContent)??"").trim())},[]),children:o.jsx(Oc.ItemSlot,{scope:a,value:l,disabled:u,textValue:v,children:o.jsx(Ge.div,{role:"option","aria-labelledby":j,"data-highlighted":b?"":void 0,"aria-selected":h&&b,"data-state":h?"checked":"unchecked","aria-disabled":u||void 0,"data-disabled":u?"":void 0,tabIndex:u?void 0:-1,...d,ref:k,onFocus:Te(d.onFocus,()=>y(!0)),onBlur:Te(d.onBlur,()=>y(!1)),onClick:Te(d.onClick,()=>{A.current!=="mouse"&&C()}),onPointerUp:Te(d.onPointerUp,()=>{A.current==="mouse"&&C()}),onPointerDown:Te(d.onPointerDown,R=>{A.current=R.pointerType}),onPointerMove:Te(d.onPointerMove,R=>{var D;A.current=R.pointerType,u?(D=m.onItemLeave)==null||D.call(m):A.current==="mouse"&&R.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Te(d.onPointerLeave,R=>{var D;R.currentTarget===document.activeElement&&((D=m.onItemLeave)==null||D.call(m))}),onKeyDown:Te(d.onKeyDown,R=>{var B;((B=m.searchRef)==null?void 0:B.current)!==""&&R.key===" "||(K_.includes(R.key)&&C(),R.key===" "&&R.preventDefault())})})})})});Mw.displayName=sc;var Wo="SelectItemText",Rw=S.forwardRef((e,r)=>{const{__scopeSelect:a,className:l,style:u,...c}=e,d=ml(Wo,a),f=pl(Wo,a),m=_w(Wo,a),h=W_(Wo,a),[v,x]=S.useState(null),b=ft(r,C=>x(C),m.onItemTextChange,C=>{var R;return(R=f.itemTextRefCallback)==null?void 0:R.call(f,C,m.value,m.disabled)}),y=v==null?void 0:v.textContent,k=S.useMemo(()=>o.jsx("option",{value:m.value,disabled:m.disabled,children:y},m.value),[m.disabled,m.value,y]),{onNativeOptionAdd:j,onNativeOptionRemove:A}=h;return jn(()=>(j(k),()=>A(k)),[j,A,k]),o.jsxs(o.Fragment,{children:[o.jsx(Ge.span,{id:m.textId,...c,ref:b}),m.isSelected&&d.valueNode&&!d.valueNodeHasChildren?ms.createPortal(c.children,d.valueNode):null]})});Rw.displayName=Wo;var Dw="SelectItemIndicator",Ow=S.forwardRef((e,r)=>{const{__scopeSelect:a,...l}=e;return _w(Dw,a).isSelected?o.jsx(Ge.span,{"aria-hidden":!0,...l,ref:r}):null});Ow.displayName=Dw;var cm="SelectScrollUpButton",zw=S.forwardRef((e,r)=>{const a=pl(cm,e.__scopeSelect),l=tp(cm,e.__scopeSelect),[u,c]=S.useState(!1),d=ft(r,l.onScrollButtonChange);return jn(()=>{if(a.viewport&&a.isPositioned){let f=function(){const h=m.scrollTop>0;c(h)};const m=a.viewport;return f(),m.addEventListener("scroll",f),()=>m.removeEventListener("scroll",f)}},[a.viewport,a.isPositioned]),u?o.jsx(Uw,{...e,ref:d,onAutoScroll:()=>{const{viewport:f,selectedItem:m}=a;f&&m&&(f.scrollTop=f.scrollTop-m.offsetHeight)}}):null});zw.displayName=cm;var dm="SelectScrollDownButton",Lw=S.forwardRef((e,r)=>{const a=pl(dm,e.__scopeSelect),l=tp(dm,e.__scopeSelect),[u,c]=S.useState(!1),d=ft(r,l.onScrollButtonChange);return jn(()=>{if(a.viewport&&a.isPositioned){let f=function(){const h=m.scrollHeight-m.clientHeight,v=Math.ceil(m.scrollTop)m.removeEventListener("scroll",f)}},[a.viewport,a.isPositioned]),u?o.jsx(Uw,{...e,ref:d,onAutoScroll:()=>{const{viewport:f,selectedItem:m}=a;f&&m&&(f.scrollTop=f.scrollTop+m.offsetHeight)}}):null});Lw.displayName=dm;var Uw=S.forwardRef((e,r)=>{const{__scopeSelect:a,onAutoScroll:l,...u}=e,c=pl("SelectScrollButton",a),d=S.useRef(null),f=zc(a),m=S.useCallback(()=>{d.current!==null&&(window.clearInterval(d.current),d.current=null)},[]);return S.useEffect(()=>()=>m(),[m]),jn(()=>{var v;const h=f().find(x=>x.ref.current===document.activeElement);(v=h==null?void 0:h.ref.current)==null||v.scrollIntoView({block:"nearest"})},[f]),o.jsx(Ge.div,{"aria-hidden":!0,...u,ref:r,style:{flexShrink:0,...u.style},onPointerDown:Te(u.onPointerDown,()=>{d.current===null&&(d.current=window.setInterval(l,50))}),onPointerMove:Te(u.onPointerMove,()=>{var h;(h=c.onItemLeave)==null||h.call(c),d.current===null&&(d.current=window.setInterval(l,50))}),onPointerLeave:Te(u.onPointerLeave,()=>{m()})})}),dM="SelectSeparator",fM=S.forwardRef((e,r)=>{const{__scopeSelect:a,...l}=e;return o.jsx(Ge.div,{"aria-hidden":!0,...l,ref:r})});fM.displayName=dM;var fm="SelectArrow",hM=S.forwardRef((e,r)=>{const{__scopeSelect:a,...l}=e,u=Lc(a),c=ml(fm,a),d=pl(fm,a);return c.open&&d.position==="popper"?o.jsx(mw,{...u,...l,ref:r}):null});hM.displayName=fm;function Bw(e){return e===""||e===void 0}var Iw=S.forwardRef((e,r)=>{const{value:a,...l}=e,u=S.useRef(null),c=ft(r,u),d=ep(a);return S.useEffect(()=>{const f=u.current,m=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(m,"value").set;if(d!==a&&v){const x=new Event("change",{bubbles:!0});v.call(f,a),f.dispatchEvent(x)}},[d,a]),o.jsx(pw,{asChild:!0,children:o.jsx("select",{...l,ref:c,defaultValue:a})})});Iw.displayName="BubbleSelect";function Hw(e){const r=sr(e),a=S.useRef(""),l=S.useRef(0),u=S.useCallback(d=>{const f=a.current+d;r(f),(function m(h){a.current=h,window.clearTimeout(l.current),h!==""&&(l.current=window.setTimeout(()=>m(""),1e3))})(f)},[r]),c=S.useCallback(()=>{a.current="",window.clearTimeout(l.current)},[]);return S.useEffect(()=>()=>window.clearTimeout(l.current),[]),[a,u,c]}function qw(e,r,a){const u=r.length>1&&Array.from(r).every(h=>h===r[0])?r[0]:r,c=a?e.indexOf(a):-1;let d=mM(e,Math.max(c,0));u.length===1&&(d=d.filter(h=>h!==a));const m=d.find(h=>h.textValue.toLowerCase().startsWith(u.toLowerCase()));return m!==a?m:void 0}function mM(e,r){return e.map((a,l)=>e[(r+l)%e.length])}var pM=gw,gM=vw,xM=bw,vM=ww,yM=Sw,bM=jw,wM=Nw,SM=Mw,jM=Rw,kM=Ow,CM=zw,EM=Lw;function ha({...e}){return o.jsx(pM,{"data-slot":"select",...e})}function ma({...e}){return o.jsx(xM,{"data-slot":"select-value",...e})}function pa({className:e,size:r="default",children:a,...l}){return o.jsxs(gM,{"data-slot":"select-trigger","data-size":r,className:_e("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...l,children:[a,o.jsx(vM,{asChild:!0,children:o.jsx(Ki,{className:"size-4 opacity-50"})})]})}function ga({className:e,children:r,position:a="popper",...l}){return o.jsx(yM,{children:o.jsxs(bM,{"data-slot":"select-content",className:_e("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...l,children:[o.jsx(NM,{}),o.jsx(wM,{className:_e("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:r}),o.jsx(TM,{})]})})}function Br({className:e,children:r,...a}){return o.jsxs(SM,{"data-slot":"select-item",className:_e("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...a,children:[o.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:o.jsx(kM,{children:o.jsx(yc,{className:"size-4"})})}),o.jsx(jM,{children:r})]})}function NM({className:e,...r}){return o.jsx(CM,{"data-slot":"select-scroll-up-button",className:_e("flex cursor-default items-center justify-center py-1",e),...r,children:o.jsx(qE,{className:"size-4"})})}function TM({className:e,...r}){return o.jsx(EM,{"data-slot":"select-scroll-down-button",className:_e("flex cursor-default items-center justify-center py-1",e),...r,children:o.jsx(Ki,{className:"size-4"})})}const Ch="all";function Wt({label:e,value:r,onChange:a,options:l,allLabel:u}){const c=l.map(d=>typeof d=="string"?{value:d,label:d}:d);return o.jsxs("div",{className:"relative",children:[o.jsxs(ha,{value:r||Ch,onValueChange:d=>a(d===Ch?"":d),children:[o.jsx(pa,{className:"w-44","aria-label":e,children:o.jsx(ma,{className:r?"pr-6":void 0})}),o.jsxs(ga,{children:[o.jsx(Br,{value:Ch,children:u}),c.map(d=>o.jsx(Br,{value:d.value,children:d.label},d.value))]})]}),r&&o.jsx(Re,{variant:"ghost",size:"icon-sm","aria-label":`Clear ${e.toLowerCase()} filter`,title:`Clear ${e.toLowerCase()} filter`,className:"absolute top-1/2 right-8 size-6 -translate-y-1/2",onClick:()=>a(""),children:o.jsx(Lm,{className:"size-3.5"})})]})}function AM({rows:e,withPrincipal:r}){return o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[r&&o.jsx(ge,{children:"User"}),o.jsx(ge,{children:"Model"}),o.jsx(ge,{children:"Endpoint"}),o.jsx(ge,{className:"text-right",children:"Requests"}),o.jsx(ge,{className:"text-right",children:"Input"}),o.jsx(ge,{className:"text-right",children:"Cached"}),o.jsx(ge,{className:"text-right",children:"Output"}),o.jsx(ge,{className:"text-right",children:"Cost"})]})}),o.jsxs(vn,{children:[e.length===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:r?8:7,className:"text-muted-foreground",children:"No usage recorded yet."})}),e.map((a,l)=>o.jsxs(Ue,{children:[r&&o.jsx(me,{className:"wrap-anywhere",children:a.principal}),o.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:a.model}),o.jsx(me,{children:a.endpoint}),o.jsx(me,{className:"text-right tabular-nums",children:qt(a.requests)}),o.jsx(me,{className:"text-right tabular-nums",children:qt(a.units.input_tokens)}),o.jsx(me,{className:"text-right tabular-nums",children:qt(a.units.cached_input_tokens)}),o.jsx(me,{className:"text-right tabular-nums",children:qt(a.units.output_tokens)}),o.jsx(me,{className:"text-right tabular-nums",children:a.cost===null?o.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):_m(a.cost)})]},l))]})]})}const Eh=[{key:"24h",label:"Last 24 hours",bucket:"hour",count:24},{key:"7d",label:"Last 7 days",bucket:"day",count:7},{key:"30d",label:"Last 30 days",bucket:"day",count:30},{key:"12w",label:"Last 12 weeks",bucket:"week",count:12},{key:"12mo",label:"Last 12 months",bucket:"month",count:12},{key:"all",label:"All time",bucket:"month",count:0}];function _M(e,r){const a=new Date(e);return a.setUTCMilliseconds(0),a.setUTCSeconds(0),a.setUTCMinutes(0),r==="hour"?a:(a.setUTCHours(0),r==="month"?(a.setUTCDate(1),a):(r==="week"&&a.setUTCDate(a.getUTCDate()-(a.getUTCDay()+6)%7),a))}function yb(e,r,a){const l=new Date(e);return r==="hour"?l.setUTCHours(l.getUTCHours()+a):r==="day"?l.setUTCDate(l.getUTCDate()+a):r==="week"?l.setUTCDate(l.getUTCDate()+a*7):l.setUTCMonth(l.getUTCMonth()+a),l}const Ka={timeZone:"UTC"};function MM(e,r){const a=new Date(e);return r==="hour"?a.toLocaleTimeString(void 0,{...Ka,hour:"2-digit",minute:"2-digit"}):r==="month"?a.toLocaleDateString(void 0,{...Ka,month:"short",year:"2-digit"}):a.toLocaleDateString(void 0,{...Ka,month:"short",day:"numeric"})}function RM(e,r){const a=new Date(e);switch(r){case"hour":return`${a.toLocaleDateString(void 0,{...Ka,month:"short",day:"numeric"})}, ${a.toLocaleTimeString(void 0,{...Ka,hour:"2-digit",minute:"2-digit"})} UTC`;case"week":return`Week of ${a.toLocaleDateString(void 0,{...Ka,month:"short",day:"numeric",year:"numeric"})}`;case"month":return a.toLocaleDateString(void 0,{...Ka,month:"long",year:"numeric"});default:return a.toLocaleDateString(void 0,{...Ka,month:"short",day:"numeric",year:"numeric"})}}function Tr(e,r){return e.reduce((a,l)=>a+r(l),0)}function Fu(e,r,a){return!a||r===0?null:(e-r)/r}function ia(e){return(e.units.input_tokens??0)+(e.units.output_tokens??0)}function Nh(e,r,a){const l=new Map;for(const u of e){const c=r(u);let d=l.get(c);d||(d=a(u),l.set(c,d)),d.requests+=u.requests,d.cancelled+=u.cancelled,u.cost!==null&&(d.cost=(d.cost??0)+u.cost);for(const[f,m]of Object.entries(u.units))d.units[f]=(d.units[f]??0)+m}return l}function Pw(e){const r={requests:0,cost:null,units:{}};for(const a of e){r.requests+=a.requests,a.cost!==null&&(r.cost=(r.cost??0)+a.cost);for(const[l,u]of Object.entries(a.units))r.units[l]=(r.units[l]??0)+u}return r}function bb(e,r,a){const l=(u,c)=>({label:c??u.principal??"",value:r(u),rows:a(u)});return Ec(e,u=>l(u),u=>l(Pw(u),`Other (${u.length} users)`))}function DM({ssoEnabled:e}){var ne;const[r,a]=S.useState("30d"),[l,u]=S.useState(""),[c,d]=S.useState(""),[f,m]=S.useState(""),[h,v]=S.useState(""),[x,b]=S.useState(!1),[y,k]=S.useState(!1),[j,A]=S.useState(!1),C=Eh.find(z=>z.key===r)??Eh[2],D=_M(new Date,C.bucket),B=C.count?yb(D,C.bucket,-(C.count-1)):null,O=B?yb(B,C.bucket,-C.count):null,_=(l?`&principal=${encodeURIComponent(l)}`:"")+(c?`&provider=${encodeURIComponent(c)}`:"")+(f?`&model=${encodeURIComponent(f)}`:"")+(h?`&client=${encodeURIComponent(h)}`:""),E=Pt(()=>Pe.get(`/stats/series?bucket=${C.bucket}`+(O?`&since=${O.toISOString()}`:"")+_),[r,l,c,f,h]),I=Pt(()=>Pe.get("/stats/summary"+(B?`?since=${B.toISOString()}`:"")),[r]),W=((ne=E.data)==null?void 0:ne.series)??[],q=B?B.getTime():-1/0,$=W.filter(z=>new Date(z.start).getTime()>=q),X=W.filter(z=>new Date(z.start).getTime()0,le=z=>z.units.input_tokens??0,ee=z=>z.units.output_tokens??0,U=z=>z.units.cached_input_tokens??0,Z=Tr($,z=>z.requests),ie=Tr($,le),K=Tr($,U),N=Tr($,ee),L=Tr($,z=>z.cost??0),F=$.some(z=>z.cost!==null),M=Tr($,z=>z.unpriced_requests),oe=z=>new Date(z.start).getTime()===D.getTime(),G=z=>MM(z.start,C.bucket),ue=z=>RM(z.start,C.bucket)+(oe(z)?" ยท in progress":""),re=$.map(z=>{const fe=z.ok+z.cancelled,ke=[...z.cancelled?[{label:"cancelled",value:mn(z.cancelled)}]:[],...fe>0?[{label:"avg input / request",value:De(Math.round(le(z)/fe))},{label:"avg output / response",value:De(Math.round(ee(z)/fe))}]:[]];return{label:G(z),title:ue(z),values:[fe,z.failed],rows:ke.length?ke:void 0}}),ye=$.map(z=>({label:G(z),title:ue(z),values:[le(z),U(z),ee(z)]})),de=$.map(z=>({label:G(z),title:ue(z),values:[z.cost],rows:z.unpriced_requests?[{label:"unpriced requests",value:mn(z.unpriced_requests)}]:void 0})),be=S.useMemo(()=>{var z;return((z=I.data)==null?void 0:z.usage)??[]},[I.data]),Ee=S.useMemo(()=>({principals:[...new Set(be.map(z=>z.principal))].sort(),providers:[...new Set(be.map(z=>z.provider))].sort(),models:[...new Set(be.filter(z=>z.model).map(z=>z.model))].sort(),clients:[...new Set(be.filter(z=>z.client).map(z=>ns(z.client)))].sort()}),[be]),Se=S.useMemo(()=>be.filter(z=>(!l||z.principal===l)&&(!c||z.provider===c)&&(!f||z.model===f)&&(!h||ns(z.client)===h)),[be,l,c,f,h]),Ie=S.useMemo(()=>[...Nh(Se,z=>z.model,z=>({model:z.model,requests:0,cancelled:0,cost:null,units:{}})).values()].sort((z,fe)=>ia(fe)-ia(z)),[Se]),Be=Ie.reduce((z,fe)=>z+ia(fe),0),{slices:Mt,overflow:Ct}=S.useMemo(()=>{const z=(fe,ke)=>({label:ke??(fe.model||"(none)"),value:ia(fe),rows:[{label:"requests",value:mn(fe.requests)},...fe.units.cached_input_tokens?[{label:"cached input",value:De(fe.units.cached_input_tokens)}]:[],...fe.cost!==null?[{label:"cost",value:Rr(fe.cost)}]:[]]});return Ec(Ie,fe=>z(fe),fe=>z(Pw(fe),`Other (${fe.length} models)`))},[Ie]),Et=S.useMemo(()=>[...Nh(Se,z=>z.principal,z=>({principal:z.principal,requests:0,cancelled:0,cost:null,units:{}})).values()],[Se]),Lt=S.useMemo(()=>bb([...Et].sort((z,fe)=>ia(fe)-ia(z)),ia,z=>[{label:"requests",value:mn(z.requests)},...z.units.cached_input_tokens?[{label:"cached input",value:De(z.units.cached_input_tokens)}]:[],...z.cost!==null?[{label:"cost",value:Rr(z.cost)}]:[]]),[Et]),Rt=S.useMemo(()=>bb(Et.filter(z=>z.cost!==null).sort((z,fe)=>(fe.cost??0)-(z.cost??0)),z=>z.cost??0,z=>[{label:"tokens",value:De(ia(z))},{label:"requests",value:mn(z.requests)}]),[Et]),Dt=S.useMemo(()=>{const z=new Map;for(const fe of Se){const ke=fe.client?j?U2(fe.client):ns(fe.client):"unknown";let Oe=z.get(ke);Oe||(Oe={label:ke,requests:0,cancelled:0,cost:null,units:{},exact:new Set},z.set(ke,Oe)),Oe.requests+=fe.requests,Oe.cancelled+=fe.cancelled,fe.cost!==null&&(Oe.cost=(Oe.cost??0)+fe.cost);for(const[en,Cn]of Object.entries(fe.units))Oe.units[en]=(Oe.units[en]??0)+Cn;fe.client&&Oe.exact.add(fe.client)}return[...z.values()].sort((fe,ke)=>ke.requests-fe.requests)},[Se,j]),zt=Dt.reduce((z,fe)=>z+fe.requests,0),we=S.useMemo(()=>Dt.map(z=>({label:z.label,title:z.exact.size?[...z.exact].sort().join(` +`):"no User-Agent header",value:z.requests})),[Dt]),mt=S.useMemo(()=>[...Nh(Se,fe=>`${fe.principal}\0${fe.model}\0${fe.endpoint}`,fe=>({principal:fe.principal,model:fe.model,endpoint:fe.endpoint,requests:0,cancelled:0,cost:null,units:{}})).values()].sort((fe,ke)=>fe.principal!==ke.principal?fe.principal.localeCompare(ke.principal):fe.model!==ke.model?fe.model.localeCompare(ke.model):fe.endpoint.localeCompare(ke.endpoint)),[Se]),Y=E.loading&&!E.data||I.loading&&!I.data,qe=!Y&&(E.loading||I.loading);return o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs(ha,{value:r,onValueChange:a,children:[o.jsx(pa,{className:"w-44","aria-label":"Time range",children:o.jsx(ma,{})}),o.jsx(ga,{children:Eh.map(z=>o.jsx(Br,{value:z.key,children:z.label},z.key))})]}),o.jsx(Wt,{label:"User",value:l,onChange:u,options:Ee.principals,allLabel:"All users"}),o.jsx(Wt,{label:"Provider",value:c,onChange:d,options:Ee.providers,allLabel:"All providers"}),o.jsx(Wt,{label:"Model",value:f,onChange:m,options:Ee.models,allLabel:"All models"}),o.jsx(Wt,{label:"Client",value:h,onChange:v,options:Ee.clients,allLabel:"All clients"}),(l||c||f||h)&&o.jsxs(Re,{variant:"ghost",size:"sm",onClick:()=>{u(""),d(""),m(""),v("")},children:[o.jsx(bc,{}),"Clear filters"]}),o.jsx(Re,{variant:"outline",size:"icon-sm","aria-label":"Refresh",onClick:()=>{E.reload(),I.reload()},children:o.jsx(Xl,{})})]}),Y?o.jsx(Tt,{}):E.error||I.error?o.jsx("p",{className:"text-sm text-destructive",children:E.error??I.error}):o.jsxs("div",{className:qe?"flex flex-col gap-6 opacity-60":"flex flex-col gap-6",children:[o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[o.jsx(gr,{label:"Requests",value:De(Z),delta:Fu(Z,Tr(X,z=>z.requests),ce)}),o.jsx(gr,{label:"Input tokens",value:De(ie),secondary:K>0?`${De(K)} cached`:void 0,delta:Fu(ie,Tr(X,le),ce)}),o.jsx(gr,{label:"Output tokens",value:De(N),delta:Fu(N,Tr(X,ee),ce)}),o.jsx(gr,{label:"Cost",value:F?Rr(L):"unpriced",delta:F?Fu(L,Tr(X,z=>z.cost??0),ce):null,hint:M?`${mn(M)} request${M===1?"":"s"} unpriced`:void 0})]}),o.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[o.jsxs(Qe,{className:x?"min-w-0 lg:col-span-2":"min-w-0",children:[o.jsxs(et,{className:"flex flex-row items-start justify-between",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx(tt,{className:"font-serif",children:"Models"}),o.jsx(ct,{children:"Share of total tokens, cached input excluded."})]}),o.jsx(Re,{variant:"outline",size:"icon-sm","aria-label":x?"Show chart":"Show all models as a table",title:x?"Show chart":"Show all models as a table",onClick:()=>b(z=>!z),children:x?o.jsx(IE,{}):o.jsx(nm,{})})]}),o.jsx(Ze,{children:x?o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[o.jsx(ge,{children:"Model"}),o.jsx(ge,{className:"text-right",children:"Share"}),o.jsx(ge,{className:"text-right",children:"Requests"}),o.jsx(ge,{className:"text-right",children:"Input"}),o.jsx(ge,{className:"text-right",children:"Cached"}),o.jsx(ge,{className:"text-right",children:"Output"}),o.jsx(ge,{className:"text-right",children:"Cost"})]})}),o.jsxs(vn,{children:[Ie.length===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:7,className:"text-muted-foreground",children:"No usage in this range."})}),Ie.map((z,fe)=>o.jsxs(Ue,{children:[o.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:z.model||o.jsx("span",{className:"text-muted-foreground",children:"(none)"})}),o.jsx(me,{className:"text-right tabular-nums",children:Be>0?`${(ia(z)/Be*100).toFixed(1)}%`:""}),o.jsx(me,{className:"text-right tabular-nums",children:De(z.requests)}),o.jsx(me,{className:"text-right tabular-nums",title:qt(z.units.input_tokens),children:z.units.input_tokens?De(z.units.input_tokens):""}),o.jsx(me,{className:"text-right tabular-nums",title:qt(z.units.cached_input_tokens),children:z.units.cached_input_tokens?De(z.units.cached_input_tokens):""}),o.jsx(me,{className:"text-right tabular-nums",title:qt(z.units.output_tokens),children:z.units.output_tokens?De(z.units.output_tokens):""}),o.jsx(me,{className:"text-right tabular-nums",children:z.cost===null?o.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):Rr(z.cost)})]},fe))]})]}):o.jsx(rs,{slices:Mt,overflow:Ct,format:De},`${r} ${l} ${c} ${f} ${h}`)})]}),o.jsxs(Qe,{className:y?"min-w-0 lg:col-span-2":"min-w-0",children:[o.jsxs(et,{className:"flex flex-row items-start justify-between",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx(tt,{className:"font-serif",children:"Clients"}),o.jsx(ct,{children:j?"Requests per client version, from the User-Agent.":"Requests per client, from the User-Agent."})]}),o.jsxs("div",{className:"flex gap-1",children:[o.jsx(Re,{variant:j?"secondary":"outline",size:"icon-sm","aria-label":j?"Group by tool":"Split by version","aria-pressed":j,title:j?"Group by tool":"Split by version",onClick:()=>A(z=>!z),children:o.jsx(JE,{})}),o.jsx(Re,{variant:"outline",size:"icon-sm","aria-label":y?"Show chart":"Show all clients as a table",title:y?"Show chart":"Show all clients as a table",onClick:()=>k(z=>!z),children:y?o.jsx(J0,{}):o.jsx(nm,{})})]})]}),o.jsx(Ze,{children:y?o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[o.jsx(ge,{children:"Client"}),o.jsx(ge,{className:"text-right",children:"Share"}),o.jsx(ge,{className:"text-right",children:"Requests"}),o.jsx(ge,{className:"text-right",children:"Input"}),o.jsx(ge,{className:"text-right",children:"Cached"}),o.jsx(ge,{className:"text-right",children:"Output"}),o.jsx(ge,{className:"text-right",children:"Cost"})]})}),o.jsxs(vn,{children:[Dt.length===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:7,className:"text-muted-foreground",children:"No usage in this range."})}),Dt.map((z,fe)=>o.jsxs(Ue,{children:[o.jsx(me,{className:"font-mono text-xs wrap-anywhere",title:z.exact.size?[...z.exact].sort().join(` +`):void 0,children:z.label}),o.jsx(me,{className:"text-right tabular-nums",children:zt>0?`${(z.requests/zt*100).toFixed(1)}%`:""}),o.jsx(me,{className:"text-right tabular-nums",children:De(z.requests)}),o.jsx(me,{className:"text-right tabular-nums",title:qt(z.units.input_tokens),children:z.units.input_tokens?De(z.units.input_tokens):""}),o.jsx(me,{className:"text-right tabular-nums",title:qt(z.units.cached_input_tokens),children:z.units.cached_input_tokens?De(z.units.cached_input_tokens):""}),o.jsx(me,{className:"text-right tabular-nums",title:qt(z.units.output_tokens),children:z.units.output_tokens?De(z.units.output_tokens):""}),o.jsx(me,{className:"text-right tabular-nums",children:z.cost===null?o.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):Rr(z.cost)})]},fe))]})]}):o.jsx(Gi,{rows:we,format:De})})]}),e&&o.jsxs(o.Fragment,{children:[o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"User tokens"}),o.jsx(ct,{children:"Share of total tokens per user, cached input excluded."})]}),o.jsx(Ze,{children:o.jsx(rs,{slices:Lt.slices,overflow:Lt.overflow,format:De},`${r} ${l} ${c} ${f} ${h}`)})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"User cost"}),o.jsx(ct,{children:"Share of total cost per user."})]}),o.jsx(Ze,{children:o.jsx(rs,{slices:Rt.slices,overflow:Rt.overflow,format:Rr,emptyMessage:"Nothing priced in this range."},`${r} ${l} ${c} ${f} ${h}`)})]})]})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Tokens"}),o.jsxs(ct,{children:["Input, cached input and output per ",C.bucket,"."]})]}),o.jsx(Ze,{children:o.jsx(Za,{points:ye,series:[{...Hl,name:"input"},{...$m,name:"cached"},{...os,name:"output"}],format:De})})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Requests"}),o.jsxs(ct,{children:["Per ",C.bucket,", split by outcome."]})]}),o.jsx(Ze,{children:o.jsx(Za,{points:re,series:[{...Hl,name:"ok"},{...os,name:"failed"}],format:De,integer:!0})})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Cost"}),o.jsxs(ct,{children:["Per ",C.bucket,", from the model prices; unpriced stays empty, never zero."]})]}),o.jsx(Ze,{children:o.jsx(Za,{points:de,series:[{...Hl,name:"cost"}],format:z=>Rr(z),emptyMessage:"Nothing priced in this range."})})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:l?"By model":"By user and model"}),o.jsxs(ct,{children:["Totals by ",l?"":"user, ","model and endpoint."]})]}),o.jsx(Ze,{children:o.jsx(AM,{rows:mt,withPrincipal:!l})})]})]})]})}const ca=[{key:"24h",label:"Last 24 hours",bucket:"hour",count:24},{key:"7d",label:"Last 7 days",bucket:"day",count:7},{key:"30d",label:"Last 30 days",bucket:"day",count:30},{key:"12w",label:"Last 12 weeks",bucket:"week",count:12},{key:"12mo",label:"Last 12 months",bucket:"month",count:12},{key:"all",label:"All time",bucket:"month",count:0}];function np(e,r){const a=new Date(e);return a.setUTCMilliseconds(0),a.setUTCSeconds(0),a.setUTCMinutes(0),r==="hour"?a:(a.setUTCHours(0),r==="month"?(a.setUTCDate(1),a):(r==="week"&&a.setUTCDate(a.getUTCDate()-(a.getUTCDay()+6)%7),a))}function uc(e,r,a){const l=new Date(e);return r==="hour"?l.setUTCHours(l.getUTCHours()+a):r==="day"?l.setUTCDate(l.getUTCDate()+a):r==="week"?l.setUTCDate(l.getUTCDate()+a*7):l.setUTCMonth(l.getUTCMonth()+a),l}const Qa={timeZone:"UTC"};function $w(e,r){const a=new Date(e);return r==="hour"?a.toLocaleTimeString(void 0,{...Qa,hour:"2-digit",minute:"2-digit"}):r==="month"?a.toLocaleDateString(void 0,{...Qa,month:"short",year:"2-digit"}):a.toLocaleDateString(void 0,{...Qa,month:"short",day:"numeric"})}function Fw(e,r){const a=new Date(e);switch(r){case"hour":return`${a.toLocaleDateString(void 0,{...Qa,month:"short",day:"numeric"})}, ${a.toLocaleTimeString(void 0,{...Qa,hour:"2-digit",minute:"2-digit"})} UTC`;case"week":return`Week of ${a.toLocaleDateString(void 0,{...Qa,month:"short",day:"numeric",year:"numeric"})}`;case"month":return a.toLocaleDateString(void 0,{...Qa,month:"long",year:"numeric"});default:return a.toLocaleDateString(void 0,{...Qa,month:"short",day:"numeric",year:"numeric"})}}const Vw="untagged";function Xo(){return{requests:0,cost:null,units:{}}}function OM(e,r){e.requests+=r.requests,r.cost!==null&&(e.cost=(e.cost??0)+r.cost);for(const[a,l]of Object.entries(r.units))e.units[a]=(e.units[a]??0)+l}function Vu(e,r,a){const l=new Map;for(const u of e){const c=r(u);let d=l.get(c);d||(d=a(c),l.set(c,d)),OM(d,u)}return[...l.values()]}function zM(e){return(e.units.input_tokens??0)+(e.units.output_tokens??0)}function Ga(e,r){return e.reduce((a,l)=>a+r(l),0)}function Th(e,r,a){return!a||r===0?null:(e-r)/r}function wb(e){return oa(e.tags,"app")||Vw}function LM(e){return oa(e.tags,"context")||Vw}function UM(){var mt;const[e,r]=S.useState("30d"),[a,l]=S.useState(""),[u,c]=S.useState(""),[d,f]=S.useState(""),[m,h]=S.useState(""),[v,x]=S.useState(!1),b=ca.find(Y=>Y.key===e)??ca[2],k=np(new Date,b.bucket),j=b.count?uc(k,b.bucket,-(b.count-1)):null,A=j?uc(j,b.bucket,-b.count):null,C="&app_tagged=1"+(a?`&tag=${encodeURIComponent(`app:${a}`)}`:"")+(u?`&tag=${encodeURIComponent(`context:${u}`)}`:"")+(d?`&principal=${encodeURIComponent(d)}`:"")+(m?`&model=${encodeURIComponent(m)}`:""),R=Pt(()=>Pe.get(`/stats/series?bucket=${b.bucket}`+(A?`&since=${A.toISOString()}`:"")+C),[e,a,u,d,m]),D=Pt(()=>Pe.get(`/stats/series?bucket=${b.bucket}`+(A?`&since=${A.toISOString()}`:"")+C+"&endpoint=embeddings"),[e,a,u,d,m]),B=Pt(()=>Pe.get("/stats/summary?app_tagged=1"+(j?`&since=${j.toISOString()}`:"")),[e]),O=((mt=R.data)==null?void 0:mt.series)??[],_=j?j.getTime():-1/0,E=O.filter(Y=>new Date(Y.start).getTime()>=_),I=O.filter(Y=>new Date(Y.start).getTime()<_),W=I.length>0,q=S.useMemo(()=>{var qe;const Y=new Map;for(const ne of((qe=D.data)==null?void 0:qe.series)??[])Y.set(ne.start,ne);return Y},[D.data]),$=Y=>Y.units.output_tokens??0,X=Y=>Y.units.cached_input_tokens??0,ce=Y=>{var qe;return((qe=q.get(Y.start))==null?void 0:qe.units.input_tokens)??0},le=Y=>Math.max(0,(Y.units.input_tokens??0)-ce(Y)),ee=Ga(E,Y=>Y.requests),U=Ga(E,le),Z=Ga(E,$),ie=Ga(E,X),K=U+Z,N=Ga(E,ce),L=Y=>new Date(Y.start).getTime()===k.getTime(),F=Y=>$w(Y.start,b.bucket),M=Y=>Fw(Y.start,b.bucket)+(L(Y)?" ยท in progress":""),oe=E.map(Y=>({label:F(Y),title:M(Y),values:[Y.ok+Y.cancelled,Y.failed],rows:Y.cancelled?[{label:"cancelled",value:mn(Y.cancelled)}]:void 0})),G=E.map(Y=>({label:F(Y),title:M(Y),values:[le(Y),X(Y),$(Y)]})),ue=E.map(Y=>({label:F(Y),title:M(Y),values:[ce(Y)]})),re=S.useMemo(()=>{var Y;return((Y=B.data)==null?void 0:Y.usage)??[]},[B.data]),ye=S.useMemo(()=>[...new Set(re.map(Y=>oa(Y.tags,"app")).filter(Boolean))].sort(),[re]),de=S.useMemo(()=>[...new Set(re.filter(Y=>!a||oa(Y.tags,"app")===a).map(Y=>oa(Y.tags,"context")).filter(Boolean))].sort(),[re,a]),be=S.useMemo(()=>[...new Set(re.map(Y=>Y.principal))].sort(),[re]),Ee=S.useMemo(()=>[...new Set(re.map(Y=>Y.model))].sort(),[re]),Se=S.useMemo(()=>re.filter(Y=>(!a||oa(Y.tags,"app")===a)&&(!u||oa(Y.tags,"context")===u)&&(!d||Y.principal===d)&&(!m||Y.model===m)),[re,a,u,d,m]),Ie=S.useMemo(()=>Vu(Se,wb,Y=>({name:Y,...Xo()})).sort((Y,qe)=>qe.requests-Y.requests),[Se]),Be=Ie.reduce((Y,qe)=>Y+qe.requests,0),Mt=S.useMemo(()=>Ie.map(Y=>({label:Y.name,value:Y.requests})),[Ie]),Ct=S.useMemo(()=>Vu(Se,Y=>Y.principal,Y=>({name:Y,...Xo()})).sort((Y,qe)=>qe.requests-Y.requests),[Se]),Et=S.useMemo(()=>{const Y=(qe,ne)=>({label:ne??qe.name??"",value:qe.requests,rows:[{label:"tokens",value:De(zM(qe))}]});return Ec(Ct,qe=>Y(qe),qe=>{const ne=Xo();for(const z of qe){ne.requests+=z.requests;for(const[fe,ke]of Object.entries(z.units))ne.units[fe]=(ne.units[fe]??0)+ke}return Y(ne,`Other (${qe.length} users)`)})},[Ct]),Lt=S.useMemo(()=>Vu(Se,LM,Y=>({name:Y,...Xo()})).sort((Y,qe)=>qe.requests-Y.requests),[Se]),Rt=S.useMemo(()=>Lt.map(Y=>({label:Y.name,value:Y.requests})),[Lt]),Dt=S.useMemo(()=>Vu(Se,Y=>`${wb(Y)} ${Y.model}`,Y=>{const qe=Y.indexOf(" ");return{name:Y.slice(0,qe),model:Y.slice(qe+1),...Xo()}}).sort((Y,qe)=>Y.name!==qe.name?Y.name.localeCompare(qe.name):Y.model.localeCompare(qe.model)),[Se]),zt=R.loading&&!R.data||B.loading&&!B.data,we=!zt&&(R.loading||B.loading||D.loading);return o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs(ha,{value:e,onValueChange:r,children:[o.jsx(pa,{className:"w-44","aria-label":"Time range",children:o.jsx(ma,{})}),o.jsx(ga,{children:ca.map(Y=>o.jsx(Br,{value:Y.key,children:Y.label},Y.key))})]}),o.jsx(Wt,{label:"App",value:a,onChange:Y=>{l(Y),c("")},options:ye,allLabel:"All apps"}),a&&o.jsx(Wt,{label:"Context",value:u,onChange:c,options:de,allLabel:"All contexts"}),o.jsx(Wt,{label:"User",value:d,onChange:f,options:be,allLabel:"All users"}),o.jsx(Wt,{label:"Model",value:m,onChange:h,options:Ee,allLabel:"All models"}),(a||u||d||m)&&o.jsxs(Re,{variant:"ghost",size:"sm",onClick:()=>{l(""),c(""),f(""),h("")},children:[o.jsx(bc,{}),"Clear filters"]}),o.jsx(Re,{variant:"outline",size:"icon-sm","aria-label":"Refresh",onClick:()=>{R.reload(),B.reload(),D.reload()},children:o.jsx(Xl,{})})]}),zt?o.jsx(Tt,{}):R.error||B.error||D.error?o.jsx("p",{className:"text-sm text-destructive",children:R.error??B.error??D.error}):o.jsxs("div",{className:we?"flex flex-col gap-6 opacity-60":"flex flex-col gap-6",children:[o.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[o.jsx(gr,{label:"Requests",value:De(ee),delta:Th(ee,Ga(I,Y=>Y.requests),W)}),o.jsx(gr,{label:"Tokens",value:De(K),secondary:`${De(U)} in ยท ${De(ie)} cached ยท ${De(Z)} out`,delta:Th(K,Ga(I,Y=>le(Y)+$(Y)),W)}),o.jsx(gr,{label:"Embedding",value:De(N),secondary:"in",delta:Th(N,Ga(I,ce),W)})]}),o.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[o.jsxs(Qe,{className:v?"min-w-0 lg:col-span-2":"min-w-0",children:[o.jsxs(et,{className:"flex flex-row items-start justify-between",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx(tt,{className:"font-serif",children:"Apps"}),o.jsx(ct,{children:"Requests per app, from the app tag."})]}),o.jsx(Re,{variant:"outline",size:"icon-sm","aria-label":v?"Show chart":"Show all apps as a table",title:v?"Show chart":"Show all apps as a table",onClick:()=>x(Y=>!Y),children:v?o.jsx(J0,{}):o.jsx(nm,{})})]}),o.jsx(Ze,{children:v?o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[o.jsx(ge,{children:"App"}),o.jsx(ge,{className:"text-right",children:"Share"}),o.jsx(ge,{className:"text-right",children:"Requests"}),o.jsx(ge,{className:"text-right",children:"Input"}),o.jsx(ge,{className:"text-right",children:"Cached"}),o.jsx(ge,{className:"text-right",children:"Output"}),o.jsx(ge,{className:"text-right",children:"Spend"})]})}),o.jsxs(vn,{children:[Ie.length===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:7,className:"text-muted-foreground",children:"No usage in this range."})}),Ie.map((Y,qe)=>o.jsxs(Ue,{children:[o.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:Y.name}),o.jsx(me,{className:"text-right tabular-nums",children:Be>0?`${(Y.requests/Be*100).toFixed(1)}%`:""}),o.jsx(me,{className:"text-right tabular-nums",children:De(Y.requests)}),o.jsx(me,{className:"text-right tabular-nums",title:qt(Y.units.input_tokens),children:Y.units.input_tokens?De(Y.units.input_tokens):""}),o.jsx(me,{className:"text-right tabular-nums",title:qt(Y.units.cached_input_tokens),children:Y.units.cached_input_tokens?De(Y.units.cached_input_tokens):""}),o.jsx(me,{className:"text-right tabular-nums",title:qt(Y.units.output_tokens),children:Y.units.output_tokens?De(Y.units.output_tokens):""}),o.jsx(me,{className:"text-right tabular-nums",children:Y.cost===null?o.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):Rr(Y.cost)})]},qe))]})]}):o.jsx(Gi,{rows:Mt,format:De})})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Users"}),o.jsx(ct,{children:"Share of requests per user."})]}),o.jsx(Ze,{children:o.jsx(rs,{slices:Et.slices,overflow:Et.overflow,format:De,emptyMessage:"No usage in this range."},`${e} ${a} ${u} ${d} ${m}`)})]}),a&&o.jsxs(Qe,{className:"lg:col-span-2",children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Contexts"}),o.jsxs(ct,{children:["Requests per context in ",a,"."]})]}),o.jsx(Ze,{children:o.jsx(Gi,{rows:Rt,format:De})})]})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Tokens"}),o.jsxs(ct,{children:["Chat input, cached input and output per ",b.bucket,"."]})]}),o.jsx(Ze,{children:o.jsx(Za,{points:G,series:[{...Hl,name:"input"},{...$m,name:"cached"},{...os,name:"output"}],format:De})})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Embedding"}),o.jsxs(ct,{children:["Input tokens on embeddings per ",b.bucket,"."]})]}),o.jsx(Ze,{children:o.jsx(Za,{points:ue,series:[{...Hl,name:"input"}],format:De,emptyMessage:"No embeddings in this range."})})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Requests"}),o.jsxs(ct,{children:["Per ",b.bucket,", split by outcome."]})]}),o.jsx(Ze,{children:o.jsx(Za,{points:oe,series:[{...Hl,name:"ok"},{...os,name:"failed"}],format:De,integer:!0})})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:a?"By model":"By app and model"}),o.jsxs(ct,{children:["Totals by ",a?"":"app and ","model."]})]}),o.jsx(Ze,{children:o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[!a&&o.jsx(ge,{children:"App"}),o.jsx(ge,{children:"Model"}),o.jsx(ge,{className:"text-right",children:"Requests"}),o.jsx(ge,{className:"text-right",children:"Input"}),o.jsx(ge,{className:"text-right",children:"Cached"}),o.jsx(ge,{className:"text-right",children:"Output"}),o.jsx(ge,{className:"text-right",children:"Spend"})]})}),o.jsxs(vn,{children:[Dt.length===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:a?6:7,className:"text-muted-foreground",children:"No usage in this range."})}),Dt.map((Y,qe)=>o.jsxs(Ue,{children:[!a&&o.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:Y.name}),o.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:Y.model}),o.jsx(me,{className:"text-right tabular-nums",children:De(Y.requests)}),o.jsx(me,{className:"text-right tabular-nums",children:qt(Y.units.input_tokens)}),o.jsx(me,{className:"text-right tabular-nums",children:qt(Y.units.cached_input_tokens)}),o.jsx(me,{className:"text-right tabular-nums",children:qt(Y.units.output_tokens)}),o.jsx(me,{className:"text-right tabular-nums",children:Y.cost===null?o.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):Rr(Y.cost)})]},qe))]})]})})]})]})]})}const BM=Y0("inline-flex items-center justify-center rounded-md border font-medium w-fit max-w-full whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",muted:"border-transparent bg-muted text-muted-foreground [a&]:hover:bg-muted/80",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent/10 [a&]:hover:text-accent-foreground",success:"border-transparent bg-[#1a7f37] text-white [a&]:hover:bg-[#1a7f37]/90",warning:"border-transparent bg-[#9a6700] text-white [a&]:hover:bg-[#9a6700]/90",info:"border-transparent bg-[#0969da] text-white [a&]:hover:bg-[#0969da]/90",tag:"border-border bg-card text-foreground [a&]:hover:bg-muted",value:"border-transparent bg-muted text-foreground font-mono [a&]:hover:bg-muted/80",whatsapp:"border-transparent bg-[#22c55e] text-white [a&]:hover:bg-[#22c55e]/90",email:"border-transparent bg-[#4b5563] text-white [a&]:hover:bg-[#4b5563]/90",telegram:"border-transparent bg-[#3b82f6] text-white [a&]:hover:bg-[#3b82f6]/90",zulip:"border-transparent bg-[#a855f7] text-white [a&]:hover:bg-[#a855f7]/90",platform:"border-transparent bg-[#f97316] text-white [a&]:hover:bg-[#f97316]/90"},size:{sm:"text-xs px-1.5 py-0",default:"text-xs px-2 py-0.5",lg:"text-sm px-3 py-1 [&>svg]:size-3.5"}},defaultVariants:{variant:"default",size:"default"}});function dn({className:e,variant:r,size:a,asChild:l=!1,...u}){const c=l?da:"span";return o.jsx(c,{"data-slot":"badge",className:_e(BM({variant:r,size:a}),e),...u})}const IM=["<1s","1โ€“5s","5โ€“15s","15โ€“30s","30โ€“60s","60โ€“120s","โ‰ฅ120s"],Ah=[{key:"upstream_error",name:"provider error",series:Hl},{key:"unreachable",name:"unreachable",series:$m},{key:"cancelled",name:"cancelled",series:os}],HM="untagged";function rp(e){return e.outcome!=="ok"}function Gw(e){return e.error_kind?e.error_kind:e.outcome==="upstream_error"&&e.status_code?`http ${e.status_code}`:e.outcome}function _h(e,r){const a=new Map;for(const l of e){const u=r(l);let c=a.get(u);c||(c={label:u,errors:0,total:0},a.set(u,c)),c.total+=l.requests,rp(l)&&(c.errors+=l.requests)}return[...a.values()].filter(l=>l.errors>0).sort((l,u)=>u.errors-l.errors)}function Mh(e){return e.map(r=>({label:r.label,value:r.errors,note:`${(r.errors/r.total*100).toFixed(1)}% of ${De(r.total)} req`}))}function qM(e){const r=new Map;for(const a of e){if(!rp(a))continue;const l=Gw(a),u=`${a.provider}\0${a.model}\0${l}\0${a.status_code??""}`;let c=r.get(u);c||(c={provider:a.provider,model:a.model,outcome:a.outcome,label:l,statusCode:a.status_code,requests:0,weightedMs:0,lastSeen:""},r.set(u,c)),c.requests+=a.requests,c.weightedMs+=a.avg_ms*a.requests,a.last_seen>c.lastSeen&&(c.lastSeen=a.last_seen)}return[...r.values()].sort((a,l)=>l.requests-a.requests)}function PM(e){const r=new URLSearchParams;return e.provider&&r.set("provider",e.provider),e.model&&r.set("model",e.model),r.set("outcome",e.outcome),"/requests?"+r.toString()}function $M(){var L,F,M,oe;const[e,r]=S.useState("7d"),[a,l]=S.useState(""),[u,c]=S.useState(""),[d,f]=S.useState(""),[m,h]=S.useState(""),v=ca.find(G=>G.key===e)??ca[1],x=np(new Date,v.bucket),b=v.count?uc(x,v.bucket,-(v.count-1)):null,y=b?`&since=${b.toISOString()}`:"",k=(a?`&principal=${encodeURIComponent(a)}`:"")+(u?`&provider=${encodeURIComponent(u)}`:"")+(d?`&model=${encodeURIComponent(d)}`:"")+(m?`&tag=${encodeURIComponent(`app:${m}`)}`:""),j=Pt(()=>Pe.get(`/stats/errors?bucket=${v.bucket}`+y+k),[e,a,u,d,m]),A=Pt(()=>Pe.get("/stats/requests/facets"+(y?"?"+y.slice(1):"")),[e]),C=((L=j.data)==null?void 0:L.series)??[],R=S.useMemo(()=>{var G;return((G=j.data)==null?void 0:G.breakdown)??[]},[j.data]),D=C.reduce((G,ue)=>G+ue.requests,0),B=C.reduce((G,ue)=>G+ue.upstream_error+ue.unreachable,0),O=C.reduce((G,ue)=>G+ue.cancelled,0),_=G=>D>0?`${(G/D*100).toFixed(1)}% of requests`:void 0,E=S.useMemo(()=>R.filter(rp),[R]),I=E.reduce((G,ue)=>G+ue.requests,0),W=I>0?E.reduce((G,ue)=>G+ue.avg_ms*ue.requests,0)/I:null,q=G=>new Date(G).getTime()===x.getTime(),$=C.map(G=>({label:$w(G.start,v.bucket),title:Fw(G.start,v.bucket)+(q(G.start)?" ยท in progress":""),values:[G.upstream_error,G.unreachable,G.cancelled],rows:[{label:"requests total",value:mn(G.requests)}]})),X=IM.map((G,ue)=>{const re=ye=>E.filter(de=>de.outcome===ye).reduce((de,be)=>de+(be.bands[ue]??0),0);return{label:G,title:`Time to failure ${G}`,values:Ah.map(ye=>re(ye.key))}}),ce=S.useMemo(()=>Mh(_h(R,G=>G.provider||"(none)")),[R]),le=S.useMemo(()=>Mh(_h(R,G=>oa(G.tags,"app")||HM)),[R]),ee=S.useMemo(()=>Mh(_h(R,G=>G.model||"(none)")),[R]),U=S.useMemo(()=>{const G=new Map;for(const re of E){const ye=Gw(re);G.set(ye,(G.get(ye)??0)+re.requests)}const ue=[...G.entries()].sort((re,ye)=>ye[1]-re[1]);return Ec(ue,([re,ye])=>({label:re,value:ye}),re=>({label:`Other (${re.length} kinds)`,value:re.reduce((ye,[,de])=>ye+de,0)}))},[E]),Z=S.useMemo(()=>qM(R).slice(0,50),[R]),ie=S.useMemo(()=>{var G;return[...new Set((((G=A.data)==null?void 0:G.tags)??[]).filter(ue=>ue.startsWith("app:")).map(ue=>ue.slice(4)))].sort()},[A.data]),K=j.loading&&!j.data,N=!K&&j.loading;return o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs(ha,{value:e,onValueChange:r,children:[o.jsx(pa,{className:"w-44","aria-label":"Time range",children:o.jsx(ma,{})}),o.jsx(ga,{children:ca.map(G=>o.jsx(Br,{value:G.key,children:G.label},G.key))})]}),o.jsx(Wt,{label:"User",value:a,onChange:l,options:((F=A.data)==null?void 0:F.principals)??[],allLabel:"All users"}),o.jsx(Wt,{label:"Provider",value:u,onChange:c,options:((M=A.data)==null?void 0:M.providers)??[],allLabel:"All providers"}),o.jsx(Wt,{label:"Model",value:d,onChange:f,options:((oe=A.data)==null?void 0:oe.models)??[],allLabel:"All models"}),o.jsx(Wt,{label:"App",value:m,onChange:h,options:ie,allLabel:"All apps"}),(a||u||d||m)&&o.jsxs(Re,{variant:"ghost",size:"sm",onClick:()=>{l(""),c(""),f(""),h("")},children:[o.jsx(bc,{}),"Clear filters"]}),o.jsx(Re,{variant:"outline",size:"icon-sm","aria-label":"Refresh",onClick:()=>j.reload(),children:o.jsx(Xl,{})})]}),K?o.jsx(Tt,{}):j.error?o.jsx("p",{className:"text-sm text-destructive",children:j.error}):o.jsxs("div",{className:N?"flex flex-col gap-6 opacity-60":"flex flex-col gap-6",children:[o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[o.jsx(gr,{label:"Requests",value:De(D)}),o.jsx(gr,{label:"Failed",value:De(B),hint:_(B)}),o.jsx(gr,{label:"Cancelled",value:De(O),hint:_(O)}),o.jsx(gr,{label:"Avg time to failure",value:W===null?"โ€”":Jh(Math.round(W))})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Failures over time"}),o.jsxs(ct,{children:["Per ",v.bucket,", split by class."]})]}),o.jsx(Ze,{children:o.jsx(Za,{points:$,series:Ah.map(G=>({...G.series,name:G.name})),format:De,integer:!0,emptyMessage:"No failures in this range."})})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Time to failure"}),o.jsx(ct,{children:"How long requests ran before failing. A pile-up near a round number is a timeout."})]}),o.jsx(Ze,{children:o.jsx(Za,{points:X,series:Ah.map(G=>({...G.series,name:G.name})),format:De,integer:!0,emptyMessage:"No failures in this range."})})]}),o.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Failures by provider"}),o.jsx(ct,{children:"Each bar with the provider's own failure rate."})]}),o.jsx(Ze,{children:o.jsx(Gi,{rows:ce,format:De,emptyMessage:"No failures in this range."})})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Failures by app"}),o.jsx(ct,{children:"From the app tag; untagged traffic grouped."})]}),o.jsx(Ze,{children:o.jsx(Gi,{rows:le,format:De,emptyMessage:"No failures in this range."})})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Failures by model"}),o.jsx(ct,{children:"Each bar with the model's own failure rate."})]}),o.jsx(Ze,{children:o.jsx(Gi,{rows:ee,format:De,emptyMessage:"No failures in this range."})})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Failure kinds"}),o.jsx(ct,{children:"Provider error codes and transport classes."})]}),o.jsx(Ze,{children:o.jsx(rs,{slices:U.slices,overflow:U.overflow,format:De,emptyMessage:"No failures in this range."},`${e} ${a} ${u} ${d} ${m}`)})]})]}),o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Error signatures"}),o.jsx(ct,{children:"Each distinct failure, newest last seen. Open one in the request explorer."})]}),o.jsx(Ze,{children:o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[o.jsx(ge,{children:"Error"}),o.jsx(ge,{children:"Provider"}),o.jsx(ge,{children:"Model"}),o.jsx(ge,{className:"text-right",children:"Requests"}),o.jsx(ge,{className:"text-right",children:"Avg time"}),o.jsx(ge,{className:"text-right",children:"Last seen"}),o.jsx(ge,{})]})}),o.jsxs(vn,{children:[Z.length===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:7,className:"text-muted-foreground",children:"No failures in this range."})}),Z.map((G,ue)=>o.jsxs(Ue,{children:[o.jsx(me,{children:o.jsxs(dn,{variant:G.outcome==="cancelled"?"warning":"destructive",children:[G.label,G.outcome!=="cancelled"&&G.statusCode&&G.label!==`http ${G.statusCode}`?` ยท ${G.statusCode}`:""]})}),o.jsx(me,{className:"font-mono text-xs",children:G.provider||"โ€”"}),o.jsx(me,{className:"font-mono text-xs",children:G.model||"โ€”"}),o.jsx(me,{className:"text-right tabular-nums",children:mn(G.requests)}),o.jsx(me,{className:"text-right tabular-nums",children:Jh(Math.round(G.weightedMs/G.requests))}),o.jsx(me,{className:"whitespace-nowrap text-right text-xs",children:T0(G.lastSeen)}),o.jsx(me,{className:"text-right",children:o.jsxs("a",{href:PM(G),className:"inline-flex items-center gap-1 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:["explore",o.jsx(BE,{className:"size-3"})]})})]},ue))]})]})})]})]})]})}var ap="Checkbox",[FM]=vr(ap),[VM,GM]=FM(ap),Yw=S.forwardRef((e,r)=>{const{__scopeCheckbox:a,name:l,checked:u,defaultChecked:c,required:d,disabled:f,value:m="on",onCheckedChange:h,form:v,...x}=e,[b,y]=S.useState(null),k=ft(r,B=>y(B)),j=S.useRef(!1),A=b?v||!!b.closest("form"):!0,[C=!1,R]=el({prop:u,defaultProp:c,onChange:h}),D=S.useRef(C);return S.useEffect(()=>{const B=b==null?void 0:b.form;if(B){const O=()=>R(D.current);return B.addEventListener("reset",O),()=>B.removeEventListener("reset",O)}},[b,R]),o.jsxs(VM,{scope:a,state:C,disabled:f,children:[o.jsx(Ge.button,{type:"button",role:"checkbox","aria-checked":Ja(C)?"mixed":C,"aria-required":d,"data-state":Qw(C),"data-disabled":f?"":void 0,disabled:f,value:m,...x,ref:k,onKeyDown:Te(e.onKeyDown,B=>{B.key==="Enter"&&B.preventDefault()}),onClick:Te(e.onClick,B=>{R(O=>Ja(O)?!0:!O),A&&(j.current=B.isPropagationStopped(),j.current||B.stopPropagation())})}),A&&o.jsx(YM,{control:b,bubbles:!j.current,name:l,value:m,checked:C,required:d,disabled:f,form:v,style:{transform:"translateX(-100%)"},defaultChecked:Ja(c)?!1:c})]})});Yw.displayName=ap;var Xw="CheckboxIndicator",Kw=S.forwardRef((e,r)=>{const{__scopeCheckbox:a,forceMount:l,...u}=e,c=GM(Xw,a);return o.jsx(Ir,{present:l||Ja(c.state)||c.state===!0,children:o.jsx(Ge.span,{"data-state":Qw(c.state),"data-disabled":c.disabled?"":void 0,...u,ref:r,style:{pointerEvents:"none",...e.style}})})});Kw.displayName=Xw;var YM=e=>{const{control:r,checked:a,bubbles:l=!0,defaultChecked:u,...c}=e,d=S.useRef(null),f=ep(a),m=Zm(r);S.useEffect(()=>{const v=d.current,x=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(x,"checked").set;if(f!==a&&y){const k=new Event("click",{bubbles:l});v.indeterminate=Ja(a),y.call(v,Ja(a)?!1:a),v.dispatchEvent(k)}},[f,a,l]);const h=S.useRef(Ja(a)?!1:a);return o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:u??h.current,...c,tabIndex:-1,ref:d,style:{...e.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Ja(e){return e==="indeterminate"}function Qw(e){return Ja(e)?"indeterminate":e?"checked":"unchecked"}var XM=Yw,KM=Kw;function lp({className:e,...r}){return o.jsx(XM,{"data-slot":"checkbox",className:_e("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:o.jsx(KM,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:o.jsx(yc,{className:"size-3.5"})})})}function Gu({label:e,sortKey:r,active:a,onSort:l,numeric:u}){return o.jsx(ge,{className:u?"text-right":void 0,children:o.jsxs("button",{type:"button",onClick:()=>l(r),"aria-label":`Sort by ${e.toLowerCase()}`,className:_e("cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring",a?"font-medium text-foreground":"hover:text-foreground"),children:[e,a&&o.jsxs("span",{"aria-hidden":!0,children:[" ",r==="name"?"โ†‘":"โ†“"]})]})})}function QM(){var j;const[e,r]=S.useState("30d"),[a,l]=S.useState("name"),[u,c]=S.useState(!1),d=ca.find(A=>A.key===e)??ca[2],f=np(new Date,d.bucket),m=d.count?uc(f,d.bucket,-(d.count-1)):null,h=Pt(()=>Pe.get("/v1/models?include_hidden=1"),[]),v=Pt(()=>Pe.get("/stats/summary"+(m?`?since=${m.toISOString()}`:"")),[e]),x=S.useMemo(()=>{var D,B;const A=new Map;for(const O of((D=v.data)==null?void 0:D.usage)??[]){let _=A.get(O.model);_||(_={requests:0,tokens:0,cost:null},A.set(O.model,_)),_.requests+=O.requests,_.tokens+=(O.units.input_tokens??0)+(O.units.output_tokens??0),O.cost!==null&&(_.cost=(_.cost??0)+O.cost)}const C=(((B=h.data)==null?void 0:B.data)??[]).filter(O=>u||!O.hidden).map(O=>{var _,E,I;return{model:O,requests:((_=A.get(O.id))==null?void 0:_.requests)??0,tokens:((E=A.get(O.id))==null?void 0:E.tokens)??0,cost:((I=A.get(O.id))==null?void 0:I.cost)??null}}),R=(O,_)=>O.model.id.localeCompare(_.model.id);return C.sort((O,_)=>a==="name"?R(O,_):a==="cost"?(_.cost??-1)-(O.cost??-1)||R(O,_):_[a]-O[a]||R(O,_))},[h.data,v.data,a,u]),b=(((j=h.data)==null?void 0:j.data)??[]).filter(A=>A.hidden).length,y=h.loading&&!h.data,k=!y&&(h.loading||v.loading);return o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs(ha,{value:e,onValueChange:r,children:[o.jsx(pa,{className:"w-44","aria-label":"Time range",children:o.jsx(ma,{})}),o.jsx(ga,{children:ca.map(A=>o.jsx(Br,{value:A.key,children:A.label},A.key))})]}),o.jsx(Re,{variant:"outline",size:"icon-sm","aria-label":"Refresh",onClick:()=>{h.reload(),v.reload()},children:o.jsx(Xl,{})}),b>0&&o.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx(lp,{checked:u,onCheckedChange:A=>c(A===!0)}),"Show hidden"]})]}),y?o.jsx(Tt,{}):h.error||v.error?o.jsx("p",{className:"text-sm text-destructive",children:h.error??v.error}):o.jsxs(Qe,{className:k?"opacity-60":void 0,children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Models"}),o.jsx(ct,{children:"Every model you can call, and how much it is used."})]}),o.jsx(Ze,{children:o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[o.jsx(Gu,{label:"Model",sortKey:"name",active:a==="name",onSort:l}),o.jsx(ge,{children:"Capabilities"}),o.jsx(Gu,{label:"Requests",sortKey:"requests",active:a==="requests",onSort:l,numeric:!0}),o.jsx(Gu,{label:"Tokens",sortKey:"tokens",active:a==="tokens",onSort:l,numeric:!0}),o.jsx(Gu,{label:"Spend",sortKey:"cost",active:a==="cost",onSort:l,numeric:!0})]})}),o.jsxs(vn,{children:[x.length===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:5,className:"text-muted-foreground",children:"No models available yet."})}),x.map(A=>o.jsxs(Ue,{children:[o.jsx(me,{className:"font-medium wrap-anywhere",children:o.jsxs("span",{className:"flex flex-col",children:[o.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[A.model.id,A.model.hidden&&o.jsx(dn,{variant:"muted",children:"hidden"})]}),A.model.alias_of&&o.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["โ†’ ",A.model.alias_of]})]})}),o.jsx(me,{children:o.jsx("div",{className:"flex flex-wrap gap-1",children:A.model.capabilities.map(C=>o.jsx(dn,{variant:"muted",children:C},C))})}),o.jsx(me,{className:"text-right tabular-nums",children:A.requests?De(A.requests):""}),o.jsx(me,{className:"text-right tabular-nums",title:qt(A.tokens),children:A.tokens?De(A.tokens):""}),o.jsx(me,{className:"text-right tabular-nums",children:A.requests?A.cost===null?o.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):Rr(A.cost):""})]},A.model.id))]})]})})]})]})}function ZM(e){const r=Date.now()-new Date(e).getTime();if(r<6e4)return"just now";const a=Math.floor(r/6e4);if(a<60)return`${a}m ago`;const l=Math.floor(a/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`}function Sb(e,r){return e===void 0||r===void 0||r===0?null:`${Math.round(e/r*100)}%`}function jb({label:e,remaining:r,limit:a}){if(r===void 0&&a===void 0)return null;const l=a&&a>0?(r??0)/a:null,u=l===null?"bg-muted-foreground":l>.5?"bg-green-500":l>.2?"bg-yellow-500":"bg-red-500";return o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsxs("div",{className:"flex items-baseline justify-between text-xs",children:[o.jsx("span",{className:"text-muted-foreground",children:e}),o.jsxs("span",{className:"tabular-nums",children:[r!==void 0?mn(r):"?",a!==void 0?` / ${mn(a)}`:"",Sb(r,a)&&o.jsxs("span",{className:"ml-1 text-muted-foreground",children:["(",Sb(r,a),")"]})]})]}),l!==null&&o.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:_e("h-full rounded-full transition-all",u),style:{width:`${Math.max(l*100,1)}%`}})})]})}function JM({snap:e}){const r=e.limit_requests!==void 0||e.remaining_requests!==void 0,a=e.limit_tokens!==void 0||e.remaining_tokens!==void 0;return o.jsxs(Qe,{children:[o.jsx(et,{className:"pb-3",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(tt,{className:"text-base font-medium",children:e.provider}),o.jsxs("span",{className:_e("text-xs tabular-nums",e.stale?"text-yellow-600 dark:text-yellow-400":"text-muted-foreground"),title:new Date(e.observed_at).toLocaleString(),children:[ZM(e.observed_at),e.stale&&" (stale)"]})]})}),o.jsxs(Ze,{className:"flex flex-col gap-3",children:[r&&o.jsx(jb,{label:"Requests",remaining:e.remaining_requests,limit:e.limit_requests}),a&&o.jsx(jb,{label:"Tokens",remaining:e.remaining_tokens,limit:e.limit_tokens}),!r&&!a&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"No rate-limit data yet."})]})]})}function WM(){const{data:e,loading:r,error:a,reload:l}=Pt(()=>Pe.get("/stats/rate-limits"),[]);return o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"font-serif text-lg font-semibold",children:"Provider rate limits"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Upstream quota reported by each configured provider."})]}),o.jsxs(Re,{variant:"outline",size:"sm",onClick:l,disabled:r,children:[r?o.jsx(Tt,{}):o.jsx(Xl,{className:"size-4"}),"Refresh"]})]}),r&&!e?o.jsx("div",{className:"flex justify-center py-12",children:o.jsx(Tt,{className:"size-6"})}):a?o.jsx("p",{className:"text-sm text-destructive",children:a}):(e==null?void 0:e.rate_limits.length)===0?o.jsx(Qe,{children:o.jsx(Ze,{className:"py-8 text-center text-sm text-muted-foreground",children:"No provider reports rate limits yet."})}):o.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:e==null?void 0:e.rate_limits.map(u=>o.jsx(JM,{snap:u},u.provider_id))})]})}const eR=[{key:"overview",label:"Overview"},{key:"apps",label:"Apps"},{key:"models",label:"Models"},{key:"providers",label:"Providers"},{key:"errors",label:"Errors"}];function tR({value:e,onChange:r}){return o.jsx("nav",{className:"-mt-2 flex items-center gap-4 border-b text-sm",children:eR.map(a=>o.jsx("button",{type:"button","aria-current":e===a.key?"page":void 0,onClick:()=>r(a.key),className:_e("cursor-pointer border-b-2 px-0.5 pb-2 outline-none focus-visible:ring-2 focus-visible:ring-ring",e===a.key?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:a.label},a.key))})}function nR({ssoEnabled:e,sub:r,onSubChange:a}){return o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsx(tR,{value:r,onChange:a}),r==="apps"?o.jsx(UM,{}):r==="models"?o.jsx(QM,{}):r==="providers"?o.jsx(WM,{}):r==="errors"?o.jsx($M,{}):o.jsx(DM,{ssoEnabled:e})]})}var ip="Switch",[rR]=vr(ip),[aR,lR]=rR(ip),Zw=S.forwardRef((e,r)=>{const{__scopeSwitch:a,name:l,checked:u,defaultChecked:c,required:d,disabled:f,value:m="on",onCheckedChange:h,form:v,...x}=e,[b,y]=S.useState(null),k=ft(r,D=>y(D)),j=S.useRef(!1),A=b?v||!!b.closest("form"):!0,[C=!1,R]=el({prop:u,defaultProp:c,onChange:h});return o.jsxs(aR,{scope:a,checked:C,disabled:f,children:[o.jsx(Ge.button,{type:"button",role:"switch","aria-checked":C,"aria-required":d,"data-state":eS(C),"data-disabled":f?"":void 0,disabled:f,value:m,...x,ref:k,onClick:Te(e.onClick,D=>{R(B=>!B),A&&(j.current=D.isPropagationStopped(),j.current||D.stopPropagation())})}),A&&o.jsx(iR,{control:b,bubbles:!j.current,name:l,value:m,checked:C,required:d,disabled:f,form:v,style:{transform:"translateX(-100%)"}})]})});Zw.displayName=ip;var Jw="SwitchThumb",Ww=S.forwardRef((e,r)=>{const{__scopeSwitch:a,...l}=e,u=lR(Jw,a);return o.jsx(Ge.span,{"data-state":eS(u.checked),"data-disabled":u.disabled?"":void 0,...l,ref:r})});Ww.displayName=Jw;var iR=e=>{const{control:r,checked:a,bubbles:l=!0,...u}=e,c=S.useRef(null),d=ep(a),f=Zm(r);return S.useEffect(()=>{const m=c.current,h=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(h,"checked").set;if(d!==a&&x){const b=new Event("click",{bubbles:l});x.call(m,a),m.dispatchEvent(b)}},[d,a,l]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...u,tabIndex:-1,ref:c,style:{...e.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function eS(e){return e?"checked":"unchecked"}var oR=Zw,sR=Ww;function kb({className:e,...r}){return o.jsx(oR,{"data-slot":"switch",className:_e("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-[#7F7F79] focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:o.jsx(sR,{"data-slot":"switch-thumb",className:"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"})})}function qi(e){return e instanceof Error?e.message:String(e)}const uR={limit_requests:"x-ratelimit-limit-requests",remaining_requests:"x-ratelimit-remaining-requests",limit_tokens:"x-ratelimit-limit-tokens",remaining_tokens:"x-ratelimit-remaining-tokens"};function cR(e){return{name:e.name,base_url:e.base_url,api_key:"",remove_credential:!1,verify_tls:e.verify_tls,timeout_connect:String(e.timeout_connect),timeout_read:String(e.timeout_read),max_concurrency:e.max_concurrency===null?"":String(e.max_concurrency),rate_limit_headers:e.rate_limit_headers?{...e.rate_limit_headers}:{}}}function dR(){const{data:e,loading:r,error:a,reload:l}=Pt(()=>Pe.get("/admin/v1/providers")),[u,c]=S.useState({name:"",base_url:"",api_key:""}),[d,f]=S.useState(!1),[m,h]=S.useState(null),[v,x]=S.useState(!1),[b,y]=S.useState(null),[k,j]=S.useState(null),A=async _=>{_.preventDefault(),f(!0);try{await Pe.post("/admin/v1/providers",{name:u.name.trim(),wire_format:"openai",base_url:u.base_url.trim(),...u.api_key!==""?{api_key:u.api_key}:{}}),Ve.success(`Provider "${u.name.trim()}" registered`),c({name:"",base_url:"",api_key:""}),l()}catch(E){Ve.error(qi(E))}finally{f(!1)}},C=async()=>{if(!m)return;const _=Number(m.timeout_connect),E=Number(m.timeout_read);if(!(_>0)||!(E>0)){Ve.error("Timeouts must be positive seconds");return}const I=m.max_concurrency.trim()===""?0:Number(m.max_concurrency);if(!Number.isInteger(I)||I<0){Ve.error("Max concurrency must be a whole number, or empty for unlimited");return}x(!0);try{const W=Object.keys(m.rate_limit_headers).length>0?m.rate_limit_headers:{};await Pe.patch(`/admin/v1/providers/${encodeURIComponent(m.name)}`,{base_url:m.base_url.trim(),verify_tls:m.verify_tls,timeout_connect:_,timeout_read:E,max_concurrency:I,rate_limit_headers:W,...m.api_key!==""?{api_key:m.api_key}:{},...m.remove_credential?{remove_credential:!0}:{}}),Ve.success(`Provider "${m.name}" updated`),h(null),l()}catch(W){Ve.error(qi(W))}finally{x(!1)}},R=async _=>{try{await Pe.patch(`/admin/v1/providers/${encodeURIComponent(_.name)}`,{enabled:!_.enabled}),l()}catch(E){Ve.error(qi(E))}},D=async _=>{try{await Pe.del(`/admin/v1/providers/${encodeURIComponent(_)}`),Ve.success(`Provider "${_}" deleted`),(k==null?void 0:k.provider)===_&&j(null),l()}catch(E){Ve.error(qi(E))}},B=async _=>{y(_);try{const E=await Pe.get(`/admin/v1/providers/${encodeURIComponent(_)}/discover`);j({provider:_,models:E.models})}catch(E){Ve.error(qi(E))}finally{y(null)}},O=async(_,E)=>{try{await Pe.post("/admin/v1/models",{alias:E,provider:_,upstream_name:E,capabilities:["chat","chat_stream"]}),Ve.success(`Bound "${E}" (chat capabilities; adjust in Models)`),B(_)}catch(I){Ve.error(qi(I))}};return o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Register a provider"}),o.jsxs(ct,{children:["An upstream OpenAI-compatible endpoint (vLLM, SGLang, OpenAI, ...). The base URL includes ",o.jsx("code",{className:"font-mono",children:"/v1"}),"."]})]}),o.jsx(Ze,{children:o.jsxs("form",{onSubmit:A,className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:"p-name",children:"Name"}),o.jsx(Kt,{id:"p-name",placeholder:"vllm-1",value:u.name,onChange:_=>c({...u,name:_.target.value}),required:!0})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:"p-url",children:"Base URL"}),o.jsx(Kt,{id:"p-url",placeholder:"http://10.0.0.5:8000/v1",value:u.base_url,onChange:_=>c({...u,base_url:_.target.value}),required:!0})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:"p-key",children:"Upstream API key (optional)"}),o.jsx(Kt,{id:"p-key",type:"password",autoComplete:"off",value:u.api_key,onChange:_=>c({...u,api_key:_.target.value})})]}),o.jsx("div",{className:"flex items-end",children:o.jsxs(Re,{type:"submit",disabled:d,children:[d&&o.jsx(Tt,{}),"Register"]})})]})})]}),o.jsxs(Qe,{children:[o.jsx(et,{children:o.jsx(tt,{className:"font-serif",children:"Providers"})}),o.jsx(Ze,{children:r&&!e?o.jsx(Tt,{}):a?o.jsx("p",{className:"text-sm text-destructive",children:a}):o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[o.jsx(ge,{children:"Name"}),o.jsx(ge,{children:"Base URL"}),o.jsx(ge,{children:"Credential"}),o.jsx(ge,{title:"Read timeout ยท max concurrency",children:"Limits"}),o.jsx(ge,{children:"Enabled"}),o.jsx(ge,{className:"w-56"})]})}),o.jsxs(vn,{children:[(e==null?void 0:e.providers.length)===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:6,className:"text-muted-foreground",children:"No providers registered yet."})}),e==null?void 0:e.providers.map(_=>(m==null?void 0:m.name)===_.name?o.jsxs(Ue,{className:"bg-muted/30 hover:bg-muted/30",children:[o.jsx(me,{className:"align-top font-medium",children:_.name}),o.jsx(me,{colSpan:5,children:o.jsxs("div",{className:"flex flex-col gap-4 py-1",children:[o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:"e-url",children:"Base URL"}),o.jsx(Kt,{id:"e-url",value:m.base_url,onChange:E=>h({...m,base_url:E.target.value})})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:"e-key",children:"Upstream API key"}),o.jsx(Kt,{id:"e-key",type:"password",autoComplete:"off",placeholder:_.has_credential?"unchanged":"none",value:m.api_key,disabled:m.remove_credential,onChange:E=>h({...m,api_key:E.target.value})}),_.has_credential&&o.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[o.jsx(lp,{checked:m.remove_credential,onCheckedChange:E=>h({...m,remove_credential:E===!0})}),"Remove the stored key"]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:"e-conc",children:"Max concurrency"}),o.jsx(Kt,{id:"e-conc",inputMode:"numeric",placeholder:"unlimited",value:m.max_concurrency,onChange:E=>h({...m,max_concurrency:E.target.value})})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:"e-connect",children:"Connect timeout (s)"}),o.jsx(Kt,{id:"e-connect",inputMode:"decimal",value:m.timeout_connect,onChange:E=>h({...m,timeout_connect:E.target.value})})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:"e-read",children:"Read timeout (s)"}),o.jsx(Kt,{id:"e-read",inputMode:"decimal",value:m.timeout_read,onChange:E=>h({...m,timeout_read:E.target.value})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Caps the wait for a response; whole request on non-streaming calls."})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:"e-tls",children:"Verify TLS"}),o.jsx(kb,{id:"e-tls",checked:m.verify_tls,onCheckedChange:E=>h({...m,verify_tls:E})})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Xt,{children:"Rate limit headers"}),Object.keys(m.rate_limit_headers).length===0&&o.jsx(Re,{variant:"outline",size:"sm",type:"button",onClick:()=>h({...m,rate_limit_headers:{...uR}}),children:"Use standard headers"}),Object.keys(m.rate_limit_headers).length>0&&o.jsx(Re,{variant:"outline",size:"sm",type:"button",onClick:()=>h({...m,rate_limit_headers:{}}),children:"Clear"})]}),Object.keys(m.rate_limit_headers).length>0&&o.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:Object.entries(m.rate_limit_headers).map(([E,I])=>o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:E}),o.jsx(Kt,{value:I,onChange:W=>h({...m,rate_limit_headers:{...m.rate_limit_headers,[E]:W.target.value}})})]},E))}),Object.keys(m.rate_limit_headers).length===0&&o.jsx("p",{className:"text-xs text-muted-foreground",children:'Not configured. Click "Use standard headers" to track upstream rate limits.'})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(Re,{size:"sm",disabled:v,onClick:C,children:[v&&o.jsx(Tt,{}),"Save"]}),o.jsx(Re,{variant:"outline",size:"sm",onClick:()=>h(null),children:"Cancel"})]})]})})]},_.name):o.jsxs(Ue,{children:[o.jsx(me,{className:"font-medium wrap-anywhere",children:_.name}),o.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:_.base_url}),o.jsx(me,{children:_.has_credential?o.jsx(dn,{variant:"secondary",children:"set"}):o.jsx(dn,{variant:"muted",children:"none"})}),o.jsxs(me,{className:"whitespace-nowrap text-xs text-muted-foreground",title:"Read timeout ยท max concurrency",children:[_.timeout_read,"s ยท"," ",_.max_concurrency===null?"unlimited":_.max_concurrency]}),o.jsx(me,{children:o.jsx(kb,{checked:_.enabled,onCheckedChange:()=>R(_),"aria-label":`Enable ${_.name}`})}),o.jsxs(me,{className:"flex items-center justify-end gap-1 whitespace-nowrap",children:[o.jsxs(Re,{variant:"outline",size:"sm",disabled:b===_.name,onClick:()=>B(_.name),children:[b===_.name?o.jsx(Tt,{}):o.jsx(Xl,{}),"Discover models"]}),o.jsx(Re,{variant:"ghost",size:"icon-sm","aria-label":`Edit ${_.name}`,onClick:()=>h(cR(_)),children:o.jsx(e1,{})}),o.jsxs(tl,{children:[o.jsx(nl,{asChild:!0,children:o.jsx(Re,{variant:"ghost",size:"icon-sm","aria-label":`Delete ${_.name}`,children:o.jsx(zm,{})})}),o.jsxs(rl,{children:[o.jsxs(al,{children:[o.jsxs(il,{children:['Delete provider "',_.name,'"?']}),o.jsx(ol,{children:"All model bindings on this provider are deleted with it, and calls to those aliases start failing immediately."})]}),o.jsxs(ll,{children:[o.jsx(ul,{children:"Cancel"}),o.jsx(sl,{onClick:()=>D(_.name),children:"Delete"})]})]})]})]})]},_.name))]})]})})]}),k&&o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsxs(tt,{className:"font-serif",children:['Models on "',k.provider,'"']}),o.jsx(ct,{children:"Read from the upstream's own model list. Binding uses the upstream name as the alias with chat capabilities; refine aliases and capabilities in the Models tab."})]}),o.jsx(Ze,{children:o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[o.jsx(ge,{children:"Upstream name"}),o.jsx(ge,{children:"Bound alias"}),o.jsx(ge,{className:"w-24"})]})}),o.jsxs(vn,{children:[k.models.length===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:3,className:"text-muted-foreground",children:"The upstream reported no models."})}),k.models.map(_=>o.jsxs(Ue,{children:[o.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:_.upstream_name}),o.jsx(me,{children:_.bound_alias?o.jsx(dn,{variant:"secondary",children:_.bound_alias}):o.jsx("span",{className:"text-muted-foreground",children:"not bound"})}),o.jsx(me,{children:!_.bound_alias&&o.jsx(Re,{variant:"outline",size:"sm",onClick:()=>O(k.provider,_.upstream_name),children:"Bind"})})]},_.upstream_name))]})]})})]})]})}function Yu({id:e,value:r,onChange:a,options:l,loading:u,note:c,placeholder:d,className:f}){const[m,h]=S.useState(!1),[v,x]=S.useState(0),[b,y]=S.useState(!1),k=S.useRef(null),j=S.useRef(null),A=S.useRef(!1),C=S.useMemo(()=>{if(!b)return l.slice(0,50);const O=r.trim().toLowerCase();return l.filter(E=>E.value.toLowerCase().includes(O)).slice(0,50)},[l,r,b]),R=()=>{y(!1);const _=l.slice(0,50).findIndex(E=>E.value===r);x(_>=0?_:0),h(!0)};S.useEffect(()=>{const O=_=>{var E;(E=k.current)!=null&&E.contains(_.target)||h(!1)};return document.addEventListener("pointerdown",O),()=>document.removeEventListener("pointerdown",O)},[]);const D=O=>{a(O.value),y(!1),h(!1)},B=O=>{if(O.key==="ArrowDown"||O.key==="ArrowUp"){if(O.preventDefault(),!m){R();return}const _=O.key==="ArrowDown"?1:-1;x(E=>(E+_+C.length)%Math.max(C.length,1))}else O.key==="Enter"&&m&&C[v]?(O.preventDefault(),D(C[v])):O.key==="Escape"&&h(!1)};return o.jsxs("div",{ref:k,className:_e("relative",f),children:[o.jsx(Kt,{ref:j,id:e,role:"combobox","aria-expanded":m,"aria-autocomplete":"list",autoComplete:"off",className:"pr-14 font-mono text-xs",placeholder:d,value:r,onChange:O=>{a(O.target.value),y(!0),x(0),h(!0)},onFocus:R,onKeyDown:B}),o.jsxs("div",{className:"absolute inset-y-0 right-1 flex items-center",children:[u?o.jsx(Tt,{className:"text-muted-foreground mr-1"}):r!==""&&o.jsx("button",{type:"button","aria-label":"Clear",tabIndex:-1,className:"text-muted-foreground hover:text-foreground rounded p-1",onPointerDown:O=>O.preventDefault(),onClick:()=>{var O;a(""),y(!1),x(0),h(!0),(O=j.current)==null||O.focus()},children:o.jsx(Lm,{className:"size-3.5"})}),o.jsx("button",{type:"button","aria-label":"Show options",tabIndex:-1,className:"text-muted-foreground hover:text-foreground rounded p-1",onPointerDown:O=>{O.preventDefault(),A.current=m},onClick:()=>{var O;(O=j.current)==null||O.focus(),A.current?h(!1):R()},children:o.jsx(Ki,{className:_e("size-4 transition-transform",m&&"rotate-180")})})]}),m&&(C.length>0||c)&&o.jsxs("div",{className:"bg-popover absolute z-20 mt-1 max-h-64 w-full overflow-y-auto rounded-md border p-1 shadow-md",children:[c&&o.jsx("p",{className:"text-muted-foreground px-2 py-1.5 text-xs",children:c}),C.map((O,_)=>o.jsxs("button",{type:"button",role:"option","aria-selected":_===v,className:_e("flex w-full items-center justify-between gap-3 rounded-sm px-2 py-1.5 text-left text-xs",_===v&&"bg-accent text-accent-foreground"),onPointerEnter:()=>x(_),onClick:()=>D(O),children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[o.jsx(yc,{className:_e("size-3.5 shrink-0",O.value!==r&&"invisible")}),o.jsx("span",{className:"truncate font-mono",children:O.value})]}),O.hint&&o.jsx("span",{className:"text-muted-foreground shrink-0",children:O.hint})]},O.value))]})]})}var Rh="rovingFocusGroup.onEntryFocus",fR={bubbles:!1,cancelable:!0},Uc="RovingFocusGroup",[hm,tS,hR]=Fm(Uc),[mR,Bc]=vr(Uc,[hR]),[pR,gR]=mR(Uc),nS=S.forwardRef((e,r)=>o.jsx(hm.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(hm.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(xR,{...e,ref:r})})}));nS.displayName=Uc;var xR=S.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,orientation:l,loop:u=!1,dir:c,currentTabStopId:d,defaultCurrentTabStopId:f,onCurrentTabStopIdChange:m,onEntryFocus:h,preventScrollOnEntryFocus:v=!1,...x}=e,b=S.useRef(null),y=ft(r,b),k=Nc(c),[j=null,A]=el({prop:d,defaultProp:f,onChange:m}),[C,R]=S.useState(!1),D=sr(h),B=tS(a),O=S.useRef(!1),[_,E]=S.useState(0);return S.useEffect(()=>{const I=b.current;if(I)return I.addEventListener(Rh,D),()=>I.removeEventListener(Rh,D)},[D]),o.jsx(pR,{scope:a,orientation:l,dir:k,loop:u,currentTabStopId:j,onItemFocus:S.useCallback(I=>A(I),[A]),onItemShiftTab:S.useCallback(()=>R(!0),[]),onFocusableItemAdd:S.useCallback(()=>E(I=>I+1),[]),onFocusableItemRemove:S.useCallback(()=>E(I=>I-1),[]),children:o.jsx(Ge.div,{tabIndex:C||_===0?-1:0,"data-orientation":l,...x,ref:y,style:{outline:"none",...e.style},onMouseDown:Te(e.onMouseDown,()=>{O.current=!0}),onFocus:Te(e.onFocus,I=>{const W=!O.current;if(I.target===I.currentTarget&&W&&!C){const q=new CustomEvent(Rh,fR);if(I.currentTarget.dispatchEvent(q),!q.defaultPrevented){const $=B().filter(U=>U.focusable),X=$.find(U=>U.active),ce=$.find(U=>U.id===j),ee=[X,ce,...$].filter(Boolean).map(U=>U.ref.current);lS(ee,v)}}O.current=!1}),onBlur:Te(e.onBlur,()=>R(!1))})})}),rS="RovingFocusGroupItem",aS=S.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,focusable:l=!0,active:u=!1,tabStopId:c,...d}=e,f=zr(),m=c||f,h=gR(rS,a),v=h.currentTabStopId===m,x=tS(a),{onFocusableItemAdd:b,onFocusableItemRemove:y}=h;return S.useEffect(()=>{if(l)return b(),()=>y()},[l,b,y]),o.jsx(hm.ItemSlot,{scope:a,id:m,focusable:l,active:u,children:o.jsx(Ge.span,{tabIndex:v?0:-1,"data-orientation":h.orientation,...d,ref:r,onMouseDown:Te(e.onMouseDown,k=>{l?h.onItemFocus(m):k.preventDefault()}),onFocus:Te(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:Te(e.onKeyDown,k=>{if(k.key==="Tab"&&k.shiftKey){h.onItemShiftTab();return}if(k.target!==k.currentTarget)return;const j=bR(k,h.orientation,h.dir);if(j!==void 0){if(k.metaKey||k.ctrlKey||k.altKey||k.shiftKey)return;k.preventDefault();let C=x().filter(R=>R.focusable).map(R=>R.ref.current);if(j==="last")C.reverse();else if(j==="prev"||j==="next"){j==="prev"&&C.reverse();const R=C.indexOf(k.currentTarget);C=h.loop?wR(C,R+1):C.slice(R+1)}setTimeout(()=>lS(C))}})})})});aS.displayName=rS;var vR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function yR(e,r){return r!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function bR(e,r,a){const l=yR(e.key,a);if(!(r==="vertical"&&["ArrowLeft","ArrowRight"].includes(l))&&!(r==="horizontal"&&["ArrowUp","ArrowDown"].includes(l)))return vR[l]}function lS(e,r=!1){const a=document.activeElement;for(const l of e)if(l===a||(l.focus({preventScroll:r}),document.activeElement!==a))return}function wR(e,r){return e.map((a,l)=>e[(r+l)%e.length])}var iS=nS,oS=aS,op="Tabs",[SR]=vr(op,[Bc]),sS=Bc(),[jR,sp]=SR(op),uS=S.forwardRef((e,r)=>{const{__scopeTabs:a,value:l,onValueChange:u,defaultValue:c,orientation:d="horizontal",dir:f,activationMode:m="automatic",...h}=e,v=Nc(f),[x,b]=el({prop:l,onChange:u,defaultProp:c});return o.jsx(jR,{scope:a,baseId:zr(),value:x,onValueChange:b,orientation:d,dir:v,activationMode:m,children:o.jsx(Ge.div,{dir:v,"data-orientation":d,...h,ref:r})})});uS.displayName=op;var cS="TabsList",dS=S.forwardRef((e,r)=>{const{__scopeTabs:a,loop:l=!0,...u}=e,c=sp(cS,a),d=sS(a);return o.jsx(iS,{asChild:!0,...d,orientation:c.orientation,dir:c.dir,loop:l,children:o.jsx(Ge.div,{role:"tablist","aria-orientation":c.orientation,...u,ref:r})})});dS.displayName=cS;var fS="TabsTrigger",hS=S.forwardRef((e,r)=>{const{__scopeTabs:a,value:l,disabled:u=!1,...c}=e,d=sp(fS,a),f=sS(a),m=gS(d.baseId,l),h=xS(d.baseId,l),v=l===d.value;return o.jsx(oS,{asChild:!0,...f,focusable:!u,active:v,children:o.jsx(Ge.button,{type:"button",role:"tab","aria-selected":v,"aria-controls":h,"data-state":v?"active":"inactive","data-disabled":u?"":void 0,disabled:u,id:m,...c,ref:r,onMouseDown:Te(e.onMouseDown,x=>{!u&&x.button===0&&x.ctrlKey===!1?d.onValueChange(l):x.preventDefault()}),onKeyDown:Te(e.onKeyDown,x=>{[" ","Enter"].includes(x.key)&&d.onValueChange(l)}),onFocus:Te(e.onFocus,()=>{const x=d.activationMode!=="manual";!v&&!u&&x&&d.onValueChange(l)})})})});hS.displayName=fS;var mS="TabsContent",pS=S.forwardRef((e,r)=>{const{__scopeTabs:a,value:l,forceMount:u,children:c,...d}=e,f=sp(mS,a),m=gS(f.baseId,l),h=xS(f.baseId,l),v=l===f.value,x=S.useRef(v);return S.useEffect(()=>{const b=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(b)},[]),o.jsx(Ir,{present:u||v,children:({present:b})=>o.jsx(Ge.div,{"data-state":v?"active":"inactive","data-orientation":f.orientation,role:"tabpanel","aria-labelledby":m,hidden:!b,id:h,tabIndex:0,...d,ref:r,style:{...e.style,animationDuration:x.current?"0s":void 0},children:b&&c})})});pS.displayName=mS;function gS(e,r){return`${e}-trigger-${r}`}function xS(e,r){return`${e}-content-${r}`}var kR=uS,CR=dS,ER=hS,NR=pS;function mm({className:e,...r}){return o.jsx(kR,{"data-slot":"tabs",className:_e("flex flex-col gap-2",e),...r})}function pm({className:e,...r}){return o.jsx(CR,{"data-slot":"tabs-list",className:_e("bg-[rgb(var(--border))] text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...r})}function lr({className:e,...r}){return o.jsx(ER,{"data-slot":"tabs-trigger",className:_e("data-[state=active]:bg-card dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function Ar({className:e,...r}){return o.jsx(NR,{"data-slot":"tabs-content",className:_e("flex-1 outline-none",e),...r})}const TR=["chat","chat_stream","completions","embeddings","transcription","vision"],Ic=[{unit:"input_tokens",label:"Input $/M",short:"in"},{unit:"output_tokens",label:"Output $/M",short:"out"},{unit:"cached_input_tokens",label:"Cached input $/M",short:"cached"}];function es(e){return e instanceof Error?e.message:String(e)}function AR(e){const r={};for(const{unit:a}of Ic)e[a]!==void 0&&(r[a]=String(e[a]));return r}function Cb(e){const r={};for(const{unit:a}of Ic){const l=(e[a]??"").trim();if(l==="")continue;const u=Number(l);if(!isFinite(u)||u<0)return null;r[a]=u}return r}function Eb({id:e,value:r,onChange:a,inherited:l}){return o.jsx(o.Fragment,{children:Ic.map(({unit:u,label:c})=>o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:`${e}-${u}`,children:c}),o.jsx(Kt,{id:`${e}-${u}`,type:"number",min:"0",step:"any",placeholder:l?"inherited":"unpriced",value:r[u]??"",onChange:d=>a({...r,[u]:d.target.value})})]},u))})}function _R({model:e}){const r=Ic.filter(({unit:a})=>e.pricing[a]!==void 0).map(({unit:a,short:l})=>`${l} ${e.pricing[a]}`);return r.length===0?o.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):o.jsxs("span",{className:"tabular-nums",children:[r.map((a,l)=>o.jsxs("span",{className:"whitespace-nowrap",children:[l>0&&" ยท ",a]},a)),e.pricing_inherited&&o.jsx(dn,{variant:"muted",className:"ml-2",title:"Priced under the upstream model name",children:"inherited"})]})}function Nb({value:e,onChange:r}){return o.jsx(o.Fragment,{children:TR.map(a=>o.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[o.jsx(lp,{checked:e.includes(a),onCheckedChange:l=>r(l===!0?[...e,a]:e.filter(u=>u!==a))}),a]},a))})}function Tb(e,r){return e.filter(a=>a.target===null&&a.alias!==r).map(a=>({value:a.alias,hint:`${a.provider} ยท ${a.upstream_name}`}))}function Ab({value:e,onChange:r}){return o.jsx(mm,{value:e,onValueChange:a=>r(a),children:o.jsxs(pm,{children:[o.jsx(lr,{value:"provider",children:"Provider model"}),o.jsx(lr,{value:"alias",children:"Alias โ†’ model"})]})})}const _b=new Map;function Mb(e){const[r,a]=S.useState([]),[l,u]=S.useState(!1),[c,d]=S.useState(null);S.useEffect(()=>{if(e===""){a([]),d(null);return}const h=_b.get(e);if(h){a(h),d(null);return}let v=!0;return u(!0),d(null),Pe.get(`/admin/v1/providers/${encodeURIComponent(e)}/discover`).then(x=>{v&&(_b.set(e,x.models),a(x.models))}).catch(x=>v&&d(es(x))).finally(()=>v&&u(!1)),()=>{v=!1}},[e]);const f=r.map(h=>({value:h.upstream_name,hint:h.bound_alias?`bound to ${h.bound_alias}`:void 0})),m=e?c?`Could not list this provider's models (${c}). Type the name.`:l?"Asking the provider what it servesโ€ฆ":r.length===0?"The provider listed no models. Type the name.":void 0:"Select a provider to list its models.";return{options:f,loading:l,note:m}}function MR(){var D,B,O,_;const e=Pt(()=>Pe.get("/admin/v1/models")),r=Pt(()=>Pe.get("/admin/v1/providers")),[a,l]=S.useState({kind:"provider",alias:"",provider:"",upstream_name:"",target:"",capabilities:["chat","chat_stream"],prices:{}}),[u,c]=S.useState(!1),[d,f]=S.useState(null),m=Mb(a.kind==="provider"?a.provider:""),h=Mb((d==null?void 0:d.kind)==="provider"?d.provider:""),v=((D=e.data)==null?void 0:D.models)??[],x=S.useRef("");S.useEffect(()=>{if(!(a.kind!=="provider"||a.provider==="")&&x.current!==a.provider&&!(m.loading||m.options.length===0)&&(x.current=a.provider,a.upstream_name.trim()==="")){const E=m.options.find(I=>!I.hint)??m.options[0];l(I=>({...I,upstream_name:E.value}))}},[a.kind,a.provider,a.upstream_name,m.loading,m.options]);const b=E=>E.kind==="alias"?{target:E.target.trim()}:{provider:E.provider,upstream_name:E.upstream_name.trim(),capabilities:E.capabilities},y=E=>E.kind==="alias"?E.target.trim()===""?"Pick the model this one points at":E.alias.trim()===""?"An alias for another model needs its own name":null:E.upstream_name.trim()===""?"Upstream model name is required":E.capabilities.length===0?"Pick at least one capability":null,k=async E=>{E.preventDefault();const I=y(a);if(I){Ve.error(I);return}const W=Cb(a.prices);if(W===null){Ve.error("Prices must be non-negative numbers");return}const q=a.alias.trim()||a.upstream_name.trim();c(!0);try{await Pe.post("/admin/v1/models",{alias:q,...b(a),pricing:Object.keys(W).length>0?W:void 0}),Ve.success(`Model "${q}" bound`),l({...a,alias:"",upstream_name:"",target:"",prices:{}}),e.reload()}catch($){Ve.error(es($))}finally{c(!1)}},j=async()=>{if(!d)return;if(d.alias.trim()===""){Ve.error("Alias is required");return}const E=y(d);if(E){Ve.error(E);return}const I=Cb(d.prices);if(I===null){Ve.error("Prices must be non-negative numbers");return}try{await Pe.patch(`/admin/v1/models/${encodeURIComponent(d.original)}`,{alias:d.alias.trim(),target:d.kind==="alias"?d.target.trim():"",...d.kind==="alias"?{}:b(d),pricing:I}),Ve.success(d.alias.trim()===d.original?`Model "${d.original}" updated`:`Model "${d.original}" renamed to "${d.alias.trim()}"`),f(null),e.reload()}catch(W){Ve.error(es(W))}},A=async(E,I)=>{try{await Pe.patch(`/admin/v1/models/${encodeURIComponent(E)}`,{hidden:I}),Ve.success(I?`Model "${E}" hidden`:`Model "${E}" shown`),e.reload()}catch(W){Ve.error(es(W))}},C=async E=>{try{await Pe.del(`/admin/v1/models/${encodeURIComponent(E)}`),Ve.success(`Model "${E}" deleted`),e.reload()}catch(I){Ve.error(es(I))}},R=o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:"m-alias",children:a.kind==="alias"?"Name":"Alias"}),o.jsx(Kt,{id:"m-alias",placeholder:a.kind==="alias"?"a new name for it":a.upstream_name.trim()||"same as the upstream name",value:a.alias,onChange:E=>l({...a,alias:E.target.value})})]});return o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Bind a model"}),o.jsxs(ct,{children:["A model name is what callers pass as ",o.jsx("code",{className:"font-mono",children:"model"}),"; names are globally unique and serve as soon as they exist (disable the provider to take its models offline). It either points at a provider's model, or at another model already bound, in which case it inherits that one's provider, capabilities and prices. Prices are per million units: a unit left blank records usage as unpriced rather than free."]})]}),o.jsx(Ze,{children:o.jsxs("form",{onSubmit:k,className:"flex flex-col gap-4",children:[o.jsx(Ab,{value:a.kind,onChange:E=>l({...a,kind:E})}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[a.kind==="alias"&&R,a.kind==="provider"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{children:"Provider"}),o.jsxs(ha,{value:a.provider,onValueChange:E=>l({...a,provider:E}),required:!0,children:[o.jsx(pa,{className:"w-full",children:o.jsx(ma,{placeholder:"Select a provider"})}),o.jsx(ga,{children:(B=r.data)==null?void 0:B.providers.map(E=>o.jsx(Br,{value:E.name,children:E.name},E.name))})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:"m-upstream",children:"Upstream model name"}),o.jsx(Yu,{id:"m-upstream",value:a.upstream_name,onChange:E=>l({...a,upstream_name:E}),...m})]})]}):o.jsxs("div",{className:"flex flex-col gap-2 sm:col-span-2",children:[o.jsx(Xt,{htmlFor:"m-target",children:"Model it points at"}),o.jsx(Yu,{id:"m-target",value:a.target,onChange:E=>l({...a,target:E}),options:Tb(v),note:v.some(E=>E.target===null)?void 0:"Bind a provider model first; an alias points at one of those."})]}),a.kind==="provider"&&R]}),o.jsx("div",{className:"grid gap-4 sm:grid-cols-3",children:o.jsx(Eb,{id:"new",value:a.prices,onChange:E=>l({...a,prices:E}),inherited:a.kind==="alias"})}),o.jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-2",children:[a.kind==="provider"?o.jsx(Nb,{value:a.capabilities,onChange:E=>l({...a,capabilities:E})}):o.jsx("span",{className:"text-sm text-muted-foreground",children:"Capabilities are inherited from the model it points at."}),o.jsxs(Re,{type:"submit",disabled:u||(a.kind==="provider"?a.provider===""||a.upstream_name.trim()==="":a.target.trim()===""||a.alias.trim()===""),children:[u&&o.jsx(Tt,{}),"Bind model"]})]})]})})]}),o.jsxs(Qe,{children:[o.jsx(et,{children:o.jsx(tt,{className:"font-serif",children:"Models"})}),o.jsx(Ze,{children:e.loading&&!e.data?o.jsx(Tt,{}):e.error?o.jsx("p",{className:"text-sm text-destructive",children:e.error}):o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[o.jsx(ge,{children:"Alias"}),o.jsx(ge,{children:"Provider"}),o.jsx(ge,{children:"Upstream name"}),o.jsx(ge,{children:"Capabilities"}),o.jsx(ge,{children:"Pricing ($/M)"}),o.jsx(ge,{className:"w-32"})]})}),o.jsxs(vn,{children:[((O=e.data)==null?void 0:O.models.length)===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:6,className:"text-muted-foreground",children:"No model bindings yet. Register a provider first, then bind models here or from provider discovery."})}),(_=e.data)==null?void 0:_.models.map(E=>{var I;return(d==null?void 0:d.original)===E.alias?o.jsx(Ue,{children:o.jsx(me,{colSpan:6,children:o.jsxs("div",{className:"flex flex-col gap-4 py-2",children:[o.jsx(Ab,{value:d.kind,onChange:W=>f({...d,kind:W})}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[d.kind==="provider"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{children:"Provider"}),o.jsxs(ha,{value:d.provider,onValueChange:W=>f({...d,provider:W}),children:[o.jsx(pa,{className:"w-full",children:o.jsx(ma,{})}),o.jsx(ga,{children:(I=r.data)==null?void 0:I.providers.map(W=>o.jsx(Br,{value:W.name,children:W.name},W.name))})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:"edit-upstream",children:"Upstream model name"}),o.jsx(Yu,{id:"edit-upstream",value:d.upstream_name,onChange:W=>f({...d,upstream_name:W}),...h})]})]}):o.jsxs("div",{className:"flex flex-col gap-2 sm:col-span-2",children:[o.jsx(Xt,{htmlFor:"edit-target",children:"Model it points at"}),o.jsx(Yu,{id:"edit-target",value:d.target,onChange:W=>f({...d,target:W}),options:Tb(v,d.original)})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(Xt,{htmlFor:"edit-alias",children:"Name"}),o.jsx(Kt,{id:"edit-alias",value:d.alias,onChange:W=>f({...d,alias:W.target.value})})]})]}),o.jsx("div",{className:"grid gap-4 sm:grid-cols-3",children:o.jsx(Eb,{id:"edit",value:d.prices,onChange:W=>f({...d,prices:W}),inherited:d.kind==="alias"})}),o.jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-2",children:[d.kind==="provider"?o.jsx(Nb,{value:d.capabilities,onChange:W=>f({...d,capabilities:W})}):o.jsx("span",{className:"text-sm text-muted-foreground",children:"Capabilities are inherited from the model it points at."}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Re,{size:"sm",onClick:j,children:"Save"}),o.jsx(Re,{variant:"ghost",size:"sm",onClick:()=>f(null),children:"Cancel"})]})]})]})})},E.alias):o.jsxs(Ue,{children:[o.jsx(me,{className:"font-medium wrap-anywhere",children:o.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[E.alias,E.hidden&&o.jsx(dn,{variant:"muted",children:"hidden"})]})}),o.jsx(me,{className:"wrap-anywhere",children:E.provider}),o.jsx(me,{className:"font-mono text-xs wrap-anywhere",children:E.target?o.jsxs("span",{className:"flex flex-col",children:[o.jsxs("span",{children:["โ†’ ",E.target]}),o.jsx("span",{className:"text-muted-foreground",children:E.upstream_name})]}):E.upstream_name}),o.jsx(me,{children:o.jsx("div",{className:"flex flex-wrap gap-1",children:E.capabilities.map(W=>o.jsx(dn,{variant:"muted",children:W},W))})}),o.jsx(me,{className:"text-sm",children:o.jsx(_R,{model:E})}),o.jsxs(me,{className:"whitespace-nowrap",children:[o.jsx(Re,{variant:"ghost",size:"icon-sm","aria-label":E.hidden?`Show ${E.alias}`:`Hide ${E.alias}`,title:"Hidden from the model list. It still answers calls.",onClick:()=>A(E.alias,!E.hidden),children:E.hidden?o.jsx($E,{}):o.jsx(FE,{})}),o.jsx(Re,{variant:"ghost",size:"icon-sm","aria-label":`Edit ${E.alias}`,onClick:()=>f({original:E.alias,kind:E.target?"alias":"provider",alias:E.alias,provider:E.provider,upstream_name:E.upstream_name,target:E.target??"",capabilities:[...E.capabilities],prices:E.pricing_inherited?{}:AR(E.pricing)}),children:o.jsx(e1,{})}),o.jsxs(tl,{children:[o.jsx(nl,{asChild:!0,children:o.jsx(Re,{variant:"ghost",size:"icon-sm","aria-label":`Delete ${E.alias}`,children:o.jsx(zm,{})})}),o.jsxs(rl,{children:[o.jsxs(al,{children:[o.jsxs(il,{children:['Delete model "',E.alias,'"?']}),o.jsx(ol,{children:"Callers using this name get model_not_found immediately. Usage history is kept, and a model other names point at cannot be deleted until they are."})]}),o.jsxs(ll,{children:[o.jsx(ul,{children:"Cancel"}),o.jsx(sl,{onClick:()=>C(E.alias),children:"Delete"})]})]})]})]})]},E.alias)})]})]})})]})]})}const Dh=[{key:"24h",label:"Last 24 hours",hours:24},{key:"7d",label:"Last 7 days",hours:168},{key:"30d",label:"Last 30 days",hours:720},{key:"all",label:"All time",hours:0},{key:"custom",label:"Custom range",hours:0}],RR=[25,50,100,200],DR=[{value:"failed",label:"Errors only"},{value:"upstream_error",label:"Provider errors"},{value:"unreachable",label:"Unreachable"},{value:"cancelled",label:"Cancelled"},{value:"ok",label:"OK only"}];function OR(e){return e?`${e}T00:00:00Z`:null}function zR(e){if(!e)return null;const r=new Date(`${e}T00:00:00Z`);return r.setUTCDate(r.getUTCDate()+1),r.toISOString()}function LR(e){const r=new Date(e);return isNaN(r.getTime())?e:r.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function UR({row:e}){return e.cancelled?o.jsx(dn,{variant:"warning",children:"cancelled"}):e.outcome==="ok"?o.jsx(dn,{variant:"success",children:"ok"}):o.jsxs(dn,{variant:"destructive",children:[e.error_kind||e.outcome,e.status_code?` ยท ${e.status_code}`:""]})}function BR({row:e}){return o.jsxs("span",{className:"flex items-baseline",children:[o.jsx("span",{className:"max-w-36 truncate",title:e.principal,children:e.principal}),e.key_suffix&&o.jsxs("span",{className:"ml-1.5 shrink-0 font-mono text-xs text-muted-foreground",title:e.key_label||void 0,children:["ยทยทยท",e.key_suffix]})]})}function IR({row:e}){const r=oa(e.tags,"app");return r?o.jsx(dn,{variant:"tag",size:"sm",className:"max-w-full font-mono",title:r,children:o.jsx("span",{className:"min-w-0 truncate",children:r})}):e.client?o.jsx("span",{className:"font-mono text-xs text-muted-foreground",title:e.client,children:ns(e.client)}):o.jsx("span",{className:"text-muted-foreground",children:"โ€”"})}function HR({row:e}){const r=e.units.input_tokens,a=e.units.output_tokens;return!r&&!a?o.jsx("span",{className:"text-muted-foreground",children:"โ€”"}):o.jsxs("span",{className:"whitespace-nowrap tabular-nums",children:[De(r??0),o.jsx("span",{className:"text-muted-foreground",children:" โ†’ "}),De(a??0)]})}function _r({label:e,children:r}){return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:e}),o.jsx("span",{className:"text-sm",children:r})]})}function qR({row:e}){const r=Object.entries(e.units).sort();return o.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-3 py-2 md:grid-cols-4",children:[o.jsx(_r,{label:"Provider",children:o.jsx("span",{className:"font-mono text-xs",children:e.provider||"โ€”"})}),o.jsx(_r,{label:"Endpoint",children:e.endpoint}),o.jsx(_r,{label:"Key",children:e.key_suffix?o.jsxs("span",{className:"font-mono text-xs",children:[e.key_label?`${e.key_label} `:"","ยทยทยท",e.key_suffix]}):"โ€”"}),o.jsx(_r,{label:"Recorded (UTC)",children:o.jsx("span",{className:"font-mono text-xs",children:e.ts.replace("T"," ").slice(0,19)})}),o.jsx(_r,{label:"Client",children:o.jsx("span",{className:"break-all font-mono text-xs",children:e.client||"โ€”"})}),o.jsx(_r,{label:"Tags",children:e.tags?o.jsx("span",{className:"flex flex-wrap gap-1",children:L2(e.tags).map(a=>o.jsx(dn,{variant:"tag",size:"sm",className:"font-mono",children:a},a))}):"โ€”"}),o.jsxs(_r,{label:"Outcome",children:[e.outcome,e.error_kind?` ยท ${e.error_kind}`:"",e.status_code?` ยท http ${e.status_code}`:"",e.streamed?" ยท streamed":""]}),o.jsx(_r,{label:"Cost",children:e.cost!==null?o.jsx("span",{className:"tabular-nums",children:_m(e.cost)}):e.unpriced?o.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):"โ€”"}),r.map(([a,l])=>o.jsx(_r,{label:a.replaceAll("_"," "),children:o.jsx("span",{className:"tabular-nums",children:qt(l)||"0"})},a)),o.jsx(_r,{label:"Duration",children:o.jsxs("span",{className:"tabular-nums",children:[mn(e.duration_ms)," ms"]})})]})}function PR(){var Ie,Be,Mt,Ct,Et,Lt,Rt,Dt,zt;const e=S.useMemo(()=>new URLSearchParams(window.location.search),[]),[r,a]=S.useState("7d"),[l,u]=S.useState(""),[c,d]=S.useState(""),[f,m]=S.useState(e.get("principal")??""),[h,v]=S.useState(""),[x,b]=S.useState(""),[y,k]=S.useState(e.get("model")??""),[j,A]=S.useState(e.get("provider")??""),[C,R]=S.useState(e.get("app")??""),[D,B]=S.useState(e.get("outcome")??""),[O,_]=S.useState(50),[E,I]=S.useState(0),[W,q]=S.useState(null),[$,X]=S.useState(0),ce=()=>X(we=>we+1),le=r==="custom",ee=Dh.find(we=>we.key===r)??Dh[1],{since:U,until:Z}=S.useMemo(()=>le?{since:OR(l),until:zR(c)}:ee.hours?{since:new Date(Date.now()-ee.hours*36e5).toISOString(),until:null}:{since:null,until:null},[r,le,l,c,$]),ie=(U?`&since=${encodeURIComponent(U)}`:"")+(Z?`&until=${encodeURIComponent(Z)}`:""),K=(f?`&principal=${encodeURIComponent(f)}`:"")+(h?`&key=${encodeURIComponent(h)}`:"")+(x?`&client=${encodeURIComponent(x)}`:"")+(y?`&model=${encodeURIComponent(y)}`:"")+(j?`&provider=${encodeURIComponent(j)}`:"")+(C?`&tag=${encodeURIComponent(`app:${C}`)}`:"")+(D?`&outcome=${encodeURIComponent(D)}`:""),N=Pt(()=>Pe.get(`/stats/requests?limit=${O}&offset=${E*O}`+ie+K),[$,U,Z,f,h,x,y,j,C,D,O,E]),L=Pt(()=>Pe.get("/stats/requests/facets"+(ie?"?"+ie.slice(1):"")),[$,U,Z]),F=E===0&&!le;S.useEffect(()=>{if(!F)return;const we=setInterval(ce,3e4);return()=>clearInterval(we)},[F]);function M(we){return mt=>{we(mt),I(0),q(null)}}const oe=(((Ie=L.data)==null?void 0:Ie.keys)??[]).map(we=>({value:we.id,label:`${we.principal} ยท ${we.label||`โ€ฆ${we.key_suffix}`}`})),G=[...new Set((((Be=L.data)==null?void 0:Be.clients)??[]).map(we=>ns(we)))].sort(),ue=[...new Set((((Mt=L.data)==null?void 0:Mt.tags)??[]).filter(we=>we.startsWith("app:")).map(we=>we.slice(4)))].sort(),re=f||h||x||y||j||C||D;function ye(){m(""),v(""),b(""),k(""),A(""),R(""),B(""),I(0),q(null)}const de=((Ct=N.data)==null?void 0:Ct.total)??0,be=((Et=N.data)==null?void 0:Et.requests.length)??0,Ee=de===0?0:E*O+1,Se=Math.max(1,Math.ceil(de/O));return o.jsxs(Qe,{children:[o.jsxs(et,{className:"flex flex-row items-start justify-between",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx(tt,{className:"font-serif",children:"Request explorer"}),o.jsx(ct,{children:"Metadata only; content is never stored. Click a row for details."})]}),o.jsx(Re,{variant:"outline",size:"icon-sm","aria-label":"Refresh",onClick:ce,children:o.jsx(Xl,{})})]}),o.jsxs(Ze,{className:"space-y-4",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs(ha,{value:r,onValueChange:M(a),children:[o.jsx(pa,{className:"w-44","aria-label":"Range",children:o.jsx(ma,{})}),o.jsx(ga,{children:Dh.map(we=>o.jsx(Br,{value:we.key,children:we.label},we.key))})]}),le&&o.jsxs(o.Fragment,{children:[o.jsx(Kt,{type:"date",className:"w-40","aria-label":"From (UTC)",value:l,onChange:we=>M(u)(we.target.value)}),o.jsx(Kt,{type:"date",className:"w-40","aria-label":"To (UTC)",value:c,onChange:we=>M(d)(we.target.value)})]}),o.jsx(Wt,{label:"User",value:f,onChange:M(m),options:((Lt=L.data)==null?void 0:Lt.principals)??[],allLabel:"All users"}),o.jsx(Wt,{label:"Key",value:h,onChange:M(v),options:oe,allLabel:"All keys"}),o.jsx(Wt,{label:"Client",value:x,onChange:M(b),options:G,allLabel:"All clients"}),o.jsx(Wt,{label:"App",value:C,onChange:M(R),options:ue,allLabel:"All apps"}),o.jsx(Wt,{label:"Model",value:y,onChange:M(k),options:((Rt=L.data)==null?void 0:Rt.models)??[],allLabel:"All models"}),o.jsx(Wt,{label:"Provider",value:j,onChange:M(A),options:((Dt=L.data)==null?void 0:Dt.providers)??[],allLabel:"All providers"}),o.jsx(Wt,{label:"Outcome",value:D,onChange:M(B),options:DR,allLabel:"All outcomes"}),re&&o.jsxs(Re,{variant:"ghost",size:"sm",onClick:ye,children:[o.jsx(bc,{})," Clear filters"]})]}),N.loading&&!N.data?o.jsx(Tt,{}):N.error?o.jsx("p",{className:"text-sm text-destructive",children:N.error}):o.jsxs(o.Fragment,{children:[o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[o.jsx(ge,{className:"w-6"}),o.jsx(ge,{children:"Time"}),o.jsx(ge,{children:"User"}),o.jsx(ge,{children:"App"}),o.jsx(ge,{children:"Model"}),o.jsx(ge,{children:"Status"}),o.jsx(ge,{className:"text-right",children:"Tokens"}),o.jsx(ge,{className:"text-right",children:"Cost"}),o.jsx(ge,{className:"text-right",children:"Duration"})]})}),o.jsxs(vn,{children:[be===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:9,className:"text-muted-foreground",children:re||U?"No requests match these filters.":"No requests recorded yet."})}),(zt=N.data)==null?void 0:zt.requests.map(we=>o.jsxs(S.Fragment,{children:[o.jsxs(Ue,{className:"cursor-pointer",onClick:()=>q(W===we.id?null:we.id),children:[o.jsx(me,{className:"pr-0",children:o.jsx("button",{type:"button","aria-label":W===we.id?"Hide details":"Show details","aria-expanded":W===we.id,className:"flex cursor-pointer items-center rounded-sm text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring",children:W===we.id?o.jsx(Ki,{className:"size-3.5"}):o.jsx(tm,{className:"size-3.5"})})}),o.jsx(me,{className:"whitespace-nowrap text-xs",title:T0(we.ts),children:LR(we.ts)}),o.jsx(me,{children:o.jsx(BR,{row:we})}),o.jsx(me,{className:"max-w-44",children:o.jsx(IR,{row:we})}),o.jsx(me,{className:"max-w-44 truncate font-mono text-xs",title:we.model||void 0,children:we.model||o.jsx("span",{className:"text-muted-foreground",children:"โ€”"})}),o.jsx(me,{children:o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx(UR,{row:we}),we.streamed&&o.jsx("span",{title:"streamed",children:o.jsx(WE,{className:"size-3 text-muted-foreground","aria-label":"streamed"})})]})}),o.jsx(me,{className:"text-right",title:we.units.input_tokens||we.units.output_tokens?`${qt(we.units.input_tokens)||0} in ยท ${qt(we.units.output_tokens)||0} out`+(we.units.cached_input_tokens?` ยท ${qt(we.units.cached_input_tokens)} cached`:""):void 0,children:o.jsx(HR,{row:we})}),o.jsx(me,{className:"text-right tabular-nums",children:we.cost!==null?_m(we.cost):we.unpriced?o.jsx("span",{className:"text-muted-foreground",children:"unpriced"}):o.jsx("span",{className:"text-muted-foreground",children:"โ€”"})}),o.jsx(me,{className:"text-right tabular-nums",children:Jh(we.duration_ms)})]}),W===we.id&&o.jsxs(Ue,{className:"bg-muted/30 hover:bg-muted/30",children:[o.jsx(me,{}),o.jsx(me,{colSpan:8,children:o.jsx(qR,{row:we})})]})]},we.id))]})]}),o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:de===0?"No requests":`Showing ${mn(Ee)}โ€“${mn(Ee+be-1)} of ${mn(de)}`}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(ha,{value:String(O),onValueChange:we=>M(_)(Number(we)),children:[o.jsx(pa,{className:"w-32","aria-label":"Page size",children:o.jsx(ma,{})}),o.jsx(ga,{children:RR.map(we=>o.jsxs(Br,{value:String(we),children:[we," per page"]},we))})]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:["Page ",E+1," of ",mn(Se)]}),o.jsx(Re,{variant:"outline",size:"icon-sm","aria-label":"Previous page",disabled:E===0,onClick:()=>{I(E-1),q(null)},children:o.jsx(HE,{})}),o.jsx(Re,{variant:"outline",size:"icon-sm","aria-label":"Next page",disabled:E+1>=Se,onClick:()=>{I(E+1),q(null)},children:o.jsx(tm,{})})]})]})]})]})]})}function $R(e){return e instanceof Error?e.message:String(e)}function FR(){const{data:e,loading:r,error:a}=Pt(()=>Pe.get("/admin/v1/principals?limit=500")),l=(e==null?void 0:e.principals.filter(u=>u.kind==="user"))??[];return o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Users"}),o.jsx(ct,{children:"People appear after their first sign-in."})]}),o.jsx(Ze,{children:r&&!e?o.jsx(Tt,{}):a?o.jsx("p",{className:"text-sm text-destructive",children:a}):o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[o.jsx(ge,{children:"Name"}),o.jsx(ge,{children:"Role"}),o.jsx(ge,{className:"w-24"})]})}),o.jsxs(vn,{children:[l.length===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:3,className:"text-muted-foreground",children:"No users yet."})}),l.map(u=>o.jsxs(Ue,{children:[o.jsx(me,{className:"wrap-anywhere",children:u.name}),o.jsx(me,{children:u.role==="admin"?o.jsx(dn,{variant:"secondary",children:"admin"}):"member"}),o.jsx(me,{className:"text-right whitespace-nowrap",children:o.jsx(VR,{principal:u})})]},u.id))]})]})})]})}function VR({principal:e}){const r=async()=>{try{await Pe.post(`/admin/v1/principals/${e.id}/revoke-sessions`),Ve.success(`Signed out ${e.name}`)}catch(a){Ve.error($R(a))}};return o.jsxs(tl,{children:[o.jsx(nl,{asChild:!0,children:o.jsx(Re,{variant:"ghost",size:"sm",children:"Sign out"})}),o.jsxs(rl,{children:[o.jsxs(al,{children:[o.jsxs(il,{children:["Sign out ",e.name," everywhere?"]}),o.jsx(ol,{children:"Their sessions end now. API keys keep working."})]}),o.jsxs(ll,{children:[o.jsx(ul,{children:"Cancel"}),o.jsx(sl,{onClick:r,children:"Sign out"})]})]})]})}function Oh(e){return e instanceof Error?e.message:String(e)}function GR(){const{data:e,loading:r,error:a,reload:l}=Pt(async()=>{const[{principals:k},{keys:j}]=await Promise.all([Pe.get("/admin/v1/principals?limit=500"),Pe.get("/admin/v1/keys?limit=500")]),A=new Set(k.filter(C=>C.kind==="service").map(C=>C.name));return{users:new Set(k.filter(C=>C.kind==="user").map(C=>C.name)),services:A,keys:j.filter(C=>C.principal&&A.has(C.principal))}}),[u,c]=S.useState(""),[d,f]=S.useState(!1),[m,h]=S.useState(null),v=async k=>{const j=await Pe.post("/admin/v1/keys",{principal:k,label:""});h(j),l()},x=async k=>{if(k.preventDefault(),e!=null&&e.users.has(u)){Ve.error(`"${u}" is a user, not a service`);return}f(!0);try{if(!(e!=null&&e.services.has(u)))try{await Pe.post("/admin/v1/principals",{name:u,kind:"service",role:"member"})}catch(j){if(!(j instanceof xc&&j.code==="principal_exists"))throw j}await v(u),c("")}catch(j){Ve.error(Oh(j))}finally{f(!1)}},b=async k=>{try{await v(k.principal??""),await Pe.del(`/admin/v1/keys/${k.id}`),l()}catch(j){Ve.error(Oh(j))}},y=async k=>{try{await Pe.del(`/admin/v1/keys/${k}`),Ve.success("Key deleted"),l()}catch(j){Ve.error(Oh(j))}};return o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Services"}),o.jsx(ct,{children:"API keys for machines and shared tools rather than people."})]}),o.jsxs(Ze,{className:"flex flex-col gap-4",children:[o.jsxs("form",{onSubmit:x,className:"flex flex-wrap items-center gap-2",children:[o.jsx(Kt,{className:"w-64",placeholder:"Name (e.g. batch-service)",maxLength:120,pattern:"[a-z0-9][a-z0-9._\\-]*",title:"lowercase letters, digits, dots, dashes, underscores",required:!0,value:u,onChange:k=>c(k.target.value)}),o.jsxs(Re,{type:"submit",disabled:d,children:[d&&o.jsx(Tt,{}),"Create service"]})]}),m&&o.jsxs("div",{className:"rounded-md border border-primary/40 bg-primary/5 p-4",children:[o.jsxs("p",{className:"mb-2 text-sm font-medium",children:["Key for ",m.principal," โ€” copy it now, it will not be shown again."]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 overflow-x-auto rounded bg-background px-2 py-1.5 font-mono text-sm",children:m.key}),o.jsx(Re,{variant:"outline",size:"icon-sm","aria-label":"Copy key",onClick:()=>{navigator.clipboard.writeText(m.key??""),Ve.success("Copied to clipboard")},children:o.jsx(Om,{})})]})]}),r&&!e?o.jsx(Tt,{}):a?o.jsx("p",{className:"text-sm text-destructive",children:a}):o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[o.jsx(ge,{children:"Service"}),o.jsx(ge,{children:"Key"}),o.jsx(ge,{children:"Created"}),o.jsx(ge,{children:"Last used"}),o.jsx(ge,{className:"w-40"})]})}),o.jsxs(vn,{children:[(e==null?void 0:e.keys.length)===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:5,className:"text-muted-foreground",children:"No services yet."})}),e==null?void 0:e.keys.map(k=>o.jsxs(Ue,{children:[o.jsx(me,{className:"wrap-anywhere",children:k.principal}),o.jsxs(me,{className:"font-mono text-xs",children:["***",k.key_suffix]}),o.jsx(me,{className:"whitespace-nowrap",children:Wa(k.created_at)}),o.jsx(me,{className:"whitespace-nowrap",children:Wa(k.last_used_at)||"never"}),o.jsxs(me,{className:"text-right whitespace-nowrap",children:[o.jsxs(tl,{children:[o.jsx(nl,{asChild:!0,children:o.jsx(Re,{variant:"ghost",size:"sm",children:"Rotate"})}),o.jsxs(rl,{children:[o.jsxs(al,{children:[o.jsxs(il,{children:["Rotate the key of ",k.principal,"?"]}),o.jsx(ol,{children:"The old key stops working immediately."})]}),o.jsxs(ll,{children:[o.jsx(ul,{children:"Cancel"}),o.jsx(sl,{onClick:()=>b(k),children:"Rotate"})]})]})]}),o.jsxs(tl,{children:[o.jsx(nl,{asChild:!0,children:o.jsx(Re,{variant:"ghost",size:"sm",children:"Delete"})}),o.jsxs(rl,{children:[o.jsxs(al,{children:[o.jsxs(il,{children:["Delete ",k.principal,"?"]}),o.jsx(ol,{children:"Its key stops working immediately."})]}),o.jsxs(ll,{children:[o.jsx(ul,{children:"Cancel"}),o.jsx(sl,{onClick:()=>y(k.id),children:"Delete"})]})]})]})]})]},k.id))]})]})]})]})}function YR(){const{data:e,loading:r,error:a,reload:l}=Pt(()=>Pe.get("/admin/v1/keys?limit=500")),[u,c]=S.useState(""),d=u.trim().toLowerCase(),f=((e==null?void 0:e.keys)??[]).filter(h=>`${h.principal} ${h.label} ${h.key_suffix}`.toLowerCase().includes(d)),m=async h=>{try{await Pe.del(`/admin/v1/keys/${h}`),Ve.success("Key deleted"),l()}catch(v){Ve.error(v instanceof Error?v.message:String(v))}};return o.jsxs(Qe,{children:[o.jsx(et,{children:o.jsx(tt,{className:"font-serif",children:"All keys"})}),o.jsxs(Ze,{className:"flex flex-col gap-4",children:[o.jsx(Kt,{className:"w-64",placeholder:"Filter by owner, label or suffix",value:u,onChange:h=>c(h.target.value)}),r&&!e?o.jsx(Tt,{}):a?o.jsx("p",{className:"text-sm text-destructive",children:a}):o.jsxs(gn,{children:[o.jsx(xn,{children:o.jsxs(Ue,{children:[o.jsx(ge,{children:"Owner"}),o.jsx(ge,{children:"Label"}),o.jsx(ge,{children:"Key"}),o.jsx(ge,{children:"Created"}),o.jsx(ge,{children:"Last used"}),o.jsx(ge,{className:"w-24"})]})}),o.jsxs(vn,{children:[f.length===0&&o.jsx(Ue,{children:o.jsx(me,{colSpan:6,className:"text-muted-foreground",children:e!=null&&e.keys.length?"No match.":"No keys yet."})}),f.map(h=>o.jsxs(Ue,{children:[o.jsx(me,{className:"wrap-anywhere",children:h.principal}),o.jsx(me,{className:"wrap-anywhere",children:h.label||o.jsx("span",{className:"text-muted-foreground",children:"(no label)"})}),o.jsxs(me,{className:"font-mono text-xs",children:["***",h.key_suffix]}),o.jsx(me,{className:"whitespace-nowrap",children:Wa(h.created_at)}),o.jsx(me,{className:"whitespace-nowrap",children:Wa(h.last_used_at)||"never"}),o.jsx(me,{className:"whitespace-nowrap",children:o.jsxs(tl,{children:[o.jsx(nl,{asChild:!0,children:o.jsx(Re,{variant:"ghost",size:"sm",children:"Delete"})}),o.jsxs(rl,{children:[o.jsxs(al,{children:[o.jsxs(il,{children:["Delete this key of ",h.principal,"?"]}),o.jsx(ol,{children:"It stops working immediately."})]}),o.jsxs(ll,{children:[o.jsx(ul,{children:"Cancel"}),o.jsx(sl,{onClick:()=>m(h.id),children:"Delete"})]})]})]})})]},h.id))]})]})]})]})}function XR(e,r){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const KR=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,QR=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ZR={};function Rb(e,r){return(ZR.jsx?QR:KR).test(e)}const JR=/[ \t\n\f\r]/g;function WR(e){return typeof e=="object"?e.type==="text"?Db(e.value):!1:Db(e)}function Db(e){return e.replace(JR,"")===""}class gs{constructor(r,a,l){this.normal=a,this.property=r,l&&(this.space=l)}}gs.prototype.normal={};gs.prototype.property={};gs.prototype.space=void 0;function vS(e,r){const a={},l={};for(const u of e)Object.assign(a,u.property),Object.assign(l,u.normal);return new gs(a,l,r)}function gm(e){return e.toLowerCase()}class Un{constructor(r,a){this.attribute=a,this.property=r}}Un.prototype.attribute="";Un.prototype.booleanish=!1;Un.prototype.boolean=!1;Un.prototype.commaOrSpaceSeparated=!1;Un.prototype.commaSeparated=!1;Un.prototype.defined=!1;Un.prototype.mustUseProperty=!1;Un.prototype.number=!1;Un.prototype.overloadedBoolean=!1;Un.prototype.property="";Un.prototype.spaceSeparated=!1;Un.prototype.space=void 0;let eD=0;const $e=Kl(),Yt=Kl(),xm=Kl(),xe=Kl(),jt=Kl(),ql=Kl(),Gn=Kl();function Kl(){return 2**++eD}const vm=Object.freeze(Object.defineProperty({__proto__:null,boolean:$e,booleanish:Yt,commaOrSpaceSeparated:Gn,commaSeparated:ql,number:xe,overloadedBoolean:xm,spaceSeparated:jt},Symbol.toStringTag,{value:"Module"})),zh=Object.keys(vm);class up extends Un{constructor(r,a,l,u){let c=-1;if(super(r,a),Ob(this,"space",u),typeof l=="number")for(;++c4&&a.slice(0,4)==="data"&&lD.test(r)){if(r.charAt(4)==="-"){const c=r.slice(5).replace(zb,sD);l="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=r.slice(4);if(!zb.test(c)){let d=c.replace(aD,oD);d.charAt(0)!=="-"&&(d="-"+d),r="data"+d}}u=up}return new u(l,r)}function oD(e){return"-"+e.toLowerCase()}function sD(e){return e.charAt(1).toUpperCase()}const uD=vS([yS,tD,SS,jS,kS],"html"),cp=vS([yS,nD,SS,jS,kS],"svg");function cD(e){return e.join(" ").trim()}var Pi={},Lh,Lb;function dD(){if(Lb)return Lh;Lb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,a=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,u=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,f=/^\s+|\s+$/g,m=` +`,h="/",v="*",x="",b="comment",y="declaration";function k(A,C){if(typeof A!="string")throw new TypeError("First argument must be a string");if(!A)return[];C=C||{};var R=1,D=1;function B(le){var ee=le.match(r);ee&&(R+=ee.length);var U=le.lastIndexOf(m);D=~U?le.length-U:D+le.length}function O(){var le={line:R,column:D};return function(ee){return ee.position=new _(le),W(),ee}}function _(le){this.start=le,this.end={line:R,column:D},this.source=C.source}_.prototype.content=A;function E(le){var ee=new Error(C.source+":"+R+":"+D+": "+le);if(ee.reason=le,ee.filename=C.source,ee.line=R,ee.column=D,ee.source=A,!C.silent)throw ee}function I(le){var ee=le.exec(A);if(ee){var U=ee[0];return B(U),A=A.slice(U.length),ee}}function W(){I(a)}function q(le){var ee;for(le=le||[];ee=$();)ee!==!1&&le.push(ee);return le}function $(){var le=O();if(!(h!=A.charAt(0)||v!=A.charAt(1))){for(var ee=2;x!=A.charAt(ee)&&(v!=A.charAt(ee)||h!=A.charAt(ee+1));)++ee;if(ee+=2,x===A.charAt(ee-1))return E("End of comment missing");var U=A.slice(2,ee-2);return D+=2,B(U),A=A.slice(ee),D+=2,le({type:b,comment:U})}}function X(){var le=O(),ee=I(l);if(ee){if($(),!I(u))return E("property missing ':'");var U=I(c),Z=le({type:y,property:j(ee[0].replace(e,x)),value:U?j(U[0].replace(e,x)):x});return I(d),Z}}function ce(){var le=[];q(le);for(var ee;ee=X();)ee!==!1&&(le.push(ee),q(le));return le}return W(),ce()}function j(A){return A?A.replace(f,x):x}return Lh=k,Lh}var Ub;function fD(){if(Ub)return Pi;Ub=1;var e=Pi&&Pi.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Pi,"__esModule",{value:!0}),Pi.default=a;const r=e(dD());function a(l,u){let c=null;if(!l||typeof l!="string")return c;const d=(0,r.default)(l),f=typeof u=="function";return d.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:v}=m;f?u(h,v,m):v&&(c=c||{},c[h]=v)}),c}return Pi}var Ko={},Bb;function hD(){if(Bb)return Ko;Bb=1,Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,a=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,u=/^-(ms)-/,c=function(h){return!h||a.test(h)||e.test(h)},d=function(h,v){return v.toUpperCase()},f=function(h,v){return"".concat(v,"-")},m=function(h,v){return v===void 0&&(v={}),c(h)?h:(h=h.toLowerCase(),v.reactCompat?h=h.replace(u,f):h=h.replace(l,f),h.replace(r,d))};return Ko.camelCase=m,Ko}var Qo,Ib;function mD(){if(Ib)return Qo;Ib=1;var e=Qo&&Qo.__importDefault||function(u){return u&&u.__esModule?u:{default:u}},r=e(fD()),a=hD();function l(u,c){var d={};return!u||typeof u!="string"||(0,r.default)(u,function(f,m){f&&m&&(d[(0,a.camelCase)(f,c)]=m)}),d}return l.default=l,Qo=l,Qo}var pD=mD();const gD=gc(pD),CS=ES("end"),dp=ES("start");function ES(e){return r;function r(a){const l=a&&a.position&&a.position[e]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function xD(e){const r=dp(e),a=CS(e);if(r&&a)return{start:r,end:a}}function as(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Hb(e.position):"start"in e||"end"in e?Hb(e):"line"in e||"column"in e?ym(e):""}function ym(e){return qb(e&&e.line)+":"+qb(e&&e.column)}function Hb(e){return ym(e&&e.start)+"-"+ym(e&&e.end)}function qb(e){return e&&typeof e=="number"?e:1}class yn extends Error{constructor(r,a,l){super(),typeof a=="string"&&(l=a,a=void 0);let u="",c={},d=!1;if(a&&("line"in a&&"column"in a?c={place:a}:"start"in a&&"end"in a?c={place:a}:"type"in a?c={ancestors:[a],place:a.position}:c={...a}),typeof r=="string"?u=r:!c.cause&&r&&(d=!0,u=r.message,c.cause=r),!c.ruleId&&!c.source&&typeof l=="string"){const m=l.indexOf(":");m===-1?c.ruleId=l:(c.source=l.slice(0,m),c.ruleId=l.slice(m+1))}if(!c.place&&c.ancestors&&c.ancestors){const m=c.ancestors[c.ancestors.length-1];m&&(c.place=m.position)}const f=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=u,this.line=f?f.line:void 0,this.name=as(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=d&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}yn.prototype.file="";yn.prototype.name="";yn.prototype.reason="";yn.prototype.message="";yn.prototype.stack="";yn.prototype.column=void 0;yn.prototype.line=void 0;yn.prototype.ancestors=void 0;yn.prototype.cause=void 0;yn.prototype.fatal=void 0;yn.prototype.place=void 0;yn.prototype.ruleId=void 0;yn.prototype.source=void 0;const fp={}.hasOwnProperty,vD=new Map,yD=/[A-Z]/g,bD=new Set(["table","tbody","thead","tfoot","tr"]),wD=new Set(["td","th"]),NS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function SD(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=r.filePath||void 0;let l;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=_D(a,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");l=AD(a,r.jsx,r.jsxs)}const u={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:l,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?cp:uD,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},c=TS(u,e,void 0);return c&&typeof c!="string"?c:u.create(e,u.Fragment,{children:c||void 0},void 0)}function TS(e,r,a){if(r.type==="element")return jD(e,r,a);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return kD(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return ED(e,r,a);if(r.type==="mdxjsEsm")return CD(e,r);if(r.type==="root")return ND(e,r,a);if(r.type==="text")return TD(e,r)}function jD(e,r,a){const l=e.schema;let u=l;r.tagName.toLowerCase()==="svg"&&l.space==="html"&&(u=cp,e.schema=u),e.ancestors.push(r);const c=_S(e,r.tagName,!1),d=MD(e,r);let f=mp(e,r);return bD.has(r.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!WR(m):!0})),AS(e,d,c,r),hp(d,f),e.ancestors.pop(),e.schema=l,e.create(r,c,d,a)}function kD(e,r){if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];return l.type,e.evaluater.evaluateExpression(l.expression)}cs(e,r.position)}function CD(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);cs(e,r.position)}function ED(e,r,a){const l=e.schema;let u=l;r.name==="svg"&&l.space==="html"&&(u=cp,e.schema=u),e.ancestors.push(r);const c=r.name===null?e.Fragment:_S(e,r.name,!0),d=RD(e,r),f=mp(e,r);return AS(e,d,c,r),hp(d,f),e.ancestors.pop(),e.schema=l,e.create(r,c,d,a)}function ND(e,r,a){const l={};return hp(l,mp(e,r)),e.create(r,e.Fragment,l,a)}function TD(e,r){return r.value}function AS(e,r,a,l){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(r.node=l)}function hp(e,r){if(r.length>0){const a=r.length>1?r:r[0];a&&(e.children=a)}}function AD(e,r,a){return l;function l(u,c,d,f){const h=Array.isArray(d.children)?a:r;return f?h(c,d,f):h(c,d)}}function _D(e,r){return a;function a(l,u,c,d){const f=Array.isArray(c.children),m=dp(l);return r(u,c,d,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function MD(e,r){const a={};let l,u;for(u in r.properties)if(u!=="children"&&fp.call(r.properties,u)){const c=DD(e,u,r.properties[u]);if(c){const[d,f]=c;e.tableCellAlignToStyle&&d==="align"&&typeof f=="string"&&wD.has(r.tagName)?l=f:a[d]=f}}if(l){const c=a.style||(a.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return a}function RD(e,r){const a={};for(const l of r.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&e.evaluater){const c=l.data.estree.body[0];c.type;const d=c.expression;d.type;const f=d.properties[0];f.type,Object.assign(a,e.evaluater.evaluateExpression(f.argument))}else cs(e,r.position);else{const u=l.name;let c;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const f=l.value.data.estree.body[0];f.type,c=e.evaluater.evaluateExpression(f.expression)}else cs(e,r.position);else c=l.value===null?!0:l.value;a[u]=c}return a}function mp(e,r){const a=[];let l=-1;const u=e.passKeys?new Map:vD;for(;++lu?0:u+r:r=r>u?u:r,a=a>0?a:0,l.length<1e4)d=Array.from(l),d.unshift(r,a),e.splice(...d);else for(a&&e.splice(r,a);c0?(Yn(e,e.length,0,r),e):r}const Fb={}.hasOwnProperty;function RS(e){const r={};let a=-1;for(;++a13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"๏ฟฝ":String.fromCodePoint(a)}function xr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Sn=gl(/[A-Za-z]/),pn=gl(/[\dA-Za-z]/),PD=gl(/[#-'*+\--9=?A-Z^-~]/);function cc(e){return e!==null&&(e<32||e===127)}const bm=gl(/\d/),$D=gl(/[\dA-Fa-f]/),FD=gl(/[!-/:-@[-`{-~]/);function ze(e){return e!==null&&e<-2}function kt(e){return e!==null&&(e<0||e===32)}function nt(e){return e===-2||e===-1||e===32}const Hc=gl(new RegExp("\\p{P}|\\p{S}","u")),Gl=gl(/\s/);function gl(e){return r;function r(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function eo(e){const r=[];let a=-1,l=0,u=0;for(;++a55295&&c<57344){const f=e.charCodeAt(a+1);c<56320&&f>56319&&f<57344?(d=String.fromCharCode(c,f),u=1):d="๏ฟฝ"}else d=String.fromCharCode(c);d&&(r.push(e.slice(l,a),encodeURIComponent(d)),l=a+u+1,d=""),u&&(a+=u,u=0)}return r.join("")+e.slice(l)}function ot(e,r,a,l){const u=l?l-1:Number.POSITIVE_INFINITY;let c=0;return d;function d(m){return nt(m)?(e.enter(a),f(m)):r(m)}function f(m){return nt(m)&&c++d))return;const E=r.events.length;let I=E,W,q;for(;I--;)if(r.events[I][0]==="exit"&&r.events[I][1].type==="chunkFlow"){if(W){q=r.events[I][1].end;break}W=!0}for(C(l),_=E;_D;){const O=a[B];r.containerState=O[1],O[0].exit.call(r,e)}a.length=D}function R(){u.write([null]),c=void 0,u=void 0,r.containerState._closeFlow=void 0}}function KD(e,r,a){return ot(e,e.attempt(this.parser.constructs.document,r,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xi(e){if(e===null||kt(e)||Gl(e))return 1;if(Hc(e))return 2}function qc(e,r,a){const l=[];let u=-1;for(;++u1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1;const x={...e[l][1].end},b={...e[a][1].start};Gb(x,-m),Gb(b,m),d={type:m>1?"strongSequence":"emphasisSequence",start:x,end:{...e[l][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:b},c={type:m>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[a][1].start}},u={type:m>1?"strong":"emphasis",start:{...d.start},end:{...f.end}},e[l][1].end={...d.start},e[a][1].start={...f.end},h=[],e[l][1].end.offset-e[l][1].start.offset&&(h=ir(h,[["enter",e[l][1],r],["exit",e[l][1],r]])),h=ir(h,[["enter",u,r],["enter",d,r],["exit",d,r],["enter",c,r]]),h=ir(h,qc(r.parser.constructs.insideSpan.null,e.slice(l+1,a),r)),h=ir(h,[["exit",c,r],["enter",f,r],["exit",f,r],["exit",u,r]]),e[a][1].end.offset-e[a][1].start.offset?(v=2,h=ir(h,[["enter",e[a][1],r],["exit",e[a][1],r]])):v=0,Yn(e,l-1,a-l+3,h),a=l+h.length-v-2;break}}for(a=-1;++a0&&nt(_)?ot(e,R,"linePrefix",c+1)(_):R(_)}function R(_){return _===null||ze(_)?e.check(Yb,j,B)(_):(e.enter("codeFlowValue"),D(_))}function D(_){return _===null||ze(_)?(e.exit("codeFlowValue"),R(_)):(e.consume(_),D)}function B(_){return e.exit("codeFenced"),r(_)}function O(_,E,I){let W=0;return q;function q(ee){return _.enter("lineEnding"),_.consume(ee),_.exit("lineEnding"),$}function $(ee){return _.enter("codeFencedFence"),nt(ee)?ot(_,X,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ee):X(ee)}function X(ee){return ee===f?(_.enter("codeFencedFenceSequence"),ce(ee)):I(ee)}function ce(ee){return ee===f?(W++,_.consume(ee),ce):W>=d?(_.exit("codeFencedFenceSequence"),nt(ee)?ot(_,le,"whitespace")(ee):le(ee)):I(ee)}function le(ee){return ee===null||ze(ee)?(_.exit("codeFencedFence"),E(ee)):I(ee)}}}function oO(e,r,a){const l=this;return u;function u(d){return d===null?a(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c)}function c(d){return l.parser.lazy[l.now().line]?a(d):r(d)}}const Bh={name:"codeIndented",tokenize:uO},sO={partial:!0,tokenize:cO};function uO(e,r,a){const l=this;return u;function u(h){return e.enter("codeIndented"),ot(e,c,"linePrefix",5)(h)}function c(h){const v=l.events[l.events.length-1];return v&&v[1].type==="linePrefix"&&v[2].sliceSerialize(v[1],!0).length>=4?d(h):a(h)}function d(h){return h===null?m(h):ze(h)?e.attempt(sO,d,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||ze(h)?(e.exit("codeFlowValue"),d(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),r(h)}}function cO(e,r,a){const l=this;return u;function u(d){return l.parser.lazy[l.now().line]?a(d):ze(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):ot(e,c,"linePrefix",5)(d)}function c(d){const f=l.events[l.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?r(d):ze(d)?u(d):a(d)}}const dO={name:"codeText",previous:hO,resolve:fO,tokenize:mO};function fO(e){let r=e.length-4,a=3,l,u;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(l=a;++l=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return rthis.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(r,a,l){const u=a||0;this.setCursor(Math.trunc(r));const c=this.right.splice(this.right.length-u,Number.POSITIVE_INFINITY);return l&&Zo(this.left,l),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),Zo(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Zo(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r=4?r(d):e.interrupt(l.parser.constructs.flow,a,r)(d)}}function BS(e,r,a,l,u,c,d,f,m){const h=m||Number.POSITIVE_INFINITY;let v=0;return x;function x(C){return C===60?(e.enter(l),e.enter(u),e.enter(c),e.consume(C),e.exit(c),b):C===null||C===32||C===41||cc(C)?a(C):(e.enter(l),e.enter(d),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(C))}function b(C){return C===62?(e.enter(c),e.consume(C),e.exit(c),e.exit(u),e.exit(l),r):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===62?(e.exit("chunkString"),e.exit(f),b(C)):C===null||C===60||ze(C)?a(C):(e.consume(C),C===92?k:y)}function k(C){return C===60||C===62||C===92?(e.consume(C),y):y(C)}function j(C){return!v&&(C===null||C===41||kt(C))?(e.exit("chunkString"),e.exit(f),e.exit(d),e.exit(l),r(C)):v999||y===null||y===91||y===93&&!m||y===94&&!f&&"_hiddenFootnoteSupport"in d.parser.constructs?a(y):y===93?(e.exit(c),e.enter(u),e.consume(y),e.exit(u),e.exit(l),r):ze(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),v):(e.enter("chunkString",{contentType:"string"}),x(y))}function x(y){return y===null||y===91||y===93||ze(y)||f++>999?(e.exit("chunkString"),v(y)):(e.consume(y),m||(m=!nt(y)),y===92?b:x)}function b(y){return y===91||y===92||y===93?(e.consume(y),f++,x):x(y)}}function HS(e,r,a,l,u,c){let d;return f;function f(b){return b===34||b===39||b===40?(e.enter(l),e.enter(u),e.consume(b),e.exit(u),d=b===40?41:b,m):a(b)}function m(b){return b===d?(e.enter(u),e.consume(b),e.exit(u),e.exit(l),r):(e.enter(c),h(b))}function h(b){return b===d?(e.exit(c),m(d)):b===null?a(b):ze(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),ot(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),v(b))}function v(b){return b===d||b===null||ze(b)?(e.exit("chunkString"),h(b)):(e.consume(b),b===92?x:v)}function x(b){return b===d||b===92?(e.consume(b),v):v(b)}}function ls(e,r){let a;return l;function l(u){return ze(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a=!0,l):nt(u)?ot(e,l,a?"linePrefix":"lineSuffix")(u):r(u)}}const SO={name:"definition",tokenize:kO},jO={partial:!0,tokenize:CO};function kO(e,r,a){const l=this;let u;return c;function c(y){return e.enter("definition"),d(y)}function d(y){return IS.call(l,e,f,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return u=xr(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),m):a(y)}function m(y){return kt(y)?ls(e,h)(y):h(y)}function h(y){return BS(e,v,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function v(y){return e.attempt(jO,x,x)(y)}function x(y){return nt(y)?ot(e,b,"whitespace")(y):b(y)}function b(y){return y===null||ze(y)?(e.exit("definition"),l.parser.defined.push(u),r(y)):a(y)}}function CO(e,r,a){return l;function l(f){return kt(f)?ls(e,u)(f):a(f)}function u(f){return HS(e,c,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return nt(f)?ot(e,d,"whitespace")(f):d(f)}function d(f){return f===null||ze(f)?r(f):a(f)}}const EO={name:"hardBreakEscape",tokenize:NO};function NO(e,r,a){return l;function l(c){return e.enter("hardBreakEscape"),e.consume(c),u}function u(c){return ze(c)?(e.exit("hardBreakEscape"),r(c)):a(c)}}const TO={name:"headingAtx",resolve:AO,tokenize:_O};function AO(e,r){let a=e.length-2,l=3,u,c;return e[l][1].type==="whitespace"&&(l+=2),a-2>l&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(l===a-1||a-4>l&&e[a-2][1].type==="whitespace")&&(a-=l+1===a?2:4),a>l&&(u={type:"atxHeadingText",start:e[l][1].start,end:e[a][1].end},c={type:"chunkText",start:e[l][1].start,end:e[a][1].end,contentType:"text"},Yn(e,l,a-l+1,[["enter",u,r],["enter",c,r],["exit",c,r],["exit",u,r]])),e}function _O(e,r,a){let l=0;return u;function u(v){return e.enter("atxHeading"),c(v)}function c(v){return e.enter("atxHeadingSequence"),d(v)}function d(v){return v===35&&l++<6?(e.consume(v),d):v===null||kt(v)?(e.exit("atxHeadingSequence"),f(v)):a(v)}function f(v){return v===35?(e.enter("atxHeadingSequence"),m(v)):v===null||ze(v)?(e.exit("atxHeading"),r(v)):nt(v)?ot(e,f,"whitespace")(v):(e.enter("atxHeadingText"),h(v))}function m(v){return v===35?(e.consume(v),m):(e.exit("atxHeadingSequence"),f(v))}function h(v){return v===null||v===35||kt(v)?(e.exit("atxHeadingText"),f(v)):(e.consume(v),h)}}const MO=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Kb=["pre","script","style","textarea"],RO={concrete:!0,name:"htmlFlow",resolveTo:zO,tokenize:LO},DO={partial:!0,tokenize:BO},OO={partial:!0,tokenize:UO};function zO(e){let r=e.length;for(;r--&&!(e[r][0]==="enter"&&e[r][1].type==="htmlFlow"););return r>1&&e[r-2][1].type==="linePrefix"&&(e[r][1].start=e[r-2][1].start,e[r+1][1].start=e[r-2][1].start,e.splice(r-2,2)),e}function LO(e,r,a){const l=this;let u,c,d,f,m;return h;function h(M){return v(M)}function v(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),x}function x(M){return M===33?(e.consume(M),b):M===47?(e.consume(M),c=!0,j):M===63?(e.consume(M),u=3,l.interrupt?r:N):Sn(M)?(e.consume(M),d=String.fromCharCode(M),A):a(M)}function b(M){return M===45?(e.consume(M),u=2,y):M===91?(e.consume(M),u=5,f=0,k):Sn(M)?(e.consume(M),u=4,l.interrupt?r:N):a(M)}function y(M){return M===45?(e.consume(M),l.interrupt?r:N):a(M)}function k(M){const oe="CDATA[";return M===oe.charCodeAt(f++)?(e.consume(M),f===oe.length?l.interrupt?r:X:k):a(M)}function j(M){return Sn(M)?(e.consume(M),d=String.fromCharCode(M),A):a(M)}function A(M){if(M===null||M===47||M===62||kt(M)){const oe=M===47,G=d.toLowerCase();return!oe&&!c&&Kb.includes(G)?(u=1,l.interrupt?r(M):X(M)):MO.includes(d.toLowerCase())?(u=6,oe?(e.consume(M),C):l.interrupt?r(M):X(M)):(u=7,l.interrupt&&!l.parser.lazy[l.now().line]?a(M):c?R(M):D(M))}return M===45||pn(M)?(e.consume(M),d+=String.fromCharCode(M),A):a(M)}function C(M){return M===62?(e.consume(M),l.interrupt?r:X):a(M)}function R(M){return nt(M)?(e.consume(M),R):q(M)}function D(M){return M===47?(e.consume(M),q):M===58||M===95||Sn(M)?(e.consume(M),B):nt(M)?(e.consume(M),D):q(M)}function B(M){return M===45||M===46||M===58||M===95||pn(M)?(e.consume(M),B):O(M)}function O(M){return M===61?(e.consume(M),_):nt(M)?(e.consume(M),O):D(M)}function _(M){return M===null||M===60||M===61||M===62||M===96?a(M):M===34||M===39?(e.consume(M),m=M,E):nt(M)?(e.consume(M),_):I(M)}function E(M){return M===m?(e.consume(M),m=null,W):M===null||ze(M)?a(M):(e.consume(M),E)}function I(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||kt(M)?O(M):(e.consume(M),I)}function W(M){return M===47||M===62||nt(M)?D(M):a(M)}function q(M){return M===62?(e.consume(M),$):a(M)}function $(M){return M===null||ze(M)?X(M):nt(M)?(e.consume(M),$):a(M)}function X(M){return M===45&&u===2?(e.consume(M),U):M===60&&u===1?(e.consume(M),Z):M===62&&u===4?(e.consume(M),L):M===63&&u===3?(e.consume(M),N):M===93&&u===5?(e.consume(M),K):ze(M)&&(u===6||u===7)?(e.exit("htmlFlowData"),e.check(DO,F,ce)(M)):M===null||ze(M)?(e.exit("htmlFlowData"),ce(M)):(e.consume(M),X)}function ce(M){return e.check(OO,le,F)(M)}function le(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),ee}function ee(M){return M===null||ze(M)?ce(M):(e.enter("htmlFlowData"),X(M))}function U(M){return M===45?(e.consume(M),N):X(M)}function Z(M){return M===47?(e.consume(M),d="",ie):X(M)}function ie(M){if(M===62){const oe=d.toLowerCase();return Kb.includes(oe)?(e.consume(M),L):X(M)}return Sn(M)&&d.length<8?(e.consume(M),d+=String.fromCharCode(M),ie):X(M)}function K(M){return M===93?(e.consume(M),N):X(M)}function N(M){return M===62?(e.consume(M),L):M===45&&u===2?(e.consume(M),N):X(M)}function L(M){return M===null||ze(M)?(e.exit("htmlFlowData"),F(M)):(e.consume(M),L)}function F(M){return e.exit("htmlFlow"),r(M)}}function UO(e,r,a){const l=this;return u;function u(d){return ze(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):a(d)}function c(d){return l.parser.lazy[l.now().line]?a(d):r(d)}}function BO(e,r,a){return l;function l(u){return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),e.attempt(xs,r,a)}}const IO={name:"htmlText",tokenize:HO};function HO(e,r,a){const l=this;let u,c,d;return f;function f(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),m}function m(N){return N===33?(e.consume(N),h):N===47?(e.consume(N),O):N===63?(e.consume(N),D):Sn(N)?(e.consume(N),I):a(N)}function h(N){return N===45?(e.consume(N),v):N===91?(e.consume(N),c=0,k):Sn(N)?(e.consume(N),R):a(N)}function v(N){return N===45?(e.consume(N),y):a(N)}function x(N){return N===null?a(N):N===45?(e.consume(N),b):ze(N)?(d=x,Z(N)):(e.consume(N),x)}function b(N){return N===45?(e.consume(N),y):x(N)}function y(N){return N===62?U(N):N===45?b(N):x(N)}function k(N){const L="CDATA[";return N===L.charCodeAt(c++)?(e.consume(N),c===L.length?j:k):a(N)}function j(N){return N===null?a(N):N===93?(e.consume(N),A):ze(N)?(d=j,Z(N)):(e.consume(N),j)}function A(N){return N===93?(e.consume(N),C):j(N)}function C(N){return N===62?U(N):N===93?(e.consume(N),C):j(N)}function R(N){return N===null||N===62?U(N):ze(N)?(d=R,Z(N)):(e.consume(N),R)}function D(N){return N===null?a(N):N===63?(e.consume(N),B):ze(N)?(d=D,Z(N)):(e.consume(N),D)}function B(N){return N===62?U(N):D(N)}function O(N){return Sn(N)?(e.consume(N),_):a(N)}function _(N){return N===45||pn(N)?(e.consume(N),_):E(N)}function E(N){return ze(N)?(d=E,Z(N)):nt(N)?(e.consume(N),E):U(N)}function I(N){return N===45||pn(N)?(e.consume(N),I):N===47||N===62||kt(N)?W(N):a(N)}function W(N){return N===47?(e.consume(N),U):N===58||N===95||Sn(N)?(e.consume(N),q):ze(N)?(d=W,Z(N)):nt(N)?(e.consume(N),W):U(N)}function q(N){return N===45||N===46||N===58||N===95||pn(N)?(e.consume(N),q):$(N)}function $(N){return N===61?(e.consume(N),X):ze(N)?(d=$,Z(N)):nt(N)?(e.consume(N),$):W(N)}function X(N){return N===null||N===60||N===61||N===62||N===96?a(N):N===34||N===39?(e.consume(N),u=N,ce):ze(N)?(d=X,Z(N)):nt(N)?(e.consume(N),X):(e.consume(N),le)}function ce(N){return N===u?(e.consume(N),u=void 0,ee):N===null?a(N):ze(N)?(d=ce,Z(N)):(e.consume(N),ce)}function le(N){return N===null||N===34||N===39||N===60||N===61||N===96?a(N):N===47||N===62||kt(N)?W(N):(e.consume(N),le)}function ee(N){return N===47||N===62||kt(N)?W(N):a(N)}function U(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),r):a(N)}function Z(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),ie}function ie(N){return nt(N)?ot(e,K,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):K(N)}function K(N){return e.enter("htmlTextData"),d(N)}}const xp={name:"labelEnd",resolveAll:FO,resolveTo:VO,tokenize:GO},qO={tokenize:YO},PO={tokenize:XO},$O={tokenize:KO};function FO(e){let r=-1;const a=[];for(;++r=3&&(h===null||ze(h))?(e.exit("thematicBreak"),r(h)):a(h)}function m(h){return h===u?(e.consume(h),l++,m):(e.exit("thematicBreakSequence"),nt(h)?ot(e,f,"whitespace")(h):f(h))}}const On={continuation:{tokenize:lz},exit:oz,name:"list",tokenize:az},nz={partial:!0,tokenize:sz},rz={partial:!0,tokenize:iz};function az(e,r,a){const l=this,u=l.events[l.events.length-1];let c=u&&u[1].type==="linePrefix"?u[2].sliceSerialize(u[1],!0).length:0,d=0;return f;function f(y){const k=l.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!l.containerState.marker||y===l.containerState.marker:bm(y)){if(l.containerState.type||(l.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(tc,a,h)(y):h(y);if(!l.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(y)}return a(y)}function m(y){return bm(y)&&++d<10?(e.consume(y),m):(!l.interrupt||d<2)&&(l.containerState.marker?y===l.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),h(y)):a(y)}function h(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||y,e.check(xs,l.interrupt?a:v,e.attempt(nz,b,x))}function v(y){return l.containerState.initialBlankLine=!0,c++,b(y)}function x(y){return nt(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):a(y)}function b(y){return l.containerState.size=c+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(y)}}function lz(e,r,a){const l=this;return l.containerState._closeFlow=void 0,e.check(xs,u,c);function u(f){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,ot(e,r,"listItemIndent",l.containerState.size+1)(f)}function c(f){return l.containerState.furtherBlankLines||!nt(f)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,d(f)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt(rz,r,d)(f))}function d(f){return l.containerState._closeFlow=!0,l.interrupt=void 0,ot(e,e.attempt(On,r,a),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function iz(e,r,a){const l=this;return ot(e,u,"listItemIndent",l.containerState.size+1);function u(c){const d=l.events[l.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===l.containerState.size?r(c):a(c)}}function oz(e){e.exit(this.containerState.type)}function sz(e,r,a){const l=this;return ot(e,u,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function u(c){const d=l.events[l.events.length-1];return!nt(c)&&d&&d[1].type==="listItemPrefixWhitespace"?r(c):a(c)}}const Qb={name:"setextUnderline",resolveTo:uz,tokenize:cz};function uz(e,r){let a=e.length,l,u,c;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){l=a;break}e[a][1].type==="paragraph"&&(u=a)}else e[a][1].type==="content"&&e.splice(a,1),!c&&e[a][1].type==="definition"&&(c=a);const d={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[u][1].type="setextHeadingText",c?(e.splice(u,0,["enter",d,r]),e.splice(c+1,0,["exit",e[l][1],r]),e[l][1].end={...e[c][1].end}):e[l][1]=d,e.push(["exit",d,r]),e}function cz(e,r,a){const l=this;let u;return c;function c(h){let v=l.events.length,x;for(;v--;)if(l.events[v][1].type!=="lineEnding"&&l.events[v][1].type!=="linePrefix"&&l.events[v][1].type!=="content"){x=l.events[v][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||x)?(e.enter("setextHeadingLine"),u=h,d(h)):a(h)}function d(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===u?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),nt(h)?ot(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||ze(h)?(e.exit("setextHeadingLine"),r(h)):a(h)}}const dz={tokenize:fz};function fz(e){const r=this,a=e.attempt(xs,l,e.attempt(this.parser.constructs.flowInitial,u,ot(e,e.attempt(this.parser.constructs.flow,u,e.attempt(xO,u)),"linePrefix")));return a;function l(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),r.currentConstruct=void 0,a}function u(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),r.currentConstruct=void 0,a}}const hz={resolveAll:PS()},mz=qS("string"),pz=qS("text");function qS(e){return{resolveAll:PS(e==="text"?gz:void 0),tokenize:r};function r(a){const l=this,u=this.parser.constructs[e],c=a.attempt(u,d,f);return d;function d(v){return h(v)?c(v):f(v)}function f(v){if(v===null){a.consume(v);return}return a.enter("data"),a.consume(v),m}function m(v){return h(v)?(a.exit("data"),c(v)):(a.consume(v),m)}function h(v){if(v===null)return!0;const x=u[v];let b=-1;if(x)for(;++b-1){const f=d[0];typeof f=="string"?d[0]=f.slice(l):d.shift()}c>0&&d.push(e[u].slice(0,c))}return d}function Az(e,r){let a=-1;const l=[];let u;for(;++a0){const en=fe.tokenStack[fe.tokenStack.length-1];(en[1]||Jb).call(fe,void 0,en[0])}for(z.position={start:Ya(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Ya(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},Oe=-1;++Oe0&&(l.className=["language-"+u[0]]);let c={type:"element",tagName:"code",properties:l,children:[{type:"text",value:a}]};return r.meta&&(c.data={meta:r.meta}),e.patch(r,c),c=e.applyData(r,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(r,c),c}function $z(e,r){const a={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,a),e.applyData(r,a)}function Fz(e,r){const a={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,a),e.applyData(r,a)}function Vz(e,r){const a=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(r.identifier).toUpperCase(),u=eo(l.toLowerCase()),c=e.footnoteOrder.indexOf(l);let d,f=e.footnoteCounts.get(l);f===void 0?(f=0,e.footnoteOrder.push(l),d=e.footnoteOrder.length):d=c+1,f+=1,e.footnoteCounts.set(l,f);const m={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+u,id:a+"fnref-"+u+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(r,m);const h={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(r,h),e.applyData(r,h)}function Gz(e,r){const a={type:"element",tagName:"h"+r.depth,properties:{},children:e.all(r)};return e.patch(r,a),e.applyData(r,a)}function Yz(e,r){if(e.options.allowDangerousHtml){const a={type:"raw",value:r.value};return e.patch(r,a),e.applyData(r,a)}}function VS(e,r){const a=r.referenceType;let l="]";if(a==="collapsed"?l+="[]":a==="full"&&(l+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+l}];const u=e.all(r),c=u[0];c&&c.type==="text"?c.value="["+c.value:u.unshift({type:"text",value:"["});const d=u[u.length-1];return d&&d.type==="text"?d.value+=l:u.push({type:"text",value:l}),u}function Xz(e,r){const a=String(r.identifier).toUpperCase(),l=e.definitionById.get(a);if(!l)return VS(e,r);const u={src:eo(l.url||""),alt:r.alt};l.title!==null&&l.title!==void 0&&(u.title=l.title);const c={type:"element",tagName:"img",properties:u,children:[]};return e.patch(r,c),e.applyData(r,c)}function Kz(e,r){const a={src:eo(r.url)};r.alt!==null&&r.alt!==void 0&&(a.alt=r.alt),r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"img",properties:a,children:[]};return e.patch(r,l),e.applyData(r,l)}function Qz(e,r){const a={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};e.patch(r,a);const l={type:"element",tagName:"code",properties:{},children:[a]};return e.patch(r,l),e.applyData(r,l)}function Zz(e,r){const a=String(r.identifier).toUpperCase(),l=e.definitionById.get(a);if(!l)return VS(e,r);const u={href:eo(l.url||"")};l.title!==null&&l.title!==void 0&&(u.title=l.title);const c={type:"element",tagName:"a",properties:u,children:e.all(r)};return e.patch(r,c),e.applyData(r,c)}function Jz(e,r){const a={href:eo(r.url)};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"a",properties:a,children:e.all(r)};return e.patch(r,l),e.applyData(r,l)}function Wz(e,r,a){const l=e.all(r),u=a?e4(a):GS(r),c={},d=[];if(typeof r.checked=="boolean"){const v=l[0];let x;v&&v.type==="element"&&v.tagName==="p"?x=v:(x={type:"element",tagName:"p",properties:{},children:[]},l.unshift(x)),x.children.length>0&&x.children.unshift({type:"text",value:" "}),x.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let f=-1;for(;++f1}function t4(e,r){const a={},l=e.all(r);let u=-1;for(typeof r.start=="number"&&r.start!==1&&(a.start=r.start);++u0){const d={type:"element",tagName:"tbody",properties:{},children:e.wrap(a,!0)},f=dp(r.children[1]),m=CS(r.children[r.children.length-1]);f&&m&&(d.position={start:f,end:m}),u.push(d)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(u,!0)};return e.patch(r,c),e.applyData(r,c)}function i4(e,r,a){const l=a?a.children:void 0,c=(l?l.indexOf(r):1)===0?"th":"td",d=a&&a.type==="table"?a.align:void 0,f=d?d.length:r.children.length;let m=-1;const h=[];for(;++m0,!0),l[0]),u=l.index+l[0].length,l=a.exec(r);return c.push(t0(r.slice(u),u>0,!1)),c.join("")}function t0(e,r,a){let l=0,u=e.length;if(r){let c=e.codePointAt(l);for(;c===Wb||c===e0;)l++,c=e.codePointAt(l)}if(a){let c=e.codePointAt(u-1);for(;c===Wb||c===e0;)u--,c=e.codePointAt(u-1)}return u>l?e.slice(l,u):""}function u4(e,r){const a={type:"text",value:s4(String(r.value))};return e.patch(r,a),e.applyData(r,a)}function c4(e,r){const a={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,a),e.applyData(r,a)}const d4={blockquote:Hz,break:qz,code:Pz,delete:$z,emphasis:Fz,footnoteReference:Vz,heading:Gz,html:Yz,imageReference:Xz,image:Kz,inlineCode:Qz,linkReference:Zz,link:Jz,listItem:Wz,list:t4,paragraph:n4,root:r4,strong:a4,table:l4,tableCell:o4,tableRow:i4,text:u4,thematicBreak:c4,toml:Xu,yaml:Xu,definition:Xu,footnoteDefinition:Xu};function Xu(){}const YS=-1,Pc=0,is=1,dc=2,vp=3,yp=4,bp=5,wp=6,XS=7,KS=8,QS=typeof self=="object"?self:globalThis,n0=(e,r)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new QS[e](r)},f4=(e,r)=>{const a=(u,c)=>(e.set(c,u),u),l=u=>{if(e.has(u))return e.get(u);const[c,d]=r[u];switch(c){case Pc:case YS:return a(d,u);case is:{const f=a([],u);for(const m of d)f.push(l(m));return f}case dc:{const f=a({},u);for(const[m,h]of d)f[l(m)]=l(h);return f}case vp:return a(new Date(d),u);case yp:{const{source:f,flags:m}=d;return a(new RegExp(f,m),u)}case bp:{const f=a(new Map,u);for(const[m,h]of d)f.set(l(m),l(h));return f}case wp:{const f=a(new Set,u);for(const m of d)f.add(l(m));return f}case XS:{const{name:f,message:m}=d;return a(typeof QS[f]=="function"?n0(f,m):new Error(m),u)}case KS:return a(BigInt(d),u);case"BigInt":return a(Object(BigInt(d)),u);case"ArrayBuffer":return a(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:f}=new Uint8Array(d);return a(new DataView(f),d)}}return a(n0(c,d),u)};return l},r0=e=>f4(new Map,e)(0),Il="",{toString:h4}={},{keys:m4}=Object,Jo=e=>{const r=typeof e;if(r!=="object"||!e)return[Pc,r];const a=h4.call(e).slice(8,-1);switch(a){case"Array":return[is,Il];case"Object":return[dc,Il];case"Date":return[vp,Il];case"RegExp":return[yp,Il];case"Map":return[bp,Il];case"Set":return[wp,Il];case"DataView":return[is,a]}return a.includes("Array")?[is,a]:e instanceof Error?[XS,e.name||"Error"]:[dc,a]},Ku=([e,r])=>e===Pc&&(r==="function"||r==="symbol"),p4=(e,r,a,l)=>{const u=(d,f)=>{const m=l.push(d)-1;return a.set(f,m),m},c=d=>{if(a.has(d))return a.get(d);let[f,m]=Jo(d);switch(f){case Pc:{let v=d;switch(m){case"bigint":f=KS,v=d.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);v=null;break;case"undefined":return u([YS],d)}return u([f,v],d)}case is:{if(m){let b=d;return m==="DataView"?b=new Uint8Array(d.buffer):m==="ArrayBuffer"&&(b=new Uint8Array(d)),u([m,[...b]],d)}const v=[],x=u([f,v],d);for(const b of d)v.push(c(b));return x}case dc:{if(m)switch(m){case"BigInt":return u([m,d.toString()],d);case"Boolean":case"Number":case"String":return u([m,d.valueOf()],d)}if(r&&"toJSON"in d)return c(d.toJSON());const v=[],x=u([f,v],d);for(const b of m4(d))(e||!Ku(Jo(d[b])))&&v.push([c(b),c(d[b])]);return x}case vp:return u([f,isNaN(d.getTime())?Il:d.toISOString()],d);case yp:{const{source:v,flags:x}=d;return u([f,{source:v,flags:x}],d)}case bp:{const v=[],x=u([f,v],d);for(const[b,y]of d)(e||!(Ku(Jo(b))||Ku(Jo(y))))&&v.push([c(b),c(y)]);return x}case wp:{const v=[],x=u([f,v],d);for(const b of d)(e||!Ku(Jo(b)))&&v.push(c(b));return x}}const{message:h}=d;return u([f,{name:m,message:h}],d)};return c},a0=(e,{json:r,lossy:a}={})=>{const l=[];return p4(!(r||a),!!r,new Map,l)(e),l},fc=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?r0(a0(e,r)):structuredClone(e):(e,r)=>r0(a0(e,r));function g4(e,r){const a=[{type:"text",value:"โ†ฉ"}];return r>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),a}function x4(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function v4(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=e.options.footnoteBackContent||g4,l=e.options.footnoteBackLabel||x4,u=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m0&&k.push({type:"text",value:" "});let R=typeof a=="string"?a:a(m,y);typeof R=="string"&&(R={type:"text",value:R}),k.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+b+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(m,y),className:["data-footnote-backref"]},children:Array.isArray(R)?R:[R]})}const A=v[v.length-1];if(A&&A.type==="element"&&A.tagName==="p"){const R=A.children[A.children.length-1];R&&R.type==="text"?R.value+=" ":A.children.push({type:"text",value:" "}),A.children.push(...k)}else v.push(...k);const C={type:"element",tagName:"li",properties:{id:r+"fn-"+b},children:e.wrap(v,!0)};e.patch(h,C),f.push(C)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...fc(d),id:"footnote-label"},children:[{type:"text",value:u}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:` +`}]}}const $c=(function(e){if(e==null)return S4;if(typeof e=="function")return Fc(e);if(typeof e=="object")return Array.isArray(e)?y4(e):b4(e);if(typeof e=="string")return w4(e);throw new Error("Expected function, string, or object as test")});function y4(e){const r=[];let a=-1;for(;++a":""))+")"})}return b;function b(){let y=ZS,k,j,A;if((!r||c(m,h,v[v.length-1]||void 0))&&(y=E4(a(m,v)),y[0]===Sm))return y;if("children"in m&&m.children){const C=m;if(C.children&&y[0]!==C4)for(j=(l?C.children.length:-1)+d,A=v.concat(C);j>-1&&j0&&a.push({type:"text",value:` +`}),a}function l0(e){let r=0,a=e.charCodeAt(r);for(;a===9||a===32;)r++,a=e.charCodeAt(r);return e.slice(r)}function i0(e,r){const a=T4(e,r),l=a.one(e,void 0),u=v4(a),c=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return u&&c.children.push({type:"text",value:` +`},u),c}function D4(e,r){return e&&"run"in e?async function(a,l){const u=i0(a,{file:l,...r});await e.run(u,l)}:function(a,l){return i0(a,{file:l,...e||r})}}function o0(e){if(e)throw e}var Hh,s0;function O4(){if(s0)return Hh;s0=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=function(h){return typeof Array.isArray=="function"?Array.isArray(h):r.call(h)==="[object Array]"},c=function(h){if(!h||r.call(h)!=="[object Object]")return!1;var v=e.call(h,"constructor"),x=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!v&&!x)return!1;var b;for(b in h);return typeof b>"u"||e.call(h,b)},d=function(h,v){a&&v.name==="__proto__"?a(h,v.name,{enumerable:!0,configurable:!0,value:v.newValue,writable:!0}):h[v.name]=v.newValue},f=function(h,v){if(v==="__proto__")if(e.call(h,v)){if(l)return l(h,v).value}else return;return h[v]};return Hh=function m(){var h,v,x,b,y,k,j=arguments[0],A=1,C=arguments.length,R=!1;for(typeof j=="boolean"&&(R=j,j=arguments[1]||{},A=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});Ad.length;let m;f&&d.push(u);try{m=e.apply(this,d)}catch(h){const v=h;if(f&&a)throw v;return u(v)}f||(m&&m.then&&typeof m.then=="function"?m.then(c,u):m instanceof Error?u(m):c(m))}function u(d,...f){a||(a=!0,r(d,...f))}function c(d){u(null,d)}}const Mr={basename:B4,dirname:I4,extname:H4,join:q4,sep:"/"};function B4(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');vs(e);let a=0,l=-1,u=e.length,c;if(r===void 0||r.length===0||r.length>e.length){for(;u--;)if(e.codePointAt(u)===47){if(c){a=u+1;break}}else l<0&&(c=!0,l=u+1);return l<0?"":e.slice(a,l)}if(r===e)return"";let d=-1,f=r.length-1;for(;u--;)if(e.codePointAt(u)===47){if(c){a=u+1;break}}else d<0&&(c=!0,d=u+1),f>-1&&(e.codePointAt(u)===r.codePointAt(f--)?f<0&&(l=u):(f=-1,l=d));return a===l?l=d:l<0&&(l=e.length),e.slice(a,l)}function I4(e){if(vs(e),e.length===0)return".";let r=-1,a=e.length,l;for(;--a;)if(e.codePointAt(a)===47){if(l){r=a;break}}else l||(l=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function H4(e){vs(e);let r=e.length,a=-1,l=0,u=-1,c=0,d;for(;r--;){const f=e.codePointAt(r);if(f===47){if(d){l=r+1;break}continue}a<0&&(d=!0,a=r+1),f===46?u<0?u=r:c!==1&&(c=1):u>-1&&(c=-1)}return u<0||a<0||c===0||c===1&&u===a-1&&u===l+1?"":e.slice(u,a)}function q4(...e){let r=-1,a;for(;++r0&&e.codePointAt(e.length-1)===47&&(a+="/"),r?"/"+a:a}function $4(e,r){let a="",l=0,u=-1,c=0,d=-1,f,m;for(;++d<=e.length;){if(d2){if(m=a.lastIndexOf("/"),m!==a.length-1){m<0?(a="",l=0):(a=a.slice(0,m),l=a.length-1-a.lastIndexOf("/")),u=d,c=0;continue}}else if(a.length>0){a="",l=0,u=d,c=0;continue}}r&&(a=a.length>0?a+"/..":"..",l=2)}else a.length>0?a+="/"+e.slice(u+1,d):a=e.slice(u+1,d),l=d-u-1;u=d,c=0}else f===46&&c>-1?c++:c=-1}return a}function vs(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const F4={cwd:V4};function V4(){return"/"}function Cm(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function G4(e){if(typeof e=="string")e=new URL(e);else if(!Cm(e)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(e.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return Y4(e)}function Y4(e){if(e.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const r=e.pathname;let a=-1;for(;++a0){let[y,...k]=v;const j=l[b][1];km(j)&&km(y)&&(y=qh(!0,j,y)),l[b]=[h,y,...k]}}}}const Z4=new jp().freeze();function Vh(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Gh(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Yh(e,r){if(r)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function c0(e){if(!km(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function d0(e,r,a){if(!a)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Qu(e){return J4(e)?e:new WS(e)}function J4(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function W4(e){return typeof e=="string"||e3(e)}function e3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const t3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",f0=[],h0={allowDangerousHtml:!0},n3=/^(https?|ircs?|mailto|xmpp)$/i,r3=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function a3(e){const r=l3(e),a=i3(e);return o3(r.runSync(r.parse(a),a),e)}function l3(e){const r=e.rehypePlugins||f0,a=e.remarkPlugins||f0,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...h0}:h0;return Z4().use(Iz).use(a).use(D4,l).use(r)}function i3(e){const r=e.children||"",a=new WS;return typeof r=="string"&&(a.value=r),a}function o3(e,r){const a=r.allowedElements,l=r.allowElement,u=r.components,c=r.disallowedElements,d=r.skipHtml,f=r.unwrapDisallowed,m=r.urlTransform||s3;for(const v of r3)Object.hasOwn(r,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+t3+v.id,void 0);return Sp(e,h),SD(e,{Fragment:o.Fragment,components:u,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function h(v,x,b){if(v.type==="raw"&&b&&typeof x=="number")return d?b.children.splice(x,1):b.children[x]={type:"text",value:v.value},x;if(v.type==="element"){let y;for(y in Uh)if(Object.hasOwn(Uh,y)&&Object.hasOwn(v.properties,y)){const k=v.properties[y],j=Uh[y];(j===null||j.includes(v.tagName))&&(v.properties[y]=m(String(k||""),y,v))}}if(v.type==="element"){let y=a?!a.includes(v.tagName):c?c.includes(v.tagName):!1;if(!y&&l&&typeof x=="number"&&(y=!l(v,x,b)),y&&b&&typeof x=="number")return f&&v.children?b.children.splice(x,1,...v.children):b.children.splice(x,1),x}}}function s3(e){const r=e.indexOf(":"),a=e.indexOf("?"),l=e.indexOf("#"),u=e.indexOf("/");return r===-1||u!==-1&&r>u||a!==-1&&r>a||l!==-1&&r>l||n3.test(e.slice(0,r))?e:""}function u3(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ej(e,r,a){const u=$c((a||{}).ignore||[]),c=c3(r);let d=-1;for(;++d0?{type:"text",value:_}:void 0),_===!1?b.lastIndex=B+1:(k!==B&&R.push({type:"text",value:h.value.slice(k,B)}),Array.isArray(_)?R.push(..._):_&&R.push(_),k=B+D[0].length,C=!0),!b.global)break;D=b.exec(h.value)}return C?(k?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let a=r[0],l=a.indexOf(")");const u=m0(e,"(");let c=m0(e,")");for(;l!==-1&&u>c;)e+=a.slice(0,l+1),a=a.slice(l+1),l=a.indexOf(")"),c++;return[e,a]}function tj(e,r){const a=e.input.charCodeAt(e.index-1);return(e.index===0||Gl(a)||Hc(a))&&(!r||a!==47)}nj.peek=L3;function T3(){this.buffer()}function A3(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function _3(){this.buffer()}function M3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function R3(e){const r=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=xr(this.sliceSerialize(e)).toLowerCase(),a.label=r}function D3(e){this.exit(e)}function O3(e){const r=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=xr(this.sliceSerialize(e)).toLowerCase(),a.label=r}function z3(e){this.exit(e)}function L3(){return"["}function nj(e,r,a,l){const u=a.createTracker(l);let c=u.move("[^");const d=a.enter("footnoteReference"),f=a.enter("reference");return c+=u.move(a.safe(a.associationId(e),{after:"]",before:c})),f(),d(),c+=u.move("]"),c}function U3(){return{enter:{gfmFootnoteCallString:T3,gfmFootnoteCall:A3,gfmFootnoteDefinitionLabelString:_3,gfmFootnoteDefinition:M3},exit:{gfmFootnoteCallString:R3,gfmFootnoteCall:D3,gfmFootnoteDefinitionLabelString:O3,gfmFootnoteDefinition:z3}}}function B3(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:a,footnoteReference:nj},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(l,u,c,d){const f=c.createTracker(d);let m=f.move("[^");const h=c.enter("footnoteDefinition"),v=c.enter("label");return m+=f.move(c.safe(c.associationId(l),{before:m,after:"]"})),v(),m+=f.move("]:"),l.children&&l.children.length>0&&(f.shift(4),m+=f.move((r?` +`:" ")+c.indentLines(c.containerFlow(l,f.current()),r?rj:I3))),h(),m}}function I3(e,r,a){return r===0?e:rj(e,r,a)}function rj(e,r,a){return(a?"":" ")+e}const H3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];aj.peek=V3;function q3(){return{canContainEols:["delete"],enter:{strikethrough:$3},exit:{strikethrough:F3}}}function P3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:H3}],handlers:{delete:aj}}}function $3(e){this.enter({type:"delete",children:[]},e)}function F3(e){this.exit(e)}function aj(e,r,a,l){const u=a.createTracker(l),c=a.enter("strikethrough");let d=u.move("~~");return d+=a.containerPhrasing(e,{...u.current(),before:d,after:"~"}),d+=u.move("~~"),c(),d}function V3(){return"~"}function G3(e){return e.length}function Y3(e,r){const a=r||{},l=(a.align||[]).concat(),u=a.stringLength||G3,c=[],d=[],f=[],m=[];let h=0,v=-1;for(;++vh&&(h=e[v].length);++Cm[C])&&(m[C]=D)}j.push(R)}d[v]=j,f[v]=A}let x=-1;if(typeof l=="object"&&"length"in l)for(;++xm[x]&&(m[x]=R),y[x]=R),b[x]=D}d.splice(1,0,b),f.splice(1,0,y),v=-1;const k=[];for(;++v "),c.shift(2);const d=a.indentLines(a.containerFlow(e,c.current()),Q3);return u(),d}function Q3(e,r,a){return">"+(a?"":" ")+e}function Z3(e,r){return g0(e,r.inConstruct,!0)&&!g0(e,r.notInConstruct,!1)}function g0(e,r,a){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return a;let l=-1;for(;++ld&&(d=c):c=1,u=l+r.length,l=a.indexOf(r,u);return d}function W3(e,r){return!!(r.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function e5(e){const r=e.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function t5(e,r,a,l){const u=e5(a),c=e.value||"",d=u==="`"?"GraveAccent":"Tilde";if(W3(e,a)){const x=a.enter("codeIndented"),b=a.indentLines(c,n5);return x(),b}const f=a.createTracker(l),m=u.repeat(Math.max(J3(c,u)+1,3)),h=a.enter("codeFenced");let v=f.move(m);if(e.lang){const x=a.enter(`codeFencedLang${d}`);v+=f.move(a.safe(e.lang,{before:v,after:" ",encode:["`"],...f.current()})),x()}if(e.lang&&e.meta){const x=a.enter(`codeFencedMeta${d}`);v+=f.move(" "),v+=f.move(a.safe(e.meta,{before:v,after:` +`,encode:["`"],...f.current()})),x()}return v+=f.move(` +`),c&&(v+=f.move(c+` +`)),v+=f.move(m),h(),v}function n5(e,r,a){return(a?"":" ")+e}function kp(e){const r=e.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function r5(e,r,a,l){const u=kp(a),c=u==='"'?"Quote":"Apostrophe",d=a.enter("definition");let f=a.enter("label");const m=a.createTracker(l);let h=m.move("[");return h+=m.move(a.safe(a.associationId(e),{before:h,after:"]",...m.current()})),h+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=a.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(a.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=a.enter("destinationRaw"),h+=m.move(a.safe(e.url,{before:h,after:e.title?" ":` +`,...m.current()}))),f(),e.title&&(f=a.enter(`title${c}`),h+=m.move(" "+u),h+=m.move(a.safe(e.title,{before:h,after:u,...m.current()})),h+=m.move(u),f()),d(),h}function a5(e){const r=e.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function ds(e){return"&#x"+e.toString(16).toUpperCase()+";"}function hc(e,r,a){const l=Xi(e),u=Xi(r);return l===void 0?u===void 0?a==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:u===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:l===1?u===void 0?{inside:!1,outside:!1}:u===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:u===void 0?{inside:!1,outside:!1}:u===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}lj.peek=l5;function lj(e,r,a,l){const u=a5(a),c=a.enter("emphasis"),d=a.createTracker(l),f=d.move(u);let m=d.move(a.containerPhrasing(e,{after:u,before:f,...d.current()}));const h=m.charCodeAt(0),v=hc(l.before.charCodeAt(l.before.length-1),h,u);v.inside&&(m=ds(h)+m.slice(1));const x=m.charCodeAt(m.length-1),b=hc(l.after.charCodeAt(0),x,u);b.inside&&(m=m.slice(0,-1)+ds(x));const y=d.move(u);return c(),a.attentionEncodeSurroundingInfo={after:b.outside,before:v.outside},f+m+y}function l5(e,r,a){return a.options.emphasis||"*"}function i5(e,r){let a=!1;return Sp(e,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return a=!0,Sm}),!!((!e.depth||e.depth<3)&&pp(e)&&(r.options.setext||a))}function o5(e,r,a,l){const u=Math.max(Math.min(6,e.depth||1),1),c=a.createTracker(l);if(i5(e,a)){const v=a.enter("headingSetext"),x=a.enter("phrasing"),b=a.containerPhrasing(e,{...c.current(),before:` +`,after:` +`});return x(),v(),b+` +`+(u===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(` +`))+1))}const d="#".repeat(u),f=a.enter("headingAtx"),m=a.enter("phrasing");c.move(d+" ");let h=a.containerPhrasing(e,{before:"# ",after:` +`,...c.current()});return/^[\t ]/.test(h)&&(h=ds(h.charCodeAt(0))+h.slice(1)),h=h?d+" "+h:d,a.options.closeAtx&&(h+=" "+d),m(),f(),h}ij.peek=s5;function ij(e){return e.value||""}function s5(){return"<"}oj.peek=u5;function oj(e,r,a,l){const u=kp(a),c=u==='"'?"Quote":"Apostrophe",d=a.enter("image");let f=a.enter("label");const m=a.createTracker(l);let h=m.move("![");return h+=m.move(a.safe(e.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=a.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(a.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=a.enter("destinationRaw"),h+=m.move(a.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=a.enter(`title${c}`),h+=m.move(" "+u),h+=m.move(a.safe(e.title,{before:h,after:u,...m.current()})),h+=m.move(u),f()),h+=m.move(")"),d(),h}function u5(){return"!"}sj.peek=c5;function sj(e,r,a,l){const u=e.referenceType,c=a.enter("imageReference");let d=a.enter("label");const f=a.createTracker(l);let m=f.move("![");const h=a.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),d();const v=a.stack;a.stack=[],d=a.enter("reference");const x=a.safe(a.associationId(e),{before:m,after:"]",...f.current()});return d(),a.stack=v,c(),u==="full"||!h||h!==x?m+=f.move(x+"]"):u==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function c5(){return"!"}uj.peek=d5;function uj(e,r,a){let l=e.value||"",u="`",c=-1;for(;new RegExp("(^|[^`])"+u+"([^`]|$)").test(l);)u+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++c\u007F]/.test(e.url))}dj.peek=f5;function dj(e,r,a,l){const u=kp(a),c=u==='"'?"Quote":"Apostrophe",d=a.createTracker(l);let f,m;if(cj(e,a)){const v=a.stack;a.stack=[],f=a.enter("autolink");let x=d.move("<");return x+=d.move(a.containerPhrasing(e,{before:x,after:">",...d.current()})),x+=d.move(">"),f(),a.stack=v,x}f=a.enter("link"),m=a.enter("label");let h=d.move("[");return h+=d.move(a.containerPhrasing(e,{before:h,after:"](",...d.current()})),h+=d.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=a.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(a.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(m=a.enter("destinationRaw"),h+=d.move(a.safe(e.url,{before:h,after:e.title?" ":")",...d.current()}))),m(),e.title&&(m=a.enter(`title${c}`),h+=d.move(" "+u),h+=d.move(a.safe(e.title,{before:h,after:u,...d.current()})),h+=d.move(u),m()),h+=d.move(")"),f(),h}function f5(e,r,a){return cj(e,a)?"<":"["}fj.peek=h5;function fj(e,r,a,l){const u=e.referenceType,c=a.enter("linkReference");let d=a.enter("label");const f=a.createTracker(l);let m=f.move("[");const h=a.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),d();const v=a.stack;a.stack=[],d=a.enter("reference");const x=a.safe(a.associationId(e),{before:m,after:"]",...f.current()});return d(),a.stack=v,c(),u==="full"||!h||h!==x?m+=f.move(x+"]"):u==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function h5(){return"["}function Cp(e){const r=e.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function m5(e){const r=Cp(e),a=e.options.bulletOther;if(!a)return r==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+a+"`) to be different");return a}function p5(e){const r=e.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function hj(e){const r=e.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function g5(e,r,a,l){const u=a.enter("list"),c=a.bulletCurrent;let d=e.ordered?p5(a):Cp(a);const f=e.ordered?d==="."?")":".":m5(a);let m=r&&a.bulletLastUsed?d===a.bulletLastUsed:!1;if(!e.ordered){const v=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&v&&(!v.children||!v.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(m=!0),hj(a)===d&&v){let x=-1;for(;++x-1?r.start:1)+(a.options.incrementListMarker===!1?0:r.children.indexOf(e))+c);let d=c.length+1;(u==="tab"||u==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(d=Math.ceil(d/4)*4);const f=a.createTracker(l);f.move(c+" ".repeat(d-c.length)),f.shift(d);const m=a.enter("listItem"),h=a.indentLines(a.containerFlow(e,f.current()),v);return m(),h;function v(x,b,y){return b?(y?"":" ".repeat(d))+x:(y?c:c+" ".repeat(d-c.length))+x}}function y5(e,r,a,l){const u=a.enter("paragraph"),c=a.enter("phrasing"),d=a.containerPhrasing(e,l);return c(),u(),d}const b5=$c(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function w5(e,r,a,l){return(e.children.some(function(d){return b5(d)})?a.containerPhrasing:a.containerFlow).call(a,e,l)}function S5(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}mj.peek=j5;function mj(e,r,a,l){const u=S5(a),c=a.enter("strong"),d=a.createTracker(l),f=d.move(u+u);let m=d.move(a.containerPhrasing(e,{after:u,before:f,...d.current()}));const h=m.charCodeAt(0),v=hc(l.before.charCodeAt(l.before.length-1),h,u);v.inside&&(m=ds(h)+m.slice(1));const x=m.charCodeAt(m.length-1),b=hc(l.after.charCodeAt(0),x,u);b.inside&&(m=m.slice(0,-1)+ds(x));const y=d.move(u+u);return c(),a.attentionEncodeSurroundingInfo={after:b.outside,before:v.outside},f+m+y}function j5(e,r,a){return a.options.strong||"*"}function k5(e,r,a,l){return a.safe(e.value,l)}function C5(e){const r=e.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function E5(e,r,a){const l=(hj(a)+(a.options.ruleSpaces?" ":"")).repeat(C5(a));return a.options.ruleSpaces?l.slice(0,-1):l}const pj={blockquote:K3,break:x0,code:t5,definition:r5,emphasis:lj,hardBreak:x0,heading:o5,html:ij,image:oj,imageReference:sj,inlineCode:uj,link:dj,linkReference:fj,list:g5,listItem:v5,paragraph:y5,root:w5,strong:mj,text:k5,thematicBreak:E5};function N5(){return{enter:{table:T5,tableData:v0,tableHeader:v0,tableRow:_5},exit:{codeText:M5,table:A5,tableData:Zh,tableHeader:Zh,tableRow:Zh}}}function T5(e){const r=e._align;this.enter({type:"table",align:r.map(function(a){return a==="none"?null:a}),children:[]},e),this.data.inTable=!0}function A5(e){this.exit(e),this.data.inTable=void 0}function _5(e){this.enter({type:"tableRow",children:[]},e)}function Zh(e){this.exit(e)}function v0(e){this.enter({type:"tableCell",children:[]},e)}function M5(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,R5));const a=this.stack[this.stack.length-1];a.type,a.value=r,this.exit(e)}function R5(e,r){return r==="|"?r:e}function D5(e){const r=e||{},a=r.tableCellPadding,l=r.tablePipeAlign,u=r.stringLength,c=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:d,tableCell:m,tableRow:f}};function d(y,k,j,A){return h(v(y,j,A),y.align)}function f(y,k,j,A){const C=x(y,j,A),R=h([C]);return R.slice(0,R.indexOf(` +`))}function m(y,k,j,A){const C=j.enter("tableCell"),R=j.enter("phrasing"),D=j.containerPhrasing(y,{...A,before:c,after:c});return R(),C(),D}function h(y,k){return Y3(y,{align:k,alignDelimiters:l,padding:a,stringLength:u})}function v(y,k,j){const A=y.children;let C=-1;const R=[],D=k.enter("table");for(;++C0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const Z5={tokenize:l6,partial:!0};function J5(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:n6,continuation:{tokenize:r6},exit:a6}},text:{91:{name:"gfmFootnoteCall",tokenize:t6},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:W5,resolveTo:e6}}}}function W5(e,r,a){const l=this;let u=l.events.length;const c=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let d;for(;u--;){const m=l.events[u][1];if(m.type==="labelImage"){d=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!d||!d._balanced)return a(m);const h=xr(l.sliceSerialize({start:d.end,end:l.now()}));return h.codePointAt(0)!==94||!c.includes(h.slice(1))?a(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),r(m))}}function e6(e,r){let a=e.length;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";const l={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+3][1].end)};u.end.column++,u.end.offset++,u.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},u.end),end:Object.assign({},e[e.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},f=[e[a+1],e[a+2],["enter",l,r],e[a+3],e[a+4],["enter",u,r],["exit",u,r],["enter",c,r],["enter",d,r],["exit",d,r],["exit",c,r],e[e.length-2],e[e.length-1],["exit",l,r]];return e.splice(a,e.length-a+1,...f),e}function t6(e,r,a){const l=this,u=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let c=0,d;return f;function f(x){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),m}function m(x){return x!==94?a(x):(e.enter("gfmFootnoteCallMarker"),e.consume(x),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(x){if(c>999||x===93&&!d||x===null||x===91||kt(x))return a(x);if(x===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return u.includes(xr(l.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(x),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):a(x)}return kt(x)||(d=!0),c++,e.consume(x),x===92?v:h}function v(x){return x===91||x===92||x===93?(e.consume(x),c++,h):h(x)}}function n6(e,r,a){const l=this,u=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let c,d=0,f;return m;function m(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",v):a(k)}function v(k){if(d>999||k===93&&!f||k===null||k===91||kt(k))return a(k);if(k===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return c=xr(l.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return kt(k)||(f=!0),d++,e.consume(k),k===92?x:v}function x(k){return k===91||k===92||k===93?(e.consume(k),d++,v):v(k)}function b(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),u.includes(c)||u.push(c),ot(e,y,"gfmFootnoteDefinitionWhitespace")):a(k)}function y(k){return r(k)}}function r6(e,r,a){return e.check(xs,r,e.attempt(Z5,r,a))}function a6(e){e.exit("gfmFootnoteDefinition")}function l6(e,r,a){const l=this;return ot(e,u,"gfmFootnoteDefinitionIndent",5);function u(c){const d=l.events[l.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?r(c):a(c)}}function i6(e){let a=(e||{}).singleTilde;const l={name:"strikethrough",tokenize:c,resolveAll:u};return a==null&&(a=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function u(d,f){let m=-1;for(;++m1?m(k):(d.consume(k),x++,y);if(x<2&&!a)return m(k);const A=d.exit("strikethroughSequenceTemporary"),C=Xi(k);return A._open=!C||C===2&&!!j,A._close=!j||j===2&&!!C,f(k)}}}class o6{constructor(){this.map=[]}add(r,a,l){s6(this,r,a,l)}consume(r){if(this.map.sort(function(c,d){return c[0]-d[0]}),this.map.length===0)return;let a=this.map.length;const l=[];for(;a>0;)a-=1,l.push(r.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),r.length=this.map[a][0];l.push(r.slice()),r.length=0;let u=l.pop();for(;u;){for(const c of u)r.push(c);u=l.pop()}this.map.length=0}}function s6(e,r,a,l){let u=0;if(!(a===0&&l.length===0)){for(;u-1;){const le=l.events[$][1].type;if(le==="lineEnding"||le==="linePrefix")$--;else break}const X=$>-1?l.events[$][1].type:null,ce=X==="tableHead"||X==="tableRow"?_:m;return ce===_&&l.parser.lazy[l.now().line]?a(q):ce(q)}function m(q){return e.enter("tableHead"),e.enter("tableRow"),h(q)}function h(q){return q===124||(d=!0,c+=1),v(q)}function v(q){return q===null?a(q):ze(q)?c>1?(c=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(q),e.exit("lineEnding"),y):a(q):nt(q)?ot(e,v,"whitespace")(q):(c+=1,d&&(d=!1,u+=1),q===124?(e.enter("tableCellDivider"),e.consume(q),e.exit("tableCellDivider"),d=!0,v):(e.enter("data"),x(q)))}function x(q){return q===null||q===124||kt(q)?(e.exit("data"),v(q)):(e.consume(q),q===92?b:x)}function b(q){return q===92||q===124?(e.consume(q),x):x(q)}function y(q){return l.interrupt=!1,l.parser.lazy[l.now().line]?a(q):(e.enter("tableDelimiterRow"),d=!1,nt(q)?ot(e,k,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):k(q))}function k(q){return q===45||q===58?A(q):q===124?(d=!0,e.enter("tableCellDivider"),e.consume(q),e.exit("tableCellDivider"),j):O(q)}function j(q){return nt(q)?ot(e,A,"whitespace")(q):A(q)}function A(q){return q===58?(c+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(q),e.exit("tableDelimiterMarker"),C):q===45?(c+=1,C(q)):q===null||ze(q)?B(q):O(q)}function C(q){return q===45?(e.enter("tableDelimiterFiller"),R(q)):O(q)}function R(q){return q===45?(e.consume(q),R):q===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(q),e.exit("tableDelimiterMarker"),D):(e.exit("tableDelimiterFiller"),D(q))}function D(q){return nt(q)?ot(e,B,"whitespace")(q):B(q)}function B(q){return q===124?k(q):q===null||ze(q)?!d||u!==c?O(q):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(q)):O(q)}function O(q){return a(q)}function _(q){return e.enter("tableRow"),E(q)}function E(q){return q===124?(e.enter("tableCellDivider"),e.consume(q),e.exit("tableCellDivider"),E):q===null||ze(q)?(e.exit("tableRow"),r(q)):nt(q)?ot(e,E,"whitespace")(q):(e.enter("data"),I(q))}function I(q){return q===null||q===124||kt(q)?(e.exit("data"),E(q)):(e.consume(q),q===92?W:I)}function W(q){return q===92||q===124?(e.consume(q),I):I(q)}}function f6(e,r){let a=-1,l=!0,u=0,c=[0,0,0,0],d=[0,0,0,0],f=!1,m=0,h,v,x;const b=new o6;for(;++aa[2]+1){const k=a[2]+1,j=a[3]-a[2]-1;e.add(k,j,[])}}e.add(a[3]+1,0,[["exit",x,r]])}return u!==void 0&&(c.end=Object.assign({},$i(r.events,u)),e.add(u,0,[["exit",c,r]]),c=void 0),c}function b0(e,r,a,l,u){const c=[],d=$i(r.events,a);u&&(u.end=Object.assign({},d),c.push(["exit",u,r])),l.end=Object.assign({},d),c.push(["exit",l,r]),e.add(a+1,0,c)}function $i(e,r){const a=e[r],l=a[0]==="enter"?"start":"end";return a[1][l]}const h6={name:"tasklistCheck",tokenize:p6};function m6(){return{text:{91:h6}}}function p6(e,r,a){const l=this;return u;function u(m){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?a(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),c)}function c(m){return kt(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),d):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),d):a(m)}function d(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):a(m)}function f(m){return ze(m)?r(m):nt(m)?e.check({tokenize:g6},r,a)(m):a(m)}}function g6(e,r,a){return ot(e,l,"whitespace");function l(u){return u===null?a(u):r(u)}}function x6(e){return RS([P5(),J5(),i6(e),c6(),m6()])}const v6={};function y6(e){const r=this,a=e||v6,l=r.data(),u=l.micromarkExtensions||(l.micromarkExtensions=[]),c=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),d=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);u.push(x6(a)),c.push(B5()),d.push(I5(a))}const b6={a:({children:e,...r})=>o.jsx("a",{...r,target:"_blank",rel:"noopener noreferrer",children:e}),img:({alt:e})=>o.jsx("span",{className:"text-muted-foreground",children:e||"(image)"})};function w6({text:e,className:r}){return o.jsx("div",{className:_e("chat-markdown",r),children:o.jsx(a3,{remarkPlugins:[y6,p3],components:b6,children:e})})}function S6({className:e,...r}){return o.jsx("textarea",{"data-slot":"textarea",className:_e("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...r})}var Nm=["Enter"," "],j6=["ArrowDown","PageUp","Home"],kj=["ArrowUp","PageDown","End"],k6=[...j6,...kj],C6={ltr:[...Nm,"ArrowRight"],rtl:[...Nm,"ArrowLeft"]},E6={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ys="Menu",[fs,N6,T6]=Fm(ys),[Ql,Cj]=vr(ys,[T6,Dc,Bc]),Vc=Dc(),Ej=Bc(),[A6,Zl]=Ql(ys),[_6,bs]=Ql(ys),Nj=e=>{const{__scopeMenu:r,open:a=!1,children:l,dir:u,onOpenChange:c,modal:d=!0}=e,f=Vc(r),[m,h]=S.useState(null),v=S.useRef(!1),x=sr(c),b=Nc(u);return S.useEffect(()=>{const y=()=>{v.current=!0,document.addEventListener("pointerdown",k,{capture:!0,once:!0}),document.addEventListener("pointermove",k,{capture:!0,once:!0})},k=()=>v.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",k,{capture:!0}),document.removeEventListener("pointermove",k,{capture:!0})}},[]),o.jsx(dw,{...f,children:o.jsx(A6,{scope:r,open:a,onOpenChange:x,content:m,onContentChange:h,children:o.jsx(_6,{scope:r,onClose:S.useCallback(()=>x(!1),[x]),isUsingKeyboardRef:v,dir:b,modal:d,children:l})})})};Nj.displayName=ys;var M6="MenuAnchor",Np=S.forwardRef((e,r)=>{const{__scopeMenu:a,...l}=e,u=Vc(a);return o.jsx(fw,{...u,...l,ref:r})});Np.displayName=M6;var Tp="MenuPortal",[R6,Tj]=Ql(Tp,{forceMount:void 0}),Aj=e=>{const{__scopeMenu:r,forceMount:a,children:l,container:u}=e,c=Zl(Tp,r);return o.jsx(R6,{scope:r,forceMount:a,children:o.jsx(Ir,{present:a||c.open,children:o.jsx(jc,{asChild:!0,container:u,children:l})})})};Aj.displayName=Tp;var or="MenuContent",[D6,Ap]=Ql(or),_j=S.forwardRef((e,r)=>{const a=Tj(or,e.__scopeMenu),{forceMount:l=a.forceMount,...u}=e,c=Zl(or,e.__scopeMenu),d=bs(or,e.__scopeMenu);return o.jsx(fs.Provider,{scope:e.__scopeMenu,children:o.jsx(Ir,{present:l||c.open,children:o.jsx(fs.Slot,{scope:e.__scopeMenu,children:d.modal?o.jsx(O6,{...u,ref:r}):o.jsx(z6,{...u,ref:r})})})})}),O6=S.forwardRef((e,r)=>{const a=Zl(or,e.__scopeMenu),l=S.useRef(null),u=ft(r,l);return S.useEffect(()=>{const c=l.current;if(c)return Bm(c)},[]),o.jsx(_p,{...e,ref:u,trapFocus:a.open,disableOutsidePointerEvents:a.open,disableOutsideScroll:!0,onFocusOutside:Te(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>a.onOpenChange(!1)})}),z6=S.forwardRef((e,r)=>{const a=Zl(or,e.__scopeMenu);return o.jsx(_p,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>a.onOpenChange(!1)})}),_p=S.forwardRef((e,r)=>{const{__scopeMenu:a,loop:l=!1,trapFocus:u,onOpenAutoFocus:c,onCloseAutoFocus:d,disableOutsidePointerEvents:f,onEntryFocus:m,onEscapeKeyDown:h,onPointerDownOutside:v,onFocusOutside:x,onInteractOutside:b,onDismiss:y,disableOutsideScroll:k,...j}=e,A=Zl(or,a),C=bs(or,a),R=Vc(a),D=Ej(a),B=N6(a),[O,_]=S.useState(null),E=S.useRef(null),I=ft(r,E,A.onContentChange),W=S.useRef(0),q=S.useRef(""),$=S.useRef(0),X=S.useRef(null),ce=S.useRef("right"),le=S.useRef(0),ee=k?Cc:S.Fragment,U=k?{as:da,allowPinchZoom:!0}:void 0,Z=K=>{var re,ye;const N=q.current+K,L=B().filter(de=>!de.disabled),F=document.activeElement,M=(re=L.find(de=>de.ref.current===F))==null?void 0:re.textValue,oe=L.map(de=>de.textValue),G=Y6(oe,N,M),ue=(ye=L.find(de=>de.textValue===G))==null?void 0:ye.ref.current;(function de(be){q.current=be,window.clearTimeout(W.current),be!==""&&(W.current=window.setTimeout(()=>de(""),1e3))})(N),ue&&setTimeout(()=>ue.focus())};S.useEffect(()=>()=>window.clearTimeout(W.current),[]),Um();const ie=S.useCallback(K=>{var L,F;return ce.current===((L=X.current)==null?void 0:L.side)&&K6(K,(F=X.current)==null?void 0:F.area)},[]);return o.jsx(D6,{scope:a,searchRef:q,onItemEnter:S.useCallback(K=>{ie(K)&&K.preventDefault()},[ie]),onItemLeave:S.useCallback(K=>{var N;ie(K)||((N=E.current)==null||N.focus(),_(null))},[ie]),onTriggerLeave:S.useCallback(K=>{ie(K)&&K.preventDefault()},[ie]),pointerGraceTimerRef:$,onPointerGraceIntentChange:S.useCallback(K=>{X.current=K},[]),children:o.jsx(ee,{...U,children:o.jsx(Sc,{asChild:!0,trapped:u,onMountAutoFocus:Te(c,K=>{var N;K.preventDefault(),(N=E.current)==null||N.focus({preventScroll:!0})}),onUnmountAutoFocus:d,children:o.jsx(wc,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:h,onPointerDownOutside:v,onFocusOutside:x,onInteractOutside:b,onDismiss:y,children:o.jsx(iS,{asChild:!0,...D,dir:C.dir,orientation:"vertical",loop:l,currentTabStopId:O,onCurrentTabStopIdChange:_,onEntryFocus:Te(m,K=>{C.isUsingKeyboardRef.current||K.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(hw,{role:"menu","aria-orientation":"vertical","data-state":Gj(A.open),"data-radix-menu-content":"",dir:C.dir,...R,...j,ref:I,style:{outline:"none",...j.style},onKeyDown:Te(j.onKeyDown,K=>{const L=K.target.closest("[data-radix-menu-content]")===K.currentTarget,F=K.ctrlKey||K.altKey||K.metaKey,M=K.key.length===1;L&&(K.key==="Tab"&&K.preventDefault(),!F&&M&&Z(K.key));const oe=E.current;if(K.target!==oe||!k6.includes(K.key))return;K.preventDefault();const ue=B().filter(re=>!re.disabled).map(re=>re.ref.current);kj.includes(K.key)&&ue.reverse(),V6(ue)}),onBlur:Te(e.onBlur,K=>{K.currentTarget.contains(K.target)||(window.clearTimeout(W.current),q.current="")}),onPointerMove:Te(e.onPointerMove,hs(K=>{const N=K.target,L=le.current!==K.clientX;if(K.currentTarget.contains(N)&&L){const F=K.clientX>le.current?"right":"left";ce.current=F,le.current=K.clientX}}))})})})})})})});_j.displayName=or;var L6="MenuGroup",Mp=S.forwardRef((e,r)=>{const{__scopeMenu:a,...l}=e;return o.jsx(Ge.div,{role:"group",...l,ref:r})});Mp.displayName=L6;var U6="MenuLabel",Mj=S.forwardRef((e,r)=>{const{__scopeMenu:a,...l}=e;return o.jsx(Ge.div,{...l,ref:r})});Mj.displayName=U6;var mc="MenuItem",w0="menu.itemSelect",Gc=S.forwardRef((e,r)=>{const{disabled:a=!1,onSelect:l,...u}=e,c=S.useRef(null),d=bs(mc,e.__scopeMenu),f=Ap(mc,e.__scopeMenu),m=ft(r,c),h=S.useRef(!1),v=()=>{const x=c.current;if(!a&&x){const b=new CustomEvent(w0,{bubbles:!0,cancelable:!0});x.addEventListener(w0,y=>l==null?void 0:l(y),{once:!0}),K0(x,b),b.defaultPrevented?h.current=!1:d.onClose()}};return o.jsx(Rj,{...u,ref:m,disabled:a,onClick:Te(e.onClick,v),onPointerDown:x=>{var b;(b=e.onPointerDown)==null||b.call(e,x),h.current=!0},onPointerUp:Te(e.onPointerUp,x=>{var b;h.current||(b=x.currentTarget)==null||b.click()}),onKeyDown:Te(e.onKeyDown,x=>{const b=f.searchRef.current!=="";a||b&&x.key===" "||Nm.includes(x.key)&&(x.currentTarget.click(),x.preventDefault())})})});Gc.displayName=mc;var Rj=S.forwardRef((e,r)=>{const{__scopeMenu:a,disabled:l=!1,textValue:u,...c}=e,d=Ap(mc,a),f=Ej(a),m=S.useRef(null),h=ft(r,m),[v,x]=S.useState(!1),[b,y]=S.useState("");return S.useEffect(()=>{const k=m.current;k&&y((k.textContent??"").trim())},[c.children]),o.jsx(fs.ItemSlot,{scope:a,disabled:l,textValue:u??b,children:o.jsx(oS,{asChild:!0,...f,focusable:!l,children:o.jsx(Ge.div,{role:"menuitem","data-highlighted":v?"":void 0,"aria-disabled":l||void 0,"data-disabled":l?"":void 0,...c,ref:h,onPointerMove:Te(e.onPointerMove,hs(k=>{l?d.onItemLeave(k):(d.onItemEnter(k),k.defaultPrevented||k.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Te(e.onPointerLeave,hs(k=>d.onItemLeave(k))),onFocus:Te(e.onFocus,()=>x(!0)),onBlur:Te(e.onBlur,()=>x(!1))})})})}),B6="MenuCheckboxItem",Dj=S.forwardRef((e,r)=>{const{checked:a=!1,onCheckedChange:l,...u}=e;return o.jsx(Bj,{scope:e.__scopeMenu,checked:a,children:o.jsx(Gc,{role:"menuitemcheckbox","aria-checked":pc(a)?"mixed":a,...u,ref:r,"data-state":Dp(a),onSelect:Te(u.onSelect,()=>l==null?void 0:l(pc(a)?!0:!a),{checkForDefaultPrevented:!1})})})});Dj.displayName=B6;var Oj="MenuRadioGroup",[I6,H6]=Ql(Oj,{value:void 0,onValueChange:()=>{}}),zj=S.forwardRef((e,r)=>{const{value:a,onValueChange:l,...u}=e,c=sr(l);return o.jsx(I6,{scope:e.__scopeMenu,value:a,onValueChange:c,children:o.jsx(Mp,{...u,ref:r})})});zj.displayName=Oj;var Lj="MenuRadioItem",Uj=S.forwardRef((e,r)=>{const{value:a,...l}=e,u=H6(Lj,e.__scopeMenu),c=a===u.value;return o.jsx(Bj,{scope:e.__scopeMenu,checked:c,children:o.jsx(Gc,{role:"menuitemradio","aria-checked":c,...l,ref:r,"data-state":Dp(c),onSelect:Te(l.onSelect,()=>{var d;return(d=u.onValueChange)==null?void 0:d.call(u,a)},{checkForDefaultPrevented:!1})})})});Uj.displayName=Lj;var Rp="MenuItemIndicator",[Bj,q6]=Ql(Rp,{checked:!1}),Ij=S.forwardRef((e,r)=>{const{__scopeMenu:a,forceMount:l,...u}=e,c=q6(Rp,a);return o.jsx(Ir,{present:l||pc(c.checked)||c.checked===!0,children:o.jsx(Ge.span,{...u,ref:r,"data-state":Dp(c.checked)})})});Ij.displayName=Rp;var P6="MenuSeparator",Hj=S.forwardRef((e,r)=>{const{__scopeMenu:a,...l}=e;return o.jsx(Ge.div,{role:"separator","aria-orientation":"horizontal",...l,ref:r})});Hj.displayName=P6;var $6="MenuArrow",qj=S.forwardRef((e,r)=>{const{__scopeMenu:a,...l}=e,u=Vc(a);return o.jsx(mw,{...u,...l,ref:r})});qj.displayName=$6;var F6="MenuSub",[r9,Pj]=Ql(F6),ts="MenuSubTrigger",$j=S.forwardRef((e,r)=>{const a=Zl(ts,e.__scopeMenu),l=bs(ts,e.__scopeMenu),u=Pj(ts,e.__scopeMenu),c=Ap(ts,e.__scopeMenu),d=S.useRef(null),{pointerGraceTimerRef:f,onPointerGraceIntentChange:m}=c,h={__scopeMenu:e.__scopeMenu},v=S.useCallback(()=>{d.current&&window.clearTimeout(d.current),d.current=null},[]);return S.useEffect(()=>v,[v]),S.useEffect(()=>{const x=f.current;return()=>{window.clearTimeout(x),m(null)}},[f,m]),o.jsx(Np,{asChild:!0,...h,children:o.jsx(Rj,{id:u.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":u.contentId,"data-state":Gj(a.open),...e,ref:vc(r,u.onTriggerChange),onClick:x=>{var b;(b=e.onClick)==null||b.call(e,x),!(e.disabled||x.defaultPrevented)&&(x.currentTarget.focus(),a.open||a.onOpenChange(!0))},onPointerMove:Te(e.onPointerMove,hs(x=>{c.onItemEnter(x),!x.defaultPrevented&&!e.disabled&&!a.open&&!d.current&&(c.onPointerGraceIntentChange(null),d.current=window.setTimeout(()=>{a.onOpenChange(!0),v()},100))})),onPointerLeave:Te(e.onPointerLeave,hs(x=>{var y,k;v();const b=(y=a.content)==null?void 0:y.getBoundingClientRect();if(b){const j=(k=a.content)==null?void 0:k.dataset.side,A=j==="right",C=A?-5:5,R=b[A?"left":"right"],D=b[A?"right":"left"];c.onPointerGraceIntentChange({area:[{x:x.clientX+C,y:x.clientY},{x:R,y:b.top},{x:D,y:b.top},{x:D,y:b.bottom},{x:R,y:b.bottom}],side:j}),window.clearTimeout(f.current),f.current=window.setTimeout(()=>c.onPointerGraceIntentChange(null),300)}else{if(c.onTriggerLeave(x),x.defaultPrevented)return;c.onPointerGraceIntentChange(null)}})),onKeyDown:Te(e.onKeyDown,x=>{var y;const b=c.searchRef.current!=="";e.disabled||b&&x.key===" "||C6[l.dir].includes(x.key)&&(a.onOpenChange(!0),(y=a.content)==null||y.focus(),x.preventDefault())})})})});$j.displayName=ts;var Fj="MenuSubContent",Vj=S.forwardRef((e,r)=>{const a=Tj(or,e.__scopeMenu),{forceMount:l=a.forceMount,...u}=e,c=Zl(or,e.__scopeMenu),d=bs(or,e.__scopeMenu),f=Pj(Fj,e.__scopeMenu),m=S.useRef(null),h=ft(r,m);return o.jsx(fs.Provider,{scope:e.__scopeMenu,children:o.jsx(Ir,{present:l||c.open,children:o.jsx(fs.Slot,{scope:e.__scopeMenu,children:o.jsx(_p,{id:f.contentId,"aria-labelledby":f.triggerId,...u,ref:h,align:"start",side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:v=>{var x;d.isUsingKeyboardRef.current&&((x=m.current)==null||x.focus()),v.preventDefault()},onCloseAutoFocus:v=>v.preventDefault(),onFocusOutside:Te(e.onFocusOutside,v=>{v.target!==f.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:Te(e.onEscapeKeyDown,v=>{d.onClose(),v.preventDefault()}),onKeyDown:Te(e.onKeyDown,v=>{var y;const x=v.currentTarget.contains(v.target),b=E6[d.dir].includes(v.key);x&&b&&(c.onOpenChange(!1),(y=f.trigger)==null||y.focus(),v.preventDefault())})})})})})});Vj.displayName=Fj;function Gj(e){return e?"open":"closed"}function pc(e){return e==="indeterminate"}function Dp(e){return pc(e)?"indeterminate":e?"checked":"unchecked"}function V6(e){const r=document.activeElement;for(const a of e)if(a===r||(a.focus(),document.activeElement!==r))return}function G6(e,r){return e.map((a,l)=>e[(r+l)%e.length])}function Y6(e,r,a){const u=r.length>1&&Array.from(r).every(h=>h===r[0])?r[0]:r,c=a?e.indexOf(a):-1;let d=G6(e,Math.max(c,0));u.length===1&&(d=d.filter(h=>h!==a));const m=d.find(h=>h.toLowerCase().startsWith(u.toLowerCase()));return m!==a?m:void 0}function X6(e,r){const{x:a,y:l}=e;let u=!1;for(let c=0,d=r.length-1;cl!=v>l&&a<(h-f)*(l-m)/(v-m)+f&&(u=!u)}return u}function K6(e,r){if(!r)return!1;const a={x:e.clientX,y:e.clientY};return X6(a,r)}function hs(e){return r=>r.pointerType==="mouse"?e(r):void 0}var Q6=Nj,Z6=Np,J6=Aj,W6=_j,eL=Mp,tL=Mj,nL=Gc,rL=Dj,aL=zj,lL=Uj,iL=Ij,oL=Hj,sL=qj,uL=$j,cL=Vj,Op="DropdownMenu",[dL]=vr(Op,[Cj]),kn=Cj(),[fL,Yj]=dL(Op),Xj=e=>{const{__scopeDropdownMenu:r,children:a,dir:l,open:u,defaultOpen:c,onOpenChange:d,modal:f=!0}=e,m=kn(r),h=S.useRef(null),[v=!1,x]=el({prop:u,defaultProp:c,onChange:d});return o.jsx(fL,{scope:r,triggerId:zr(),triggerRef:h,contentId:zr(),open:v,onOpenChange:x,onOpenToggle:S.useCallback(()=>x(b=>!b),[x]),modal:f,children:o.jsx(Q6,{...m,open:v,onOpenChange:x,dir:l,modal:f,children:a})})};Xj.displayName=Op;var Kj="DropdownMenuTrigger",Qj=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,disabled:l=!1,...u}=e,c=Yj(Kj,a),d=kn(a);return o.jsx(Z6,{asChild:!0,...d,children:o.jsx(Ge.button,{type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed","data-disabled":l?"":void 0,disabled:l,...u,ref:vc(r,c.triggerRef),onPointerDown:Te(e.onPointerDown,f=>{!l&&f.button===0&&f.ctrlKey===!1&&(c.onOpenToggle(),c.open||f.preventDefault())}),onKeyDown:Te(e.onKeyDown,f=>{l||(["Enter"," "].includes(f.key)&&c.onOpenToggle(),f.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});Qj.displayName=Kj;var hL="DropdownMenuPortal",Zj=e=>{const{__scopeDropdownMenu:r,...a}=e,l=kn(r);return o.jsx(J6,{...l,...a})};Zj.displayName=hL;var Jj="DropdownMenuContent",Wj=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,u=Yj(Jj,a),c=kn(a),d=S.useRef(!1);return o.jsx(W6,{id:u.contentId,"aria-labelledby":u.triggerId,...c,...l,ref:r,onCloseAutoFocus:Te(e.onCloseAutoFocus,f=>{var m;d.current||(m=u.triggerRef.current)==null||m.focus(),d.current=!1,f.preventDefault()}),onInteractOutside:Te(e.onInteractOutside,f=>{const m=f.detail.originalEvent,h=m.button===0&&m.ctrlKey===!0,v=m.button===2||h;(!u.modal||v)&&(d.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Wj.displayName=Jj;var mL="DropdownMenuGroup",pL=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,u=kn(a);return o.jsx(eL,{...u,...l,ref:r})});pL.displayName=mL;var gL="DropdownMenuLabel",ek=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,u=kn(a);return o.jsx(tL,{...u,...l,ref:r})});ek.displayName=gL;var xL="DropdownMenuItem",tk=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,u=kn(a);return o.jsx(nL,{...u,...l,ref:r})});tk.displayName=xL;var vL="DropdownMenuCheckboxItem",nk=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,u=kn(a);return o.jsx(rL,{...u,...l,ref:r})});nk.displayName=vL;var yL="DropdownMenuRadioGroup",bL=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,u=kn(a);return o.jsx(aL,{...u,...l,ref:r})});bL.displayName=yL;var wL="DropdownMenuRadioItem",SL=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,u=kn(a);return o.jsx(lL,{...u,...l,ref:r})});SL.displayName=wL;var jL="DropdownMenuItemIndicator",rk=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,u=kn(a);return o.jsx(iL,{...u,...l,ref:r})});rk.displayName=jL;var kL="DropdownMenuSeparator",ak=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,u=kn(a);return o.jsx(oL,{...u,...l,ref:r})});ak.displayName=kL;var CL="DropdownMenuArrow",EL=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,u=kn(a);return o.jsx(sL,{...u,...l,ref:r})});EL.displayName=CL;var NL="DropdownMenuSubTrigger",TL=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,u=kn(a);return o.jsx(uL,{...u,...l,ref:r})});TL.displayName=NL;var AL="DropdownMenuSubContent",_L=S.forwardRef((e,r)=>{const{__scopeDropdownMenu:a,...l}=e,u=kn(a);return o.jsx(cL,{...u,...l,ref:r,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});_L.displayName=AL;var ML=Xj,RL=Qj,DL=Zj,OL=Wj,zL=ek,LL=tk,UL=nk,BL=rk,IL=ak;function lk({...e}){return o.jsx(ML,{"data-slot":"dropdown-menu",...e})}function ik({...e}){return o.jsx(RL,{"data-slot":"dropdown-menu-trigger",...e})}function ok({className:e,sideOffset:r=4,...a}){return o.jsx(DL,{children:o.jsx(OL,{"data-slot":"dropdown-menu-content",sideOffset:r,className:_e("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...a})})}function HL({className:e,inset:r,variant:a="default",...l}){return o.jsx(LL,{"data-slot":"dropdown-menu-item","data-inset":r,"data-variant":a,className:_e("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...l})}function qL({className:e,children:r,checked:a,...l}){return o.jsxs(UL,{"data-slot":"dropdown-menu-checkbox-item",className:_e("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:a,...l,children:[o.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:o.jsx(BL,{children:o.jsx(yc,{className:"size-4"})})}),r]})}function Tm({className:e,inset:r,...a}){return o.jsx(zL,{"data-slot":"dropdown-menu-label","data-inset":r,className:_e("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...a})}function sk({className:e,...r}){return o.jsx(IL,{"data-slot":"dropdown-menu-separator",className:_e("bg-border -mx-1 my-1 h-px",e),...r})}const uk="llmproxy.playground.models",S0="llmproxy.playground.webfetch",PL={type:"function",function:{name:"web_fetch",description:"Fetch a public web page over HTTP(S) and return its text content.",parameters:{type:"object",properties:{url:{type:"string",description:"The absolute http(s) URL to fetch."}},required:["url"]}}},$L=5;function FL(){try{const e=JSON.parse(localStorage.getItem(uk)??"[]");return Array.isArray(e)?e.filter(r=>typeof r=="string"):[]}catch{return[]}}function j0(e){return e.images.length===0?e.text:[...e.text?[{type:"text",text:e.text}]:[],...e.images.map(r=>({type:"image_url",image_url:{url:r.dataUrl}}))]}function VL(){var q;const e=Pt(async()=>{const[$,X]=await Promise.all([Pe.get("/v1/models?endpoint=chat"),Pe.get("/v1/models?endpoint=chat_stream")]);return{chat:$,streamable:new Set(X.data.map(ce=>ce.id))}}),[r,a]=S.useState(FL),[l,u]=S.useState(()=>localStorage.getItem(S0)==="1"),[c,d]=S.useState([]),[f,m]=S.useState(""),[h,v]=S.useState([]),[x,b]=S.useState(!1),y=S.useRef(null),k=S.useRef(1),j=S.useRef(null),A=S.useRef(null),C=(((q=e.data)==null?void 0:q.chat.data)??[]).map($=>$.id);S.useEffect(()=>{e.data&&a($=>{const X=$.filter(ce=>C.includes(ce));return X.length===$.length?$:X})},[e.data]),S.useEffect(()=>{localStorage.setItem(uk,JSON.stringify(r))},[r]),S.useEffect(()=>{localStorage.setItem(S0,l?"1":"0")},[l]),S.useEffect(()=>()=>{var $;return($=y.current)==null?void 0:$.abort()},[]);const R=($,X)=>{a(ce=>X?[...ce,$]:ce.filter(le=>le!==$))},D=($,X,ce)=>{d(le=>le.map(ee=>ee.id===$?{...ee,replies:{...ee.replies,[X]:{...ee.replies[X],...ce}}}:ee))},B=async($,X,ce,le,ee)=>{var ye;const U=[];for(const de of X){U.push({role:"user",content:j0(de)});const be=de.replies[$];(be==null?void 0:be.status)==="done"&&be.text&&U.push({role:"assistant",content:be.text})}U.push({role:"user",content:j0(ce)});const Z=((ye=e.data)==null?void 0:ye.streamable.has($))??!0,ie=performance.now();let K,N="",L,F;const M=[],oe=(de,be)=>D(ce.id,$,{status:de,error:be,text:N,firstTokenMs:K,promptTokens:L,completionTokens:F,totalMs:performance.now()-ie}),G=de=>{de&&(de.prompt_tokens!==void 0&&(L=(L??0)+de.prompt_tokens),de.completion_tokens!==void 0&&(F=(F??0)+de.completion_tokens))},ue=(de,be)=>{K===void 0&&(K=performance.now()-ie),be&&N&&(N+=` + +`),N+=de,D(ce.id,$,{text:N})},re=async()=>{var Mt,Ct,Et,Lt,Rt,Dt,zt;const de=await fetch("/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({model:$,messages:U,stream:Z,...le?{tools:[PL]}:{}}),signal:ee});if(!de.ok||!de.body){let we=`HTTP ${de.status}`;try{we=((Mt=(await de.json()).error)==null?void 0:Mt.message)??we}catch{}return oe("error",we),"error"}if(!Z){const we=await de.json(),mt=(Et=(Ct=we.choices)==null?void 0:Ct[0])==null?void 0:Et.message,Y=typeof(mt==null?void 0:mt.content)=="string"?mt.content:"";Y&&ue(Y,!0),G(we.usage);const qe=(mt==null?void 0:mt.tool_calls)??[];return qe.length>0&&U.push({role:"assistant",content:Y||null,tool_calls:qe}),qe}const be=de.body.getReader(),Ee=new TextDecoder,Se=[];let Ie="",Be="";for(;;){const{done:we,value:mt}=await be.read();if(we)break;Be+=Ee.decode(mt,{stream:!0});let Y;for(;(Y=Be.indexOf(` +`))>=0;){const qe=Be.slice(0,Y).trim();if(Be=Be.slice(Y+1),!qe.startsWith("data:"))continue;const ne=qe.slice(5).trim();if(!ne||ne==="[DONE]")continue;let z;try{z=JSON.parse(ne)}catch{continue}const fe=(Rt=(Lt=z.choices)==null?void 0:Lt[0])==null?void 0:Rt.delta;fe!=null&&fe.content&&(ue(fe.content,Ie===""),Ie+=fe.content);for(const ke of(fe==null?void 0:fe.tool_calls)??[]){const Oe=ke.index??0;Se[Oe]??(Se[Oe]={id:"",type:"function",function:{name:"",arguments:""}}),ke.id&&(Se[Oe].id=ke.id),(Dt=ke.function)!=null&&Dt.name&&(Se[Oe].function.name+=ke.function.name),(zt=ke.function)!=null&&zt.arguments&&(Se[Oe].function.arguments+=ke.function.arguments)}G(z.usage)}}return Se.length>0&&U.push({role:"assistant",content:Ie||null,tool_calls:Se}),Se};try{for(let de=0;de<$L;de++){const be=await re();if(be==="error")return;if(be.length===0){oe("done");return}for(const Ee of be){let Se="";try{Se=String(JSON.parse(Ee.function.arguments).url??"")}catch{}M.push(Se||"(invalid tool arguments)"),D(ce.id,$,{tools:[...M]});let Ie;if(Ee.function.name!=="web_fetch"||!Se)Ie="error: only the web_fetch tool with a url argument is available";else try{const Be=await Pe.post("/my/webfetch",{url:Se});Ie=`HTTP ${Be.status} +${Be.text}${Be.truncated?` +[content truncated]`:""}`}catch(Be){Ie=`fetch failed: ${Be instanceof Error?Be.message:String(Be)}`}U.push({role:"tool",tool_call_id:Ee.id,content:Ie})}}oe("done")}catch(de){ee.aborted?N?oe("done"):oe("error","stopped"):oe("error",de instanceof Error?de.message:String(de))}},O=async()=>{const $=f.trim();if(!$&&h.length===0||r.length===0||x)return;const X=c,ce={id:k.current++,text:$,images:h,replies:{}};for(const ee of r)ce.replies[ee]={text:"",status:"streaming"};d([...X,ce]),m(""),v([]),b(!0),requestAnimationFrame(()=>{var ee;return(ee=A.current)==null?void 0:ee.scrollIntoView({behavior:"smooth"})});const le=new AbortController;y.current=le,await Promise.all(r.map(ee=>B(ee,X,ce,l,le.signal))),b(!1)},_=()=>{var $;return($=y.current)==null?void 0:$.abort()},E=$=>{for(const X of $){if(!X.type.startsWith("image/"))continue;const ce=new FileReader;ce.onload=()=>{const le=ce.result;typeof le=="string"&&v(ee=>[...ee,{name:X.name,dataUrl:le}])},ce.readAsDataURL(X)}},I=$=>{const X=Array.from($.clipboardData.files);X.length>0&&($.preventDefault(),E(X))},W=$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),O())};return e.loading&&!e.data?o.jsx(Tt,{}):e.error?o.jsx("p",{className:"text-sm text-destructive",children:e.error}):o.jsxs(Qe,{children:[o.jsxs(et,{children:[o.jsx(tt,{className:"font-serif",children:"Playground"}),o.jsx(ct,{children:"Chat with your models straight from the browser; nothing is saved."}),o.jsxs(aN,{className:"flex flex-wrap items-center justify-end gap-2",children:[o.jsxs(Re,{variant:l?"secondary":"outline","aria-pressed":l,title:"Let the model fetch public web pages",onClick:()=>u($=>!$),children:[o.jsx(W0,{}),"Web fetch: ",l?"on":"off"]}),o.jsxs(lk,{children:[o.jsx(ik,{asChild:!0,children:o.jsxs(Re,{variant:"outline",children:[r.length===0?"Select models":r.length===1?r[0]:`${r.length} models`,o.jsx(Ki,{})]})}),o.jsxs(ok,{align:"end",className:"max-h-96",children:[o.jsx(Tm,{className:"font-normal text-muted-foreground",children:"Pick several to compare"}),o.jsx(sk,{}),C.length===0&&o.jsx(Tm,{className:"font-normal text-muted-foreground",children:"No chat models configured"}),C.map($=>o.jsx(qL,{checked:r.includes($),onCheckedChange:X=>R($,X===!0),onSelect:X=>X.preventDefault(),children:$},$))]})]}),c.length>0&&o.jsxs(Re,{variant:"outline",disabled:x,onClick:()=>d([]),children:[o.jsx(zm,{}),"Clear chat"]})]})]}),o.jsxs(Ze,{className:"flex flex-col gap-6",children:[c.length===0&&o.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:r.length===0?"Select a model to start.":"Send a message to start."}),c.map($=>o.jsx(GL,{turn:$},$.id)),o.jsx("div",{ref:A}),o.jsxs("div",{className:"flex flex-col gap-2 border-t pt-4",children:[h.length>0&&o.jsx("div",{className:"flex flex-wrap gap-2",children:h.map(($,X)=>o.jsxs("div",{className:"relative",children:[o.jsx("img",{src:$.dataUrl,alt:$.name,className:"h-16 w-16 rounded-md border object-cover"}),o.jsx(Re,{variant:"secondary",size:"icon-sm","aria-label":`Remove ${$.name}`,className:"absolute -top-2 -right-2 size-5 rounded-full",onClick:()=>v(ce=>ce.filter((le,ee)=>ee!==X)),children:o.jsx(Lm,{className:"size-3"})})]},X))}),o.jsxs("div",{className:"flex items-end gap-2",children:[o.jsx("input",{ref:j,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:$=>{E($.target.files??[]),$.target.value=""}}),o.jsx(Re,{variant:"outline",size:"icon","aria-label":"Attach image",title:"Attach image",onClick:()=>{var $;return($=j.current)==null?void 0:$.click()},children:o.jsx(VE,{})}),o.jsx(S6,{className:"max-h-48 min-h-9",rows:1,placeholder:r.length>1?`Message ${r.length} models`:"Message",value:f,onChange:$=>m($.target.value),onKeyDown:W,onPaste:I}),x?o.jsx(Re,{variant:"outline",size:"icon","aria-label":"Stop",title:"Stop",onClick:_,children:o.jsx(KE,{})}):o.jsx(Re,{size:"icon","aria-label":"Send",title:"Send",disabled:!f.trim()&&h.length===0||r.length===0,onClick:()=>void O(),children:o.jsx(XE,{})})]})]})]})]})}function GL({turn:e}){const r=Object.keys(e.replies);return o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"ml-auto max-w-[85%]",children:o.jsxs("div",{className:"rounded-lg bg-primary px-3 py-2 text-sm whitespace-pre-wrap text-primary-foreground",children:[e.images.length>0&&o.jsx("div",{className:"mb-1 flex flex-wrap gap-2",children:e.images.map((a,l)=>o.jsx("img",{src:a.dataUrl,alt:a.name,className:"max-h-40 rounded-md"},l))}),e.text]})}),o.jsx("div",{className:"grid gap-3 [grid-template-columns:repeat(auto-fit,minmax(260px,1fr))]",children:r.map(a=>o.jsx(YL,{model:a,reply:e.replies[a],solo:r.length===1},a))})]})}function YL({model:e,reply:r,solo:a}){return o.jsxs("div",{className:a?"":"rounded-lg border p-3",children:[o.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[o.jsx(dn,{variant:"secondary",className:"font-mono",children:e}),r.status==="streaming"&&o.jsx(Tt,{className:"size-3"}),o.jsx(XL,{reply:r})]}),r.tools&&r.tools.length>0&&o.jsx("div",{className:"mb-1 flex flex-col gap-0.5",children:r.tools.map((l,u)=>o.jsxs("span",{className:"flex items-center gap-1 break-all text-xs text-muted-foreground",children:[o.jsx(W0,{className:"size-3 shrink-0"}),l]},u))}),r.status==="error"?o.jsx("p",{className:"text-sm text-destructive",children:r.error}):o.jsx("div",{className:"text-sm",children:r.text?o.jsx(w6,{text:r.text}):r.status==="done"&&o.jsx("span",{className:"text-muted-foreground",children:"(empty response)"})})]})}function XL({reply:e}){if(e.status!=="done")return null;const r=[];if(e.firstTokenMs!==void 0&&r.push(`${(e.firstTokenMs/1e3).toFixed(2)}s to first token`),e.totalMs!==void 0&&r.push(`${(e.totalMs/1e3).toFixed(2)}s total`),e.completionTokens&&e.totalMs){const a=e.firstTokenMs!==void 0&&e.totalMs-e.firstTokenMs>100?e.totalMs-e.firstTokenMs:e.totalMs;r.push(`${(e.completionTokens/(a/1e3)).toFixed(1)} tok/s`)}return(e.promptTokens!==void 0||e.completionTokens!==void 0)&&r.push(`${e.promptTokens??"?"} in / ${e.completionTokens??"?"} out`),r.length===0?null:o.jsx("span",{className:"text-xs text-muted-foreground",children:r.join(" ยท ")})}const k0="llmproxy-theme",ck=S.createContext({theme:"system",resolvedTheme:"light",setTheme:()=>{}});function C0(){return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function KL({children:e}){const[r,a]=S.useState(()=>{const d=localStorage.getItem(k0);return d==="light"||d==="dark"?d:"system"}),l=r==="system"?C0():r,u=S.useCallback(d=>{const f=d==="system"?C0():d;document.documentElement.classList.toggle("dark",f==="dark")},[]),c=S.useCallback(d=>{a(d),localStorage.setItem(k0,d),u(d)},[u]);return S.useEffect(()=>{u(r);const d=matchMedia("(prefers-color-scheme: dark)"),f=()=>u(r);return d.addEventListener("change",f),()=>d.removeEventListener("change",f)},[r,u]),o.jsx(ck.Provider,{value:{theme:r,resolvedTheme:l,setTheme:c},children:e})}function dk(){return S.useContext(ck)}function QL(){const[e,r]=S.useState(null),[a,l]=S.useState(!1),u=S.useCallback(()=>{Pe.get("/auth/me").then(r).catch(()=>l(!0))},[]);return S.useEffect(u,[u]),a?o.jsx("div",{className:"flex min-h-screen items-center justify-center",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"The proxy is not reachable. Reload to retry."})}):e===null?o.jsx("div",{className:"flex min-h-screen items-center justify-center",children:o.jsx(Tt,{className:"size-6"})}):e.authenticated?o.jsx(e9,{me:e}):o.jsx(lN,{me:e,onLogin:u})}function ZL(){const{theme:e,setTheme:r}=dk(),a={light:"dark",dark:"system",system:"light"},l={light:o.jsx(ZE,{}),dark:o.jsx(YE,{}),system:o.jsx(QE,{})};return o.jsx(Re,{variant:"ghost",size:"icon","aria-label":`Theme: ${e}. Switch to ${a[e]}`,title:`Theme: ${e}`,onClick:()=>r(a[e]),children:l[e]})}const JL=["providers","models","users","services","all-keys"],WL=["overview","apps","models","providers","errors"];function E0(e){const r=window.location.pathname.replace(/^\/+/,"").split("/");let a=r[0];if(a==="activity"&&(a="requests"),e&&JL.includes(a))return{tab:"admin",sub:a,usageSub:"overview"};const l=["usage","requests","keys","playground"].includes(a)?a:"usage",u=l==="usage"&&WL.includes(r[1])?r[1]:"overview";return{tab:l,sub:"providers",usageSub:u}}function e9({me:e}){const r=e.role==="admin",[a,l]=S.useState(()=>E0(r));S.useEffect(()=>{const m=()=>l(E0(r));return window.addEventListener("popstate",m),()=>window.removeEventListener("popstate",m)},[r]);const u=m=>{l(m);let h="/"+(m.tab==="admin"?m.sub:m.tab);m.tab==="usage"&&m.usageSub!=="overview"&&(h+="/"+m.usageSub),window.location.pathname!==h&&window.history.pushState(null,"",h)},c=m=>u({...a,tab:m}),d=m=>u({...a,tab:"admin",sub:m}),f=m=>u({...a,tab:"usage",usageSub:m});return o.jsxs(mm,{value:a.tab,onValueChange:c,children:[o.jsx("header",{className:"border-b bg-card",children:o.jsxs("div",{className:"mx-auto flex max-w-6xl flex-wrap items-center gap-x-6 gap-y-2 px-4 py-3",children:[o.jsxs("a",{href:"/usage",onClick:m=>{m.metaKey||m.ctrlKey||m.shiftKey||m.button!==0||(m.preventDefault(),c("usage"))},className:"flex items-center gap-2 rounded-md outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[o.jsx(V0,{className:"h-6"}),o.jsx("span",{className:"font-serif text-lg font-semibold",children:"llmproxy"})]}),o.jsxs(pm,{children:[o.jsx(lr,{value:"usage",children:"Usage"}),o.jsx(lr,{value:"requests",children:"Requests"}),o.jsx(lr,{value:"keys",children:"API keys"}),o.jsx(lr,{value:"playground",children:"Playground"}),r&&o.jsx(lr,{value:"admin",children:"Admin"})]}),o.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[o.jsx(ZL,{}),o.jsxs(lk,{children:[o.jsx(ik,{asChild:!0,children:o.jsxs(Re,{variant:"ghost",className:"gap-2",children:[o.jsx(PE,{}),o.jsx("span",{className:"max-w-40 truncate",children:e.name}),r&&o.jsx(dn,{variant:"secondary",children:"admin"})]})}),o.jsxs(ok,{align:"end",children:[o.jsxs(Tm,{className:"font-normal text-muted-foreground",children:["Signed in as ",e.name]}),o.jsx(sk,{}),o.jsx(HL,{onClick:()=>window.location.href="/auth/logout",children:"Sign out"})]})]})]})]})}),o.jsxs("main",{className:"mx-auto flex w-full max-w-6xl flex-col gap-6 px-4 py-8",children:[o.jsx(Ar,{value:"usage",children:o.jsx(nR,{ssoEnabled:e.sso_enabled,sub:a.usageSub,onSubChange:f})}),o.jsx(Ar,{value:"requests",children:o.jsx(PR,{})}),o.jsx(Ar,{value:"keys",children:o.jsx(jA,{})}),o.jsx(Ar,{value:"playground",forceMount:!0,className:"data-[state=inactive]:hidden",children:o.jsx(VL,{})}),r&&o.jsx(Ar,{value:"admin",children:o.jsxs(mm,{value:a.sub,onValueChange:d,className:"gap-6",children:[o.jsxs(pm,{children:[o.jsx(lr,{value:"providers",children:"Providers"}),o.jsx(lr,{value:"models",children:"Models"}),o.jsx(lr,{value:"users",children:"Users"}),o.jsx(lr,{value:"services",children:"Services"}),o.jsx(lr,{value:"all-keys",children:"All keys"})]}),o.jsx(Ar,{value:"providers",children:o.jsx(dR,{})}),o.jsx(Ar,{value:"models",children:o.jsx(MR,{})}),o.jsx(Ar,{value:"users",children:o.jsx(FR,{})}),o.jsx(Ar,{value:"services",children:o.jsx(GR,{})}),o.jsx(Ar,{value:"all-keys",children:o.jsx(YR,{})})]})})]})]})}const t9=({...e})=>{const{resolvedTheme:r}=dk();return o.jsx(RN,{theme:r,className:"toaster group",style:{"--normal-bg":"var(--color-popover)","--normal-text":"var(--color-popover-foreground)","--normal-border":"var(--color-border)"},...e})};z2.createRoot(document.getElementById("root")).render(o.jsx(S.StrictMode,{children:o.jsxs(KL,{children:[o.jsx(QL,{}),o.jsx(t9,{position:"bottom-right"})]})})); diff --git a/internal/server/uidist/index.html b/internal/server/uidist/index.html index 290c5a5..b9b30a7 100644 --- a/internal/server/uidist/index.html +++ b/internal/server/uidist/index.html @@ -14,8 +14,8 @@ } } catch {} - - + +
diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 14e0f68..6ceea44 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -92,7 +92,7 @@ const ADMIN_SUBS = ['providers', 'models', 'users', 'services', 'all-keys'] // The Usage tab has its own second segment (/usage/apps, /usage/errors), // kept in a separate field so the admin sub-nav is untouched by it. -const USAGE_SUBS = ['overview', 'apps', 'models', 'errors'] +const USAGE_SUBS = ['overview', 'apps', 'models', 'providers', 'errors'] interface Nav { tab: string diff --git a/ui/src/components/ProvidersUsage.tsx b/ui/src/components/ProvidersUsage.tsx new file mode 100644 index 0000000..8e29b59 --- /dev/null +++ b/ui/src/components/ProvidersUsage.tsx @@ -0,0 +1,154 @@ +import { api, type RateLimitSnapshot, formatNumber } from '@/lib/api' +import { useAsync } from '@/lib/useAsync' +import { Button } from '@/components/ui/button' +import { Spinner } from '@/components/ui/spinner' +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from '@/components/ui/card' +import { cn } from '@/lib/utils' +import { RefreshCw } from 'lucide-react' + +function ago(ts: string): string { + const ms = Date.now() - new Date(ts).getTime() + if (ms < 60_000) return 'just now' + const mins = Math.floor(ms / 60_000) + if (mins < 60) return `${mins}m ago` + const hours = Math.floor(mins / 60) + if (hours < 24) return `${hours}h ago` + return `${Math.floor(hours / 24)}d ago` +} + +function pct(remaining: number | undefined, limit: number | undefined): string | null { + if (remaining === undefined || limit === undefined || limit === 0) return null + return `${Math.round((remaining / limit) * 100)}%` +} + +function Meter({ + label, + remaining, + limit, +}: { + label: string + remaining: number | undefined + limit: number | undefined +}) { + if (remaining === undefined && limit === undefined) return null + const ratio = limit && limit > 0 ? (remaining ?? 0) / limit : null + const color = + ratio === null + ? 'bg-muted-foreground' + : ratio > 0.5 + ? 'bg-green-500' + : ratio > 0.2 + ? 'bg-yellow-500' + : 'bg-red-500' + return ( +
+
+ {label} + + {remaining !== undefined ? formatNumber(remaining) : '?'} + {limit !== undefined ? ` / ${formatNumber(limit)}` : ''} + {pct(remaining, limit) && ( + ({pct(remaining, limit)}) + )} + +
+ {ratio !== null && ( +
+
+
+ )} +
+ ) +} + +function ProviderCard({ snap }: { snap: RateLimitSnapshot }) { + const hasRequests = snap.limit_requests !== undefined || snap.remaining_requests !== undefined + const hasTokens = snap.limit_tokens !== undefined || snap.remaining_tokens !== undefined + return ( + + +
+ {snap.provider} + + {ago(snap.observed_at)} + {snap.stale && ' (stale)'} + +
+
+ + {hasRequests && ( + + )} + {hasTokens && ( + + )} + {!hasRequests && !hasTokens && ( +

No rate-limit data yet.

+ )} +
+
+ ) +} + +export function ProvidersUsage() { + const { data, loading, error, reload } = useAsync( + () => api.get<{ rate_limits: RateLimitSnapshot[] }>('/stats/rate-limits'), + [], + ) + + return ( +
+
+
+

Provider rate limits

+

+ Upstream quota reported by each configured provider. +

+
+ +
+ + {loading && !data ? ( +
+ +
+ ) : error ? ( +

{error}

+ ) : data?.rate_limits.length === 0 ? ( + + + No provider reports rate limits yet. + + + ) : ( +
+ {data?.rate_limits.map((snap) => ( + + ))} +
+ )} +
+ ) +} diff --git a/ui/src/lib/api.ts b/ui/src/lib/api.ts index a973d92..8e7ed2b 100644 --- a/ui/src/lib/api.ts +++ b/ui/src/lib/api.ts @@ -146,6 +146,22 @@ export interface Provider { // null means unlimited. max_concurrency: number | null enabled: boolean + rate_limit_headers: Record | null +} + +export interface RateLimitSnapshot { + provider: string + provider_id: string + observed_at: string + stale: boolean + limit_requests?: number + remaining_requests?: number + min_remaining_requests?: number + limit_tokens?: number + remaining_tokens?: number + min_remaining_tokens?: number + reset_requests_at?: string + reset_tokens_at?: string } export interface Model { diff --git a/ui/src/pages/Providers.tsx b/ui/src/pages/Providers.tsx index 82b9133..c4d5d9e 100644 --- a/ui/src/pages/Providers.tsx +++ b/ui/src/pages/Providers.tsx @@ -41,6 +41,13 @@ function errMsg(err: unknown): string { return err instanceof Error ? err.message : String(err) } +const STANDARD_RL_HEADERS: Record = { + limit_requests: 'x-ratelimit-limit-requests', + remaining_requests: 'x-ratelimit-remaining-requests', + limit_tokens: 'x-ratelimit-limit-tokens', + remaining_tokens: 'x-ratelimit-remaining-tokens', +} + // The editable operational settings of one provider. Numbers stay strings // while typed; parsing happens on save. interface EditState { @@ -52,6 +59,7 @@ interface EditState { timeout_connect: string timeout_read: string max_concurrency: string // empty = unlimited + rate_limit_headers: Record } function editStateOf(p: Provider): EditState { @@ -64,6 +72,7 @@ function editStateOf(p: Provider): EditState { timeout_connect: String(p.timeout_connect), timeout_read: String(p.timeout_read), max_concurrency: p.max_concurrency === null ? '' : String(p.max_concurrency), + rate_limit_headers: p.rate_limit_headers ? { ...p.rate_limit_headers } : {}, } } @@ -116,12 +125,16 @@ export function Providers() { } setSaving(true) try { + const rlh = Object.keys(editing.rate_limit_headers).length > 0 + ? editing.rate_limit_headers + : {} await api.patch(`/admin/v1/providers/${encodeURIComponent(editing.name)}`, { base_url: editing.base_url.trim(), verify_tls: editing.verify_tls, timeout_connect: connect, timeout_read: read, max_concurrency: concurrency, // 0 clears the cap + rate_limit_headers: rlh, ...(editing.api_key !== '' ? { api_key: editing.api_key } : {}), ...(editing.remove_credential ? { remove_credential: true } : {}), }) @@ -358,6 +371,65 @@ export function Providers() { />
+
+
+ + {Object.keys(editing.rate_limit_headers).length === 0 && ( + + )} + {Object.keys(editing.rate_limit_headers).length > 0 && ( + + )} +
+ {Object.keys(editing.rate_limit_headers).length > 0 && ( +
+ {Object.entries(editing.rate_limit_headers).map(([key, val]) => ( +
+ {key} + + setEditing({ + ...editing, + rate_limit_headers: { + ...editing.rate_limit_headers, + [key]: e.target.value, + }, + }) + } + /> +
+ ))} +
+ )} + {Object.keys(editing.rate_limit_headers).length === 0 && ( +

+ Not configured. Click "Use standard headers" to track upstream + rate limits. +

+ )} +