diff --git a/cmd/fanout-docgen/routes.go b/cmd/fanout-docgen/routes.go index 9e7ddfed..fee79427 100644 --- a/cmd/fanout-docgen/routes.go +++ b/cmd/fanout-docgen/routes.go @@ -253,7 +253,7 @@ func renderRoutes(routes []api.RouteDoc) []byte { b.WriteString("- `/debug/pprof/*` — only when `FANOUT_PPROF_ENABLED` is true, which is\n") b.WriteString(" **not** the default. Enabling it also turns on mutex and block sampling.\n") - b.WriteString("- `/mcp`, `/api/mcp`, `/oauth/*` and `/.well-known/*` — only when\n") + b.WriteString("- `/mcp`, `/api/mcp`, `/api/auth/oauth/*`, `/oauth/*` and `/.well-known/*` — only when\n") b.WriteString(" `FANOUT_MCP_ENABLED` is true, which **is** the default.\n") b.WriteString("- `/api/agent/*` — only when `FANOUT_AI_PROVIDER` selects `anthropic` or\n") b.WriteString(" `openai`, with that provider's required key. An empty provider disables chat.\n") diff --git a/docs/authentication.md b/docs/authentication.md index a629fecf..1e3929f8 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -238,6 +238,19 @@ The `issuer` value relaxes that check and is accepted only when an allow policy is configured, on the basis that the issuer itself vouches for the address. Use it only with a provider you administer. +## MCP OAuth connections + +Signed-in users can review their connected agents in Settings and disconnect +one agent at a time. Disconnecting immediately revokes that client's access and +refresh tokens for the current user. Other agents and browser sessions stay +connected. To reconnect, authorize the agent again. + +`GET /api/auth/oauth/connections` lists the current user's live connections; +`POST /api/auth/oauth/connections/{id}/revoke` disconnects one client. Both +require a browser session. Administrators can still revoke all of a user's +access, including browser sessions and OAuth tokens, through +`POST /api/users/{id}/access/revoke`. + ## Credentials at a glance | Credential | Purpose | Rotation | @@ -247,7 +260,7 @@ it only with a provider you administer. | Browser session | Interactive access | Idle and absolute TTL; revoked on role, email, or status change | | Ingest token | OTLP ingest | Settings page | | Metrics token | `/metrics` scrape | `FANOUT_METRICS_TOKEN` | -| MCP OAuth tokens | MCP clients | One-hour access tokens; refresh rotation with replay-family revocation, admitting the same client's just-rotated token for one minute so processes sharing a credential can refresh together | +| MCP OAuth tokens | MCP clients | 30-day access tokens, checked on every request; 90-day refresh tokens renewed on each use. Refresh rotation with replay-family revocation, admitting the same client's rotated token for one access-token lifetime so processes sharing a credential can refresh from stale copies. Users disconnect individual agents in Settings; admins can still revoke all of a user's access | Local email codes allow three attempts per code and expire after five minutes. Attempts are reserved atomically, so concurrent guesses cannot exceed the limit. diff --git a/internal/api/auth_middleware.go b/internal/api/auth_middleware.go index 4cdf125d..a91e3b65 100644 --- a/internal/api/auth_middleware.go +++ b/internal/api/auth_middleware.go @@ -278,6 +278,11 @@ func classifyRoute(method, path string) (routePolicy, bool) { return routePolicy{kind: routePolicyAuthenticated}, method == http.MethodPost case path == "/api/auth/oauth/authorize": return routePolicy{kind: routePolicyAuthenticated}, read || method == http.MethodPost + case path == "/api/auth/oauth/connections": + return routePolicy{kind: routePolicyAuthenticated}, read + case strings.HasPrefix(path, "/api/auth/oauth/connections/"): + id, action, _ := strings.Cut(strings.TrimPrefix(path, "/api/auth/oauth/connections/"), "/") + return routePolicy{kind: routePolicyAuthenticated}, id != "" && action == "revoke" && method == http.MethodPost case strings.HasPrefix(path, "/.well-known/"): return routePolicy{kind: routePolicyProtocol}, read case path == "/oauth/register" || path == "/oauth/token": diff --git a/internal/api/auth_test.go b/internal/api/auth_test.go index 9b1810a0..00627d73 100644 --- a/internal/api/auth_test.go +++ b/internal/api/auth_test.go @@ -163,6 +163,8 @@ func TestRoutePolicyClassification(t *testing.T) { {http.MethodPost, "/api/auth/logout", routePolicyAuthenticated, ""}, {http.MethodGet, "/api/auth/oauth/authorize", routePolicyAuthenticated, ""}, {http.MethodPost, "/api/auth/oauth/authorize", routePolicyAuthenticated, ""}, + {http.MethodGet, "/api/auth/oauth/connections", routePolicyAuthenticated, ""}, + {http.MethodPost, "/api/auth/oauth/connections/client-1/revoke", routePolicyAuthenticated, ""}, {http.MethodGet, "/api/traces/abc", routePolicyCapability, ReadTelemetry}, {http.MethodHead, "/api/traces/abc", routePolicyCapability, ReadTelemetry}, {http.MethodGet, "/api/intelligence", routePolicyCapability, ReadTelemetry}, diff --git a/internal/api/oauth.go b/internal/api/oauth.go index ba7fcfab..1a5fe3b9 100644 --- a/internal/api/oauth.go +++ b/internal/api/oauth.go @@ -82,6 +82,49 @@ func (h *MCPAuthorization) Register(e *echo.Echo) { e.POST("/oauth/token", h.Token) e.GET("/api/auth/oauth/authorize", h.Authorize) e.POST("/api/auth/oauth/authorize", h.Authorize) + e.GET("/api/auth/oauth/connections", h.ListConnections, browserOAuthConnection) + e.POST("/api/auth/oauth/connections/:id/revoke", h.RevokeConnection, browserOAuthConnection) +} + +func browserOAuthConnection(next echo.HandlerFunc) echo.HandlerFunc { + return func(c *echo.Context) error { + c.Response().Header().Set("Cache-Control", "no-store") + if fields := strings.Fields(c.Request().Header.Get("Authorization")); len(fields) > 0 && strings.EqualFold(fields[0], "Bearer") { + return echo.NewHTTPError(http.StatusUnauthorized, "browser session required") + } + return next(c) + } +} + +func (h *MCPAuthorization) ListConnections(c *echo.Context) error { + userID, err := RequestOwner(c) + if err != nil { + return err + } + connections, err := h.store.ListConnections(c.Request().Context(), userID) + if err != nil { + slog.Error("list OAuth connections failed", "err", err) + return echo.NewHTTPError(http.StatusInternalServerError, "failed to list connections") + } + return c.JSON(http.StatusOK, map[string]any{"connections": connections}) +} + +func (h *MCPAuthorization) RevokeConnection(c *echo.Context) error { + userID, err := RequestOwner(c) + if err != nil { + return err + } + err = h.store.RevokeConnection(c.Request().Context(), userID, c.Param("id"), appauth.AuditEvent{ + RemoteIP: c.RealIP(), UserAgent: c.Request().UserAgent(), + }) + if errors.Is(err, appauth.ErrOAuthConnectionNotFound) { + return echo.NewHTTPError(http.StatusNotFound, "connection not found") + } + if err != nil { + slog.Error("revoke OAuth connection failed", "err", err) + return echo.NewHTTPError(http.StatusInternalServerError, "failed to revoke connection") + } + return c.JSON(http.StatusOK, map[string]bool{"ok": true}) } func (h *MCPAuthorization) ProtectMCP(next http.Handler) http.Handler { diff --git a/internal/api/oauth_test.go b/internal/api/oauth_test.go index cc115473..a9a42df2 100644 --- a/internal/api/oauth_test.go +++ b/internal/api/oauth_test.go @@ -4,6 +4,7 @@ import ( "crypto/sha256" "encoding/base64" "encoding/json" + "errors" "fmt" "net/http" "net/http/httptest" @@ -861,3 +862,125 @@ func TestMCPOAuthConsentMarksDynamicClientUnverified(t *testing.T) { t.Fatalf("consent screen presents an attacker-chosen client name with no provenance warning: %s", page) } } + +func TestOAuthConnectionsRequireBrowserSession(t *testing.T) { + s := newTestAuthServer(t) + store := auth.NewOAuthStore(s.db.DB) + handler, err := NewMCPAuthorization(store, s.users, testMCPResource) + if err != nil { + t.Fatal(err) + } + handler.Register(s.e) + user, err := s.users.CreateWithAudit("connections-auth@example.com", "", "admin", auth.AuditEvent{EventType: "user.created", Outcome: "success"}) + if err != nil { + t.Fatal(err) + } + client := registerOAuthClient(t, s.e) + pair, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, mcpReadScope, testMCPResource) + if err != nil { + t.Fatal(err) + } + cookie := s.login(t, user) + for _, route := range []struct{ method, path string }{ + {http.MethodGet, "/api/auth/oauth/connections"}, + {http.MethodPost, "/api/auth/oauth/connections/" + client.ClientID + "/revoke"}, + } { + for _, credential := range []string{"anonymous", "bearer", "bearer with cookie"} { + t.Run(route.method+" "+credential, func(t *testing.T) { + req := httptest.NewRequest(route.method, route.path, nil) + req.Header.Set("Fanout-Request", "1") + if credential != "anonymous" { + req.Header.Set("Authorization", "Bearer "+pair.AccessToken) + } + if credential == "bearer with cookie" { + req.AddCookie(cookie) + } + rec := httptest.NewRecorder() + s.e.ServeHTTP(rec, req) + if rec.Code != http.StatusUnauthorized || rec.Header().Get("Cache-Control") != "no-store" { + t.Fatalf("response = %d %v %s", rec.Code, rec.Header(), rec.Body.String()) + } + var body map[string]any + if err := json.Unmarshal(rec.Body.Bytes(), &body); err != nil || body["code"] != "unauthorized" || body["message"] == nil { + t.Fatalf("error body = %s, %v", rec.Body.String(), err) + } + }) + } + } +} + +func TestOAuthConnectionsAreOwnAccountOnlyForEveryRole(t *testing.T) { + for _, role := range []auth.Role{auth.RoleAdmin, auth.RoleOperator, auth.RoleViewer} { + t.Run(string(role), func(t *testing.T) { + s := newTestAuthServer(t) + store := auth.NewOAuthStore(s.db.DB) + handler, err := NewMCPAuthorization(store, s.users, testMCPResource) + if err != nil { + t.Fatal(err) + } + handler.Register(s.e) + user, err := s.users.CreateWithAudit("connections-owner@example.com", "", role, auth.AuditEvent{EventType: "user.created", Outcome: "success"}) + if err != nil { + t.Fatal(err) + } + other, err := s.users.CreateWithAudit("connections-other@example.com", "", "viewer", auth.AuditEvent{EventType: "user.created", Outcome: "success"}) + if err != nil { + t.Fatal(err) + } + ownClient := registerOAuthClient(t, s.e) + otherClient := registerOAuthClient(t, s.e) + issue := func(clientID, userID string) auth.OAuthTokenPair { + t.Helper() + pair, err := store.IssueTokenPair(t.Context(), clientID, userID, mcpReadScope, testMCPResource) + if err != nil { + t.Fatal(err) + } + return pair + } + ownToken := issue(ownClient.ClientID, user.ID) + otherToken := issue(otherClient.ClientID, other.ID) + cookie := s.login(t, user) + list := serve(t, s.e, http.MethodGet, "/api/auth/oauth/connections?user_id="+other.ID, "", nil, cookie) + var body struct { + Connections []auth.OAuthConnection `json:"connections"` + } + if err := json.Unmarshal(list.Body.Bytes(), &body); err != nil { + t.Fatal(err) + } + if list.Code != http.StatusOK || list.Header().Get("Cache-Control") != "no-store" || len(body.Connections) != 1 || body.Connections[0].ClientID != ownClient.ClientID || body.Connections[0].ClientName != ownClient.ClientName || body.Connections[0].ConnectedAt.IsZero() || body.Connections[0].RefreshedAt.IsZero() || body.Connections[0].Scope != mcpReadScope { + t.Fatalf("list = %d %s", list.Code, list.Body.String()) + } + for _, clientID := range []string{otherClient.ClientID, "unknown"} { + rec := serve(t, s.e, http.MethodPost, "/api/auth/oauth/connections/"+clientID+"/revoke", "", map[string]string{"Fanout-Request": "1"}, cookie) + if rec.Code != http.StatusNotFound || rec.Header().Get("Cache-Control") != "no-store" || !strings.Contains(rec.Body.String(), `"code":"not_found"`) { + t.Fatalf("other or unknown revoke = %d %s", rec.Code, rec.Body.String()) + } + } + request := httptest.NewRequest(http.MethodPost, "/api/auth/oauth/connections/"+ownClient.ClientID+"/revoke", nil) + request.AddCookie(cookie) + blocked := httptest.NewRecorder() + s.e.ServeHTTP(blocked, request) + if blocked.Code != http.StatusForbidden { + t.Fatalf("revoke without CSRF header = %d", blocked.Code) + } + revoked := serve(t, s.e, http.MethodPost, "/api/auth/oauth/connections/"+ownClient.ClientID+"/revoke", "", map[string]string{"Fanout-Request": "1", "User-Agent": "connection-test"}, cookie) + if revoked.Code != http.StatusOK || revoked.Header().Get("Cache-Control") != "no-store" || !strings.Contains(revoked.Body.String(), `"ok":true`) { + t.Fatalf("revoke = %d %s", revoked.Code, revoked.Body.String()) + } + if _, err := store.VerifyAccessToken(t.Context(), ownToken.AccessToken, testMCPResource); !errors.Is(err, auth.ErrInvalidOAuthToken) { + t.Fatalf("revoked token = %v", err) + } + if _, err := store.VerifyAccessToken(t.Context(), otherToken.AccessToken, testMCPResource); err != nil { + t.Fatalf("other token = %v", err) + } + list = serve(t, s.e, http.MethodGet, "/api/auth/oauth/connections", "", nil, cookie) + if list.Code != http.StatusOK || !strings.Contains(list.Body.String(), `"connections":[]`) { + t.Fatalf("browser session after revoke = %d %s", list.Code, list.Body.String()) + } + var events int + if err := s.db.DB.QueryRow(`SELECT COUNT(*) FROM auth_audit_events WHERE event_type = 'oauth_connection.revoked' AND actor_user_id = ? AND target_type = 'oauth_client' AND target_id = ? AND user_agent = 'connection-test' AND json_extract(metadata_json, '$.client_name') = ?`, user.ID, ownClient.ClientID, ownClient.ClientName).Scan(&events); err != nil || events != 1 { + t.Fatalf("revocation audits = %d, %v", events, err) + } + }) + } +} diff --git a/internal/auth/audit.go b/internal/auth/audit.go index b8024e1b..907f3f28 100644 --- a/internal/auth/audit.go +++ b/internal/auth/audit.go @@ -54,7 +54,7 @@ func recordAudit(ctx context.Context, executor auditExecutor, event AuditEvent) if !validAuditValue(event.EventType, map[AuditEventType]struct{}{ "authorization.denied": {}, "identity.linked": {}, "ingest_key.rotated": {}, "login.failed": {}, "login.requested": {}, "login.succeeded": {}, "logout": {}, - "login_link.issued": {}, "login_link.redeemed": {}, + "login_link.issued": {}, "login_link.redeemed": {}, "oauth_connection.revoked": {}, "oidc.denied": {}, "role.changed": {}, "session.revoked": {}, "setup.completed": {}, "user.created": {}, "user.suspended": {}, "user.deleted": {}, "user.provisioned": {}, "user.updated": {}, }) { @@ -65,7 +65,7 @@ func recordAudit(ctx context.Context, executor auditExecutor, event AuditEvent) appmetrics.AuthAuditWriteFailures.Inc() return fmt.Errorf("auth: invalid audit outcome %q", event.Outcome) } - if event.TargetType != "" && !validAuditValue(event.TargetType, map[AuditTargetType]struct{}{"email": {}, "identity": {}, "ingest": {}, "route": {}, "user": {}}) { + if event.TargetType != "" && !validAuditValue(event.TargetType, map[AuditTargetType]struct{}{"email": {}, "identity": {}, "ingest": {}, "oauth_client": {}, "route": {}, "user": {}}) { appmetrics.AuthAuditWriteFailures.Inc() return fmt.Errorf("auth: invalid audit target type %q", event.TargetType) } diff --git a/internal/auth/oauth_store.go b/internal/auth/oauth_store.go index 6134bcc0..24961bb9 100644 --- a/internal/auth/oauth_store.go +++ b/internal/auth/oauth_store.go @@ -17,22 +17,26 @@ import ( const ( // Access tokens are checked against the database on every request, so - // revocation is immediate whatever their lifetime. - OAuthAccessTTL = time.Hour - OAuthRefreshTTL = 30 * 24 * time.Hour + // revocation is immediate whatever their lifetime. A long lifetime keeps + // agent clients from refreshing, and racing each other, more than monthly. + OAuthAccessTTL = 30 * 24 * time.Hour + OAuthRefreshTTL = 90 * 24 * time.Hour OAuthCodeTTL = 5 * time.Minute // OAuthRefreshReuseGrace admits a refresh token its own client rotated - // moments ago, as when agent processes sharing one stored credential - // refresh together; later reuse still revokes the family. - OAuthRefreshReuseGrace = time.Minute + // within one access-token lifetime. Agent processes sharing one stored + // credential refresh from stale copies minutes or hours apart, and the + // holder of that credential already holds an access token that lives as + // long; later reuse still revokes the family. + OAuthRefreshReuseGrace = OAuthAccessTTL ) var ( - ErrOAuthClientNotFound = errors.New("oauth client not found") - ErrInvalidOAuthGrant = errors.New("invalid oauth grant") - ErrInvalidOAuthScope = errors.New("invalid oauth scope") - ErrOAuthRefreshReuse = errors.New("oauth refresh token reuse detected") - ErrInvalidOAuthToken = errors.New("invalid oauth token") + ErrOAuthClientNotFound = errors.New("oauth client not found") + ErrOAuthConnectionNotFound = errors.New("oauth connection not found") + ErrInvalidOAuthGrant = errors.New("invalid oauth grant") + ErrInvalidOAuthScope = errors.New("invalid oauth scope") + ErrOAuthRefreshReuse = errors.New("oauth refresh token reuse detected") + ErrInvalidOAuthToken = errors.New("invalid oauth token") ) // TokenKind discriminates the two token rows stored per grant. @@ -88,6 +92,14 @@ type OAuthTokenPair struct { Scope string } +type OAuthConnection struct { + ClientID string `json:"client_id"` + ClientName string `json:"client_name"` + ConnectedAt time.Time `json:"connected_at"` + RefreshedAt time.Time `json:"refreshed_at"` + Scope string `json:"scope"` +} + // String implements fmt.Stringer with the token material redacted so that a // stray %v/%s log of a pair can never leak raw credentials. func (p OAuthTokenPair) String() string { @@ -103,6 +115,96 @@ func NewOAuthStore(db *sql.DB) *OAuthStore { return &OAuthStore{db: db, now: time.Now} } +func (s *OAuthStore) ListConnections(ctx context.Context, userID string) ([]OAuthConnection, error) { + rows, err := s.db.QueryContext(ctx, ` + WITH live_refresh AS ( + SELECT client_id, family_id, scope, created_at, token_hash + FROM oauth_tokens + WHERE user_id = ? AND kind = 'refresh' AND revoked_at IS NULL AND expires_at > ? + ) + SELECT c.client_id, c.client_name, MIN(t.created_at), MAX(t.created_at), + (SELECT scope FROM live_refresh WHERE client_id = c.client_id + ORDER BY created_at DESC, token_hash LIMIT 1) + FROM oauth_tokens t JOIN oauth_clients c ON c.client_id = t.client_id + WHERE t.user_id = ? AND EXISTS ( + SELECT 1 FROM live_refresh live + WHERE live.client_id = t.client_id AND live.family_id = t.family_id + ) + GROUP BY c.client_id, c.client_name + ORDER BY MIN(t.created_at) DESC, c.client_id`, userID, s.now().UTC().Unix(), userID) + if err != nil { + return nil, fmt.Errorf("oauth: list connections: %w", err) + } + defer rows.Close() + connections := []OAuthConnection{} + for rows.Next() { + var connection OAuthConnection + var connected, refreshed int64 + if err := rows.Scan(&connection.ClientID, &connection.ClientName, &connected, &refreshed, &connection.Scope); err != nil { + return nil, fmt.Errorf("oauth: scan connection: %w", err) + } + connection.ConnectedAt = time.Unix(connected, 0).UTC() + connection.RefreshedAt = time.Unix(refreshed, 0).UTC() + connections = append(connections, connection) + } + if err := rows.Err(); err != nil { + return nil, fmt.Errorf("oauth: read connections: %w", err) + } + return connections, nil +} + +func (s *OAuthStore) RevokeConnection(ctx context.Context, userID, clientID string, event AuditEvent) error { + conn, err := s.db.Conn(ctx) + if err != nil { + return fmt.Errorf("oauth: open connection revocation: %w", err) + } + defer conn.Close() + if _, err := conn.ExecContext(ctx, "BEGIN IMMEDIATE"); err != nil { + return fmt.Errorf("oauth: begin connection revocation: %w", err) + } + committed := false + defer func() { + if !committed { + rollbackConn(conn, "OAuth connection revocation") + } + }() + now := s.now().UTC().Unix() + var name string + err = conn.QueryRowContext(ctx, ` + SELECT c.client_name FROM oauth_clients c + WHERE c.client_id = ? AND EXISTS ( + SELECT 1 FROM oauth_tokens t WHERE t.client_id = c.client_id AND t.user_id = ? + AND t.kind = 'refresh' AND t.revoked_at IS NULL AND t.expires_at > ? + )`, clientID, userID, now).Scan(&name) + if errors.Is(err, sql.ErrNoRows) { + return ErrOAuthConnectionNotFound + } + if err != nil { + return fmt.Errorf("oauth: read connection for revocation: %w", err) + } + if _, err := conn.ExecContext(ctx, ` + UPDATE oauth_tokens SET revoked_at = COALESCE(revoked_at, ?) + WHERE client_id = ? AND user_id = ?`, now, clientID, userID); err != nil { + return fmt.Errorf("oauth: revoke connection: %w", err) + } + // A pending code would otherwise mint a new family after the disconnect. + if _, err := conn.ExecContext(ctx, `DELETE FROM oauth_authorization_codes WHERE client_id = ? AND user_id = ?`, clientID, userID); err != nil { + return fmt.Errorf("oauth: delete connection authorization codes: %w", err) + } + event.ActorUserID = userID + event.EventType, event.Outcome = "oauth_connection.revoked", "success" + event.TargetType, event.TargetID = "oauth_client", clientID + event.Metadata = map[string]any{"client_name": name} + if err := recordAudit(ctx, conn, event); err != nil { + return err + } + if _, err := conn.ExecContext(ctx, "COMMIT"); err != nil { + return fmt.Errorf("oauth: commit connection revocation: %w", err) + } + committed = true + return nil +} + func (s *OAuthStore) RegisterClient(ctx context.Context, name, clientURI string, redirectURIs []string) (OAuthClient, error) { id, err := appid.New() if err != nil { diff --git a/internal/auth/oauth_store_test.go b/internal/auth/oauth_store_test.go index bc3d75b6..73d0bdff 100644 --- a/internal/auth/oauth_store_test.go +++ b/internal/auth/oauth_store_test.go @@ -109,8 +109,8 @@ func TestOAuthStoreRefreshRotationAndReuseRevokesFamily(t *testing.T) { } } -// Agent processes sharing one stored credential refresh together; the -// sibling that presents the just-rotated token gets its own pair, once per +// Agent processes sharing one stored credential refresh from stale copies; +// the sibling that presents the rotated token gets its own pair within the // grace window, and only from the same client while the family is live. func TestOAuthStoreRefreshGraceAdmitsConcurrentSibling(t *testing.T) { sqlite := newTestSQLite(t) @@ -142,6 +142,9 @@ func TestOAuthStoreRefreshGraceAdmitsConcurrentSibling(t *testing.T) { if _, err := store.RotateRefreshToken(t.Context(), other.ClientID, first.RefreshToken, resource, ""); !errors.Is(err, ErrInvalidOAuthGrant) { t.Fatalf("another client's sibling refresh = %v, want invalid grant", err) } + if _, err := store.VerifyAccessToken(t.Context(), second.AccessToken, resource); err != nil { + t.Fatalf("rotated access token = %v", err) + } store.now = func() time.Time { return base.Add(OAuthRefreshReuseGrace) } sibling, err := store.RotateRefreshToken(t.Context(), client.ClientID, first.RefreshToken, resource, "") if err != nil { @@ -150,20 +153,16 @@ func TestOAuthStoreRefreshGraceAdmitsConcurrentSibling(t *testing.T) { if sibling.RefreshToken == second.RefreshToken || sibling.AccessToken == second.AccessToken { t.Fatal("a sibling must receive its own credentials") } - for name, pair := range map[string]OAuthTokenPair{"rotated": second, "sibling": sibling} { - if _, err := store.VerifyAccessToken(t.Context(), pair.AccessToken, resource); err != nil { - t.Fatalf("%s access token = %v", name, err) - } + if _, err := store.VerifyAccessToken(t.Context(), sibling.AccessToken, resource); err != nil { + t.Fatalf("sibling access token = %v", err) } // The sibling refresh must not move the rotation time and extend the window. store.now = func() time.Time { return base.Add(OAuthRefreshReuseGrace + time.Second) } if _, err := store.RotateRefreshToken(t.Context(), client.ClientID, first.RefreshToken, resource, ""); !errors.Is(err, ErrOAuthRefreshReuse) { t.Fatalf("refresh after grace = %v, want reuse detection", err) } - for name, pair := range map[string]OAuthTokenPair{"rotated": second, "sibling": sibling} { - if _, err := store.VerifyAccessToken(t.Context(), pair.AccessToken, resource); !errors.Is(err, ErrInvalidOAuthToken) { - t.Fatalf("%s access token after reuse = %v, want invalid token", name, err) - } + if _, err := store.VerifyAccessToken(t.Context(), sibling.AccessToken, resource); !errors.Is(err, ErrInvalidOAuthToken) { + t.Fatalf("sibling access token after reuse = %v, want invalid token", err) } } @@ -287,6 +286,13 @@ func TestRevokeAllSessionsAlsoRevokesOAuthCredentials(t *testing.T) { if err != nil { t.Fatal(err) } + code, err := store.CreateAuthorizationCode(t.Context(), OAuthAuthorizationCode{ + ClientID: client.ClientID, UserID: user.ID, RedirectURI: "http://localhost/callback", + Scope: MCPScopeTelemetryRead, Resource: resource, CodeChallenge: "challenge", + }) + if err != nil { + t.Fatal(err) + } if err := users.RevokeAllSessionsWithAudit(user.ID, AuditEvent{EventType: "session.revoked", Outcome: "success"}); err != nil { t.Fatalf("RevokeAllSessions: %v", err) } @@ -296,6 +302,9 @@ func TestRevokeAllSessionsAlsoRevokesOAuthCredentials(t *testing.T) { if _, err := store.RotateRefreshToken(t.Context(), client.ClientID, pair.RefreshToken, resource, ""); !errors.Is(err, ErrOAuthRefreshReuse) { t.Fatalf("replayed refresh token = %v, want reuse detection", err) } + if _, err := store.ConsumeAuthorizationCode(t.Context(), code); !errors.Is(err, ErrInvalidOAuthGrant) { + t.Fatalf("pending authorization code after revocation = %v, want invalid grant", err) + } } func TestOAuthStoreRejectsWrongAudienceAndSuspendedRefresh(t *testing.T) { @@ -576,3 +585,211 @@ func TestOAuthStoreExpiredCodeFails(t *testing.T) { t.Fatalf("expired code = %v, want invalid grant", err) } } + +func TestOAuthConnectionsListLiveFamilies(t *testing.T) { + sqlite := newTestSQLite(t) + users := NewUserStore(sqlite.DB) + user, err := users.CreateWithAudit("connections@example.com", "", "admin", AuditEvent{EventType: "user.created", Outcome: "success"}) + if err != nil { + t.Fatal(err) + } + other, err := users.CreateWithAudit("other-connections@example.com", "", "viewer", AuditEvent{EventType: "user.created", Outcome: "success"}) + if err != nil { + t.Fatal(err) + } + store := NewOAuthStore(sqlite.DB) + now := time.Date(2026, 10, 1, 0, 0, 0, 0, time.UTC) + store.now = func() time.Time { return now } + register := func(name string) OAuthClient { + t.Helper() + client, err := store.RegisterClient(t.Context(), name, "", []string{"http://localhost/callback"}) + if err != nil { + t.Fatal(err) + } + return client + } + issue := func(client OAuthClient, owner User) OAuthTokenPair { + t.Helper() + pair, err := store.IssueTokenPair(t.Context(), client.ClientID, owner.ID, MCPScopeTelemetryRead+" "+MCPScopeDashboardManage, "https://fanout.example.com/mcp") + if err != nil { + t.Fatal(err) + } + return pair + } + client := register("Codex") + issue(client, user) + if _, err := sqlite.DB.Exec(`UPDATE oauth_tokens SET revoked_at = ? WHERE client_id = ?`, now.Unix(), client.ClientID); err != nil { + t.Fatal(err) + } + now = now.Add(time.Hour) + connected := now + first := issue(client, user) + now = now.Add(time.Hour) + issue(client, user) + now = now.Add(time.Hour) + newest := register("Claude Code") + issue(newest, user) + now = now.Add(time.Hour) + if _, err := store.RotateRefreshToken(t.Context(), client.ClientID, first.RefreshToken, "https://fanout.example.com/mcp", MCPScopeTelemetryRead); err != nil { + t.Fatal(err) + } + expired := register("Expired") + issue(expired, user) + if _, err := sqlite.DB.Exec(`UPDATE oauth_tokens SET expires_at = ? WHERE client_id = ? AND kind = 'refresh'`, now.Unix(), expired.ClientID); err != nil { + t.Fatal(err) + } + revoked := register("Revoked") + issue(revoked, user) + if _, err := sqlite.DB.Exec(`UPDATE oauth_tokens SET revoked_at = ? WHERE client_id = ? AND kind = 'refresh'`, now.Unix(), revoked.ClientID); err != nil { + t.Fatal(err) + } + otherClient := register("Other user's agent") + issue(otherClient, other) + issue(client, other) + unused := register("Unused") + + connections, err := store.ListConnections(t.Context(), user.ID) + if err != nil { + t.Fatal(err) + } + if len(connections) != 2 || connections[0].ClientID != newest.ClientID || connections[1].ClientID != client.ClientID { + t.Fatalf("connections = %+v", connections) + } + got := connections[1] + if got.ClientName != "Codex" || !got.ConnectedAt.Equal(connected) || !got.RefreshedAt.Equal(now) || got.Scope != MCPScopeTelemetryRead { + t.Fatalf("connection = %+v", got) + } + for _, clientID := range []string{expired.ClientID, revoked.ClientID, unused.ClientID, otherClient.ClientID, "unknown"} { + if err := store.RevokeConnection(t.Context(), user.ID, clientID, AuditEvent{}); !errors.Is(err, ErrOAuthConnectionNotFound) { + t.Fatalf("non-live connection revoke = %v", err) + } + } + connections, err = store.ListConnections(t.Context(), "unknown") + if err != nil || connections == nil || len(connections) != 0 { + t.Fatalf("empty connections = %+v, %v", connections, err) + } +} + +func TestOAuthConnectionRevocationIsScopedAndImmediate(t *testing.T) { + sqlite := newTestSQLite(t) + users := NewUserStore(sqlite.DB) + user, err := users.CreateWithAudit("revoke-connection@example.com", "", "admin", AuditEvent{EventType: "user.created", Outcome: "success"}) + if err != nil { + t.Fatal(err) + } + other, err := users.CreateWithAudit("other-revoke@example.com", "", "viewer", AuditEvent{EventType: "user.created", Outcome: "success"}) + if err != nil { + t.Fatal(err) + } + store := NewOAuthStore(sqlite.DB) + client, err := store.RegisterClient(t.Context(), "Codex", "", []string{"http://localhost/callback"}) + if err != nil { + t.Fatal(err) + } + second, err := store.RegisterClient(t.Context(), "Claude Code", "", []string{"http://localhost/callback"}) + if err != nil { + t.Fatal(err) + } + issue := func(clientID, userID string) OAuthTokenPair { + t.Helper() + pair, err := store.IssueTokenPair(t.Context(), clientID, userID, MCPScopeTelemetryRead, "https://fanout.example.com/mcp") + if err != nil { + t.Fatal(err) + } + return pair + } + pair := issue(client.ClientID, user.ID) + sibling, err := store.RotateRefreshToken(t.Context(), client.ClientID, pair.RefreshToken, "https://fanout.example.com/mcp", "") + if err != nil { + t.Fatal(err) + } + family := issue(client.ClientID, user.ID) + otherUser := issue(client.ClientID, other.ID) + otherClient := issue(second.ClientID, user.ID) + code := func(userID string) string { + t.Helper() + raw, err := store.CreateAuthorizationCode(t.Context(), OAuthAuthorizationCode{ + ClientID: client.ClientID, UserID: userID, RedirectURI: "http://localhost/callback", + Scope: MCPScopeTelemetryRead, Resource: "https://fanout.example.com/mcp", CodeChallenge: "challenge", + }) + if err != nil { + t.Fatal(err) + } + return raw + } + pendingCode, otherUserCode := code(user.ID), code(other.ID) + if _, err := store.VerifyAccessToken(t.Context(), pair.AccessToken, "https://fanout.example.com/mcp"); err != nil { + t.Fatal(err) + } + if err := store.RevokeConnection(t.Context(), user.ID, client.ClientID, AuditEvent{}); err != nil { + t.Fatal(err) + } + for _, token := range []string{pair.AccessToken, sibling.AccessToken, family.AccessToken} { + if _, err := store.VerifyAccessToken(t.Context(), token, "https://fanout.example.com/mcp"); !errors.Is(err, ErrInvalidOAuthToken) { + t.Fatalf("revoked access = %v", err) + } + } + for _, token := range []string{pair.RefreshToken, sibling.RefreshToken, family.RefreshToken} { + if _, err := store.RotateRefreshToken(t.Context(), client.ClientID, token, "https://fanout.example.com/mcp", ""); err == nil { + t.Fatal("disconnected refresh token accepted") + } + } + for _, token := range []string{otherUser.AccessToken, otherClient.AccessToken} { + if _, err := store.VerifyAccessToken(t.Context(), token, "https://fanout.example.com/mcp"); err != nil { + t.Fatalf("unrelated access = %v", err) + } + } + if _, err := store.ConsumeAuthorizationCode(t.Context(), pendingCode); !errors.Is(err, ErrInvalidOAuthGrant) { + t.Fatalf("pending code after disconnect = %v, want invalid grant", err) + } + if _, err := store.ConsumeAuthorizationCode(t.Context(), otherUserCode); err != nil { + t.Fatalf("other user's pending code = %v", err) + } + var live int + if err := sqlite.DB.QueryRow(`SELECT COUNT(*) FROM oauth_tokens WHERE client_id = ? AND user_id = ? AND revoked_at IS NULL`, client.ClientID, user.ID).Scan(&live); err != nil || live != 0 { + t.Fatalf("unrevoked tokens = %d, %v", live, err) + } + if err := store.RevokeConnection(t.Context(), user.ID, client.ClientID, AuditEvent{}); !errors.Is(err, ErrOAuthConnectionNotFound) { + t.Fatalf("second revoke = %v", err) + } + if err := store.RevokeConnection(t.Context(), "unknown", second.ClientID, AuditEvent{}); !errors.Is(err, ErrOAuthConnectionNotFound) { + t.Fatalf("other user's connection = %v", err) + } + if err := store.RevokeConnection(t.Context(), user.ID, "unknown", AuditEvent{}); !errors.Is(err, ErrOAuthConnectionNotFound) { + t.Fatalf("unknown connection = %v", err) + } + var events int + if err := sqlite.DB.QueryRow(`SELECT COUNT(*) FROM auth_audit_events WHERE event_type = 'oauth_connection.revoked' AND actor_user_id = ? AND target_type = 'oauth_client' AND target_id = ? AND json_extract(metadata_json, '$.client_name') = 'Codex'`, user.ID, client.ClientID).Scan(&events); err != nil || events != 1 { + t.Fatalf("revocation audits = %d, %v", events, err) + } +} + +func TestOAuthConnectionRevocationRollsBackWithAuditFailure(t *testing.T) { + sqlite := newTestSQLite(t) + users := NewUserStore(sqlite.DB) + user, err := users.CreateWithAudit("rollback-connection@example.com", "", "admin", AuditEvent{EventType: "user.created", Outcome: "success"}) + if err != nil { + t.Fatal(err) + } + store := NewOAuthStore(sqlite.DB) + client, err := store.RegisterClient(t.Context(), "Codex", "", []string{"http://localhost/callback"}) + if err != nil { + t.Fatal(err) + } + pair, err := store.IssueTokenPair(t.Context(), client.ClientID, user.ID, MCPScopeTelemetryRead, "https://fanout.example.com/mcp") + if err != nil { + t.Fatal(err) + } + if _, err := sqlite.DB.Exec(`CREATE TRIGGER reject_connection_audit BEFORE INSERT ON auth_audit_events BEGIN SELECT RAISE(ABORT, 'audit unavailable'); END`); err != nil { + t.Fatal(err) + } + if err := store.RevokeConnection(t.Context(), user.ID, client.ClientID, AuditEvent{}); err == nil { + t.Fatal("audit failure must fail revocation") + } + if _, err := store.VerifyAccessToken(t.Context(), pair.AccessToken, "https://fanout.example.com/mcp"); err != nil { + t.Fatalf("rolled-back access = %v", err) + } + if _, err := store.RotateRefreshToken(t.Context(), client.ClientID, pair.RefreshToken, "https://fanout.example.com/mcp", ""); err != nil { + t.Fatalf("rolled-back refresh = %v", err) + } +} diff --git a/internal/auth/user_store.go b/internal/auth/user_store.go index 1da421e5..ffa23d5c 100644 --- a/internal/auth/user_store.go +++ b/internal/auth/user_store.go @@ -422,6 +422,9 @@ func (s *UserStore) revokeAllSessions(id string, event *AuditEvent) error { if _, err := conn.ExecContext(ctx, `UPDATE oauth_tokens SET revoked_at = COALESCE(revoked_at, ?) WHERE user_id = ?`, time.Now().UTC().Unix(), id); err != nil { return fmt.Errorf("auth: revoke user OAuth tokens: %w", err) } + if _, err := conn.ExecContext(ctx, `DELETE FROM oauth_authorization_codes WHERE user_id = ?`, id); err != nil { + return fmt.Errorf("auth: delete user OAuth authorization codes: %w", err) + } if event != nil { event.TargetType = "user" event.TargetID = id diff --git a/internal/ui/dist/assets/WarningCircle.es-BgWO6KzZ.js b/internal/ui/dist/assets/WarningCircle.es-DWFLwubM.js similarity index 98% rename from internal/ui/dist/assets/WarningCircle.es-BgWO6KzZ.js rename to internal/ui/dist/assets/WarningCircle.es-DWFLwubM.js index 67f97f86..8ae8da1e 100644 --- a/internal/ui/dist/assets/WarningCircle.es-BgWO6KzZ.js +++ b/internal/ui/dist/assets/WarningCircle.es-DWFLwubM.js @@ -1 +1 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{M as r,Y as i,a,f as o,w as s}from"./brand-DUaZkIz1.js";import{G as c,J as l,K as u,Q as d,X as f,Y as p,Z as m,q as h}from"./index-BBEH7zHj.js";var g={root:`m_849cf0da`},_=t(),v={underline:`hover`},y=s(e=>{let{underline:t,className:n,unstyled:a,mod:s,...c}=r(`Anchor`,v,e);return(0,_.jsx)(o,{component:`a`,className:i({[g.root]:!a},n),...c,mod:[{underline:t},s],__staticSelector:`Anchor`,unstyled:a})});y.classes=g,y.displayName=`@mantine/core/Anchor`;var b=class extends h{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),f(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&l(t.mutationKey)!==l(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??c();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){u.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},x=n(e(),1);function S(e,t){let n=d(t),[r]=x.useState(()=>new b(n,e));x.useEffect(()=>{r.setOptions(e)},[r,e]);let i=x.useSyncExternalStore(x.useCallback(e=>r.subscribe(u.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=x.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(p)},[r]);if(i.error&&m(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var C=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z`}))]]),w=x.forwardRef((e,t)=>x.createElement(a,{ref:t,...e,weights:C}));w.displayName=`WarningCircleIcon`;var T=w;export{S as n,y as r,T as t}; \ No newline at end of file +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{M as r,Y as i,a,f as o,w as s}from"./brand-DUaZkIz1.js";import{G as c,J as l,K as u,Q as d,X as f,Y as p,Z as m,q as h}from"./index-CEp3GmPL.js";var g={root:`m_849cf0da`},_=t(),v={underline:`hover`},y=s(e=>{let{underline:t,className:n,unstyled:a,mod:s,...c}=r(`Anchor`,v,e);return(0,_.jsx)(o,{component:`a`,className:i({[g.root]:!a},n),...c,mod:[{underline:t},s],__staticSelector:`Anchor`,unstyled:a})});y.classes=g,y.displayName=`@mantine/core/Anchor`;var b=class extends h{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),f(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&l(t.mutationKey)!==l(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??c();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){u.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},x=n(e(),1);function S(e,t){let n=d(t),[r]=x.useState(()=>new b(n,e));x.useEffect(()=>{r.setOptions(e)},[r,e]);let i=x.useSyncExternalStore(x.useCallback(e=>r.subscribe(u.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=x.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(p)},[r]);if(i.error&&m(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var C=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z`}))]]),w=x.forwardRef((e,t)=>x.createElement(a,{ref:t,...e,weights:C}));w.displayName=`WarningCircleIcon`;var T=w;export{S as n,y as r,T as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat-BvDR6vN4.js b/internal/ui/dist/assets/chat-BqevyT9H.js similarity index 99% rename from internal/ui/dist/assets/chat-BvDR6vN4.js rename to internal/ui/dist/assets/chat-BqevyT9H.js index 57585250..3a0d9a73 100644 --- a/internal/ui/dist/assets/chat-BvDR6vN4.js +++ b/internal/ui/dist/assets/chat-BqevyT9H.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mcp-app-frame-DHytkU6U.js","assets/useRouter-ByJ6_rwb.js","assets/brand-DUaZkIz1.js","assets/index-BBEH7zHj.js","assets/useNavigate-B1zgPEUp.js","assets/preload-helper-EHBQhIeL.js","assets/Tooltip-B3r3s_B9.js","assets/index-ADB9ThEc.css"])))=>i.map(i=>d[i]); -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{A as r,C as i,M as a,S as o,T as s,_ as c,a as l,c as u,d,f,i as p,l as m,m as h,n as g,o as _,p as v,r as y,tt as b,u as x,x as S,y as C}from"./brand-DUaZkIz1.js";import{c as w,d as T,g as E,h as D,l as O,m as ee,o as k,p as A,s as te,t as j,u as M}from"./preload-helper-EHBQhIeL.js";import{t as N}from"./Tooltip-B3r3s_B9.js";import{a as P,c as F,d as I,l as L,n as R,r as ne,t as re,u as ie}from"./dashboard-change-chips-B-4MjJKf.js";import{zt as z}from"./index-BBEH7zHj.js";var B=n(e(),1),V=t(),ae=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],H={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`};function U(e){Object.keys(H).forEach(t=>{e.style.setProperty(t,H[t],`important`)})}function oe(e){let t=window.getComputedStyle(e);if(t===null)return null;let n={};for(let e of ae)n[e]=t[e];return n.boxSizing===``?null:{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)}}var W=null;function se(e,t,n=1,r=1/0){W||(W=document.createElement(`textarea`),W.setAttribute(`tabindex`,`-1`),W.setAttribute(`aria-hidden`,`true`),W.setAttribute(`aria-label`,`autosize measurement`),U(W)),W.parentNode===null&&document.body.appendChild(W);let{paddingSize:i,borderSize:a,sizingStyle:o}=e,{boxSizing:s}=o;Object.keys(o).forEach(e=>{W.style[e]=o[e]}),U(W),W.value=t;let c=s===`border-box`?W.scrollHeight+a:W.scrollHeight-i;W.value=t,c=s===`border-box`?W.scrollHeight+a:W.scrollHeight-i,W.value=`x`;let l=W.scrollHeight-i,u=l*n;s===`border-box`&&(u=u+i+a),c=Math.max(u,c);let d=l*r;return s===`border-box`&&(d=d+i+a),c=Math.min(d,c),[c,l]}function ce({maxRows:e,minRows:t,onChange:n,ref:r,...i}){let a=i.value!==void 0,o=(0,B.useRef)(null),s=b(o,r),c=(0,B.useRef)(0),l=(0,B.useRef)(0),u=()=>{let n=o.current;if(!n)return;let r=oe(n);if(!r)return;let[i]=se(r,n.value||n.placeholder||`x`,t,e);c.current!==i&&(c.current=i,n.style.setProperty(`height`,`${i}px`,`important`))},d=(0,B.useEffectEvent)(u),f=e=>{a||u(),n?.(e)};return(0,B.useLayoutEffect)(u),(0,B.useEffect)(()=>{let e=()=>u();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,B.useEffect)(()=>{let e=o.current;if(!e||typeof ResizeObserver>`u`)return;l.current=e.offsetWidth;let t=0,n=new ResizeObserver(()=>{o.current&&o.current.offsetWidth!==l.current&&(l.current=o.current.offsetWidth,cancelAnimationFrame(t),t=requestAnimationFrame(d))});return n.observe(e),()=>{cancelAnimationFrame(t),n.disconnect()}},[]),(0,B.useEffect)(()=>{let e=()=>u();return document.fonts.addEventListener(`loadingdone`,e),()=>document.fonts.removeEventListener(`loadingdone`,e)},[]),(0,B.useEffect)(()=>{let e=e=>{if(o.current?.form===e.target&&!a){let e=o.current.value;requestAnimationFrame(()=>{o.current&&e!==o.current.value&&u()})}};return document.body.addEventListener(`reset`,e),()=>document.body.removeEventListener(`reset`,e)},[a]),(0,V.jsx)(`textarea`,{rows:t,...i,onChange:f,ref:s})}var G=s(e=>{let{autosize:t,maxRows:n,minRows:r,__staticSelector:i,resize:o,bottomSection:s,bottomSectionProps:c,...l}=a([`Input`,`InputWrapper`,`Textarea`],null,e),u=t&&I()!==`test`,d=u?{maxRows:n,minRows:r}:{};return(0,V.jsx)(h,{component:u?ce:`textarea`,...l,__staticSelector:i||`Textarea`,__bottomSection:s,__bottomSectionProps:c,multiline:!0,"data-no-overflow":t&&n===void 0||void 0,__vars:{"--input-resize":o},...d})});G.classes=h.classes,G.displayName=`@mantine/core/Textarea`;var K={root:`m_d08caa0`},q=s(e=>{let t=a(`Typography`,null,e),{classNames:n,className:o,style:s,styles:c,unstyled:l,attributes:u,...d}=t,f=r({name:`Typography`,classes:K,props:t,className:o,style:s,classNames:n,styles:c,unstyled:l,attributes:u});return(0,V.jsx)(i,{...f(`root`),...d})});q.classes=K,q.displayName=`@mantine/core/Typography`;var le=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M208.49,152.49l-72,72a12,12,0,0,1-17,0l-72-72a12,12,0,0,1,17-17L116,187V40a12,12,0,0,1,24,0V187l51.51-51.52a12,12,0,0,1,17,17Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,144l-72,72L56,144Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M207.39,140.94A8,8,0,0,0,200,136H136V40a8,8,0,0,0-16,0v96H56a8,8,0,0,0-5.66,13.66l72,72a8,8,0,0,0,11.32,0l72-72A8,8,0,0,0,207.39,140.94ZM128,204.69,75.31,152H180.69Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,56,136h64V40a8,8,0,0,1,16,0v96h64a8,8,0,0,1,5.66,13.66Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M204.24,148.24l-72,72a6,6,0,0,1-8.48,0l-72-72a6,6,0,0,1,8.48-8.48L122,201.51V40a6,6,0,0,1,12,0V201.51l61.76-61.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M202.83,146.83l-72,72a4,4,0,0,1-5.66,0l-72-72a4,4,0,0,1,5.66-5.66L124,206.34V40a4,4,0,0,1,8,0V206.34l65.17-65.17a4,4,0,0,1,5.66,5.66Z`}))]]),ue=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M176,128,96,208V48Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z`}))]]),de=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M230.14,25.86a20,20,0,0,0-19.57-5.11l-.22.07L18.44,79a20,20,0,0,0-3.06,37.25L99,157l40.71,83.65a19.81,19.81,0,0,0,18,11.38c.57,0,1.15,0,1.73-.07A19.82,19.82,0,0,0,177,237.56L235.18,45.65a1.42,1.42,0,0,0,.07-.22A20,20,0,0,0,230.14,25.86ZM156.91,221.07l-34.37-70.64,46-45.95a12,12,0,0,0-17-17l-46,46L34.93,99.09,210,46Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M223.69,42.18l-58.22,192a8,8,0,0,1-14.92,1.25L108,148,20.58,105.45a8,8,0,0,1,1.25-14.92l192-58.22A8,8,0,0,1,223.69,42.18Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M231.4,44.34s0,.1,0,.15l-58.2,191.94a15.88,15.88,0,0,1-14,11.51q-.69.06-1.38.06a15.86,15.86,0,0,1-14.42-9.15L107,164.15a4,4,0,0,1,.77-4.58l57.92-57.92a8,8,0,0,0-11.31-11.31L96.43,148.26a4,4,0,0,1-4.58.77L17.08,112.64a16,16,0,0,1,2.49-29.8l191.94-58.2.15,0A16,16,0,0,1,231.4,44.34Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M225.88,30.12a13.83,13.83,0,0,0-13.7-3.58l-.11,0L20.14,84.77A14,14,0,0,0,18,110.85l85.56,41.64L145.12,238a13.87,13.87,0,0,0,12.61,8c.4,0,.81,0,1.21-.05a13.9,13.9,0,0,0,12.29-10.09l58.2-191.93,0-.11A13.83,13.83,0,0,0,225.88,30.12Zm-8,10.4L159.73,232.43l0,.11a2,2,0,0,1-3.76.26l-40.68-83.58,49-49a6,6,0,1,0-8.49-8.49l-49,49L23.15,100a2,2,0,0,1,.31-3.74l.11,0L215.48,38.08a1.94,1.94,0,0,1,1.92.52A2,2,0,0,1,217.92,40.52Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224.47,31.52a11.87,11.87,0,0,0-11.82-3L20.74,86.67a12,12,0,0,0-1.91,22.38L105,151l41.92,86.15A11.88,11.88,0,0,0,157.74,244c.34,0,.69,0,1,0a11.89,11.89,0,0,0,10.52-8.63l58.21-192,0-.08A11.85,11.85,0,0,0,224.47,31.52Zm-4.62,9.54-58.23,192a4,4,0,0,1-7.48.59l-41.3-84.86,50-50a4,4,0,1,0-5.66-5.66l-50,50-84.9-41.31a3.88,3.88,0,0,1-2.27-4,3.93,3.93,0,0,1,3-3.54L214.9,36.16A3.93,3.93,0,0,1,216,36a4,4,0,0,1,2.79,1.19A3.93,3.93,0,0,1,219.85,41.06Z`}))]]),fe=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z`}))]]),J=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:le}));J.displayName=`ArrowDownIcon`;var pe=J,Y=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:ue}));Y.displayName=`CaretRightIcon`;var X=Y,me=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:de}));me.displayName=`PaperPlaneTiltIcon`;var he=me,ge=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:fe}));ge.displayName=`StopIcon`;var _e=ge;function ve(e){return e.dashboard.panels.length===1?e.dashboard.panels[0].title:e.dashboard.name}function ye(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Missing panel view`);let t=e;if(!t.view||![`preset`,`query`].includes(t.view.kind)||!/^[a-f0-9]{64}$/.test(t.view.key))throw Error(`Invalid panel view identity`);if(t.dashboard?.version!==1||!Array.isArray(t.dashboard.panels)||!t.dashboard.panels.length||t.dashboard.panels.length>40||!Array.isArray(t.results)||t.dashboard.panels.some(e=>!e||typeof e.id!=`string`||!e.id)||t.results.some(e=>!e||typeof e.id!=`string`))throw Error(`Invalid panel view`);let n=new Set(t.dashboard.panels.map(e=>e.id));if(n.size!==t.dashboard.panels.length||t.results.length!==n.size||new Set(t.results.map(e=>e.id)).size!==n.size||t.results.some(e=>!n.has(e.id)||![`ok`,`empty`,`error`].includes(e.status)))throw Error(`Panel results do not match the view`);if(t.vars!==void 0&&(!t.vars||typeof t.vars!=`object`||Array.isArray(t.vars)||Object.values(t.vars).some(e=>typeof e!=`string`&&!(Array.isArray(e)&&e.every(e=>typeof e==`string`)))))throw Error(`Invalid panel variables`);if(t.trace!==void 0&&(!t.trace?.data||!Array.isArray(t.trace.data.spans)||!Array.isArray(t.trace.data.logs)||!Array.isArray(t.trace.data.services)))throw Error(`Invalid trace detail`);return t}var be=new WeakSet;function xe(e){if(!e||typeof e!=`object`||Array.isArray(e))return;if(be.has(e))return e;let t=e;if(Object.keys(t).sort().join(`,`)===`is_error,resource_uri,tool_input,tool_name,tool_result`&&t.resource_uri===`ui://fanout/panels.html`&&typeof t.tool_name==`string`&&t.tool_name&&typeof t.is_error==`boolean`&&t.tool_input&&typeof t.tool_input==`object`&&!Array.isArray(t.tool_input)){try{ye(t.tool_result)}catch{return}return be.add(t),t}}var Se=16,Ce=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `]);function we(e){let t=(0,B.useRef)(null),n=(0,B.useRef)(null),r=(0,B.useRef)(null),i=(0,B.useRef)(!0),a=(0,B.useRef)(e),o=(0,B.useRef)(()=>{}),s=(0,B.useRef)(null),c=(0,B.useRef)(new Set),l=(0,B.useRef)(null),u=(0,B.useRef)(null),[d,f]=(0,B.useState)(!1),p=(0,B.useCallback)(()=>{let e=t.current,n=r.current?.lastElementChild,i=!e||!n||n.getBoundingClientRect().bottom>e.getBoundingClientRect().top+e.clientTop+e.clientHeight+1;f(!!e&&i&&e.scrollHeight-e.clientHeight-e.scrollTop>1)},[]),m=(0,B.useCallback)(()=>{let e=t.current;if(!e)return;let n=e.getBoundingClientRect().top+e.clientTop,r=[...e.querySelectorAll(`[data-chat-anchor]`)].find(e=>e.getBoundingClientRect().bottom>n);l.current=r?{node:r,top:r.getBoundingClientRect().top}:null},[]),h=(0,B.useCallback)((e,t)=>{e.scrollTop=t,u.current=e.scrollTop},[]),g=(0,B.useCallback)(()=>{let e=t.current;if(e){if(r.current){let t=n.current&&parseFloat(getComputedStyle(n.current).paddingBottom)||0;r.current.style.minHeight=`${Math.max(0,e.clientHeight-Se-t)}px`,i.current&&h(e,e.scrollTop+r.current.getBoundingClientRect().top-e.getBoundingClientRect().top-e.clientTop-Se)}if(!i.current){let t=l.current;t?.node.isConnected&&h(e,e.scrollTop+t.node.getBoundingClientRect().top-t.top),m()}p()}},[m,h,p]),_=(0,B.useCallback)(()=>{let e=t.current,i=n.current;if(!e||!i){s.current?.disconnect(),s.current=null,c.current.clear();return}s.current??=new ResizeObserver(g);let a=new Set([e,i,...i.querySelectorAll(`[data-chat-anchor]`)]);r.current&&a.add(r.current);for(let e of c.current)a.has(e)||s.current.unobserve(e);for(let e of a)c.current.has(e)||s.current.observe(e);c.current=a},[g]),v=(0,B.useCallback)(e=>{if(o.current(),t.current=e,u.current=null,l.current=null,i.current=!0,_(),!e)return;let n=!1,r=()=>{i.current=!1,m()},a=e=>{let t=e.target;!e.defaultPrevented&&Ce.has(e.key)&&(t instanceof HTMLElement&&(t.closest(`input, textarea, select, [contenteditable]`)||(e.key===` `?t.closest(`button`):t.closest(`[role=slider]`)))||r())},s=()=>{n=!0},c=()=>{n=!1},d=()=>{n&&e.scrollTop!==u.current&&r(),i.current||m(),p()};e.addEventListener(`scroll`,d,{passive:!0}),e.addEventListener(`wheel`,r,{passive:!0}),e.addEventListener(`touchmove`,r,{passive:!0}),e.addEventListener(`keydown`,a),e.addEventListener(`pointerdown`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c),o.current=()=>{e.removeEventListener(`scroll`,d),e.removeEventListener(`wheel`,r),e.removeEventListener(`touchmove`,r),e.removeEventListener(`keydown`,a),e.removeEventListener(`pointerdown`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),o.current=()=>{}},g()},[g,m,_,p]),y=(0,B.useCallback)(e=>{n.current=e,_()},[_]),b=(0,B.useCallback)(e=>{r.current?.style.removeProperty(`min-height`),r.current=e,_()},[_]);return(0,B.useLayoutEffect)(()=>{a.current!==e&&(a.current=e,i.current=!0,l.current=null),_(),g()}),{scrollRef:v,contentRef:y,turnRef:b,showJump:d,jumpToLatest:(0,B.useCallback)(()=>{let e=t.current;e&&(e.focus({preventScroll:!0}),i.current=!1,h(e,e.scrollHeight),m(),p())},[m,h,p])}}function Te(e=1500){let[t,n]=(0,B.useState)(`idle`),r=(0,B.useRef)(null);(0,B.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);function i(t){r.current&&clearTimeout(r.current),n(`idle`),(navigator.clipboard?navigator.clipboard.writeText(t):Promise.reject(Error(`clipboard unavailable`))).then(()=>n(`copied`),()=>n(`failed`)).finally(()=>{r.current=setTimeout(()=>n(`idle`),e)})}return{state:t,copy:i}}var Z=e=>`${(e/1e3).toFixed(1)} s`;function Ee({receipt:e,running:t=!1,activity:n=``,awaitingAnswer:r=!1}){let[i,a]=(0,B.useState)(!1),o=(0,B.useId)(),s=e.saved,l=s?.receipt.save_check,p=t=>Object.hasOwn(e.panel_titles,t)?e.panel_titles[t]:t,m=Object.values(e.stages).filter(e=>e.state===`complete`).length,h=[e.stages.schema.state===`complete`?`Read telemetry`:void 0,e.panel_count===void 0?void 0:`${e.panel_count} ${e.panel_count===1?`panel`:`panels`}`,l?.checked?`Checked in ${Z(l.elapsed_ms)}`:void 0,s?`Saved v${s.version}`:void 0].filter(Boolean).join(` · `)||`Building dashboard`,g=[...s?O(s.receipt):[],...new Map(e.corrections.map(e=>[e.panel_id,`Fixed ${e.title}`])).values()];return(0,V.jsx)(S,{"data-build-receipt":e.turn_id,"data-dashboard-result":s?.id,"data-chat-anchor":!0,withBorder:!0,radius:`md`,p:`sm`,children:(0,V.jsxs)(u,{gap:6,children:[(0,V.jsxs)(c,{gap:`xs`,justify:`space-between`,children:[(0,V.jsxs)(f,{size:`sm`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[h,(0,V.jsxs)(f,{span:!0,c:`dimmed`,size:`xs`,children:[` · `,m,` stages complete`]})]}),(0,V.jsxs)(d,{component:`button`,variant:`subtle`,color:`gray`,size:`compact-xs`,"aria-expanded":i,"aria-controls":o,onClick:()=>a(e=>!e),children:[`Details`,g.length>4?` (+${g.length-4})`:``]})]}),t&&r&&(0,V.jsxs)(c,{gap:`xs`,"data-build-running":!0,children:[(0,V.jsx)(C,{type:`dots`,size:`sm`}),(0,V.jsx)(f,{c:`dimmed`,size:`sm`,children:n||`Analyzing your system`})]}),(0,V.jsx)(re,{labels:g.slice(0,4)}),e.explanations.map(e=>t?e.split(` · `).filter(e=>!e.endsWith(`: incomplete`)).join(` · `):e).filter(Boolean).map((e,t)=>(0,V.jsx)(f,{size:`xs`,c:`dimmed`,"data-receipt-attention":!0,children:e},t)),s&&(0,V.jsx)(d,{renderRoot:e=>(0,V.jsx)(E,{...e,to:`/dashboards/$dashboardId`,params:{dashboardId:s.id},search:{}}),variant:`subtle`,size:`compact-sm`,color:`gray`,style:{alignSelf:`flex-start`},children:`Open dashboard`}),(0,V.jsx)(ie,{expanded:i,id:o,children:(0,V.jsxs)(u,{gap:4,children:[s&&(0,V.jsxs)(f,{size:`xs`,children:[s.label,` `,s.name,` · opens the current dashboard`]}),Object.entries(e.stages).map(([e,n])=>(0,V.jsxs)(f,{size:`xs`,c:`dimmed`,children:[T[e],`: `,t&&n.state===`incomplete`?`in progress`:n.state,n.elapsed_ms===void 0?``:` · ${Z(n.elapsed_ms)}`]},e)),e.save_attempts.map((e,t)=>e.state===`retried`&&(0,V.jsxs)(f,{size:`xs`,c:`dimmed`,children:[`Save attempt `,t+1,`: retried`]},e.call_id)),!!e.context_counts.deploys&&(0,V.jsxs)(f,{size:`xs`,children:[e.context_counts.deploys,` deploys observed`]}),!!e.context_counts.anomalies&&(0,V.jsxs)(f,{size:`xs`,children:[e.context_counts.anomalies,` anomalies observed`]}),e.panels.map(e=>(0,V.jsxs)(f,{size:`xs`,children:[`Preview · `,p(e.id),`: `,e.status,e.elapsed_ms===void 0?``:` · ${Z(e.elapsed_ms)}`]},e.id)),l&&(0,V.jsxs)(f,{size:`xs`,children:[`Save check: `,l.checked?`checked`:`incomplete`,` · `,Z(l.elapsed_ms)]}),l?.panels.map(e=>(0,V.jsxs)(f,{size:`xs`,children:[`Save · `,p(e.id),`: `,e.status,` · `,e.rows??0,` rows`,e.elapsed_ms===void 0?``:` · ${Z(e.elapsed_ms)}`]},e.id)),g.slice(4).map((e,t)=>(0,V.jsx)(f,{size:`xs`,children:e},t)),e.corrections.map((e,t)=>(0,V.jsxs)(f,{size:`xs`,children:[`Fixed `,e.title,`: `,e.message]},t))]})})]})})}var De=(0,B.lazy)(()=>j(()=>import(`./mcp-app-frame-DHytkU6U.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Oe=e=>e.tool_result.view.kind===`preset`;function ke(e){let t=new Map,n=new Set,r=[],i=()=>{let e=new Map;for(let t of r){let n=t.content.tool_result.view.key;e.set(n,t)}let i=new Set([...e.values()].map(e=>e.id)),a=[...e.values()].some(e=>Oe(e.content)),o=r.filter(e=>i.has(e.id)).at(-1)?.id;for(let e of r)i.has(e.id)?t.set(e.id,{content:e.content,expanded:Oe(e.content)||!a&&e.id===o}):n.add(e.id);r=[]};for(let t of e)if(t.role===`user`&&i(),t.role===`activity`&&t.activityType===`mcp-app`){let e=xe(t.content);e&&r.push({id:t.id,content:e})}return i(),{views:t,duplicates:n}}function Ae(e,t){return Array.isArray(e)?e.flatMap(e=>{if(!D(e)||typeof e.message!=`string`)return[];let n=typeof e.path==`string`?/^panels\[(\d+)\](?:\.|$)/.exec(e.path)?.[1]:void 0,r=n===void 0?void 0:t?.[Number(n)];return[r&&!e.message.startsWith(r)?`${r}: ${e.message}`:e.message]}):[]}function je(e){let t=new Map,n=new Map,r=new Map,i=`unattributed`;for(let a of e){if(a.role===`user`&&(n.clear(),r.clear(),i=a.id),a.role===`assistant`){i=a.id;for(let e of a.toolCalls??[]){let t=[`create_dashboard`,`replace_dashboard`].includes(e.function.name)?A(e.function.arguments)?.dashboard:void 0,r=D(t)&&Array.isArray(t.panels)?t.panels.map(e=>D(e)&&typeof e.title==`string`?e.title:``):void 0;n.set(e.id,{assistant:i,name:e.function.name,titles:r})}}if(a.role===`tool`){let e=A(a.content);if(!a.error&&!e?.error&&e?.isError!==!0)continue;let o=n.get(a.toolCallId);if(o&&ee.has(o.name)&&M(a))continue;let s=D(e?.error)?e?.error:void 0;if(s?.code===`no_data`||s?.code===`unknown_service`)continue;let c=o?.assistant??i,l=r.get(c)??a.id;r.set(c,l);let u=t.get(l)??[],d=typeof s?.message==`string`?s.message:typeof a.error==`string`&&a.error?a.error:`Could not complete this step. Try again.`,f=[`create_dashboard`,`edit_dashboard`,`replace_dashboard`].includes(o?.name??``)&&(s?.code===`invalid_spec`||s?.code===`dashboard_version_conflict`);u.push({name:k(o?.name??``),message:d,details:f?Ae(e?.problems,o?.titles):[],readOnly:s?.code===`answer_only`,rejected:f}),t.set(l,u)}}return t}function Me({failures:e}){let[t,n]=(0,B.useState)({rejected:!1,failed:!1}),r=e.filter(e=>e.rejected),a=e.filter(e=>!e.readOnly&&!e.rejected),s=[{key:`rejected`,items:r,label:`${r.length} ${r.length===1?`draft`:`drafts`} rejected`},{key:`failed`,items:a,label:`${a.length} ${a.length===1?`step`:`steps`} failed`}];return(0,V.jsxs)(i,{"data-chat-anchor":!0,children:[e.some(e=>e.readOnly)&&(0,V.jsx)(f,{size:`sm`,c:`dimmed`,children:`Not saved: Explain is read-only`}),s.map(({key:e,items:r,label:a})=>r.length>0&&(0,V.jsxs)(i,{children:[(0,V.jsxs)(o,{className:`chat-app-toggle`,"aria-expanded":t[e],onClick:()=>n(t=>({...t,[e]:!t[e]})),style:{color:`var(--mantine-color-dimmed)`},children:[(0,V.jsx)(`span`,{className:`chat-app-chevron`,"aria-hidden":`true`,children:t[e]?(0,V.jsx)(F,{size:14}):(0,V.jsx)(X,{size:14})}),(0,V.jsx)(`span`,{className:`chat-app-summary`,children:a})]}),t[e]&&(0,V.jsx)(u,{gap:`xs`,pl:`md`,children:r.flatMap((e,t)=>(e.details.length?e.details:[`${e.name}: ${e.message}`]).map((e,n)=>(0,V.jsx)(f,{size:`sm`,c:`dimmed`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:e},`${t}-${n}`)))})]},e))]})}function Ne({view:e}){let[t,n]=(0,B.useState)(e.expanded);(0,B.useEffect)(()=>n(e.expanded),[e.expanded]);let r=e.content.tool_result,i=ve(r),a=[...new Set(r.dashboard.panels.map(e=>e.viz===`timeseries`?`time series`:e.viz.replaceAll(`_`,` `)))].join(`, `),s=r.results.reduce((e,t)=>e+(t.frame?.rows??0),0),c=new Map;for(let e of r.results)e.status!==`ok`&&c.set(e.status,(c.get(e.status)??0)+1);let l=r.dashboard.panels.length>1?[`${r.dashboard.panels.length} panels`,...Array.from(c,([e,t])=>`${t} ${e}`)].join(` · `):c.size?[...c.keys()].join(`, `):`${s} ${s===1?`row`:`rows`}`;return(0,V.jsxs)(S,{"data-chat-app":!0,"data-chat-anchor":!0,withBorder:!0,radius:`lg`,style:{overflow:`hidden`},children:[(0,V.jsxs)(o,{className:`chat-app-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,V.jsx)(`span`,{className:`chat-app-chevron`,"aria-hidden":`true`,children:t?(0,V.jsx)(F,{size:14}):(0,V.jsx)(X,{size:14})}),(0,V.jsxs)(`span`,{className:`chat-app-summary`,children:[i,` · `,a,` · `,l]})]}),t&&(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(x,{mih:180,children:(0,V.jsx)(C,{size:`sm`})}),children:(0,V.jsx)(De,{content:e.content})})]})}var Pe=[`Summarize system health for the last hour`,`Find the source of elevated errors`,`Map the current service dependencies`,`Show the slowest endpoints`];function Fe(){let{agentAvailable:e,messages:t,messageTimes:n,ready:r,running:a,activity:o,stopped:s,error:l,threadMissing:p,send:h,retry:g,reloadThread:y,newThread:b}=w(),T=te(t),E=t.filter(e=>e.role===`user`).at(-1)?.id,{scrollRef:D,contentRef:O,turnRef:ee,showJump:k,jumpToLatest:A}=we(E);if(!e)return(0,V.jsx)(m,{size:`sm`,py:96,children:(0,V.jsx)(S,{withBorder:!0,radius:`lg`,p:{base:`xl`,sm:40},children:(0,V.jsxs)(u,{gap:`md`,children:[(0,V.jsx)(f,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Optional capability`}),(0,V.jsx)(_,{order:1,fz:28,children:`Chat is not configured`}),(0,V.jsx)(f,{c:`dimmed`,children:`Add an AI provider key to enable chat. Telemetry ingest, dashboards, traces, logs, and metrics remain available without it.`}),(0,V.jsx)(d,{component:`a`,href:`/dashboards`,variant:`light`,mt:`sm`,children:`Open dashboards`})]})})});let j=ke(t),M=je(t),P=t.filter(e=>j.duplicates.has(e.id)?!1:e.role===`tool`?M.has(e.id):e.role===`assistant`?!e.toolCalls?.length&&typeof e.content==`string`&&e.content.trim().length>0:e.role===`activity`?e.activityType===`mcp-app`||e.activityType===`agent-outcome`:e.role===`user`),F=t.findIndex(e=>e.id===E),I=t.slice(F+1).some(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.length>0),L=t.slice(F+1).filter(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.trim().length>0).at(-1),R=[];for(let e of P)(e.role===`user`||R.length===0)&&R.push({id:e.id,messages:[]}),R.at(-1).messages.push(e);R.length===0&&R.push({id:`draft`,messages:[]});let ne=e=>M.has(e.id)?(0,V.jsx)(Me,{failures:M.get(e.id)},e.id):(0,V.jsxs)(i,{children:[(0,V.jsx)(Re,{message:e,time:n[e.id],appView:j.views.get(e.id)}),T.has(e.id)&&(0,V.jsx)(i,{mt:`sm`,children:(0,V.jsx)(Ee,{receipt:T.get(e.id),running:a&&e.id===E,awaitingAnswer:!I,activity:o})})]},e.id);return(0,V.jsxs)(i,{className:`chat-pane`,children:[(0,V.jsxs)(i,{className:`chat-viewport`,children:[(0,V.jsx)(i,{className:`chat-scroll`,ref:D,tabIndex:0,role:`log`,"aria-label":`Conversation`,children:(0,V.jsxs)(m,{size:880,px:{base:`md`,sm:`xl`},py:`lg`,ref:O,children:[p&&(0,V.jsx)(v,{color:`warn`,radius:`lg`,title:`This chat no longer exists`,children:(0,V.jsxs)(c,{justify:`space-between`,children:[(0,V.jsx)(f,{size:`sm`,children:`It was deleted, or the link is wrong.`}),(0,V.jsx)(d,{size:`compact-sm`,variant:`light`,onClick:b,children:`New chat`})]})}),!p&&!r&&l&&(0,V.jsx)(Q,{message:l,onRetry:y,onNewThread:b}),!p&&!r&&!l&&(0,V.jsxs)(x,{mih:`40vh`,children:[(0,V.jsx)(C,{size:`sm`}),(0,V.jsx)(f,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading chat`})]}),!p&&r&&(0,V.jsxs)(V.Fragment,{children:[P.length===0&&(0,V.jsx)(Le,{onSelect:h}),(0,V.jsx)(u,{gap:`lg`,children:R.map((e,t)=>(0,V.jsxs)(u,{gap:`lg`,ref:e.id===E?ee:void 0,"data-chat-turn":e.id===E?E:void 0,children:[e.messages.filter(e=>e.id!==L?.id).map(ne),t===R.length-1&&(0,V.jsxs)(V.Fragment,{children:[L&&(0,V.jsx)(i,{"data-answer-position":!0,children:(0,V.jsx)(Re,{message:L,time:n[L.id]})},`answer-${E??`draft`}`),a&&!I&&!T.has(E??``)&&(0,V.jsxs)(c,{gap:`xs`,role:`status`,children:[(0,V.jsx)(C,{type:`dots`,size:`sm`}),(0,V.jsx)(f,{c:`dimmed`,size:`sm`,children:o||`Analyzing your system`})]}),s&&(0,V.jsx)(f,{c:`dimmed`,size:`sm`,children:`Stopped`}),l&&(0,V.jsx)(Q,{message:l,onRetry:g})]})]},e.id))})]})]})}),k&&(0,V.jsx)(N,{label:`Jump to latest`,children:(0,V.jsx)(z,{className:`chat-jump`,variant:`default`,size:36,radius:`xl`,"aria-label":`Jump to latest`,onClick:A,children:(0,V.jsx)(pe,{size:18,"aria-hidden":`true`})})})]}),!p&&(0,V.jsx)(Ie,{})]})}function Q({message:e,onRetry:t,onNewThread:n}){return(0,V.jsx)(v,{color:`bad`,radius:`lg`,title:`Something went wrong`,children:(0,V.jsxs)(c,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,V.jsx)(f,{size:`sm`,children:e}),(0,V.jsxs)(c,{gap:`xs`,wrap:`nowrap`,children:[n&&(0,V.jsx)(d,{size:`compact-sm`,variant:`subtle`,color:`bad`,onClick:n,children:`New chat`}),(0,V.jsx)(d,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:t,children:`Retry`})]})]})})}function Ie(){let{input:e,setInput:t,inputRef:n,submit:r,send:a,stop:o,ready:s,running:l}=w();return(0,V.jsx)(i,{className:`chat-composer`,children:(0,V.jsxs)(m,{size:880,px:{base:`md`,sm:`xl`},children:[(0,V.jsx)(S,{component:`form`,onSubmit:r,className:`chat-composer-field`,withBorder:!0,radius:24,py:6,pl:`lg`,pr:6,children:(0,V.jsxs)(c,{align:`flex-end`,gap:`xs`,wrap:`nowrap`,children:[(0,V.jsx)(G,{ref:n,"aria-label":`Message Fanout`,value:e,onChange:e=>t(e.currentTarget.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),a(e))},placeholder:l?`Fanout is working…`:`Ask about health, errors, or latency…`,disabled:!s,autosize:!0,minRows:1,maxRows:8,variant:`unstyled`,flex:1}),l?(0,V.jsx)(N,{label:`Stop`,children:(0,V.jsx)(z,{type:`button`,variant:`default`,size:40,radius:`xl`,"aria-label":`Stop`,onClick:o,children:(0,V.jsx)(_e,{size:16,weight:`fill`})})}):(0,V.jsx)(z,{type:`submit`,variant:`filled`,size:40,radius:`xl`,disabled:!e.trim()||!s,"aria-label":`Send message`,children:(0,V.jsx)(he,{size:17,weight:`fill`})})]})}),(0,V.jsx)(f,{c:`dimmed`,size:`xs`,ta:`center`,mt:6,children:`Enter to send, Shift+Enter for a new line`})]})})}function Le({onSelect:e}){return(0,V.jsxs)(u,{align:`center`,gap:`md`,pt:{base:32,sm:88},pb:`xl`,ta:`center`,children:[(0,V.jsx)(g,{size:`large`}),(0,V.jsx)(_,{order:1,fz:24,fw:500,lh:1.25,maw:560,children:`What do you want to know about your system?`}),(0,V.jsx)(c,{justify:`center`,gap:`xs`,mt:`xs`,maw:720,children:Pe.map(t=>(0,V.jsx)(d,{variant:`default`,size:`sm`,radius:`xl`,onClick:()=>void e(t),children:t},t))})]})}function Re({message:e,time:t,appView:n}){if(e.role===`activity`)return e.activityType===`agent-outcome`&&e.content&&typeof e.content==`object`&&`message`in e.content&&typeof e.content.message==`string`?`status`in e.content&&e.content.status===`stopped`?(0,V.jsx)(f,{c:`dimmed`,size:`sm`,"data-chat-anchor":!0,children:e.content.message}):(0,V.jsx)(v,{color:`bad`,title:`Something went wrong`,"data-chat-anchor":!0,children:e.content.message}):e.activityType===`mcp-app`?n?(0,V.jsx)(Ne,{view:n}):(0,V.jsx)(v,{color:`bad`,"data-chat-anchor":!0,children:`This view could not be loaded. Please try again.`}):null;if(e.role===`assistant`&&e.toolCalls?.length)return null;let r=typeof e.content==`string`?e.content:JSON.stringify(e.content);if(!r&&e.role===`assistant`)return null;let a=e.role===`user`,o=t?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(new Date(t)):``;return(0,V.jsxs)(i,{className:`chat-message`,"data-chat-anchor":!0,"data-role":a?`user`:`assistant`,children:[a?(0,V.jsx)(S,{radius:`lg`,px:`md`,py:`sm`,bg:`var(--mantine-color-brand-light)`,maw:`70%`,ml:`auto`,w:`fit-content`,children:(0,V.jsx)(f,{style:{whiteSpace:`pre-wrap`},children:r})}):(0,V.jsx)(q,{className:`chat-markdown`,children:(0,V.jsx)(ne,{remarkPlugins:[R],components:Be,children:r})}),(o||!a)&&(0,V.jsxs)(c,{className:`chat-message-meta`,gap:6,justify:a?`flex-end`:`flex-start`,mt:4,h:24,children:[o&&t&&(0,V.jsx)(f,{c:`dimmed`,size:`xs`,title:P(t),children:o}),!a&&(0,V.jsx)(ze,{text:r,label:`Copy message`})]})]})}function ze({text:e,label:t}){let{state:n,copy:r}=Te();return(0,V.jsx)(N,{label:n===`failed`?`Could not copy`:n===`copied`?`Copied`:t,children:(0,V.jsx)(z,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":t,"data-state":n===`idle`?void 0:n,onClick:()=>r(e),children:n===`copied`?(0,V.jsx)(p,{size:13,weight:`bold`}):(0,V.jsx)(y,{size:13})})})}var Be={table:({children:e})=>(0,V.jsx)(i,{className:`chat-table`,children:(0,V.jsx)(L,{striped:!0,highlightOnHover:!0,withTableBorder:!0,verticalSpacing:`xs`,fz:`sm`,children:e})}),thead:({children:e})=>(0,V.jsx)(L.Thead,{children:e}),tbody:({children:e})=>(0,V.jsx)(L.Tbody,{children:e}),tr:({children:e})=>(0,V.jsx)(L.Tr,{children:e}),th:({children:e})=>(0,V.jsx)(L.Th,{children:e}),td:({children:e})=>(0,V.jsx)(L.Td,{children:e}),pre:({children:e})=>(0,V.jsx)(Ve,{children:e}),a:({href:e,children:t})=>(0,V.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})};function Ve({children:e}){let t=$(e);return(0,V.jsxs)(i,{className:`chat-code`,pos:`relative`,children:[(0,V.jsx)(i,{className:`chat-code-actions`,pos:`absolute`,top:6,right:6,children:(0,V.jsx)(ze,{text:t,label:`Copy code`})}),(0,V.jsx)(`pre`,{children:e})]})}function $(e){return typeof e==`string`?e:Array.isArray(e)?e.map($).join(``):e&&typeof e==`object`&&`props`in e?$(e.props.children):``}export{xe as n,Fe as t}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mcp-app-frame-Do9gIdfD.js","assets/useRouter-ByJ6_rwb.js","assets/brand-DUaZkIz1.js","assets/index-CEp3GmPL.js","assets/useNavigate-B1zgPEUp.js","assets/preload-helper-EHBQhIeL.js","assets/Tooltip-B3r3s_B9.js","assets/index-ADB9ThEc.css"])))=>i.map(i=>d[i]); +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{A as r,C as i,M as a,S as o,T as s,_ as c,a as l,c as u,d,f,i as p,l as m,m as h,n as g,o as _,p as v,r as y,tt as b,u as x,x as S,y as C}from"./brand-DUaZkIz1.js";import{c as w,d as T,g as E,h as D,l as O,m as ee,o as k,p as A,s as te,t as j,u as M}from"./preload-helper-EHBQhIeL.js";import{t as N}from"./Tooltip-B3r3s_B9.js";import{a as P,c as F,d as I,l as L,n as R,r as ne,t as re,u as ie}from"./dashboard-change-chips-DHVvGnTI.js";import{zt as z}from"./index-CEp3GmPL.js";var B=n(e(),1),V=t(),ae=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],H={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`};function U(e){Object.keys(H).forEach(t=>{e.style.setProperty(t,H[t],`important`)})}function oe(e){let t=window.getComputedStyle(e);if(t===null)return null;let n={};for(let e of ae)n[e]=t[e];return n.boxSizing===``?null:{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)}}var W=null;function se(e,t,n=1,r=1/0){W||(W=document.createElement(`textarea`),W.setAttribute(`tabindex`,`-1`),W.setAttribute(`aria-hidden`,`true`),W.setAttribute(`aria-label`,`autosize measurement`),U(W)),W.parentNode===null&&document.body.appendChild(W);let{paddingSize:i,borderSize:a,sizingStyle:o}=e,{boxSizing:s}=o;Object.keys(o).forEach(e=>{W.style[e]=o[e]}),U(W),W.value=t;let c=s===`border-box`?W.scrollHeight+a:W.scrollHeight-i;W.value=t,c=s===`border-box`?W.scrollHeight+a:W.scrollHeight-i,W.value=`x`;let l=W.scrollHeight-i,u=l*n;s===`border-box`&&(u=u+i+a),c=Math.max(u,c);let d=l*r;return s===`border-box`&&(d=d+i+a),c=Math.min(d,c),[c,l]}function ce({maxRows:e,minRows:t,onChange:n,ref:r,...i}){let a=i.value!==void 0,o=(0,B.useRef)(null),s=b(o,r),c=(0,B.useRef)(0),l=(0,B.useRef)(0),u=()=>{let n=o.current;if(!n)return;let r=oe(n);if(!r)return;let[i]=se(r,n.value||n.placeholder||`x`,t,e);c.current!==i&&(c.current=i,n.style.setProperty(`height`,`${i}px`,`important`))},d=(0,B.useEffectEvent)(u),f=e=>{a||u(),n?.(e)};return(0,B.useLayoutEffect)(u),(0,B.useEffect)(()=>{let e=()=>u();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,B.useEffect)(()=>{let e=o.current;if(!e||typeof ResizeObserver>`u`)return;l.current=e.offsetWidth;let t=0,n=new ResizeObserver(()=>{o.current&&o.current.offsetWidth!==l.current&&(l.current=o.current.offsetWidth,cancelAnimationFrame(t),t=requestAnimationFrame(d))});return n.observe(e),()=>{cancelAnimationFrame(t),n.disconnect()}},[]),(0,B.useEffect)(()=>{let e=()=>u();return document.fonts.addEventListener(`loadingdone`,e),()=>document.fonts.removeEventListener(`loadingdone`,e)},[]),(0,B.useEffect)(()=>{let e=e=>{if(o.current?.form===e.target&&!a){let e=o.current.value;requestAnimationFrame(()=>{o.current&&e!==o.current.value&&u()})}};return document.body.addEventListener(`reset`,e),()=>document.body.removeEventListener(`reset`,e)},[a]),(0,V.jsx)(`textarea`,{rows:t,...i,onChange:f,ref:s})}var G=s(e=>{let{autosize:t,maxRows:n,minRows:r,__staticSelector:i,resize:o,bottomSection:s,bottomSectionProps:c,...l}=a([`Input`,`InputWrapper`,`Textarea`],null,e),u=t&&I()!==`test`,d=u?{maxRows:n,minRows:r}:{};return(0,V.jsx)(h,{component:u?ce:`textarea`,...l,__staticSelector:i||`Textarea`,__bottomSection:s,__bottomSectionProps:c,multiline:!0,"data-no-overflow":t&&n===void 0||void 0,__vars:{"--input-resize":o},...d})});G.classes=h.classes,G.displayName=`@mantine/core/Textarea`;var K={root:`m_d08caa0`},q=s(e=>{let t=a(`Typography`,null,e),{classNames:n,className:o,style:s,styles:c,unstyled:l,attributes:u,...d}=t,f=r({name:`Typography`,classes:K,props:t,className:o,style:s,classNames:n,styles:c,unstyled:l,attributes:u});return(0,V.jsx)(i,{...f(`root`),...d})});q.classes=K,q.displayName=`@mantine/core/Typography`;var le=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M208.49,152.49l-72,72a12,12,0,0,1-17,0l-72-72a12,12,0,0,1,17-17L116,187V40a12,12,0,0,1,24,0V187l51.51-51.52a12,12,0,0,1,17,17Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,144l-72,72L56,144Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M207.39,140.94A8,8,0,0,0,200,136H136V40a8,8,0,0,0-16,0v96H56a8,8,0,0,0-5.66,13.66l72,72a8,8,0,0,0,11.32,0l72-72A8,8,0,0,0,207.39,140.94ZM128,204.69,75.31,152H180.69Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,56,136h64V40a8,8,0,0,1,16,0v96h64a8,8,0,0,1,5.66,13.66Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M204.24,148.24l-72,72a6,6,0,0,1-8.48,0l-72-72a6,6,0,0,1,8.48-8.48L122,201.51V40a6,6,0,0,1,12,0V201.51l61.76-61.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M202.83,146.83l-72,72a4,4,0,0,1-5.66,0l-72-72a4,4,0,0,1,5.66-5.66L124,206.34V40a4,4,0,0,1,8,0V206.34l65.17-65.17a4,4,0,0,1,5.66,5.66Z`}))]]),ue=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M176,128,96,208V48Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z`}))]]),de=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M230.14,25.86a20,20,0,0,0-19.57-5.11l-.22.07L18.44,79a20,20,0,0,0-3.06,37.25L99,157l40.71,83.65a19.81,19.81,0,0,0,18,11.38c.57,0,1.15,0,1.73-.07A19.82,19.82,0,0,0,177,237.56L235.18,45.65a1.42,1.42,0,0,0,.07-.22A20,20,0,0,0,230.14,25.86ZM156.91,221.07l-34.37-70.64,46-45.95a12,12,0,0,0-17-17l-46,46L34.93,99.09,210,46Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M223.69,42.18l-58.22,192a8,8,0,0,1-14.92,1.25L108,148,20.58,105.45a8,8,0,0,1,1.25-14.92l192-58.22A8,8,0,0,1,223.69,42.18Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M231.4,44.34s0,.1,0,.15l-58.2,191.94a15.88,15.88,0,0,1-14,11.51q-.69.06-1.38.06a15.86,15.86,0,0,1-14.42-9.15L107,164.15a4,4,0,0,1,.77-4.58l57.92-57.92a8,8,0,0,0-11.31-11.31L96.43,148.26a4,4,0,0,1-4.58.77L17.08,112.64a16,16,0,0,1,2.49-29.8l191.94-58.2.15,0A16,16,0,0,1,231.4,44.34Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M225.88,30.12a13.83,13.83,0,0,0-13.7-3.58l-.11,0L20.14,84.77A14,14,0,0,0,18,110.85l85.56,41.64L145.12,238a13.87,13.87,0,0,0,12.61,8c.4,0,.81,0,1.21-.05a13.9,13.9,0,0,0,12.29-10.09l58.2-191.93,0-.11A13.83,13.83,0,0,0,225.88,30.12Zm-8,10.4L159.73,232.43l0,.11a2,2,0,0,1-3.76.26l-40.68-83.58,49-49a6,6,0,1,0-8.49-8.49l-49,49L23.15,100a2,2,0,0,1,.31-3.74l.11,0L215.48,38.08a1.94,1.94,0,0,1,1.92.52A2,2,0,0,1,217.92,40.52Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224.47,31.52a11.87,11.87,0,0,0-11.82-3L20.74,86.67a12,12,0,0,0-1.91,22.38L105,151l41.92,86.15A11.88,11.88,0,0,0,157.74,244c.34,0,.69,0,1,0a11.89,11.89,0,0,0,10.52-8.63l58.21-192,0-.08A11.85,11.85,0,0,0,224.47,31.52Zm-4.62,9.54-58.23,192a4,4,0,0,1-7.48.59l-41.3-84.86,50-50a4,4,0,1,0-5.66-5.66l-50,50-84.9-41.31a3.88,3.88,0,0,1-2.27-4,3.93,3.93,0,0,1,3-3.54L214.9,36.16A3.93,3.93,0,0,1,216,36a4,4,0,0,1,2.79,1.19A3.93,3.93,0,0,1,219.85,41.06Z`}))]]),fe=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z`}))]]),J=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:le}));J.displayName=`ArrowDownIcon`;var pe=J,Y=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:ue}));Y.displayName=`CaretRightIcon`;var X=Y,me=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:de}));me.displayName=`PaperPlaneTiltIcon`;var he=me,ge=B.forwardRef((e,t)=>B.createElement(l,{ref:t,...e,weights:fe}));ge.displayName=`StopIcon`;var _e=ge;function ve(e){return e.dashboard.panels.length===1?e.dashboard.panels[0].title:e.dashboard.name}function ye(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Missing panel view`);let t=e;if(!t.view||![`preset`,`query`].includes(t.view.kind)||!/^[a-f0-9]{64}$/.test(t.view.key))throw Error(`Invalid panel view identity`);if(t.dashboard?.version!==1||!Array.isArray(t.dashboard.panels)||!t.dashboard.panels.length||t.dashboard.panels.length>40||!Array.isArray(t.results)||t.dashboard.panels.some(e=>!e||typeof e.id!=`string`||!e.id)||t.results.some(e=>!e||typeof e.id!=`string`))throw Error(`Invalid panel view`);let n=new Set(t.dashboard.panels.map(e=>e.id));if(n.size!==t.dashboard.panels.length||t.results.length!==n.size||new Set(t.results.map(e=>e.id)).size!==n.size||t.results.some(e=>!n.has(e.id)||![`ok`,`empty`,`error`].includes(e.status)))throw Error(`Panel results do not match the view`);if(t.vars!==void 0&&(!t.vars||typeof t.vars!=`object`||Array.isArray(t.vars)||Object.values(t.vars).some(e=>typeof e!=`string`&&!(Array.isArray(e)&&e.every(e=>typeof e==`string`)))))throw Error(`Invalid panel variables`);if(t.trace!==void 0&&(!t.trace?.data||!Array.isArray(t.trace.data.spans)||!Array.isArray(t.trace.data.logs)||!Array.isArray(t.trace.data.services)))throw Error(`Invalid trace detail`);return t}var be=new WeakSet;function xe(e){if(!e||typeof e!=`object`||Array.isArray(e))return;if(be.has(e))return e;let t=e;if(Object.keys(t).sort().join(`,`)===`is_error,resource_uri,tool_input,tool_name,tool_result`&&t.resource_uri===`ui://fanout/panels.html`&&typeof t.tool_name==`string`&&t.tool_name&&typeof t.is_error==`boolean`&&t.tool_input&&typeof t.tool_input==`object`&&!Array.isArray(t.tool_input)){try{ye(t.tool_result)}catch{return}return be.add(t),t}}var Se=16,Ce=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `]);function we(e){let t=(0,B.useRef)(null),n=(0,B.useRef)(null),r=(0,B.useRef)(null),i=(0,B.useRef)(!0),a=(0,B.useRef)(e),o=(0,B.useRef)(()=>{}),s=(0,B.useRef)(null),c=(0,B.useRef)(new Set),l=(0,B.useRef)(null),u=(0,B.useRef)(null),[d,f]=(0,B.useState)(!1),p=(0,B.useCallback)(()=>{let e=t.current,n=r.current?.lastElementChild,i=!e||!n||n.getBoundingClientRect().bottom>e.getBoundingClientRect().top+e.clientTop+e.clientHeight+1;f(!!e&&i&&e.scrollHeight-e.clientHeight-e.scrollTop>1)},[]),m=(0,B.useCallback)(()=>{let e=t.current;if(!e)return;let n=e.getBoundingClientRect().top+e.clientTop,r=[...e.querySelectorAll(`[data-chat-anchor]`)].find(e=>e.getBoundingClientRect().bottom>n);l.current=r?{node:r,top:r.getBoundingClientRect().top}:null},[]),h=(0,B.useCallback)((e,t)=>{e.scrollTop=t,u.current=e.scrollTop},[]),g=(0,B.useCallback)(()=>{let e=t.current;if(e){if(r.current){let t=n.current&&parseFloat(getComputedStyle(n.current).paddingBottom)||0;r.current.style.minHeight=`${Math.max(0,e.clientHeight-Se-t)}px`,i.current&&h(e,e.scrollTop+r.current.getBoundingClientRect().top-e.getBoundingClientRect().top-e.clientTop-Se)}if(!i.current){let t=l.current;t?.node.isConnected&&h(e,e.scrollTop+t.node.getBoundingClientRect().top-t.top),m()}p()}},[m,h,p]),_=(0,B.useCallback)(()=>{let e=t.current,i=n.current;if(!e||!i){s.current?.disconnect(),s.current=null,c.current.clear();return}s.current??=new ResizeObserver(g);let a=new Set([e,i,...i.querySelectorAll(`[data-chat-anchor]`)]);r.current&&a.add(r.current);for(let e of c.current)a.has(e)||s.current.unobserve(e);for(let e of a)c.current.has(e)||s.current.observe(e);c.current=a},[g]),v=(0,B.useCallback)(e=>{if(o.current(),t.current=e,u.current=null,l.current=null,i.current=!0,_(),!e)return;let n=!1,r=()=>{i.current=!1,m()},a=e=>{let t=e.target;!e.defaultPrevented&&Ce.has(e.key)&&(t instanceof HTMLElement&&(t.closest(`input, textarea, select, [contenteditable]`)||(e.key===` `?t.closest(`button`):t.closest(`[role=slider]`)))||r())},s=()=>{n=!0},c=()=>{n=!1},d=()=>{n&&e.scrollTop!==u.current&&r(),i.current||m(),p()};e.addEventListener(`scroll`,d,{passive:!0}),e.addEventListener(`wheel`,r,{passive:!0}),e.addEventListener(`touchmove`,r,{passive:!0}),e.addEventListener(`keydown`,a),e.addEventListener(`pointerdown`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c),o.current=()=>{e.removeEventListener(`scroll`,d),e.removeEventListener(`wheel`,r),e.removeEventListener(`touchmove`,r),e.removeEventListener(`keydown`,a),e.removeEventListener(`pointerdown`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),o.current=()=>{}},g()},[g,m,_,p]),y=(0,B.useCallback)(e=>{n.current=e,_()},[_]),b=(0,B.useCallback)(e=>{r.current?.style.removeProperty(`min-height`),r.current=e,_()},[_]);return(0,B.useLayoutEffect)(()=>{a.current!==e&&(a.current=e,i.current=!0,l.current=null),_(),g()}),{scrollRef:v,contentRef:y,turnRef:b,showJump:d,jumpToLatest:(0,B.useCallback)(()=>{let e=t.current;e&&(e.focus({preventScroll:!0}),i.current=!1,h(e,e.scrollHeight),m(),p())},[m,h,p])}}function Te(e=1500){let[t,n]=(0,B.useState)(`idle`),r=(0,B.useRef)(null);(0,B.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);function i(t){r.current&&clearTimeout(r.current),n(`idle`),(navigator.clipboard?navigator.clipboard.writeText(t):Promise.reject(Error(`clipboard unavailable`))).then(()=>n(`copied`),()=>n(`failed`)).finally(()=>{r.current=setTimeout(()=>n(`idle`),e)})}return{state:t,copy:i}}var Z=e=>`${(e/1e3).toFixed(1)} s`;function Ee({receipt:e,running:t=!1,activity:n=``,awaitingAnswer:r=!1}){let[i,a]=(0,B.useState)(!1),o=(0,B.useId)(),s=e.saved,l=s?.receipt.save_check,p=t=>Object.hasOwn(e.panel_titles,t)?e.panel_titles[t]:t,m=Object.values(e.stages).filter(e=>e.state===`complete`).length,h=[e.stages.schema.state===`complete`?`Read telemetry`:void 0,e.panel_count===void 0?void 0:`${e.panel_count} ${e.panel_count===1?`panel`:`panels`}`,l?.checked?`Checked in ${Z(l.elapsed_ms)}`:void 0,s?`Saved v${s.version}`:void 0].filter(Boolean).join(` · `)||`Building dashboard`,g=[...s?O(s.receipt):[],...new Map(e.corrections.map(e=>[e.panel_id,`Fixed ${e.title}`])).values()];return(0,V.jsx)(S,{"data-build-receipt":e.turn_id,"data-dashboard-result":s?.id,"data-chat-anchor":!0,withBorder:!0,radius:`md`,p:`sm`,children:(0,V.jsxs)(u,{gap:6,children:[(0,V.jsxs)(c,{gap:`xs`,justify:`space-between`,children:[(0,V.jsxs)(f,{size:`sm`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[h,(0,V.jsxs)(f,{span:!0,c:`dimmed`,size:`xs`,children:[` · `,m,` stages complete`]})]}),(0,V.jsxs)(d,{component:`button`,variant:`subtle`,color:`gray`,size:`compact-xs`,"aria-expanded":i,"aria-controls":o,onClick:()=>a(e=>!e),children:[`Details`,g.length>4?` (+${g.length-4})`:``]})]}),t&&r&&(0,V.jsxs)(c,{gap:`xs`,"data-build-running":!0,children:[(0,V.jsx)(C,{type:`dots`,size:`sm`}),(0,V.jsx)(f,{c:`dimmed`,size:`sm`,children:n||`Analyzing your system`})]}),(0,V.jsx)(re,{labels:g.slice(0,4)}),e.explanations.map(e=>t?e.split(` · `).filter(e=>!e.endsWith(`: incomplete`)).join(` · `):e).filter(Boolean).map((e,t)=>(0,V.jsx)(f,{size:`xs`,c:`dimmed`,"data-receipt-attention":!0,children:e},t)),s&&(0,V.jsx)(d,{renderRoot:e=>(0,V.jsx)(E,{...e,to:`/dashboards/$dashboardId`,params:{dashboardId:s.id},search:{}}),variant:`subtle`,size:`compact-sm`,color:`gray`,style:{alignSelf:`flex-start`},children:`Open dashboard`}),(0,V.jsx)(ie,{expanded:i,id:o,children:(0,V.jsxs)(u,{gap:4,children:[s&&(0,V.jsxs)(f,{size:`xs`,children:[s.label,` `,s.name,` · opens the current dashboard`]}),Object.entries(e.stages).map(([e,n])=>(0,V.jsxs)(f,{size:`xs`,c:`dimmed`,children:[T[e],`: `,t&&n.state===`incomplete`?`in progress`:n.state,n.elapsed_ms===void 0?``:` · ${Z(n.elapsed_ms)}`]},e)),e.save_attempts.map((e,t)=>e.state===`retried`&&(0,V.jsxs)(f,{size:`xs`,c:`dimmed`,children:[`Save attempt `,t+1,`: retried`]},e.call_id)),!!e.context_counts.deploys&&(0,V.jsxs)(f,{size:`xs`,children:[e.context_counts.deploys,` deploys observed`]}),!!e.context_counts.anomalies&&(0,V.jsxs)(f,{size:`xs`,children:[e.context_counts.anomalies,` anomalies observed`]}),e.panels.map(e=>(0,V.jsxs)(f,{size:`xs`,children:[`Preview · `,p(e.id),`: `,e.status,e.elapsed_ms===void 0?``:` · ${Z(e.elapsed_ms)}`]},e.id)),l&&(0,V.jsxs)(f,{size:`xs`,children:[`Save check: `,l.checked?`checked`:`incomplete`,` · `,Z(l.elapsed_ms)]}),l?.panels.map(e=>(0,V.jsxs)(f,{size:`xs`,children:[`Save · `,p(e.id),`: `,e.status,` · `,e.rows??0,` rows`,e.elapsed_ms===void 0?``:` · ${Z(e.elapsed_ms)}`]},e.id)),g.slice(4).map((e,t)=>(0,V.jsx)(f,{size:`xs`,children:e},t)),e.corrections.map((e,t)=>(0,V.jsxs)(f,{size:`xs`,children:[`Fixed `,e.title,`: `,e.message]},t))]})})]})})}var De=(0,B.lazy)(()=>j(()=>import(`./mcp-app-frame-Do9gIdfD.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Oe=e=>e.tool_result.view.kind===`preset`;function ke(e){let t=new Map,n=new Set,r=[],i=()=>{let e=new Map;for(let t of r){let n=t.content.tool_result.view.key;e.set(n,t)}let i=new Set([...e.values()].map(e=>e.id)),a=[...e.values()].some(e=>Oe(e.content)),o=r.filter(e=>i.has(e.id)).at(-1)?.id;for(let e of r)i.has(e.id)?t.set(e.id,{content:e.content,expanded:Oe(e.content)||!a&&e.id===o}):n.add(e.id);r=[]};for(let t of e)if(t.role===`user`&&i(),t.role===`activity`&&t.activityType===`mcp-app`){let e=xe(t.content);e&&r.push({id:t.id,content:e})}return i(),{views:t,duplicates:n}}function Ae(e,t){return Array.isArray(e)?e.flatMap(e=>{if(!D(e)||typeof e.message!=`string`)return[];let n=typeof e.path==`string`?/^panels\[(\d+)\](?:\.|$)/.exec(e.path)?.[1]:void 0,r=n===void 0?void 0:t?.[Number(n)];return[r&&!e.message.startsWith(r)?`${r}: ${e.message}`:e.message]}):[]}function je(e){let t=new Map,n=new Map,r=new Map,i=`unattributed`;for(let a of e){if(a.role===`user`&&(n.clear(),r.clear(),i=a.id),a.role===`assistant`){i=a.id;for(let e of a.toolCalls??[]){let t=[`create_dashboard`,`replace_dashboard`].includes(e.function.name)?A(e.function.arguments)?.dashboard:void 0,r=D(t)&&Array.isArray(t.panels)?t.panels.map(e=>D(e)&&typeof e.title==`string`?e.title:``):void 0;n.set(e.id,{assistant:i,name:e.function.name,titles:r})}}if(a.role===`tool`){let e=A(a.content);if(!a.error&&!e?.error&&e?.isError!==!0)continue;let o=n.get(a.toolCallId);if(o&&ee.has(o.name)&&M(a))continue;let s=D(e?.error)?e?.error:void 0;if(s?.code===`no_data`||s?.code===`unknown_service`)continue;let c=o?.assistant??i,l=r.get(c)??a.id;r.set(c,l);let u=t.get(l)??[],d=typeof s?.message==`string`?s.message:typeof a.error==`string`&&a.error?a.error:`Could not complete this step. Try again.`,f=[`create_dashboard`,`edit_dashboard`,`replace_dashboard`].includes(o?.name??``)&&(s?.code===`invalid_spec`||s?.code===`dashboard_version_conflict`);u.push({name:k(o?.name??``),message:d,details:f?Ae(e?.problems,o?.titles):[],readOnly:s?.code===`answer_only`,rejected:f}),t.set(l,u)}}return t}function Me({failures:e}){let[t,n]=(0,B.useState)({rejected:!1,failed:!1}),r=e.filter(e=>e.rejected),a=e.filter(e=>!e.readOnly&&!e.rejected),s=[{key:`rejected`,items:r,label:`${r.length} ${r.length===1?`draft`:`drafts`} rejected`},{key:`failed`,items:a,label:`${a.length} ${a.length===1?`step`:`steps`} failed`}];return(0,V.jsxs)(i,{"data-chat-anchor":!0,children:[e.some(e=>e.readOnly)&&(0,V.jsx)(f,{size:`sm`,c:`dimmed`,children:`Not saved: Explain is read-only`}),s.map(({key:e,items:r,label:a})=>r.length>0&&(0,V.jsxs)(i,{children:[(0,V.jsxs)(o,{className:`chat-app-toggle`,"aria-expanded":t[e],onClick:()=>n(t=>({...t,[e]:!t[e]})),style:{color:`var(--mantine-color-dimmed)`},children:[(0,V.jsx)(`span`,{className:`chat-app-chevron`,"aria-hidden":`true`,children:t[e]?(0,V.jsx)(F,{size:14}):(0,V.jsx)(X,{size:14})}),(0,V.jsx)(`span`,{className:`chat-app-summary`,children:a})]}),t[e]&&(0,V.jsx)(u,{gap:`xs`,pl:`md`,children:r.flatMap((e,t)=>(e.details.length?e.details:[`${e.name}: ${e.message}`]).map((e,n)=>(0,V.jsx)(f,{size:`sm`,c:`dimmed`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:e},`${t}-${n}`)))})]},e))]})}function Ne({view:e}){let[t,n]=(0,B.useState)(e.expanded);(0,B.useEffect)(()=>n(e.expanded),[e.expanded]);let r=e.content.tool_result,i=ve(r),a=[...new Set(r.dashboard.panels.map(e=>e.viz===`timeseries`?`time series`:e.viz.replaceAll(`_`,` `)))].join(`, `),s=r.results.reduce((e,t)=>e+(t.frame?.rows??0),0),c=new Map;for(let e of r.results)e.status!==`ok`&&c.set(e.status,(c.get(e.status)??0)+1);let l=r.dashboard.panels.length>1?[`${r.dashboard.panels.length} panels`,...Array.from(c,([e,t])=>`${t} ${e}`)].join(` · `):c.size?[...c.keys()].join(`, `):`${s} ${s===1?`row`:`rows`}`;return(0,V.jsxs)(S,{"data-chat-app":!0,"data-chat-anchor":!0,withBorder:!0,radius:`lg`,style:{overflow:`hidden`},children:[(0,V.jsxs)(o,{className:`chat-app-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,V.jsx)(`span`,{className:`chat-app-chevron`,"aria-hidden":`true`,children:t?(0,V.jsx)(F,{size:14}):(0,V.jsx)(X,{size:14})}),(0,V.jsxs)(`span`,{className:`chat-app-summary`,children:[i,` · `,a,` · `,l]})]}),t&&(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(x,{mih:180,children:(0,V.jsx)(C,{size:`sm`})}),children:(0,V.jsx)(De,{content:e.content})})]})}var Pe=[`Summarize system health for the last hour`,`Find the source of elevated errors`,`Map the current service dependencies`,`Show the slowest endpoints`];function Fe(){let{agentAvailable:e,messages:t,messageTimes:n,ready:r,running:a,activity:o,stopped:s,error:l,threadMissing:p,send:h,retry:g,reloadThread:y,newThread:b}=w(),T=te(t),E=t.filter(e=>e.role===`user`).at(-1)?.id,{scrollRef:D,contentRef:O,turnRef:ee,showJump:k,jumpToLatest:A}=we(E);if(!e)return(0,V.jsx)(m,{size:`sm`,py:96,children:(0,V.jsx)(S,{withBorder:!0,radius:`lg`,p:{base:`xl`,sm:40},children:(0,V.jsxs)(u,{gap:`md`,children:[(0,V.jsx)(f,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Optional capability`}),(0,V.jsx)(_,{order:1,fz:28,children:`Chat is not configured`}),(0,V.jsx)(f,{c:`dimmed`,children:`Add an AI provider key to enable chat. Telemetry ingest, dashboards, traces, logs, and metrics remain available without it.`}),(0,V.jsx)(d,{component:`a`,href:`/dashboards`,variant:`light`,mt:`sm`,children:`Open dashboards`})]})})});let j=ke(t),M=je(t),P=t.filter(e=>j.duplicates.has(e.id)?!1:e.role===`tool`?M.has(e.id):e.role===`assistant`?!e.toolCalls?.length&&typeof e.content==`string`&&e.content.trim().length>0:e.role===`activity`?e.activityType===`mcp-app`||e.activityType===`agent-outcome`:e.role===`user`),F=t.findIndex(e=>e.id===E),I=t.slice(F+1).some(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.length>0),L=t.slice(F+1).filter(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.trim().length>0).at(-1),R=[];for(let e of P)(e.role===`user`||R.length===0)&&R.push({id:e.id,messages:[]}),R.at(-1).messages.push(e);R.length===0&&R.push({id:`draft`,messages:[]});let ne=e=>M.has(e.id)?(0,V.jsx)(Me,{failures:M.get(e.id)},e.id):(0,V.jsxs)(i,{children:[(0,V.jsx)(Re,{message:e,time:n[e.id],appView:j.views.get(e.id)}),T.has(e.id)&&(0,V.jsx)(i,{mt:`sm`,children:(0,V.jsx)(Ee,{receipt:T.get(e.id),running:a&&e.id===E,awaitingAnswer:!I,activity:o})})]},e.id);return(0,V.jsxs)(i,{className:`chat-pane`,children:[(0,V.jsxs)(i,{className:`chat-viewport`,children:[(0,V.jsx)(i,{className:`chat-scroll`,ref:D,tabIndex:0,role:`log`,"aria-label":`Conversation`,children:(0,V.jsxs)(m,{size:880,px:{base:`md`,sm:`xl`},py:`lg`,ref:O,children:[p&&(0,V.jsx)(v,{color:`warn`,radius:`lg`,title:`This chat no longer exists`,children:(0,V.jsxs)(c,{justify:`space-between`,children:[(0,V.jsx)(f,{size:`sm`,children:`It was deleted, or the link is wrong.`}),(0,V.jsx)(d,{size:`compact-sm`,variant:`light`,onClick:b,children:`New chat`})]})}),!p&&!r&&l&&(0,V.jsx)(Q,{message:l,onRetry:y,onNewThread:b}),!p&&!r&&!l&&(0,V.jsxs)(x,{mih:`40vh`,children:[(0,V.jsx)(C,{size:`sm`}),(0,V.jsx)(f,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading chat`})]}),!p&&r&&(0,V.jsxs)(V.Fragment,{children:[P.length===0&&(0,V.jsx)(Le,{onSelect:h}),(0,V.jsx)(u,{gap:`lg`,children:R.map((e,t)=>(0,V.jsxs)(u,{gap:`lg`,ref:e.id===E?ee:void 0,"data-chat-turn":e.id===E?E:void 0,children:[e.messages.filter(e=>e.id!==L?.id).map(ne),t===R.length-1&&(0,V.jsxs)(V.Fragment,{children:[L&&(0,V.jsx)(i,{"data-answer-position":!0,children:(0,V.jsx)(Re,{message:L,time:n[L.id]})},`answer-${E??`draft`}`),a&&!I&&!T.has(E??``)&&(0,V.jsxs)(c,{gap:`xs`,role:`status`,children:[(0,V.jsx)(C,{type:`dots`,size:`sm`}),(0,V.jsx)(f,{c:`dimmed`,size:`sm`,children:o||`Analyzing your system`})]}),s&&(0,V.jsx)(f,{c:`dimmed`,size:`sm`,children:`Stopped`}),l&&(0,V.jsx)(Q,{message:l,onRetry:g})]})]},e.id))})]})]})}),k&&(0,V.jsx)(N,{label:`Jump to latest`,children:(0,V.jsx)(z,{className:`chat-jump`,variant:`default`,size:36,radius:`xl`,"aria-label":`Jump to latest`,onClick:A,children:(0,V.jsx)(pe,{size:18,"aria-hidden":`true`})})})]}),!p&&(0,V.jsx)(Ie,{})]})}function Q({message:e,onRetry:t,onNewThread:n}){return(0,V.jsx)(v,{color:`bad`,radius:`lg`,title:`Something went wrong`,children:(0,V.jsxs)(c,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,V.jsx)(f,{size:`sm`,children:e}),(0,V.jsxs)(c,{gap:`xs`,wrap:`nowrap`,children:[n&&(0,V.jsx)(d,{size:`compact-sm`,variant:`subtle`,color:`bad`,onClick:n,children:`New chat`}),(0,V.jsx)(d,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:t,children:`Retry`})]})]})})}function Ie(){let{input:e,setInput:t,inputRef:n,submit:r,send:a,stop:o,ready:s,running:l}=w();return(0,V.jsx)(i,{className:`chat-composer`,children:(0,V.jsxs)(m,{size:880,px:{base:`md`,sm:`xl`},children:[(0,V.jsx)(S,{component:`form`,onSubmit:r,className:`chat-composer-field`,withBorder:!0,radius:24,py:6,pl:`lg`,pr:6,children:(0,V.jsxs)(c,{align:`flex-end`,gap:`xs`,wrap:`nowrap`,children:[(0,V.jsx)(G,{ref:n,"aria-label":`Message Fanout`,value:e,onChange:e=>t(e.currentTarget.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),a(e))},placeholder:l?`Fanout is working…`:`Ask about health, errors, or latency…`,disabled:!s,autosize:!0,minRows:1,maxRows:8,variant:`unstyled`,flex:1}),l?(0,V.jsx)(N,{label:`Stop`,children:(0,V.jsx)(z,{type:`button`,variant:`default`,size:40,radius:`xl`,"aria-label":`Stop`,onClick:o,children:(0,V.jsx)(_e,{size:16,weight:`fill`})})}):(0,V.jsx)(z,{type:`submit`,variant:`filled`,size:40,radius:`xl`,disabled:!e.trim()||!s,"aria-label":`Send message`,children:(0,V.jsx)(he,{size:17,weight:`fill`})})]})}),(0,V.jsx)(f,{c:`dimmed`,size:`xs`,ta:`center`,mt:6,children:`Enter to send, Shift+Enter for a new line`})]})})}function Le({onSelect:e}){return(0,V.jsxs)(u,{align:`center`,gap:`md`,pt:{base:32,sm:88},pb:`xl`,ta:`center`,children:[(0,V.jsx)(g,{size:`large`}),(0,V.jsx)(_,{order:1,fz:24,fw:500,lh:1.25,maw:560,children:`What do you want to know about your system?`}),(0,V.jsx)(c,{justify:`center`,gap:`xs`,mt:`xs`,maw:720,children:Pe.map(t=>(0,V.jsx)(d,{variant:`default`,size:`sm`,radius:`xl`,onClick:()=>void e(t),children:t},t))})]})}function Re({message:e,time:t,appView:n}){if(e.role===`activity`)return e.activityType===`agent-outcome`&&e.content&&typeof e.content==`object`&&`message`in e.content&&typeof e.content.message==`string`?`status`in e.content&&e.content.status===`stopped`?(0,V.jsx)(f,{c:`dimmed`,size:`sm`,"data-chat-anchor":!0,children:e.content.message}):(0,V.jsx)(v,{color:`bad`,title:`Something went wrong`,"data-chat-anchor":!0,children:e.content.message}):e.activityType===`mcp-app`?n?(0,V.jsx)(Ne,{view:n}):(0,V.jsx)(v,{color:`bad`,"data-chat-anchor":!0,children:`This view could not be loaded. Please try again.`}):null;if(e.role===`assistant`&&e.toolCalls?.length)return null;let r=typeof e.content==`string`?e.content:JSON.stringify(e.content);if(!r&&e.role===`assistant`)return null;let a=e.role===`user`,o=t?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(new Date(t)):``;return(0,V.jsxs)(i,{className:`chat-message`,"data-chat-anchor":!0,"data-role":a?`user`:`assistant`,children:[a?(0,V.jsx)(S,{radius:`lg`,px:`md`,py:`sm`,bg:`var(--mantine-color-brand-light)`,maw:`70%`,ml:`auto`,w:`fit-content`,children:(0,V.jsx)(f,{style:{whiteSpace:`pre-wrap`},children:r})}):(0,V.jsx)(q,{className:`chat-markdown`,children:(0,V.jsx)(ne,{remarkPlugins:[R],components:Be,children:r})}),(o||!a)&&(0,V.jsxs)(c,{className:`chat-message-meta`,gap:6,justify:a?`flex-end`:`flex-start`,mt:4,h:24,children:[o&&t&&(0,V.jsx)(f,{c:`dimmed`,size:`xs`,title:P(t),children:o}),!a&&(0,V.jsx)(ze,{text:r,label:`Copy message`})]})]})}function ze({text:e,label:t}){let{state:n,copy:r}=Te();return(0,V.jsx)(N,{label:n===`failed`?`Could not copy`:n===`copied`?`Copied`:t,children:(0,V.jsx)(z,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":t,"data-state":n===`idle`?void 0:n,onClick:()=>r(e),children:n===`copied`?(0,V.jsx)(p,{size:13,weight:`bold`}):(0,V.jsx)(y,{size:13})})})}var Be={table:({children:e})=>(0,V.jsx)(i,{className:`chat-table`,children:(0,V.jsx)(L,{striped:!0,highlightOnHover:!0,withTableBorder:!0,verticalSpacing:`xs`,fz:`sm`,children:e})}),thead:({children:e})=>(0,V.jsx)(L.Thead,{children:e}),tbody:({children:e})=>(0,V.jsx)(L.Tbody,{children:e}),tr:({children:e})=>(0,V.jsx)(L.Tr,{children:e}),th:({children:e})=>(0,V.jsx)(L.Th,{children:e}),td:({children:e})=>(0,V.jsx)(L.Td,{children:e}),pre:({children:e})=>(0,V.jsx)(Ve,{children:e}),a:({href:e,children:t})=>(0,V.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})};function Ve({children:e}){let t=$(e);return(0,V.jsxs)(i,{className:`chat-code`,pos:`relative`,children:[(0,V.jsx)(i,{className:`chat-code-actions`,pos:`absolute`,top:6,right:6,children:(0,V.jsx)(ze,{text:t,label:`Copy code`})}),(0,V.jsx)(`pre`,{children:e})]})}function $(e){return typeof e==`string`?e:Array.isArray(e)?e.map($).join(``):e&&typeof e==`object`&&`props`in e?$(e.props.children):``}export{xe as n,Fe as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat._threadId-BzKwvTFN.js b/internal/ui/dist/assets/chat._threadId-BzKwvTFN.js new file mode 100644 index 00000000..c2e1842d --- /dev/null +++ b/internal/ui/dist/assets/chat._threadId-BzKwvTFN.js @@ -0,0 +1 @@ +import{t as e}from"./chat-BqevyT9H.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat._threadId-CpaVOTkg.js b/internal/ui/dist/assets/chat._threadId-CpaVOTkg.js deleted file mode 100644 index c240519e..00000000 --- a/internal/ui/dist/assets/chat._threadId-CpaVOTkg.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./chat-BvDR6vN4.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat.index-BzKwvTFN.js b/internal/ui/dist/assets/chat.index-BzKwvTFN.js new file mode 100644 index 00000000..c2e1842d --- /dev/null +++ b/internal/ui/dist/assets/chat.index-BzKwvTFN.js @@ -0,0 +1 @@ +import{t as e}from"./chat-BqevyT9H.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat.index-CpaVOTkg.js b/internal/ui/dist/assets/chat.index-CpaVOTkg.js deleted file mode 100644 index c240519e..00000000 --- a/internal/ui/dist/assets/chat.index-CpaVOTkg.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./chat-BvDR6vN4.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboard-change-chips-B-4MjJKf.js b/internal/ui/dist/assets/dashboard-change-chips-DHVvGnTI.js similarity index 99% rename from internal/ui/dist/assets/dashboard-change-chips-B-4MjJKf.js rename to internal/ui/dist/assets/dashboard-change-chips-DHVvGnTI.js index 2ff4e918..c0fdc40a 100644 --- a/internal/ui/dist/assets/dashboard-change-chips-B-4MjJKf.js +++ b/internal/ui/dist/assets/dashboard-change-chips-DHVvGnTI.js @@ -1,4 +1,4 @@ -import{a as e,i as t,o as n,r,s as i}from"./useRouter-ByJ6_rwb.js";import{A as a,C as o,K as s,M as c,P as l,Q as u,T as d,X as f,_ as p,_t as m,a as h,et as g,mt as _,rt as v,ut as y,z as b}from"./brand-DUaZkIz1.js";import{E as x,S,o as C}from"./Tooltip-B3r3s_B9.js";import{It as w}from"./index-BBEH7zHj.js";var T=i(t(),1),E=i(m(),1);function D(e){if(!e||typeof e==`string`)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function O(e){return e.current?e.current.scrollHeight:`auto`}function k(e){return typeof e==`number`&&e>0}function ee({transitionDuration:e,transitionTimingFunction:t=`ease`,onTransitionEnd:n,onTransitionStart:r,expanded:i,keepMounted:a}){let o={height:0,overflow:`hidden`,...a?{}:{display:`none`}},s=(0,T.useEffectEvent)(()=>r?.()),c=(0,T.useEffectEvent)(()=>n?.()),l=(0,T.useRef)(null),[u,d]=(0,T.useState)(i?{}:o),[f,p]=(0,T.useState)(i?`entered`:`exited`),m=e=>{(0,E.flushSync)(()=>d(e))},h=e=>{m(t=>({...t,...e}))},_=n=>{let r=e??D(n);return{transition:`height ${r}ms ${t}, opacity ${r}ms ${t}`}},y=(0,T.useRef)(0);v(()=>{y.current+=1;let t=y.current,n=()=>y.current===t;e!==0&&s(),i?window.requestAnimationFrame(()=>{n()&&l.current&&((0,E.flushSync)(()=>p(`entering`)),h({willChange:`height`,display:`block`,overflow:`hidden`}),window.requestAnimationFrame(()=>{if(!n()||!l.current)return;let e=O(l);if(!k(e)){m({}),p(`entered`),c();return}h({..._(e),height:e})}))}):window.requestAnimationFrame(()=>{if(!n()||!l.current)return;(0,E.flushSync)(()=>p(`exiting`));let e=O(l);if(!k(e)){m(o),p(`exited`),c();return}h({..._(e),willChange:`height`,height:e}),window.requestAnimationFrame(()=>{n()&&l.current&&h({height:0,overflow:`hidden`})})})},[i]);let b=e=>{if(e.target===l.current&&e.propertyName===`height`){if(i){let e=O(l);e===u.height?m({}):h({height:e}),p(`entered`),c()}else u.height===0&&(m(o),p(`exited`),c())}};return{state:f,getCollapseProps:e=>({"aria-hidden":!i,inert:!i,ref:g(l,e?.ref),onTransitionEnd:b,style:{boxSizing:`border-box`,...e?.style,...u}})}}function te(e){if(!e||typeof e==`string`)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function A(e){return e.current?e.current.scrollWidth:`auto`}function j({transitionDuration:e,transitionTimingFunction:t=`ease`,onTransitionEnd:n,onTransitionStart:r,expanded:i,keepMounted:a}){let o={width:0,overflow:`hidden`,...a?{}:{display:`none`}},s=(0,T.useEffectEvent)(()=>r?.()),c=(0,T.useEffectEvent)(()=>n?.()),l=(0,T.useRef)(null),[u,d]=(0,T.useState)(i?{}:o),[f,p]=(0,T.useState)(i?`entered`:`exited`),m=e=>{(0,E.flushSync)(()=>d(e))},h=e=>{m(t=>({...t,...e}))},_=n=>{let r=e??te(n);return{transition:`width ${r}ms ${t}, opacity ${r}ms ${t}`}},y=(0,T.useRef)(0);v(()=>{y.current+=1;let t=y.current,n=()=>y.current===t;e!==0&&s(),i?window.requestAnimationFrame(()=>{n()&&l.current&&((0,E.flushSync)(()=>p(`entering`)),h({willChange:`width`,display:`block`,overflow:`hidden`}),window.requestAnimationFrame(()=>{if(!n()||!l.current)return;let e=A(l);if(!k(e)){m({}),p(`entered`),c();return}h({..._(e),width:e})}))}):window.requestAnimationFrame(()=>{if(!n()||!l.current)return;(0,E.flushSync)(()=>p(`exiting`));let e=A(l);if(!k(e)){m(o),p(`exited`),c();return}h({..._(e),willChange:`width`,width:e}),window.requestAnimationFrame(()=>{n()&&l.current&&h({width:0,overflow:`hidden`})})})},[i]);let b=e=>{if(e.target===l.current&&e.propertyName===`width`){if(i){let e=A(l);e===u.width?m({}):h({width:e}),p(`entered`),c()}else u.width===0&&(m(o),p(`exited`),c())}};return{state:f,getCollapseProps:e=>({"aria-hidden":!i,inert:!i,ref:g(l,e?.ref),onTransitionEnd:b,style:{boxSizing:`border-box`,...e?.style,...u}})}}function ne(){return`development`}var M=r(),N={transitionDuration:200,transitionTimingFunction:`ease`,animateOpacity:!0,orientation:`vertical`,keepMounted:!0,keepMountedMode:`activity`},re=d(e=>{let{children:t,expanded:n,transitionDuration:r,transitionTimingFunction:i,style:a,onTransitionEnd:s,onTransitionStart:d,animateOpacity:f,keepMounted:p,keepMountedMode:m,ref:h,orientation:g,..._}=c(`Collapse`,N,e),v=b(),y=l(),x=u(),C=y.respectReducedMotion&&x?0:r,w=(g===`horizontal`?j:ee)({expanded:n,transitionDuration:C,transitionTimingFunction:i,onTransitionEnd:s,onTransitionStart:d,keepMounted:!1});if(C===0)return p===!0&&(m===`display-none`||v!==`test`)?m===`display-none`?(0,M.jsx)(o,{..._,style:{...S(a,y),...n?{}:{display:`none`}},ref:h,children:t}):(0,M.jsx)(T.Activity,{mode:n?`visible`:`hidden`,children:(0,M.jsx)(o,{..._,style:a,ref:h,children:t})}):n?(0,M.jsx)(o,{..._,style:a,ref:h,children:t}):null;let E=w.state===`exited`,D;return D=p===!1?E?null:t:p===!0?m===`display-none`?t:(0,M.jsx)(T.Activity,{mode:E?`hidden`:`visible`,children:t}):t,(0,M.jsx)(o,{..._,...w.getCollapseProps({style:{opacity:n||!f?1:0,transition:f?`opacity ${C}ms ${i}`:`none`,...S(a,y),...p&&m===`display-none`&&E?{display:`none`}:{}},ref:h}),children:D})});re.displayName=`@mantine/core/Collapse`;var[ie,ae]=x(`Table component was not found in the tree`),oe={table:`m_b23fa0ef`,th:`m_4e7aa4f3`,tr:`m_4e7aa4fd`,td:`m_4e7aa4ef`,tbody:`m_b2404537`,thead:`m_b242d975`,caption:`m_9e5a3ac7`,scrollContainer:`m_a100c15`,scrollContainerInner:`m_62259741`};function se(e,t){if(!t)return;let n={};return t.columnBorder&&e.withColumnBorders&&(n[`data-with-column-border`]=!0),t.rowBorder&&e.withRowBorders&&(n[`data-with-row-border`]=!0),t.striped&&e.striped&&(n[`data-striped`]=e.striped),t.highlightOnHover&&e.highlightOnHover&&(n[`data-hover`]=!0),t.captionSide&&e.captionSide&&(n[`data-side`]=e.captionSide),t.stickyHeader&&e.stickyHeader&&(n[`data-sticky`]=!0),n}function ce(e,t){let n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,r=d(r=>{let i=c(n,{},r),{classNames:a,className:s,style:l,styles:u,...d}=i,f=ae();return(0,M.jsx)(o,{component:e,...se(f,t),...f.getStyles(e,{className:s,classNames:a,style:l,styles:u,props:i}),...d})});return r.displayName=`@mantine/core/${n}`,r.classes=oe,r}var le=ce(`th`,{columnBorder:!0}),ue=ce(`td`,{columnBorder:!0}),de=ce(`tr`,{rowBorder:!0,striped:!0,highlightOnHover:!0}),fe=ce(`thead`,{stickyHeader:!0}),pe=ce(`tbody`),me=ce(`tfoot`),he=ce(`caption`,{captionSide:!0}),ge={type:`scrollarea`},_e=f((e,{minWidth:t,maxHeight:n,type:r})=>({scrollContainer:{"--table-min-width":_(t),"--table-max-height":_(n),"--table-overflow":r===`native`?`auto`:void 0}})),ve=d(e=>{let t=c(`TableScrollContainer`,ge,e),{classNames:n,className:r,style:i,styles:s,unstyled:l,vars:u,children:d,minWidth:f,maxHeight:p,type:m,scrollAreaProps:h,attributes:g,..._}=t,v=a({name:`TableScrollContainer`,classes:oe,props:t,className:r,style:i,classNames:n,styles:s,unstyled:l,attributes:g,vars:u,varsResolver:_e,rootSelector:`scrollContainer`});return(0,M.jsx)(o,{component:m===`scrollarea`?C:`div`,...m===`scrollarea`?p?{offsetScrollbars:`xy`,...h}:{offsetScrollbars:`x`,...h}:{},...v(`scrollContainer`),..._,children:(0,M.jsx)(`div`,{...v(`scrollContainerInner`),children:d})})});ve.classes=oe,ve.varsResolver=_e,ve.displayName=`@mantine/core/TableScrollContainer`;function ye({data:e}){return(0,M.jsxs)(M.Fragment,{children:[e.caption&&(0,M.jsx)(he,{children:e.caption}),e.head&&(0,M.jsx)(fe,{children:(0,M.jsx)(de,{children:e.head.map((e,t)=>(0,M.jsx)(le,{children:e},t))})}),e.body&&(0,M.jsx)(pe,{children:e.body.map((e,t)=>(0,M.jsx)(de,{children:e.map((e,t)=>(0,M.jsx)(ue,{children:e},t))},t))}),e.foot&&(0,M.jsx)(me,{children:(0,M.jsx)(de,{children:e.foot.map((e,t)=>(0,M.jsx)(le,{children:e},t))})})]})}ye.displayName=`@mantine/core/TableDataRenderer`;var be={withRowBorders:!0,verticalSpacing:7},xe=f((e,{layout:t,captionSide:n,horizontalSpacing:r,verticalSpacing:i,borderColor:a,stripedColor:o,highlightOnHoverColor:c,striped:l,highlightOnHover:u,stickyHeaderOffset:d,stickyHeader:f})=>({table:{"--table-layout":t,"--table-caption-side":n,"--table-horizontal-spacing":y(r),"--table-vertical-spacing":y(i),"--table-border-color":a?s(a,e):void 0,"--table-striped-color":l&&o?s(o,e):void 0,"--table-highlight-on-hover-color":u&&c?s(c,e):void 0,"--table-sticky-header-offset":f?_(d):void 0}})),P=d(e=>{let t=c(`Table`,be,e),{classNames:n,className:r,style:i,styles:s,unstyled:l,vars:u,horizontalSpacing:d,verticalSpacing:f,captionSide:p,stripedColor:m,highlightOnHoverColor:h,striped:g,highlightOnHover:_,withColumnBorders:v,withRowBorders:y,withTableBorder:b,borderColor:x,layout:S,data:C,children:w,stickyHeader:E,stickyHeaderOffset:D,mod:O,tabularNums:k,attributes:ee,...te}=t,A=a({name:`Table`,props:t,className:r,style:i,classes:oe,classNames:n,styles:s,unstyled:l,attributes:ee,rootSelector:`table`,vars:u,varsResolver:xe,stable:!0}),j=g===!0?`odd`:g||void 0,ne=p||`bottom`,N=(0,T.useMemo)(()=>({getStyles:A,stickyHeader:E,striped:j,highlightOnHover:_,withColumnBorders:v,withRowBorders:y,captionSide:ne}),[A,E,j,_,v,y,ne]);return(0,M.jsx)(ie,{value:N,children:(0,M.jsx)(o,{component:`table`,mod:[{withTableBorder:b,tabularNums:k},O],...A(`table`),...te,children:w||!!C&&(0,M.jsx)(ye,{data:C})})})});P.classes=oe,P.varsResolver=xe,P.displayName=`@mantine/core/Table`,P.Td=ue,P.Th=le,P.Tr=de,P.Thead=fe,P.Tbody=pe,P.Tfoot=me,P.Caption=he,P.ScrollContainer=ve,P.DataRenderer=ye;var Se=new Map([[`bold`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z`}))],[`duotone`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),T.createElement(`path`,{d:`M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z`}))],[`fill`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z`}))],[`light`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z`}))]]),Ce=T.forwardRef((e,t)=>T.createElement(h,{ref:t,...e,weights:Se}));Ce.displayName=`CaretDownIcon`;var we=Ce,Te=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function Ee(e){return Number.isFinite(e)?e>0&&e<1e-4?`<0.01%`:`${(e*100).toFixed(e>=.1?1:2)}%`:`—`}function De(e){if(!Number.isFinite(e))return`—`;if(e<0)return`-${De(-e)}`;if(e===0)return`0ms`;if(e<.01)return`<0.01ms`;if(e<1)return`${e.toFixed(2)}ms`;if(Math.round(e*10)/10<100)return`${e.toFixed(1)}ms`;if(Math.round(e)<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/100)/10;if(t<10)return`${(e/1e3).toFixed(2)}s`;if(t<60)return`${t.toFixed(1)}s`;let n=Math.round(e/1e3),r=Math.floor(n/60),i=n%60;if(r<60)return i===0?`${r}m`:`${r}m ${i}s`;let a=Math.floor(r/60),o=r%60;return o===0?`${a}h`:`${a}h ${o}m`}function Oe(e){let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.valueOf())?String(e):t.toLocaleString([],{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`,timeZoneName:`short`})}function ke(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Ae=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,je=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Me={};function Ne(e,t){return((t||Me).jsx?je:Ae).test(e)}var Pe=/[ \t\n\f\r]/g;function Fe(e){return typeof e==`object`?e.type===`text`&&Ie(e.value):Ie(e)}function Ie(e){return e.replace(Pe,``)===``}var Le=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Le.prototype.normal={},Le.prototype.property={},Le.prototype.space=void 0;function Re(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Le(n,r,t)}function ze(e){return e.toLowerCase()}var F=class{constructor(e,t){this.attribute=t,this.property=e}};F.prototype.attribute=``,F.prototype.booleanish=!1,F.prototype.boolean=!1,F.prototype.commaOrSpaceSeparated=!1,F.prototype.commaSeparated=!1,F.prototype.defined=!1,F.prototype.mustUseProperty=!1,F.prototype.number=!1,F.prototype.overloadedBoolean=!1,F.prototype.property=``,F.prototype.spaceSeparated=!1,F.prototype.space=void 0;var Be=n({boolean:()=>I,booleanish:()=>L,commaOrSpaceSeparated:()=>B,commaSeparated:()=>Ue,number:()=>R,overloadedBoolean:()=>He,spaceSeparated:()=>z}),Ve=0,I=We(),L=We(),He=We(),R=We(),z=We(),Ue=We(),B=We();function We(){return 2**++Ve}var Ge=Object.keys(Be),Ke=class extends F{constructor(e,t,n,r){let i=-1;if(super(e,t),qe(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&ot.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(at,lt);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!at.test(e)){let n=e.replace(it,ct);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ke}return new i(r,t)}function ct(e){return`-`+e.toLowerCase()}function lt(e){return e.charAt(1).toUpperCase()}var ut=Re([Ye,Qe,et,tt,nt],`html`),dt=Re([Ye,$e,et,tt,nt],`svg`);function ft(e){return e.join(` `).trim()}var pt=e(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` +import{a as e,i as t,o as n,r,s as i}from"./useRouter-ByJ6_rwb.js";import{A as a,C as o,K as s,M as c,P as l,Q as u,T as d,X as f,_ as p,_t as m,a as h,et as g,mt as _,rt as v,ut as y,z as b}from"./brand-DUaZkIz1.js";import{E as x,S,o as C}from"./Tooltip-B3r3s_B9.js";import{It as w}from"./index-CEp3GmPL.js";var T=i(t(),1),E=i(m(),1);function D(e){if(!e||typeof e==`string`)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function O(e){return e.current?e.current.scrollHeight:`auto`}function k(e){return typeof e==`number`&&e>0}function ee({transitionDuration:e,transitionTimingFunction:t=`ease`,onTransitionEnd:n,onTransitionStart:r,expanded:i,keepMounted:a}){let o={height:0,overflow:`hidden`,...a?{}:{display:`none`}},s=(0,T.useEffectEvent)(()=>r?.()),c=(0,T.useEffectEvent)(()=>n?.()),l=(0,T.useRef)(null),[u,d]=(0,T.useState)(i?{}:o),[f,p]=(0,T.useState)(i?`entered`:`exited`),m=e=>{(0,E.flushSync)(()=>d(e))},h=e=>{m(t=>({...t,...e}))},_=n=>{let r=e??D(n);return{transition:`height ${r}ms ${t}, opacity ${r}ms ${t}`}},y=(0,T.useRef)(0);v(()=>{y.current+=1;let t=y.current,n=()=>y.current===t;e!==0&&s(),i?window.requestAnimationFrame(()=>{n()&&l.current&&((0,E.flushSync)(()=>p(`entering`)),h({willChange:`height`,display:`block`,overflow:`hidden`}),window.requestAnimationFrame(()=>{if(!n()||!l.current)return;let e=O(l);if(!k(e)){m({}),p(`entered`),c();return}h({..._(e),height:e})}))}):window.requestAnimationFrame(()=>{if(!n()||!l.current)return;(0,E.flushSync)(()=>p(`exiting`));let e=O(l);if(!k(e)){m(o),p(`exited`),c();return}h({..._(e),willChange:`height`,height:e}),window.requestAnimationFrame(()=>{n()&&l.current&&h({height:0,overflow:`hidden`})})})},[i]);let b=e=>{if(e.target===l.current&&e.propertyName===`height`){if(i){let e=O(l);e===u.height?m({}):h({height:e}),p(`entered`),c()}else u.height===0&&(m(o),p(`exited`),c())}};return{state:f,getCollapseProps:e=>({"aria-hidden":!i,inert:!i,ref:g(l,e?.ref),onTransitionEnd:b,style:{boxSizing:`border-box`,...e?.style,...u}})}}function te(e){if(!e||typeof e==`string`)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function A(e){return e.current?e.current.scrollWidth:`auto`}function j({transitionDuration:e,transitionTimingFunction:t=`ease`,onTransitionEnd:n,onTransitionStart:r,expanded:i,keepMounted:a}){let o={width:0,overflow:`hidden`,...a?{}:{display:`none`}},s=(0,T.useEffectEvent)(()=>r?.()),c=(0,T.useEffectEvent)(()=>n?.()),l=(0,T.useRef)(null),[u,d]=(0,T.useState)(i?{}:o),[f,p]=(0,T.useState)(i?`entered`:`exited`),m=e=>{(0,E.flushSync)(()=>d(e))},h=e=>{m(t=>({...t,...e}))},_=n=>{let r=e??te(n);return{transition:`width ${r}ms ${t}, opacity ${r}ms ${t}`}},y=(0,T.useRef)(0);v(()=>{y.current+=1;let t=y.current,n=()=>y.current===t;e!==0&&s(),i?window.requestAnimationFrame(()=>{n()&&l.current&&((0,E.flushSync)(()=>p(`entering`)),h({willChange:`width`,display:`block`,overflow:`hidden`}),window.requestAnimationFrame(()=>{if(!n()||!l.current)return;let e=A(l);if(!k(e)){m({}),p(`entered`),c();return}h({..._(e),width:e})}))}):window.requestAnimationFrame(()=>{if(!n()||!l.current)return;(0,E.flushSync)(()=>p(`exiting`));let e=A(l);if(!k(e)){m(o),p(`exited`),c();return}h({..._(e),willChange:`width`,width:e}),window.requestAnimationFrame(()=>{n()&&l.current&&h({width:0,overflow:`hidden`})})})},[i]);let b=e=>{if(e.target===l.current&&e.propertyName===`width`){if(i){let e=A(l);e===u.width?m({}):h({width:e}),p(`entered`),c()}else u.width===0&&(m(o),p(`exited`),c())}};return{state:f,getCollapseProps:e=>({"aria-hidden":!i,inert:!i,ref:g(l,e?.ref),onTransitionEnd:b,style:{boxSizing:`border-box`,...e?.style,...u}})}}function ne(){return`development`}var M=r(),N={transitionDuration:200,transitionTimingFunction:`ease`,animateOpacity:!0,orientation:`vertical`,keepMounted:!0,keepMountedMode:`activity`},re=d(e=>{let{children:t,expanded:n,transitionDuration:r,transitionTimingFunction:i,style:a,onTransitionEnd:s,onTransitionStart:d,animateOpacity:f,keepMounted:p,keepMountedMode:m,ref:h,orientation:g,..._}=c(`Collapse`,N,e),v=b(),y=l(),x=u(),C=y.respectReducedMotion&&x?0:r,w=(g===`horizontal`?j:ee)({expanded:n,transitionDuration:C,transitionTimingFunction:i,onTransitionEnd:s,onTransitionStart:d,keepMounted:!1});if(C===0)return p===!0&&(m===`display-none`||v!==`test`)?m===`display-none`?(0,M.jsx)(o,{..._,style:{...S(a,y),...n?{}:{display:`none`}},ref:h,children:t}):(0,M.jsx)(T.Activity,{mode:n?`visible`:`hidden`,children:(0,M.jsx)(o,{..._,style:a,ref:h,children:t})}):n?(0,M.jsx)(o,{..._,style:a,ref:h,children:t}):null;let E=w.state===`exited`,D;return D=p===!1?E?null:t:p===!0?m===`display-none`?t:(0,M.jsx)(T.Activity,{mode:E?`hidden`:`visible`,children:t}):t,(0,M.jsx)(o,{..._,...w.getCollapseProps({style:{opacity:n||!f?1:0,transition:f?`opacity ${C}ms ${i}`:`none`,...S(a,y),...p&&m===`display-none`&&E?{display:`none`}:{}},ref:h}),children:D})});re.displayName=`@mantine/core/Collapse`;var[ie,ae]=x(`Table component was not found in the tree`),oe={table:`m_b23fa0ef`,th:`m_4e7aa4f3`,tr:`m_4e7aa4fd`,td:`m_4e7aa4ef`,tbody:`m_b2404537`,thead:`m_b242d975`,caption:`m_9e5a3ac7`,scrollContainer:`m_a100c15`,scrollContainerInner:`m_62259741`};function se(e,t){if(!t)return;let n={};return t.columnBorder&&e.withColumnBorders&&(n[`data-with-column-border`]=!0),t.rowBorder&&e.withRowBorders&&(n[`data-with-row-border`]=!0),t.striped&&e.striped&&(n[`data-striped`]=e.striped),t.highlightOnHover&&e.highlightOnHover&&(n[`data-hover`]=!0),t.captionSide&&e.captionSide&&(n[`data-side`]=e.captionSide),t.stickyHeader&&e.stickyHeader&&(n[`data-sticky`]=!0),n}function ce(e,t){let n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,r=d(r=>{let i=c(n,{},r),{classNames:a,className:s,style:l,styles:u,...d}=i,f=ae();return(0,M.jsx)(o,{component:e,...se(f,t),...f.getStyles(e,{className:s,classNames:a,style:l,styles:u,props:i}),...d})});return r.displayName=`@mantine/core/${n}`,r.classes=oe,r}var le=ce(`th`,{columnBorder:!0}),ue=ce(`td`,{columnBorder:!0}),de=ce(`tr`,{rowBorder:!0,striped:!0,highlightOnHover:!0}),fe=ce(`thead`,{stickyHeader:!0}),pe=ce(`tbody`),me=ce(`tfoot`),he=ce(`caption`,{captionSide:!0}),ge={type:`scrollarea`},_e=f((e,{minWidth:t,maxHeight:n,type:r})=>({scrollContainer:{"--table-min-width":_(t),"--table-max-height":_(n),"--table-overflow":r===`native`?`auto`:void 0}})),ve=d(e=>{let t=c(`TableScrollContainer`,ge,e),{classNames:n,className:r,style:i,styles:s,unstyled:l,vars:u,children:d,minWidth:f,maxHeight:p,type:m,scrollAreaProps:h,attributes:g,..._}=t,v=a({name:`TableScrollContainer`,classes:oe,props:t,className:r,style:i,classNames:n,styles:s,unstyled:l,attributes:g,vars:u,varsResolver:_e,rootSelector:`scrollContainer`});return(0,M.jsx)(o,{component:m===`scrollarea`?C:`div`,...m===`scrollarea`?p?{offsetScrollbars:`xy`,...h}:{offsetScrollbars:`x`,...h}:{},...v(`scrollContainer`),..._,children:(0,M.jsx)(`div`,{...v(`scrollContainerInner`),children:d})})});ve.classes=oe,ve.varsResolver=_e,ve.displayName=`@mantine/core/TableScrollContainer`;function ye({data:e}){return(0,M.jsxs)(M.Fragment,{children:[e.caption&&(0,M.jsx)(he,{children:e.caption}),e.head&&(0,M.jsx)(fe,{children:(0,M.jsx)(de,{children:e.head.map((e,t)=>(0,M.jsx)(le,{children:e},t))})}),e.body&&(0,M.jsx)(pe,{children:e.body.map((e,t)=>(0,M.jsx)(de,{children:e.map((e,t)=>(0,M.jsx)(ue,{children:e},t))},t))}),e.foot&&(0,M.jsx)(me,{children:(0,M.jsx)(de,{children:e.foot.map((e,t)=>(0,M.jsx)(le,{children:e},t))})})]})}ye.displayName=`@mantine/core/TableDataRenderer`;var be={withRowBorders:!0,verticalSpacing:7},xe=f((e,{layout:t,captionSide:n,horizontalSpacing:r,verticalSpacing:i,borderColor:a,stripedColor:o,highlightOnHoverColor:c,striped:l,highlightOnHover:u,stickyHeaderOffset:d,stickyHeader:f})=>({table:{"--table-layout":t,"--table-caption-side":n,"--table-horizontal-spacing":y(r),"--table-vertical-spacing":y(i),"--table-border-color":a?s(a,e):void 0,"--table-striped-color":l&&o?s(o,e):void 0,"--table-highlight-on-hover-color":u&&c?s(c,e):void 0,"--table-sticky-header-offset":f?_(d):void 0}})),P=d(e=>{let t=c(`Table`,be,e),{classNames:n,className:r,style:i,styles:s,unstyled:l,vars:u,horizontalSpacing:d,verticalSpacing:f,captionSide:p,stripedColor:m,highlightOnHoverColor:h,striped:g,highlightOnHover:_,withColumnBorders:v,withRowBorders:y,withTableBorder:b,borderColor:x,layout:S,data:C,children:w,stickyHeader:E,stickyHeaderOffset:D,mod:O,tabularNums:k,attributes:ee,...te}=t,A=a({name:`Table`,props:t,className:r,style:i,classes:oe,classNames:n,styles:s,unstyled:l,attributes:ee,rootSelector:`table`,vars:u,varsResolver:xe,stable:!0}),j=g===!0?`odd`:g||void 0,ne=p||`bottom`,N=(0,T.useMemo)(()=>({getStyles:A,stickyHeader:E,striped:j,highlightOnHover:_,withColumnBorders:v,withRowBorders:y,captionSide:ne}),[A,E,j,_,v,y,ne]);return(0,M.jsx)(ie,{value:N,children:(0,M.jsx)(o,{component:`table`,mod:[{withTableBorder:b,tabularNums:k},O],...A(`table`),...te,children:w||!!C&&(0,M.jsx)(ye,{data:C})})})});P.classes=oe,P.varsResolver=xe,P.displayName=`@mantine/core/Table`,P.Td=ue,P.Th=le,P.Tr=de,P.Thead=fe,P.Tbody=pe,P.Tfoot=me,P.Caption=he,P.ScrollContainer=ve,P.DataRenderer=ye;var Se=new Map([[`bold`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z`}))],[`duotone`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),T.createElement(`path`,{d:`M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z`}))],[`fill`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z`}))],[`light`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z`}))]]),Ce=T.forwardRef((e,t)=>T.createElement(h,{ref:t,...e,weights:Se}));Ce.displayName=`CaretDownIcon`;var we=Ce,Te=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function Ee(e){return Number.isFinite(e)?e>0&&e<1e-4?`<0.01%`:`${(e*100).toFixed(e>=.1?1:2)}%`:`—`}function De(e){if(!Number.isFinite(e))return`—`;if(e<0)return`-${De(-e)}`;if(e===0)return`0ms`;if(e<.01)return`<0.01ms`;if(e<1)return`${e.toFixed(2)}ms`;if(Math.round(e*10)/10<100)return`${e.toFixed(1)}ms`;if(Math.round(e)<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/100)/10;if(t<10)return`${(e/1e3).toFixed(2)}s`;if(t<60)return`${t.toFixed(1)}s`;let n=Math.round(e/1e3),r=Math.floor(n/60),i=n%60;if(r<60)return i===0?`${r}m`:`${r}m ${i}s`;let a=Math.floor(r/60),o=r%60;return o===0?`${a}h`:`${a}h ${o}m`}function Oe(e){let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.valueOf())?String(e):t.toLocaleString([],{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`,timeZoneName:`short`})}function ke(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Ae=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,je=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Me={};function Ne(e,t){return((t||Me).jsx?je:Ae).test(e)}var Pe=/[ \t\n\f\r]/g;function Fe(e){return typeof e==`object`?e.type===`text`&&Ie(e.value):Ie(e)}function Ie(e){return e.replace(Pe,``)===``}var Le=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Le.prototype.normal={},Le.prototype.property={},Le.prototype.space=void 0;function Re(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Le(n,r,t)}function ze(e){return e.toLowerCase()}var F=class{constructor(e,t){this.attribute=t,this.property=e}};F.prototype.attribute=``,F.prototype.booleanish=!1,F.prototype.boolean=!1,F.prototype.commaOrSpaceSeparated=!1,F.prototype.commaSeparated=!1,F.prototype.defined=!1,F.prototype.mustUseProperty=!1,F.prototype.number=!1,F.prototype.overloadedBoolean=!1,F.prototype.property=``,F.prototype.spaceSeparated=!1,F.prototype.space=void 0;var Be=n({boolean:()=>I,booleanish:()=>L,commaOrSpaceSeparated:()=>B,commaSeparated:()=>Ue,number:()=>R,overloadedBoolean:()=>He,spaceSeparated:()=>z}),Ve=0,I=We(),L=We(),He=We(),R=We(),z=We(),Ue=We(),B=We();function We(){return 2**++Ve}var Ge=Object.keys(Be),Ke=class extends F{constructor(e,t,n,r){let i=-1;if(super(e,t),qe(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&ot.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(at,lt);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!at.test(e)){let n=e.replace(it,ct);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ke}return new i(r,t)}function ct(e){return`-`+e.toLowerCase()}function lt(e){return e.charAt(1).toUpperCase()}var ut=Re([Ye,Qe,et,tt,nt],`html`),dt=Re([Ye,$e,et,tt,nt],`svg`);function ft(e){return e.join(` `).trim()}var pt=e(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),mt=e((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(pt());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),ht=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),gt=e(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(mt()),r=ht();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),_t=yt(`end`),vt=yt(`start`);function yt(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function bt(e){let t=vt(e),n=_t(e);if(t&&n)return{start:t,end:n}}function xt(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ct(e.position):`start`in e||`end`in e?Ct(e):`line`in e||`column`in e?St(e):``}function St(e){return wt(e&&e.line)+`:`+wt(e&&e.column)}function Ct(e){return St(e&&e.start)+`-`+St(e&&e.end)}function wt(e){return e&&typeof e==`number`?e:1}var V=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=xt(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};V.prototype.file=``,V.prototype.name=``,V.prototype.reason=``,V.prototype.message=``,V.prototype.stack=``,V.prototype.column=void 0,V.prototype.line=void 0,V.prototype.ancestors=void 0,V.prototype.cause=void 0,V.prototype.fatal=void 0,V.prototype.place=void 0,V.prototype.ruleId=void 0,V.prototype.source=void 0;var Tt=i(gt(),1),Et={}.hasOwnProperty,Dt=new Map,Ot=/[A-Z]/g,kt=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),At=new Set([`td`,`th`]),jt=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Mt(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Ut(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Ht(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?dt:ut,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Nt(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Nt(e,t,n){if(t.type===`element`)return Pt(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Ft(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Lt(e,t,n);if(t.type===`mdxjsEsm`)return It(e,t);if(t.type===`root`)return Rt(e,t,n);if(t.type===`text`)return zt(e,t)}function Pt(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=dt,e.schema=i),e.ancestors.push(t);let a=Yt(e,t.tagName,!1),o=Wt(e,t),s=Kt(e,t);return kt.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Fe(e)})),Bt(e,o,a,t),Vt(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ft(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Xt(e,t.position)}function It(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Xt(e,t.position)}function Lt(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=dt,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Yt(e,t.name,!0),o=Gt(e,t),s=Kt(e,t);return Bt(e,o,a,t),Vt(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Rt(e,t,n){let r={};return Vt(r,Kt(e,t)),e.create(t,e.Fragment,r,n)}function zt(e,t){return t.value}function Bt(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Vt(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Ht(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Ut(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=vt(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Wt(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Et.call(t.properties,i)){let a=qt(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&At.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Gt(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Xt(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Xt(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Kt(e,t){let n=[],r=-1,i=e.passKeys?new Map:Dt;for(;++ri?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(H(e,e.length,0,t),e):t}var ln={}.hasOwnProperty;function un(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function W(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var G=xn(/[A-Za-z]/),K=xn(/[\dA-Za-z]/),mn=xn(/[#-'*+\--9=?A-Z^-~]/);function hn(e){return e!==null&&(e<32||e===127)}var gn=xn(/\d/),_n=xn(/[\dA-Fa-f]/),vn=xn(/[!-/:-@[-`{-~]/);function q(e){return e!==null&&e<-2}function J(e){return e!==null&&(e<0||e===32)}function Y(e){return e===-2||e===-1||e===32}var yn=xn(/\p{P}|\p{S}/u),bn=xn(/\s/);function xn(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Sn(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function X(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Y(r)?(e.enter(n),s(r)):t(r)}function s(r){return Y(r)&&a++0&&Y(t)?(e.enter(r),c(t)):l(t)}function c(t){return Y(t)&&o=i?t(e):n(e)}}var wn={tokenize:Tn};function Tn(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return q(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var En=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){Dn(this,e,t,n,!1)}addBefore(e,t,n){Dn(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function Dn(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var On={tokenize:An},kn={tokenize:jn};function An(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(ro))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;er;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function jn(e,t,n){return X(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Mn(e){if(e===null||J(e)||bn(e))return 1;if(yn(e))return 2}function Nn(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};Ln(o,-a),Ln(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=U(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=U(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=U(r,Nn(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=U(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=U(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),H(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n0&&Y(t)?X(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||q(t)?e.check(Xn,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||q(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Y(t)?X(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var er={name:`codeIndented`,tokenize:nr},tr={partial:!0,tokenize:rr};function nr(e,t,n){return r;function r(t){return e.enter(`codeIndented`),Cn(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):q(t)?e.attempt(tr,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||q(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function rr(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):q(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):Cn(e,t,a,`linePrefix`,4,4)(o)}function a(e){return q(e)?i(e):n(e)}}var ir={name:`codeText`,previous:or,resolve:ar,tokenize:sr};function ar(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&lr(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),lr(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),lr(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function _r(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||hn(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||q(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||J(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):q(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Y(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function yr(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||q(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function br(e,t){let n;return r;function r(i){return q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Y(i)?X(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var xr={name:`definition`,tokenize:Cr},Sr={partial:!0,tokenize:wr};function Cr(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return vr.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=W(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return J(t)?br(e,l)(t):l(t)}function l(t){return _r(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Sr,d,d)(t)}function d(t){return Y(t)?X(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function wr(e,t,n){return r;function r(t){return J(t)?br(e,i)(t):n(t)}function i(t){return yr(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Y(t)?X(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||q(e)?t(e):n(e)}}var Tr={name:`hardBreakEscape`,tokenize:Er};function Er(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Dr={name:`headingAtx`,resolve:Or,tokenize:kr};function Or(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};H(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function kr(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||J(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||q(n)?(e.exit(`atxHeading`),t(n)):Y(n)?X(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||J(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Ar=`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`.split(`.`),jr=[`pre`,`script`,`style`,`textarea`],Mr={concrete:!0,name:`htmlFlow`,resolveTo:Pr,tokenize:Fr},Nr={partial:!0,tokenize:Ir};function Pr(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Fr(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:N):G(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):G(a)?(e.consume(a),i=4,r.interrupt?t:N):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:N):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return G(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||J(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&jr.includes(l)?(i=1,r.interrupt?t(s):O(s)):Ar.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||K(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Y(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||G(t)?(e.consume(t),b):Y(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Y(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Y(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||q(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||J(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Y(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||q(t)?O(t):Y(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),A):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),N):t===93&&i===5?(e.consume(t),M):q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Nr,ie,k)(t)):t===null||q(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Xn,ee,ie)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||q(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function A(t){return t===45?(e.consume(t),N):O(t)}function j(t){return t===47?(e.consume(t),o=``,ne):O(t)}function ne(t){if(t===62){let n=o.toLowerCase();return jr.includes(n)?(e.consume(t),re):O(t)}return G(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ne):O(t)}function M(t){return t===93?(e.consume(t),N):O(t)}function N(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),N):O(t)}function re(t){return t===null||q(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function Ir(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Bn,t,n)}}var Lr={name:`htmlText`,tokenize:Rr};function Rr(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):G(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):G(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):q(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?A(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):q(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?A(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?A(t):q(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):q(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?A(e):y(e)}function x(t){return G(t)?(e.consume(t),S):n(t)}function S(t){return t===45||K(t)?(e.consume(t),S):C(t)}function C(t){return q(t)?(o=C,j(t)):Y(t)?(e.consume(t),C):A(t)}function w(t){return t===45||K(t)?(e.consume(t),w):t===47||t===62||J(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),A):t===58||t===95||G(t)?(e.consume(t),E):q(t)?(o=T,j(t)):Y(t)?(e.consume(t),T):A(t)}function E(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):q(t)?(o=D,j(t)):Y(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):q(t)?(o=O,j(t)):Y(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):q(t)?(o=k,j(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||J(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||J(e)?T(e):n(e)}function A(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return Y(t)?X(e,M,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):M(t)}function M(t){return e.enter(`htmlTextData`),o(t)}}var zr={name:`labelEnd`,resolveAll:Ur,resolveTo:Wr,tokenize:Gr},Br={tokenize:Kr},Vr={tokenize:qr},Hr={tokenize:Jr};function Ur(e){let t=-1,n=[];for(;++t0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(W(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Br,u,o?u:d)(t):t===91?e.attempt(Vr,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Hr,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function Kr(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return J(t)?br(e,a)(t):a(t)}function a(t){return t===41?u(t):_r(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return J(t)?br(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?yr(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return J(t)?br(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function qr(e,t,n){let r=this;return i;function i(t){return vr.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(W(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Jr(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Yr={name:`labelStartImage`,resolveAll:zr.resolveAll,tokenize:Xr};function Xr(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var Zr={name:`labelStartLink`,resolveAll:zr.resolveAll,tokenize:Qr};function Qr(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var $r={name:`lineEnding`,tokenize:ei};function ei(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}}var ti={name:`thematicBreak`,tokenize:ni};function ni(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Y(t)?X(e,s,`whitespace`)(t):s(t))}}var Z={continuation:{tokenize:oi},exit:ci,name:`list`,tokenize:ai},ri={partial:!0,tokenize:li},ii={partial:!0,tokenize:si};function ai(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:gn(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(ti,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return gn(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Bn,r.interrupt?n:u,e.attempt(ri,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Y(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function oi(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Bn,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,X(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Y(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ii,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,X(e,e.attempt(Z,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function si(e,t,n){let r=this;return X(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function ci(e){e.exit(this.containerState.type)}function li(e,t,n){let r=this;return X(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Y(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var ui={name:`setextUnderline`,resolveTo:di,tokenize:fi};function di(e,t){let n=new En,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function fi(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Y(t)?X(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var pi={tokenize:mi};function mi(e){let t=this,n=e.attempt(Bn,r,e.attempt(this.parser.constructs.flowInitial,i,X(e,e.attempt(this.parser.constructs.flow,i,e.attempt(fr,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var hi={resolveAll:yi()},gi=vi(`string`),_i=vi(`text`);function vi(e){return{resolveAll:yi(e===`text`?bi:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++iki,contentInitial:()=>Ci,disable:()=>Ai,document:()=>Si,flow:()=>Ti,flowInitial:()=>wi,insideSpan:()=>Oi,string:()=>Ei,text:()=>Di}),Si={42:Z,43:Z,45:Z,48:Z,49:Z,50:Z,51:Z,52:Z,53:Z,54:Z,55:Z,56:Z,57:Z,62:Hn},Ci={91:xr},wi={[-2]:er,[-1]:er,32:er},Ti={35:Dr,42:ti,45:[ui,ti],60:Mr,61:ui,95:ti,96:Qn,126:Qn},Ei={38:Jn,92:Kn},Di={[-5]:$r,[-4]:$r,[-3]:$r,33:Yr,38:Jn,42:Pn,60:[Rn,Lr],91:Zr,92:[Tr,Kn],93:zr,95:Pn,96:ir},Oi={null:[Pn,hi]},ki={null:[42,95]},Ai={null:[]};function ji(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=U(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Nn(a,l.events,l),l.events):[]}function f(e,t){return Ni(p(e),t)}function p(e){return Mi(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Ni(e,t){let n=-1,r=[],i;for(;++n0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||qi).call(a,void 0,e[0])}for(r.position={start:Wi(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Wi(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++dvoid c({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:a(n),replace:r,resetScroll:t!==e});return(0,o.jsx)(n,{dashboardId:e,search:s,onSearch:(t,n)=>l(e,t,n),onOpen:(e,t)=>l(e,{},t)})}export{s as component}; \ No newline at end of file +import{r as e}from"./useRouter-ByJ6_rwb.js";import{n as t}from"./useNavigate-B1zgPEUp.js";import{t as n}from"./page-CFdV4uPH.js";import{f as r,g as i,y as a}from"./index-CEp3GmPL.js";var o=e();function s(){let{dashboardId:e}=r.useParams(),s=i(r.useSearch()),c=t(),l=(t,n,r)=>void c({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:a(n),replace:r,resetScroll:t!==e});return(0,o.jsx)(n,{dashboardId:e,search:s,onSearch:(t,n)=>l(e,t,n),onOpen:(e,t)=>l(e,{},t)})}export{s as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboards.index-B3tO4nLJ.js b/internal/ui/dist/assets/dashboards.index-D0Pptviw.js similarity index 68% rename from internal/ui/dist/assets/dashboards.index-B3tO4nLJ.js rename to internal/ui/dist/assets/dashboards.index-D0Pptviw.js index 327144be..2a958c0f 100644 --- a/internal/ui/dist/assets/dashboards.index-B3tO4nLJ.js +++ b/internal/ui/dist/assets/dashboards.index-D0Pptviw.js @@ -1 +1 @@ -import{r as e}from"./useRouter-ByJ6_rwb.js";import{n as t}from"./useNavigate-B1zgPEUp.js";import{t as n}from"./page-BsR2kcwd.js";import{g as r,p as i,y as a}from"./index-BBEH7zHj.js";var o=e();function s(){let e=r(i.useSearch()),s=t();return(0,o.jsx)(n,{search:e,onSearch:()=>void 0,onOpen:(t,n)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:a(e),replace:n})})}export{s as component}; \ No newline at end of file +import{r as e}from"./useRouter-ByJ6_rwb.js";import{n as t}from"./useNavigate-B1zgPEUp.js";import{t as n}from"./page-CFdV4uPH.js";import{g as r,p as i,y as a}from"./index-CEp3GmPL.js";var o=e();function s(){let e=r(i.useSearch()),s=t();return(0,o.jsx)(n,{search:e,onSearch:()=>void 0,onOpen:(t,n)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:a(e),replace:n})})}export{s as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/index-BBEH7zHj.js b/internal/ui/dist/assets/index-CEp3GmPL.js similarity index 96% rename from internal/ui/dist/assets/index-BBEH7zHj.js rename to internal/ui/dist/assets/index-CEp3GmPL.js index 92a6e4a9..22a4b98a 100644 --- a/internal/ui/dist/assets/index-BBEH7zHj.js +++ b/internal/ui/dist/assets/index-CEp3GmPL.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-D2AdaqvY.js","assets/useRouter-ByJ6_rwb.js","assets/useNavigate-B1zgPEUp.js","assets/settings-sUA_tcIn.js","assets/brand-DUaZkIz1.js","assets/Tooltip-B3r3s_B9.js","assets/WarningCircle.es-BgWO6KzZ.js","assets/chat.index-CpaVOTkg.js","assets/chat-BvDR6vN4.js","assets/preload-helper-EHBQhIeL.js","assets/dashboard-change-chips-B-4MjJKf.js","assets/chat._threadId-CpaVOTkg.js","assets/dashboards.index-B3tO4nLJ.js","assets/page-BsR2kcwd.js","assets/dashboards._dashboardId-BKxXsvyw.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-D2AdaqvY.js","assets/useRouter-ByJ6_rwb.js","assets/useNavigate-B1zgPEUp.js","assets/settings-NQwuPzSG.js","assets/brand-DUaZkIz1.js","assets/Tooltip-B3r3s_B9.js","assets/WarningCircle.es-DWFLwubM.js","assets/chat.index-BzKwvTFN.js","assets/chat-BqevyT9H.js","assets/preload-helper-EHBQhIeL.js","assets/dashboard-change-chips-DHVvGnTI.js","assets/chat._threadId-BzKwvTFN.js","assets/dashboards.index-D0Pptviw.js","assets/page-CFdV4uPH.js","assets/dashboards._dashboardId-AkIsvXSZ.js"])))=>i.map(i=>d[i]); import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./useRouter-ByJ6_rwb.js";import{$ as s,A as c,B as l,C as u,F as d,G as f,H as p,I as m,J as h,K as g,L as _,M as v,N as y,P as b,Q as x,R as S,S as C,T as w,U as T,V as ee,W as E,X as D,Y as O,Z as te,_ as ne,_t as re,a as k,at as ie,b as ae,c as oe,ct as se,d as ce,dt as le,f as ue,gt as de,h as fe,ht as pe,i as me,it as he,j as ge,k as _e,l as ve,lt as ye,m as A,mt as j,nt as be,o as xe,ot as Se,p as Ce,pt as we,q as Te,r as Ee,rt as De,st as Oe,t as ke,tt as Ae,u as je,ut as Me,v as Ne,w as Pe,x as Fe,y as Ie,z as Le}from"./brand-DUaZkIz1.js";import{i as Re,n as ze,r as Be,t as Ve}from"./useNavigate-B1zgPEUp.js";import{A as He,C as Ue,D as We,E as Ge,M as Ke,O as qe,T as Je,_ as Ye,a as Xe,b as Ze,c as Qe,f as $e,g as et,i as tt,j as nt,k as rt,n as it,r as at,t as ot,v as st,w as ct,y as lt}from"./preload-helper-EHBQhIeL.js";import{C as ut,E as dt,T as ft,_ as pt,a as mt,c as ht,d as gt,f as _t,g as vt,h as yt,i as bt,l as xt,m as St,n as Ct,o as wt,p as Tt,r as Et,s as Dt,t as Ot,u as kt,v as At,x as jt,y as Mt}from"./Tooltip-B3r3s_B9.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Nt=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&ne(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-Tt&&ee());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ne(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,te=O.port2;O.port1.onmessage=E,D=function(){te.postMessage(null)}}else D=function(){_(E,0)};function ne(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ne(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Pt=e(((e,t)=>{t.exports=Nt()})),Ft=e((e=>{var n=Pt(),r=t(),i=re();function a(e){var t=`https://react.dev/errors/`+e;if(1Se||(e.current=xe[Se],xe[Se]=null,Se--)}function Te(e,t){Se++,xe[Se]=e.current,e.current=t}var Ee=Ce(null),De=Ce(null),Oe=Ce(null),ke=Ce(null);function Ae(e,t){switch(Te(Oe,t),Te(De,e),Te(Ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?xp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=xp(t),e=Sp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}we(Ee),Te(Ee,e)}function je(){we(Ee),we(De),we(Oe)}function Me(e){var t=e.memoizedState;t!==null&&(vh._currentValue=t.memoizedState,Te(ke,e)),t=Ee.current;var n=Sp(t,e.type);t!==n&&(Te(De,e),Te(Ee,n))}function Ne(e){De.current===e&&(we(Ee),we(De)),ke.current===e&&(we(ke),vh._currentValue=be)}var Pe,Fe;function Ie(e){if(Pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Pe=t&&t[1]||``,Fe=-1)`:-1s(e,t,n)},i,a=sE,o=!XT.jitless,s=o&&cE.value,c=t.catchall,l;e._zod.parse=(u,d)=>{l??=n.value;let f=u.value;if(!a(f))return u.issues.push({expected:`object`,code:`invalid_type`,input:f,inst:e}),u;let p=[];if(o&&s&&d?.async===!1&&d.jitless!==!0)i||=r(t.shape),u=i(u,d);else{u.value={};let e=l.shape;for(let t of l.keys){let n=e[t],r=n._zod.run({value:f[t],issues:[]},d),i=n._zod.optin===`optional`&&n._zod.optout===`optional`;r instanceof Promise?p.push(r.then(e=>i?ZE(e,u,t,f):XE(e,u,t))):i?ZE(r,u,t,f):XE(r,u,t)}}if(!c)return p.length?Promise.all(p).then(()=>u):u;let m=[],h=l.keySet,g=c._zod,_=g.def.type;for(let e of Object.keys(f)){if(h.has(e))continue;if(_===`never`){m.push(e);continue}let t=g.run({value:f[e],issues:[]},d);t instanceof Promise?p.push(t.then(t=>XE(t,u,e))):XE(t,u,e)}return m.length&&u.issues.push({code:`unrecognized_keys`,keys:m,input:f,inst:e}),p.length?Promise.all(p).then(()=>u):u}});function $E(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>wE(e,r,ZT())))}),t}var eD=$(`$ZodUnion`,(e,t)=>{GE.init(e,t),rE(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),rE(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),rE(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),rE(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>nE(e.source)).join(`|`)})$`)}}),e._zod.parse=(n,r)=>{let i=!1,a=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},r);if(t instanceof Promise)a.push(t),i=!0;else{if(t.issues.length===0)return t;a.push(t)}}return i?Promise.all(a).then(t=>$E(t,n,e,r)):$E(a,n,e,r)}}),tD=$(`$ZodIntersection`,(e,t)=>{GE.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>rD(e,t,n)):rD(e,i,a)}});function nD(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(lE(e)&&lE(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=nD(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r{GE.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!lE(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[];if(t.keyType._zod.values){let o=t.keyType._zod.values;n.value={};for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...SE(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...SE(e,o.issues)),n.value[e]=o.value)}let s;for(let e in i)o.has(e)||(s??=[],s.push(e));s&&s.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:s})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){n.issues.push({origin:`record`,code:`invalid_key`,issues:s.issues.map(e=>wE(e,r,ZT())),input:o,path:[o],inst:e}),n.value[s.value]=s.value;continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...SE(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...SE(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),aD=$(`$ZodEnum`,(e,t)=>{GE.init(e,t);let n=QT(t.entries);e._zod.values=new Set(n),e._zod.pattern=RegExp(`^(${n.filter(e=>uE.has(typeof e)).map(e=>typeof e==`string`?dE(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,r)=>{let i=t.value;return e._zod.values.has(i)||t.issues.push({code:`invalid_value`,values:n,input:i,inst:e}),t}}),oD=$(`$ZodLiteral`,(e,t)=>{GE.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?dE(e):e?e.toString():String(e)).join(`|`)})$`),e._zod.parse=(n,r)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:`invalid_value`,values:t.values,input:i,inst:e}),n}}),sD=$(`$ZodTransform`,(e,t)=>{GE.init(e,t),e._zod.parse=(e,n)=>{let r=t.transform(e.value,e);if(n.async)return(r instanceof Promise?r:Promise.resolve(r)).then(t=>(e.value=t,e));if(r instanceof Promise)throw new YT;return e.value=r,e}}),cD=$(`$ZodOptional`,(e,t)=>{GE.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,rE(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),rE(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${nE(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>t.innerType._zod.optin===`optional`?t.innerType._zod.run(e,n):e.value===void 0?e:t.innerType._zod.run(e,n)}),lD=$(`$ZodNullable`,(e,t)=>{GE.init(e,t),rE(e._zod,`optin`,()=>t.innerType._zod.optin),rE(e._zod,`optout`,()=>t.innerType._zod.optout),rE(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${nE(e.source)}|null)$`):void 0}),rE(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),uD=$(`$ZodDefault`,(e,t)=>{GE.init(e,t),e._zod.optin=`optional`,rE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>dD(e,t)):dD(r,t)}});function dD(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var fD=$(`$ZodPrefault`,(e,t)=>{GE.init(e,t),e._zod.optin=`optional`,rE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),pD=$(`$ZodNonOptional`,(e,t)=>{GE.init(e,t),rE(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>mD(t,e)):mD(i,e)}});function mD(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var hD=$(`$ZodCatch`,(e,t)=>{GE.init(e,t),e._zod.optin=`optional`,rE(e._zod,`optout`,()=>t.innerType._zod.optout),rE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>wE(e,n,ZT()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>wE(e,n,ZT()))},input:e.value}),e.issues=[]),e)}}),gD=$(`$ZodPipe`,(e,t)=>{GE.init(e,t),rE(e._zod,`values`,()=>t.in._zod.values),rE(e._zod,`optin`,()=>t.in._zod.optin),rE(e._zod,`optout`,()=>t.out._zod.optout),e._zod.parse=(e,n)=>{let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>_D(e,t,n)):_D(r,t,n)}});function _D(e,t,n){return xE(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}var vD=$(`$ZodReadonly`,(e,t)=>{GE.init(e,t),rE(e._zod,`propValues`,()=>t.innerType._zod.propValues),rE(e._zod,`values`,()=>t.innerType._zod.values),rE(e._zod,`optin`,()=>t.innerType._zod.optin),rE(e._zod,`optout`,()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(yD):yD(r)}});function yD(e){return e.value=Object.freeze(e.value),e}var bD=$(`$ZodLazy`,(e,t)=>{GE.init(e,t),rE(e._zod,`innerType`,()=>t.getter()),rE(e._zod,`pattern`,()=>e._zod.innerType._zod.pattern),rE(e._zod,`propValues`,()=>e._zod.innerType._zod.propValues),rE(e._zod,`optin`,()=>e._zod.innerType._zod.optin),rE(e._zod,`optout`,()=>e._zod.innerType._zod.optout),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),xD=$(`$ZodCustom`,(e,t)=>{RE.init(e,t),GE.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>SD(t,n,r,e));SD(i,n,r,e)}});function SD(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(EE(e))}}var CD=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==`object`&&`id`in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function wD(){return new CD}var TD=wD();function ED(e){return new e({type:`unknown`})}function DD(e,t){return new e({type:`never`,...pE(t)})}function OD(e,t){return new zE({check:`max_length`,...pE(t),maximum:e})}function kD(e,t){return new BE({check:`min_length`,...pE(t),minimum:e})}function AD(e,t){return new VE({check:`length_equals`,...pE(t),length:e})}function jD(e){return new HE({check:`overwrite`,tx:e})}function MD(e,t,n){return new e({type:`array`,element:t,...pE(n)})}function ND(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...pE(n)})}var PD=(e,t)=>{OE.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>jE(e,t)},flatten:{value:t=>AE(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get(){return e.issues.length===0}}})};$(`ZodError`,PD);var FD=$(`ZodError`,PD,{Parent:Error}),ID=ME(FD),LD=NE(FD),RD=PE(FD),zD=IE(FD),BD=$(`ZodType`,(e,t)=>(GE.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),e.clone=(t,n)=>fE(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>ID(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>RD(e,t,n),e.parseAsync=async(t,n)=>LD(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>zD(e,t,n),e.spa=e.safeParseAsync,e.refine=(t,n)=>e.check(CO(t,n)),e.superRefine=t=>e.check(wO(t)),e.overwrite=t=>e.check(jD(t)),e.optional=()=>aO(e),e.nullable=()=>sO(e),e.nullish=()=>aO(sO(e)),e.nonoptional=t=>pO(e,t),e.array=()=>KD(e),e.or=t=>YD([e,t]),e.and=t=>ZD(e,t),e.transform=t=>_O(e,rO(t)),e.default=t=>lO(e,t),e.prefault=t=>dO(e,t),e.catch=t=>hO(e,t),e.pipe=t=>_O(e,t),e.readonly=()=>yO(e),e.describe=t=>{let n=e.clone();return TD.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return TD.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return TD.get(e);let n=e.clone();return TD.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),VD=$(`ZodUnknown`,(e,t)=>{KE.init(e,t),BD.init(e,t)});function HD(){return ED(VD)}var UD=$(`ZodNever`,(e,t)=>{qE.init(e,t),BD.init(e,t)});function WD(e){return DD(UD,e)}var GD=$(`ZodArray`,(e,t)=>{YE.init(e,t),BD.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(kD(t,n)),e.nonempty=t=>e.check(kD(1,t)),e.max=(t,n)=>e.check(OD(t,n)),e.length=(t,n)=>e.check(AD(t,n)),e.unwrap=()=>e.element});function KD(e,t){return MD(GD,e,t)}var qD=$(`ZodObject`,(e,t)=>{QE.init(e,t),BD.init(e,t),rE(e,`shape`,()=>t.shape),e.keyof=()=>eO(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:HD()}),e.loose=()=>e.clone({...e._zod.def,catchall:HD()}),e.strict=()=>e.clone({...e._zod.def,catchall:WD()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>_E(e,t),e.merge=t=>vE(e,t),e.pick=t=>hE(e,t),e.omit=t=>gE(e,t),e.partial=(...t)=>yE(iO,e,t[0]),e.required=(...t)=>bE(fO,e,t[0])}),JD=$(`ZodUnion`,(e,t)=>{eD.init(e,t),BD.init(e,t),e.options=t.options});function YD(e,t){return new JD({type:`union`,options:e,...pE(t)})}var XD=$(`ZodIntersection`,(e,t)=>{tD.init(e,t),BD.init(e,t)});function ZD(e,t){return new XD({type:`intersection`,left:e,right:t})}var QD=$(`ZodRecord`,(e,t)=>{iD.init(e,t),BD.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType}),$D=$(`ZodEnum`,(e,t)=>{aD.init(e,t),BD.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new $D({...t,checks:[],...pE(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new $D({...t,checks:[],...pE(r),entries:i})}});function eO(e,t){return new $D({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...pE(t)})}var tO=$(`ZodLiteral`,(e,t)=>{oD.init(e,t),BD.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})}),nO=$(`ZodTransform`,(e,t)=>{sD.init(e,t),BD.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=r=>{if(typeof r==`string`)n.issues.push(EE(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,t.continue??=!0,n.issues.push(EE(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function rO(e){return new nO({type:`transform`,transform:e})}var iO=$(`ZodOptional`,(e,t)=>{cD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function aO(e){return new iO({type:`optional`,innerType:e})}var oO=$(`ZodNullable`,(e,t)=>{lD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function sO(e){return new oO({type:`nullable`,innerType:e})}var cO=$(`ZodDefault`,(e,t)=>{uD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function lO(e,t){return new cO({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():t}})}var uO=$(`ZodPrefault`,(e,t)=>{fD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function dO(e,t){return new uO({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():t}})}var fO=$(`ZodNonOptional`,(e,t)=>{pD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function pO(e,t){return new fO({type:`nonoptional`,innerType:e,...pE(t)})}var mO=$(`ZodCatch`,(e,t)=>{hD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hO(e,t){return new mO({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var gO=$(`ZodPipe`,(e,t)=>{gD.init(e,t),BD.init(e,t),e.in=t.in,e.out=t.out});function _O(e,t){return new gO({type:`pipe`,in:e,out:t})}var vO=$(`ZodReadonly`,(e,t)=>{vD.init(e,t),BD.init(e,t)});function yO(e){return new vO({type:`readonly`,innerType:e})}var bO=$(`ZodLazy`,(e,t)=>{bD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.getter()}),xO=$(`ZodCustom`,(e,t)=>{xD.init(e,t),BD.init(e,t)});function SO(e){let t=new RE({check:`custom`});return t._zod.check=e,t}function CO(e,t={}){return ND(xO,e,t)}function wO(e){let t=SO(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(EE(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(EE(r))}},e(n.value,n)));return t}var TO=`@ag-ui/client`;function EO(e){if(!e.metadata||!Object.prototype.hasOwnProperty.call(e.metadata,TO))return;let t=e.metadata?.[TO];if(!t||typeof t!=`object`||Array.isArray(t))return[];if(!Object.prototype.hasOwnProperty.call(t,`authoritativeActivityTypes`))return;let n=t.authoritativeActivityTypes;return n===null?null:Array.isArray(n)&&n.every(e=>typeof e==`string`)?n:[]}var DO=e=>{if(typeof structuredClone==`function`)return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function OO(){return Qc()}function kO(e){return e instanceof TypeError&&/read[- ]?only|not extensible|cannot add property|cannot delete property|can't be deleted|unable to delete property|object is frozen|is not writable/i.test(e.message)}function AO(e){if(Object.freeze(e),typeof e==`object`&&e)for(let t of Object.values(e))typeof t==`object`&&t&&!Object.isFrozen(t)&&AO(t);return e}var jO=524288;function MO(e,t,n){let r=0,i=[e,t],a=new WeakSet;for(;i.length>0;){let e=i.pop();if(typeof e==`string`){if(r+=e.length,r>n)return!0}else if(typeof e==`object`&&e){if(a.has(e))continue;if(a.add(e),Array.isArray(e))for(let t=0;tn)return!0;i.push(e[o])}}}}return!1}async function NO(e,t,n,r){let i=typeof process<`u`&&!0,a=i&&!!{}.VITEST_WORKER_ID,o=i&&!!{}.VITEST_WORKER_ID,s=o&&!MO(t,n,jO),c=s?DO(t):t,l=s?DO(n):n,u=!1,d=!1,f;for(let t of e)try{s&&(AO(c),AO(l));let e=await r(t,c,l);if(e===void 0)continue;let n=!1;if(e.messages!==void 0&&e.messages!==c&&(c=DO(e.messages),u=!0,n=!0),e.state!==void 0&&e.state!==l&&(l=DO(e.state),d=!0,n=!0),s&&n&&MO(c,l,jO)&&(s=!1),f=e.stopPropagation,f===!0)break}catch(e){if(a&&e instanceof TypeError)throw e;s&&o&&kO(e)?console.error(`AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.`,e):console.error(`Subscriber error:`,e);continue}return{...u?{messages:Object.isFrozen(c)?DO(c):c}:{},...d?{state:Object.isFrozen(l)?DO(l):l}:{},...f===void 0?{}:{stopPropagation:f}}}function PO(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,n=e.lifecycle??!0,r=e.verbose??!1;return{enabled:t||n,events:t,lifecycle:n,verbose:r}}function FO(e){if(e instanceof IO)return e;if(e===!0)return new IO(PO(!0))}var IO=class{constructor(e){this.config=e}event(e,t,n,r){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof n==`string`?n:JSON.stringify(n)):console.debug(`[${e}] ${t}`,r??n))}lifecycle(e,t,n){this.config.lifecycle&&(n?console.debug(`[${e}] ${t}`,n):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function LO(e){return e.enabled?new IO(e):void 0}function RO(e,t,n){if(t){let r=e.find(e=>e.id===t);if(r?.role===`assistant`)return r;r&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${r.role}' message, not assistant — falling back to toolCallId`);let i={id:r?n:t,role:`assistant`,toolCalls:[]};return e.push(i),i}let r={id:n,role:`assistant`,toolCalls:[]};return e.push(r),r}function zO(e,t){return!e||t.metadata===void 0?!1:(e.metadata=il(e.metadata,DO(t.metadata)),!0)}var BO=(e,t,n,r,i)=>{let a=FO(i),o=DO(n.messages),s=DO(e.state),c={},l=[],u=new Set,d=e=>{let t=e.outcome?.type===`success`?e.outcome.pendingToolCallIds:void 0;return t!==void 0&&t.length>0?[...t]:l.filter(e=>!u.has(e))},f=e=>{e.messages!==void 0&&(o=e.messages,c.messages=e.messages),e.state!==void 0&&(s=e.state,c.state=e.state)},p=()=>{let e=DO(c);return c={},e.messages!==void 0||e.state!==void 0?Sd(e):Wu};return t.pipe(Nd(async t=>{let i=await NO(r,o,s,(r,i,a)=>r.onEvent?.({event:t,agent:n,input:e,messages:i,state:a}));if(f(i),i.stopPropagation===!0?a?.event(`APPLY`,`Event dropped:`,t,{type:t.type,reason:`stopPropagation by subscriber`}):a?.event(`APPLY`,`Event applied:`,t,{type:t.type,subscribers:r.length}),i.stopPropagation===!0)return p();switch(t.type){case I.TEXT_MESSAGE_START:{let i=await NO(r,o,s,(r,i,a)=>r.onTextMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messageId:e,role:n=`assistant`,name:r,subagentRunId:i}=t,a=o.find(t=>t.id===e);if(a?.role===`activity`)return console.warn(`TEXT_MESSAGE_START: Message '${e}' is an activity message — message ids must be unique across activity and text messages`),p();let s=a;if(!s){let t={id:e,role:n,content:``,...r!==void 0&&{name:r},...i!=null&&{subagentRunId:i}};o.push(t),s=t}let c=zO(s,t);(!a||c)&&f({messages:o})}return p()}case I.TEXT_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=o.find(e=>e.id===i);if(!c)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${i}'`),p();if(c.role===`activity`)return console.warn(`TEXT_MESSAGE_CONTENT: Message '${i}' is an activity message — message ids must be unique across activity and text messages`),p();let l=await NO(r,o,s,(r,i,a)=>r.onTextMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,textMessageBuffer:typeof c.content==`string`?c.content:``}));return f(l),l.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,zO(c,t),f({messages:o})),p()}case I.TEXT_MESSAGE_END:{let{messageId:i}=t,a=o.find(e=>e.id===i);if(!a)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${i}'`),p();if(a.role===`activity`)return console.warn(`TEXT_MESSAGE_END: Message '${i}' is an activity message — message ids must be unique across activity and text messages`),p();let c=await NO(r,o,s,(r,i,o)=>r.onTextMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,textMessageBuffer:typeof a.content==`string`?a.content:``}));return f(c),c.stopPropagation!==!0&&zO(a,t)&&f({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),p()}case I.TOOL_CALL_START:{let i=await NO(r,o,s,(r,i,a)=>r.onToolCallStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{toolCallId:e,toolCallName:n,parentMessageId:r,subagentRunId:i}=t;l.includes(e)||l.push(e);let a=o.find(t=>t.toolCalls?.some(t=>t.id===e))?.toolCalls?.find(t=>t.id===e);if(a){let r=a.function.name!==n;return r&&(console.warn(`TOOL_CALL_START: tool call '${e}' already exists with name '${a.function.name}' — updating it to '${n}'`),a.function.name=n),(zO(a,t)||r)&&f({messages:o}),p()}let s=new Set(o.map(e=>e.id)),c=RO(o,r,e);!s.has(c.id)&&i!=null&&c.subagentRunId===void 0&&(c.subagentRunId=i),c.toolCalls??=[];let u={id:e,type:`function`,function:{name:n,arguments:``}};c.toolCalls.push(u),zO(u,t),f({messages:o})}return p()}case I.TOOL_CALL_ARGS:{let{toolCallId:i,delta:a}=t,c=o.find(e=>e.toolCalls?.some(e=>e.id===i));if(!c)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${i}'`),p();let l=c.toolCalls?.find(e=>e.id===i);if(!l)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${i}'`),p();let u=await NO(r,o,s,(r,i,a)=>{let o=l.function.arguments,s=l.function.name,c={};try{c=Hd(o)}catch{}return r.onToolCallArgsEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallBuffer:o,toolCallName:s,partialToolCallArgs:c})});return f(u),u.stopPropagation!==!0&&(l.function.arguments+=a,zO(l,t),f({messages:o})),p()}case I.TOOL_CALL_END:{let{toolCallId:i}=t,a=o.find(e=>e.toolCalls?.some(e=>e.id===i));if(!a)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${i}'`),p();let c=a.toolCalls?.find(e=>e.id===i);if(!c)return console.warn(`TOOL_CALL_END: No tool call found with ID '${i}'`),p();let l=await NO(r,o,s,(r,i,a)=>{let o=c.function.arguments,s=c.function.name,l={};try{l=JSON.parse(o)}catch{}return r.onToolCallEndEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallName:s,toolCallArgs:l})});return f(l),l.stopPropagation!==!0&&zO(c,t)&&f({messages:o}),await Promise.all(r.map(t=>{t.onNewToolCall?.({toolCall:c,messages:o,state:s,agent:n,input:e})})),p()}case I.TOOL_CALL_RESULT:{let i=await NO(r,o,s,(r,i,a)=>r.onToolCallResultEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messageId:i,toolCallId:a,content:c,role:l,subagentRunId:d}=t;u.add(a);let p={id:i,toolCallId:a,role:l||`tool`,content:c,...d!=null&&{subagentRunId:d}};zO(p,t);let m=o.findIndex(e=>e.role===`assistant`&&e.toolCalls?.some(e=>e.id===a));if(m===-1)o.push(p);else{let e=m+1;for(;e{t.onNewMessage?.({message:p,messages:o,state:s,agent:n,input:e})})),f({messages:o})}return p()}case I.STATE_SNAPSHOT:{let i=await NO(r,o,s,(r,i,a)=>r.onStateSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{snapshot:e}=t;s=e,f({state:s})}return p()}case I.STATE_DELTA:{let i=await NO(r,o,s,(r,i,a)=>r.onStateDeltaEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{delta:e}=t;try{s=Hl.applyPatch(s,e,!0,!1).newDocument,f({state:s})}catch(t){let n=t instanceof Error?t.message:String(t);console.warn(`Failed to apply state patch:\nCurrent state: ${JSON.stringify(s,null,2)}\nPatch operations: ${JSON.stringify(e,null,2)}\nError: ${n}`)}}return p()}case I.MESSAGES_SNAPSHOT:{let i=await NO(r,o,s,(r,i,a)=>r.onMessagesSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messages:e}=t,n=e.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}),r=new Map(n.map(e=>[e.id,e])),i=EO(t),a=n.some(e=>e.role===`activity`),s=n.some(e=>e.role===`reasoning`),c=e=>e.role===`activity`&&(i?!i.includes(e.activityType):i!==null&&!a)||e.role===`reasoning`&&!s;o=o.filter(e=>r.has(e.id)||c(e)).map(e=>r.get(e.id)??e);let l=new Set(o.map(e=>e.id));for(let e of n)l.has(e.id)||o.push(e);f({messages:o})}return p()}case I.ACTIVITY_SNAPSHOT:{let i=t,a=o.findIndex(e=>e.id===i.messageId),c=a>=0?o[a]:void 0,l=c?.role===`activity`?c:void 0,u=i.replace??!0,d=await NO(r,o,s,(t,r,a)=>t.onActivitySnapshotEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:l,existingMessage:c}));if(f(d),d.stopPropagation!==!0){let t={id:i.messageId,role:`activity`,activityType:i.activityType,content:DO(i.content),...i.subagentRunId!=null&&{subagentRunId:i.subagentRunId}},c,d;a===-1?(o.push(t),c=t,d=t):l?(u&&(o[a]={...l,activityType:i.activityType,content:DO(i.content),subagentRunId:i.subagentRunId},i.subagentRunId??delete o[a].subagentRunId),d=o[a]):u&&(o[a]=t,c=t,d=t),zO(d,i),f({messages:o}),c&&await Promise.all(r.map(t=>t.onNewMessage?.({message:c,messages:o,state:s,agent:n,input:e})))}return p()}case I.ACTIVITY_DELTA:{let i=t,a=o.findIndex(e=>e.id===i.messageId);if(a===-1)return p();let c=o[a];if(c.role!==`activity`)return console.warn(`ACTIVITY_DELTA: Message '${i.messageId}' is not an activity message`),p();let l=c,u=await NO(r,o,s,(t,r,a)=>t.onActivityDeltaEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:l}));if(f(u),u.stopPropagation!==!0)try{zO(l,i)&&f({messages:o});let e=DO(l.content??{}),t=Hl.applyPatch(e,i.patch??[],!0,!1).newDocument;o[a]={...l,content:DO(t),activityType:i.activityType},f({messages:o})}catch(e){let t=e instanceof Error?e.message:String(e);console.warn(`Failed to apply activity patch for '${i.messageId}': ${t}`)}return p()}case I.RAW:return f(await NO(r,o,s,(r,i,a)=>r.onRawEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.CUSTOM:return f(await NO(r,o,s,(r,i,a)=>r.onCustomEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.RUN_STARTED:{let i=await NO(r,o,s,(r,i,a)=>r.onRunStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),l=[],u=new Set,i.stopPropagation!==!0){let e=t;if(e.input?.messages){for(let t of e.input.messages){let e=t;if(t.subagentRunId===null){let n={...t};delete n.subagentRunId,e=n}o.find(t=>t.id===e.id)||o.push(e)}f({messages:o})}}return p()}case I.RUN_FINISHED:{let i=t,a=i.outcome?.type===`interrupt`?{event:i,outcome:`interrupt`,interrupts:i.outcome.interrupts}:i.outcome?.type===`cancelled`?{event:i,outcome:`cancelled`}:{event:i,outcome:`success`,result:i.result,pendingToolCallIds:d(i)},c=await NO(r,o,s,(t,r,i)=>t.onRunFinishedEvent?.({...a,messages:r,state:i,agent:n,input:e}));return f(c),c.stopPropagation!==!0&&(n.pendingInterrupts=a.outcome===`interrupt`?a.interrupts.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}):[]),p()}case I.RUN_ERROR:return f(await NO(r,o,s,(r,i,a)=>r.onRunErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.STEP_STARTED:return f(await NO(r,o,s,(r,i,a)=>r.onStepStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.STEP_FINISHED:return f(await NO(r,o,s,(r,i,a)=>r.onStepFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.TEXT_MESSAGE_CHUNK:throw Error(`TEXT_MESSAGE_CHUNK must be transformed before being applied`);case I.TOOL_CALL_CHUNK:throw Error(`TOOL_CALL_CHUNK must be transformed before being applied`);case I.REASONING_START:return f(await NO(r,o,s,(r,i,a)=>r.onReasoningStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.REASONING_MESSAGE_START:{let i=await NO(r,o,s,(r,i,a)=>r.onReasoningMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messageId:e,subagentRunId:n}=t,r=o.find(t=>t.id===e);if(r?.role===`activity`)return console.warn(`REASONING_MESSAGE_START: Message '${e}' is an activity message — message ids must be unique across activity and reasoning messages`),p();let i=r;if(!i){let t={id:e,role:`reasoning`,content:``,...n!=null&&{subagentRunId:n}};o.push(t),i=t}let a=zO(i,t);(!r||a)&&f({messages:o})}return p()}case I.REASONING_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=o.find(e=>e.id===i);if(!c)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${i}'`),p();if(c.role===`activity`)return console.warn(`REASONING_MESSAGE_CONTENT: Message '${i}' is an activity message — message ids must be unique across activity and reasoning messages`),p();let l=await NO(r,o,s,(r,i,a)=>r.onReasoningMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,reasoningMessageBuffer:typeof c.content==`string`?c.content:``}));return f(l),l.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,zO(c,t),f({messages:o})),p()}case I.REASONING_MESSAGE_END:{let{messageId:i}=t,a=o.find(e=>e.id===i);if(!a)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${i}'`),p();if(a.role===`activity`)return console.warn(`REASONING_MESSAGE_END: Message '${i}' is an activity message — message ids must be unique across activity and reasoning messages`),p();let c=await NO(r,o,s,(r,i,o)=>r.onReasoningMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,reasoningMessageBuffer:typeof a.content==`string`?a.content:``}));return f(c),c.stopPropagation!==!0&&zO(a,t)&&f({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),p()}case I.REASONING_MESSAGE_CHUNK:throw Error(`REASONING_MESSAGE_CHUNK must be transformed before being applied`);case I.REASONING_END:return f(await NO(r,o,s,(r,i,a)=>r.onReasoningEndEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.REASONING_ENCRYPTED_VALUE:{let{subtype:i,entityId:a,encryptedValue:l}=t,u=await NO(r,o,s,(r,i,a)=>r.onReasoningEncryptedValueEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(u),u.stopPropagation!==!0){let e=!1;if(i===`tool-call`){for(let t of o)if(t.role===`assistant`&&t.toolCalls){let n=t.toolCalls.find(e=>e.id===a);if(n){n.encryptedValue=l,e=!0;break}}}else{let t=o.find(e=>e.id===a);t?.role!==`activity`&&t&&(t.encryptedValue=l,e=!0)}e&&(c.messages=o)}return p()}case I.SUBAGENT_STARTED:return f(await NO(r,o,s,(r,i,a)=>r.onSubagentStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.SUBAGENT_FINISHED:return f(await NO(r,o,s,(r,i,a)=>r.onSubagentFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case I.SUBAGENT_ERROR:return f(await NO(r,o,s,(r,i,a)=>r.onSubagentErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p()}return t.type,p()}),Od(),r.length>0?Id({}):e=>e)};function VO(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][compat] Converting deprecated ${e} to ${t}. The old shape leaves the protocol after its shim window — see the repo-root DEPRECATIONS.md. Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)}var HO=e=>t=>{let n=FO(e),r=new Set,i=new Set,a=new Set,o=new Set,s={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},c=!1,l=!1,u=!1,d=new Map,f=e=>{let t=d.get(e);return t||(t=new Map,d.set(e,t)),t},p=()=>{for(let e of d.values())if(e.size>0)return!0;return!1},m=new Map,h=new Set,g=!1,_=!1,v=()=>{_=!1,r.clear(),i.clear(),a.clear(),o.clear(),s.message.clear(),s.toolCall.clear(),s.activity.clear(),s.reasoning.clear(),d.clear(),m.clear(),h.clear(),c=!1,l=!1,g=!0},y=(e,t)=>{let n=e??[];if(Array.isArray(n))for(let e of n){if(!e||typeof e.id!=`string`)continue;if(e.subagentRunId===null)return new L(`Cannot send a message (id '${e.id}') with 'subagentRunId: null'. The field is optional — omit it entirely.`);let n=e.role===`reasoning`?s.reasoning:e.role===`activity`?s.activity:s.message;(t||!n.has(e.id))&&n.set(e.id,{subagentRunId:e.subagentRunId});for(let n of e.toolCalls??[])n&&typeof n.id==`string`&&(t||!s.toolCall.has(n.id))&&s.toolCall.set(n.id,{subagentRunId:e.subagentRunId??void 0})}},b=(e,t,n,r,i)=>{if(t!==void 0&&n&&n.subagentRunId!==t)return new L(`Cannot send '${e}': subagentRunId '${t}' does not match the ${r} '${i}' opener's subagent '${n.subagentRunId??`(the parent agent)`}'.`)};return t.pipe(Dd(e=>{let t=e.type;if(n?.event(`VERIFY`,`Event:`,e,{type:e.type}),l&&t!==I.RUN_STARTED)return z(()=>new L(`Cannot send event type '${t}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(c&&t!==I.RUN_ERROR&&t!==I.RUN_STARTED)return z(()=>new L(`Cannot send event type '${t}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(!u){if(u=!0,t!==I.RUN_STARTED&&t!==I.RUN_ERROR)return z(()=>new L(`First event must be 'RUN_STARTED'`))}else if(t===I.RUN_STARTED){if(g&&!c&&!l)return z(()=>new L(`Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run.`));(c||l)&&v()}if(e.subagentRunId===null){_||(_=!0,VO(`subagentRunId: null`,`an absent field`));let{subagentRunId:t,...n}=e;e=n}if(t===I.SUBAGENT_STARTED||t===I.SUBAGENT_FINISHED||t===I.SUBAGENT_ERROR){let n=t===I.SUBAGENT_STARTED?[`description`,`parentSubagentRunId`,`parentToolCallId`,`parentMessageId`]:t===I.SUBAGENT_FINISHED?[`outcome`]:[`code`];for(let r of n)if(e[r]===null)return z(()=>new L(`Cannot send '${t}' with '${r}: null'. The field is optional — omit it entirely.`));let r=e.outcome;if(r!=null&&r.type!==`success`&&r.type!==`suspended`)return z(()=>new L(`Cannot send '${t}' with outcome type '${String(r.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(r&&r.interruptIds===null)return z(()=>new L(`Cannot send '${t}' with 'outcome.interruptIds: null'. The field is optional — omit it entirely.`));if(r&&Array.isArray(r.interruptIds)&&r.interruptIds.some(e=>typeof e!=`string`))return z(()=>new L(`Cannot send '${t}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(t===I.RUN_FINISHED){let t=e.outcome;if(t?.type===`interrupt`&&Array.isArray(t.interrupts)){for(let e of t.interrupts)if(e&&e.subagentRunId===null)return z(()=>new L(`Cannot send 'RUN_FINISHED' with an interrupt (id '${e.id}') carrying 'subagentRunId: null'. The field is optional — omit it entirely.`))}}switch(t){case I.TEXT_MESSAGE_START:{let n=e.messageId;if(r.has(n))return z(()=>new L(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${n}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let i=s.message.get(n);if(i){let r=b(t,e.subagentRunId,i,`message`,n);if(r)return z(()=>r)}return r.add(n),i||s.message.set(n,{subagentRunId:e.subagentRunId}),Sd(e)}case I.TEXT_MESSAGE_CONTENT:{let n=e.messageId;if(!r.has(n))return z(()=>new L(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${n}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let i=b(t,e.subagentRunId,s.message.get(n),`message`,n);return i?z(()=>i):Sd(e)}case I.TEXT_MESSAGE_END:{let n=e.messageId;if(!r.has(n))return z(()=>new L(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${n}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let i=b(t,e.subagentRunId,s.message.get(n),`message`,n);return i?z(()=>i):(r.delete(n),Sd(e))}case I.TOOL_CALL_START:{let n=e.toolCallId;if(i.has(n))return z(()=>new L(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${n}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let r=e.parentMessageId,a=e.subagentRunId,o;if(r!==void 0){let e=s.message.get(r);if(e){if(a!==void 0&&a!==e.subagentRunId)return z(()=>new L(`Cannot send 'TOOL_CALL_START': subagentRunId '${a}' does not match its parent message '${r}' owner '${e.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`));o=e}}let c=s.toolCall.get(n);if(c){let e=b(t,a,c,`tool call`,n);if(e)return z(()=>e);if(a===void 0&&o&&o.subagentRunId!==c.subagentRunId)return z(()=>new L(`Cannot send 'TOOL_CALL_START': tool call '${n}' is owned by '${c.subagentRunId??`(the parent agent)`}' but its parent message '${r}' is owned by '${o.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`))}return i.add(n),c||s.toolCall.set(n,a===void 0?o??{subagentRunId:void 0}:{subagentRunId:a}),Sd(e)}case I.TOOL_CALL_ARGS:{let n=e.toolCallId;if(!i.has(n))return z(()=>new L(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${n}'. Start a tool call with 'TOOL_CALL_START' first.`));let r=b(t,e.subagentRunId,s.toolCall.get(n),`tool call`,n);return r?z(()=>r):Sd(e)}case I.TOOL_CALL_END:{let n=e.toolCallId;if(!i.has(n))return z(()=>new L(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${n}'. A 'TOOL_CALL_START' event must be sent first.`));let r=b(t,e.subagentRunId,s.toolCall.get(n),`tool call`,n);return r?z(()=>r):(i.delete(n),Sd(e))}case I.STEP_STARTED:{let t=e.stepName,n=e.subagentRunId;return f(n).has(t)?z(()=>new L(`Step "${t}" is already active for 'STEP_STARTED'${n===void 0?``:` in subagent '${n}'`}`)):(f(n).set(t,!0),Sd(e))}case I.STEP_FINISHED:{let t=e.stepName,n=e.subagentRunId;if(!f(n).has(t)){let e,r=!1;for(let[i,a]of d)if(i!==n&&a.has(t)){e=i,r=!0;break}return z(r?()=>new L(`Cannot send 'STEP_FINISHED' for step "${t}" attributed to ${n===void 0?`the parent agent`:`subagent '${n}'`}: that step is open under ${e===void 0?`the parent agent`:`subagent '${e}'`}. A step must be finished by whoever started it.`):()=>new L(`Cannot send 'STEP_FINISHED' for step "${t}" that was not started`))}return f(n).delete(t),Sd(e)}case I.ACTIVITY_SNAPSHOT:{let t=e.messageId;return(!s.activity.has(t)||e.replace!==!1)&&s.activity.set(t,{subagentRunId:e.subagentRunId}),Sd(e)}case I.TOOL_CALL_RESULT:{let t=e.messageId;return typeof t==`string`&&s.message.set(t,{subagentRunId:e.subagentRunId}),Sd(e)}case I.REASONING_START:case I.REASONING_MESSAGE_START:{let n=e.messageId,r=t===I.REASONING_START,i=r?a:o;if(i.has(n))return z(()=>new L(r?`Cannot send 'REASONING_START' event: A reasoning span with ID '${n}' is already in progress. Complete it with 'REASONING_END' first.`:`Cannot send 'REASONING_MESSAGE_START' event: A reasoning message with ID '${n}' is already in progress. Complete it with 'REASONING_MESSAGE_END' first.`));let c=s.reasoning.get(n);if(c){let r=b(t,e.subagentRunId,c,`reasoning message`,n);if(r)return z(()=>r)}return i.add(n),c||s.reasoning.set(n,{subagentRunId:e.subagentRunId}),Sd(e)}case I.REASONING_MESSAGE_CONTENT:case I.REASONING_MESSAGE_END:case I.REASONING_END:{let n=e.messageId,r=t===I.REASONING_END,i=r?a:o;if(!i.has(n))return z(()=>new L(r?`Cannot send 'REASONING_END' event: No active reasoning span found with ID '${n}'. A 'REASONING_START' event must be sent first.`:`Cannot send '${t}' event: No active reasoning message found with ID '${n}'. Start a reasoning message with 'REASONING_MESSAGE_START' first.`));let c=b(t,e.subagentRunId,s.reasoning.get(n),`reasoning message`,n);return c?z(()=>c):((t===I.REASONING_END||t===I.REASONING_MESSAGE_END)&&i.delete(n),Sd(e))}case I.REASONING_ENCRYPTED_VALUE:{let n=e.entityId,r=e.subtype,i=r===`tool-call`?s.toolCall.get(n):r===`message`?s.message.get(n)??s.reasoning.get(n):s.reasoning.get(n),a=r===`tool-call`?`tool call`:r===`message`?`message`:`reasoning message`,o=b(t,e.subagentRunId,i,a,n);return o?z(()=>o):Sd(e)}case I.ACTIVITY_DELTA:{let n=e.messageId,r=b(t,e.subagentRunId,s.activity.get(n),`activity`,n);return r?z(()=>r):Sd(e)}case I.SUBAGENT_STARTED:{if(typeof e.subagentRunId!=`string`)return z(()=>new L(`Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'.`));if(typeof e.name!=`string`)return z(()=>new L(`Cannot send 'SUBAGENT_STARTED' without a 'name'.`));let t=e.subagentRunId,n=e.parentSubagentRunId;return m.has(t)?z(()=>new L(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):h.has(t)?z(()=>new L(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):n!==void 0&&!m.has(n)&&!h.has(n)?z(()=>new L(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${n}' has not been started in this run.`)):(m.set(t,!0),Sd(e))}case I.SUBAGENT_FINISHED:case I.SUBAGENT_ERROR:{if(typeof e.subagentRunId!=`string`)return z(()=>new L(`Cannot send '${t}' without a 'subagentRunId'.`));if(t===I.SUBAGENT_ERROR&&typeof e.message!=`string`)return z(()=>new L(`Cannot send 'SUBAGENT_ERROR' without a 'message'.`));let n=e.subagentRunId;return m.has(n)?(m.delete(n),h.add(n),Sd(e)):z(()=>new L(`Cannot send '${t}': no active subagent found with ID '${n}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case I.MESSAGES_SNAPSHOT:{let t=y(e.messages,!0);if(t)return z(()=>t)}return Sd(e);case I.RUN_STARTED:g=!0;{let t=y((e.input??{}).messages,!1);if(t)return z(()=>t)}return Sd(e);case I.RUN_FINISHED:if(p()){let e=[];for(let[t,n]of d)for(let r of n.keys())e.push(t===void 0?r:`${r} (subagent '${t}')`);let t=e.join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while steps are still active: ${t}`))}if(r.size>0){let e=Array.from(r.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while text messages are still active: ${e}`))}if(o.size>0){let e=Array.from(o.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while reasoning messages are still active: ${e}`))}if(a.size>0){let e=Array.from(a.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while reasoning spans are still active: ${e}`))}if(i.size>0){let e=Array.from(i.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${e}`))}if(m.size>0){let e=Array.from(m.keys()).join(`, `);return z(()=>new L(`Cannot send 'RUN_FINISHED' while subagents are still active: ${e}`))}return c=!0,Sd(e);case I.RUN_ERROR:return l=!0,Sd(e);case I.CUSTOM:return Sd(e);default:return Sd(e)}}))},UO=function(e){return e.HEADERS=`headers`,e.DATA=`data`,e}({}),WO=e=>Ad(()=>xd(e())).pipe(Rd(e=>{if(!e.ok){let t=e.headers.get(`content-type`)||``;return xd(e.text()).pipe(Dd(n=>{let r=n;if(t.includes(`application/json`))try{r=JSON.parse(n)}catch{}let i=Error(`HTTP ${e.status}: ${typeof r==`string`?r:JSON.stringify(r)}`);return i.status=e.status,i.payload=r,z(()=>i)}))}let t={type:UO.HEADERS,status:e.status,headers:e.headers},n=e.body?.getReader();return n?new ju(e=>{let r=!1;return e.next(t),(async()=>{try{for(;!e.closed;){let{done:t,value:i}=await n.read();if(t){r=!0;break}let a={type:UO.DATA,data:i};e.next(a)}e.complete()}catch(t){r=!0,e.error(t)}})(),()=>{r||n.cancel().catch(e=>{e?.name!==`AbortError`&&console.warn(`Failed to cancel HTTP response stream:`,e)})}}):z(()=>Error(`Failed to getReader() from response`))})),GO=10485760,KO=(e,t)=>{let n=FO(t),r=new Bu,i=new TextDecoder(`utf-8`,{fatal:!1}),a=``;e.subscribe({next:e=>{if(e.type!==UO.HEADERS&&e.type===UO.DATA&&e.data){let t=i.decode(e.data,{stream:!0});a+=t;let n=a.split(/\n\n/);a=n.pop()||``;for(let e of n)o(e);if(a.length>GO){r.error(Error(`SSE buffer size exceeded maximum limit of ${GO/1048576} MB`));return}}},error:e=>r.error(e),complete:()=>{a&&(a+=i.decode(),o(a)),r.complete()}});function o(e){let t=e.split(` `),i=[];for(let e of t)e.startsWith(`data:`)&&i.push(e.slice(5).replace(/^ /,``));if(i.length>0)try{let e=i.join(` `),t=JSON.parse(e);n?.event(`SSE`,`Event received:`,t,{type:t?.type}),r.next(t)}catch(e){r.error(e)}}return r.asObservable()},qO=10485760,JO=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS,YO=(e,t)=>{let n=FO(t),r=new Bu,i=new Uint8Array,a=!1;e.subscribe({next:e=>{if(e.type!==UO.HEADERS&&e.type===UO.DATA&&e.data){let t=new Uint8Array(i.length+e.data.length);t.set(i,0),t.set(e.data,i.length),i=t,o()}},error:e=>r.error(e),complete:()=>{if(o(),!a){if(i.length>0){r.error(Error(`The binary stream ended mid-frame: ${i.length} trailing bytes could not be read as a complete message.`));return}r.complete()}}});function o(){if(!a)for(;i.length>=4;){let e=4+new DataView(i.buffer,i.byteOffset,4).getUint32(0,!1);if(e>qO){r.error(Error(`Protobuf message size exceeded maximum limit of ${qO/1048576} MB`));return}if(i.length{let n=FO(t),r=new Bu,i=new Uu(1),a=!1,o,s=!1,c=()=>{s=!0,o?.unsubscribe()},l=e=>{c(),r.error(e)},u=()=>{c(),r.complete()};return o=e.subscribe({next:e=>{if(i.next(e),e.type===UO.HEADERS&&!a){a=!0;let t=e.headers.get(`content-type`);n?.lifecycle(`HTTP`,`Stream format detected:`,{contentType:t,parser:t===`application/vnd.ag-ui.event+proto`?`protobuf`:`sse`}),t===`application/vnd.ag-ui.event+proto`?YO(i,n).subscribe({next:e=>r.next(e),error:e=>l(e),complete:()=>u()}):KO(i,n).subscribe({next:e=>{if(typeof e!=`object`||!e||Array.isArray(e)){let t=Error(`Invalid event: the frame is not a JSON object.`);n?.event(`HTTP`,`Event invalid:`,{json:e,error:String(t)}),l(t);return}let t=e;if(typeof t.type!=`string`||t.type.length===0){let t=Error(`Invalid event: the frame carries no event type.`);n?.event(`HTTP`,`Event invalid:`,{json:e,error:String(t)}),l(t);return}n?.event(`HTTP`,`Event received:`,e,{type:t.type}),r.next(e)},error:e=>{if(e?.name===`AbortError`){r.next({type:I.RUN_ERROR,message:e.message||`Request aborted`,code:`abort`,rawEvent:e}),u();return}return l(e)},complete:()=>u()})}else a||l(Error(`No headers event received before data events`))},error:e=>{i.error(e),l(e)},complete:()=>{i.complete()}}),s&&o.unsubscribe(),r.asObservable()},ZO={TextMessageStart:`TextMessageStart`,TextMessageContent:`TextMessageContent`,TextMessageEnd:`TextMessageEnd`,ActionExecutionStart:`ActionExecutionStart`,ActionExecutionArgs:`ActionExecutionArgs`,ActionExecutionEnd:`ActionExecutionEnd`,ActionExecutionResult:`ActionExecutionResult`,AgentStateMessage:`AgentStateMessage`,MetaEvent:`MetaEvent`,RunStarted:`RunStarted`,RunFinished:`RunFinished`,RunError:`RunError`,NodeStarted:`NodeStarted`,NodeFinished:`NodeFinished`},QO=e=>{if(typeof e==`string`)return e;if(!Array.isArray(e))return;let t=e.filter(e=>e.type===`text`).map(e=>e.text).filter(e=>e.length>0);if(t.length!==0)return t.join(` -`)};function $O(e,t){return ol(t)&&ek(`[ag-ui][legacy] The result of tool call '${e}' carries content parts the legacy protocol cannot represent; only its text parts are bridged and the rest is dropped.`),al(t)}var ek=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(e)},tk=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=!1,p=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(Dd(r=>{switch(r.type){case I.TEXT_MESSAGE_START:{let e=r;return[{type:ZO.TextMessageStart,messageId:e.messageId,role:e.role}]}case I.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:ZO.TextMessageContent,messageId:e.messageId,content:e.delta}]}case I.TEXT_MESSAGE_END:{let e=r;return[{type:ZO.TextMessageEnd,messageId:e.messageId}]}case I.TOOL_CALL_START:{let e=r;return u.push({id:e.toolCallId,type:`function`,function:{name:e.toolCallName,arguments:``}}),o=!0,d[e.toolCallId]=e.toolCallName,[{type:ZO.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case I.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return ek(`[ag-ui][legacy] TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let f=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(Hd(d.function.arguments));e.tool_argument&&e.tool_argument in t?(p({...i,[e.state_key]:t[e.tool_argument]}),f=!0):e.tool_argument||(p({...i,[e.state_key]:t}),f=!0)}catch{}}return[{type:ZO.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...f?[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case I.TOOL_CALL_END:{let e=r;return[{type:ZO.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case I.TOOL_CALL_RESULT:{let e=r,t=d[e.toolCallId];return(t===void 0||t===``)&&ek(`[ag-ui][legacy] No usable tool name was seen for tool call '${e.toolCallId}' (${t===void 0?`no TOOL_CALL_START reached this bridge`:`its TOOL_CALL_START carried an empty toolCallName`}), so its result is being bridged with the fabricated action name "unknown". Downstream consumers route on that name.`),[{type:ZO.ActionExecutionResult,actionExecutionId:e.toolCallId,result:$O(e.toolCallId,e.content),actionName:t||`unknown`}]}case I.RAW:return f||(f=!0,ek(`[ag-ui][legacy] Dropping RAW events: the legacy runtime protocol has no equivalent, so the provider payloads they carry do not reach the legacy stream. Reported once per stream.`)),[];case I.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:ZO.MetaEvent,name:e.name,value:e.value}]}case I.STATE_SNAPSHOT:return p(r.snapshot),[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case I.STATE_DELTA:{let c=r,l;try{l=Hl.applyPatch(i,c.delta,!0,!1).newDocument}catch(e){let t=e instanceof Error?e.message:String(e);return ek(`[ag-ui][legacy] Failed to apply state patch:\nCurrent state: ${JSON.stringify(i,null,2)}\nPatch operations: ${JSON.stringify(c.delta,null,2)}\nError: ${t}`),[]}return p(l),[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]}case I.MESSAGES_SNAPSHOT:return c=r.messages,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case I.RUN_STARTED:return[];case I.RUN_FINISHED:{if(c&&(i.messages=c),Object.keys(i).length===0)return[];let r=null;if(c)try{r=nk(c)}catch(e){return[{type:ZO.RunError,message:e.message}]}return[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...r?{messages:r}:{}}),active:!1}]}case I.RUN_ERROR:{let e=r;return[{type:ZO.RunError,message:e.message,code:e.code}]}case I.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case I.STEP_FINISHED:return u=[],l=null,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function nk(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=QO(n.content);if(e){let r={id:n.id,role:n.role,content:e};t.push(r)}if(n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0)for(let e of n.toolCalls){let r;try{r=JSON.parse(e.function.arguments)}catch(t){throw Error(`Failed to parse arguments for tool call '${e.id}' (${e.function.name}): ${t.message}`)}let i={id:e.id,name:e.function.name,arguments:r,parentMessageId:n.id};t.push(i)}}else if(n.role===`tool`){let r=`unknown`;for(let t of e)if(t.role===`assistant`&&t.toolCalls?.length){for(let e of t.toolCalls)if(e.id===n.toolCallId){r=e.function.name;break}}let i={id:n.id,result:$O(n.toolCallId,n.content),actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var rk=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,ik=e=>e===`tool`?`toolCallId`:`messageId`,ak=(e,t,n,r,i)=>{if(r!==void 0&&r!==i)throw Error(`Cannot continue ${e} '${t}': chunk ${n} '${r}' does not match the open stream's ${n} ${i===void 0?`(absent)`:`'${i}'`}.`)},ok=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},sk=(e,t)=>{let n=ok(e,t);return t.rawEvent===void 0?n:{...n,rawEvent:t.rawEvent}},ck=e=>new Set(Object.keys(e.shape)),lk=ck(Cx),uk=ck(Dx),dk=ck(uS),fk=(e,t)=>{let n;for(let r of Object.keys(e))t.has(r)||((n??={})[r]=e[r]);return n},pk=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][transform] ${e} Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)},mk=(e,t,n,r)=>{if(t===void 0||n||e.length===0)return;let i=e[e.length-1],a=Object.keys(t).filter(e=>Object.prototype.hasOwnProperty.call(i,e));a.length>0&&pk(`A ${r} carried ${a.map(e=>`'${e}'`).join(`, `)}, which the synthesized ${String(i.type)} already describes. The synthesized value is kept and the chunk's is dropped — this stage does not judge a described field, so the producer's value cannot be substituted for its own.`),e[e.length-1]={...t,...i}},hk=e=>t=>{let n=FO(e),r=new Map,i=e=>{let t=r.get(e);if(!t)return[];switch(r.delete(e),t.kind){case`text`:{let e={type:I.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:I.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:I.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`REASONING_MESSAGE_END`,e,{messageId:e.messageId}),[e]}}},a=()=>[...r.keys()].flatMap(e=>i(e)),o=(e,t)=>{for(let[n,i]of r)if(i.kind===e&&rk(i)===t)return{owner:n}},s=(e,t,n,i,a)=>{if(t!==void 0){let r=o(e,t);if(r){if(n!==void 0&&n!==r.owner)throw Error(`Cannot continue ${a} '${t}': chunk subagentRunId '${n}' does not match the open stream's subagent '${r.owner??`(the parent agent)`}'.`);return r.owner}return n}if(n!==void 0)return n;if(r.get(void 0)?.kind===e)return;let s=[...r.entries()].filter(([,t])=>t.kind===e);if(s.length===1)return s[0][0];if(s.length>1)throw Error(`Ambiguous ${i}: it carries neither a ${ik(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(Dd(e=>{switch(e.type){case I.TEXT_MESSAGE_START:case I.TEXT_MESSAGE_CONTENT:case I.TEXT_MESSAGE_END:case I.TOOL_CALL_START:case I.TOOL_CALL_ARGS:case I.TOOL_CALL_END:case I.TOOL_CALL_RESULT:case I.STATE_SNAPSHOT:case I.STATE_DELTA:case I.CUSTOM:case I.STEP_STARTED:case I.STEP_FINISHED:case I.REASONING_START:case I.REASONING_MESSAGE_START:case I.REASONING_MESSAGE_CONTENT:case I.REASONING_MESSAGE_END:case I.REASONING_END:return[...i(e.subagentRunId??void 0),e];case I.RUN_STARTED:case I.RUN_FINISHED:case I.RUN_ERROR:case I.MESSAGES_SNAPSHOT:return[...a(),e];case I.RAW:case I.ACTIVITY_SNAPSHOT:case I.ACTIVITY_DELTA:case I.REASONING_ENCRYPTED_VALUE:case I.SUBAGENT_STARTED:return[e];case I.SUBAGENT_FINISHED:case I.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case I.TEXT_MESSAGE_CHUNK:{let t=e,a=fk(e,lk),o=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`text`&&(t.messageId===void 0||t.messageId===c.fields.messageId))ak(`text message`,c.fields.messageId,`role`,t.role,c.fields.role),ak(`text message`,c.fields.messageId,`name`,t.name,c.fields.name),d=c.fields;else{if(l.push(...i(o)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);d={messageId:t.messageId,role:t.role===void 0?`assistant`:t.role,name:t.name,subagentRunId:t.subagentRunId},r.set(o,{kind:`text`,fields:d});let e=ok({type:I.TEXT_MESSAGE_START,messageId:t.messageId,role:d.role,...t.name!==void 0&&{name:t.name},...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:I.TEXT_MESSAGE_CONTENT,messageId:d.messageId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:d.messageId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:I.TEXT_MESSAGE_CONTENT,messageId:d.messageId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`TEXT_MESSAGE_CHUNK`),l}case I.TOOL_CALL_CHUNK:{let t=e,a=fk(e,uk),o=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===c.fields.toolCallId))ak(`tool call`,c.fields.toolCallId,`toolCallName`,t.toolCallName,c.fields.toolCallName),ak(`tool call`,c.fields.toolCallId,`parentMessageId`,t.parentMessageId,c.fields.parentMessageId),d=c.fields;else{if(l.push(...i(o)),t.toolCallId===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallId`);if(t.toolCallName===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallName`);d={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(o,{kind:`tool`,fields:d});let e=ok({type:I.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,...t.parentMessageId!==void 0&&{parentMessageId:t.parentMessageId},...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:I.TOOL_CALL_ARGS,toolCallId:d.toolCallId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:d.toolCallId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:I.TOOL_CALL_ARGS,toolCallId:d.toolCallId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`TOOL_CALL_CHUNK`),l}case I.REASONING_MESSAGE_CHUNK:{let t=e,a=fk(e,dk),o=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===c.fields.messageId))d=c.fields;else{if(l.push(...i(o)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);d={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(o,{kind:`reasoning`,fields:d});let e=ok({type:I.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:I.REASONING_MESSAGE_CONTENT,messageId:d.messageId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:d.messageId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:I.REASONING_MESSAGE_CONTENT,messageId:d.messageId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`REASONING_MESSAGE_CHUNK`),l}}return e.type,[e]}),Ld(()=>{a()}))},gk=Symbol(`agui.strip.drop`);function _k(e){let t=e;for(;;){if(t instanceof iO||t instanceof oO||t instanceof cO||t instanceof vO||t instanceof mO){t=t.unwrap();continue}if(t instanceof gO){t=t.def.in;continue}if(t instanceof bO){t=t.def.getter();continue}return t}}function vk(e){let t=e.def;return typeof t?.discriminator==`string`?t.discriminator:void 0}function yk(e){let t=e,n=Array.isArray(t.def?.values)?t.def.values:t.values?Array.from(t.values):void 0;return n&&n.length===1?n[0]:t.value}function bk(e){let t=_k(e);return t instanceof tO?yk(t):void 0}function xk(e,t,n,r){let i=_k(t);if(i instanceof qD){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=i.shape,a=e,o={},s=i.meta()?.specOpen===!0;for(let e of Object.keys(a)){let i=Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;if(i===void 0){if(s){o[e]=a[e];continue}r.push(`${n}/${e}`);continue}let c=r.length,l=xk(a[e],i,`${n}/${e}`,r);if(l===gk){if(r.length=c,i.safeParse(void 0).success){r.push(`${n}/${e}`);continue}return gk}o[e]=l}return o}if(i instanceof GD){if(!Array.isArray(e))return e;let t=i.element,a=[];return e.forEach((e,i)=>{let o=r.length,s=xk(e,t,`${n}/${i}`,r);if(s===gk){r.length=o,r.push(`${n}/${i}`);return}a.push(s)}),a}if(i instanceof QD){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=i.def.valueType,a=e,o={};for(let e of Object.keys(a)){let i=r.length,s=xk(a[e],t,`${n}/${e}`,r);if(s===gk){r.length=i,r.push(`${n}/${e}`);continue}o[e]=s}return o}if(i instanceof JD){let t=i.options,a=vk(i);if(a!==void 0){if(typeof e!=`object`||!e||Array.isArray(e))return e;let i=e[a];for(let o of t){let t=_k(o);if(!(t instanceof qD))continue;let s=t.shape;if(bk(s[a])===i)return xk(e,o,n,r)}return gk}let o=t.filter(e=>_k(e)instanceof qD),s=typeof e==`object`&&!!e&&!Array.isArray(e);if(o.length>1&&s)return e;for(let i of t){let t=_k(i);if(t instanceof GD&&Array.isArray(e)||t instanceof qD&&s)return xk(e,i,n,r)}return e}return e}function Sk(e,t){let n=[],r=xk(e,t,``,n);if(r===gk)throw Error(`Internal error: the stripper found the whole value unrecognisable, which the schemas are not supposed to allow — schema/stripper mismatch.`);return{value:r,stripped:n}}var Ck=new Set(Object.values(I));function wk(e){return Ck.has(e.type)}var Tk=new Map(gS.options.map(e=>{let t=e.shape;return[String(yk(t.type)),e]})),Ek=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS;function Dk(e){Ek()||console.warn(`[ag-ui][enforce] ${e}`)}var Ok=e=>t=>{let n=FO(e);return t.pipe(Dd(e=>{if(!wk(e))return Dk(`Dropping unrecognised event '${String(e.type)}': no middleware translated it and the protocol does not describe it.`),n?.event(`ENFORCE`,`Unrecognised event dropped:`,e,{type:e.type}),Wu;let t=Tk.get(e.type);if(t===void 0)throw Error(`No validator for recognised event type '${String(e.type)}'`);let{value:r,stripped:i}=Sk(e,t);for(let t of i)Dk(`Removed unrecognised material at '${t}' on ${String(e.type)}. Nothing handled it; see the repo-root DEPRECATIONS.md if it is a retired shape.`);return Sd(t.parse(r))}))};function kk(e){let{value:t,stripped:n}=Sk(nl(e,`RunAgentInput`),Xx);for(let e of n)Dk(`Removed unrecognised material at '${e}' from the outgoing input.`);return Xx.parse(t)}var Ak=class{runNext(e,t){return t.run(e).pipe(hk(!1))}runNextWithState(e,t){let n=DO(e.messages||[]),r=DO(e.state===void 0?{}:e.state),i=new Uu;return BO(e,i,t,[]).subscribe({next:e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)},error:()=>{}}),this.runNext(e,t).pipe(Nd(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:DO(n),state:DO(r)})))}},jk=class extends Ak{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function Mk(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function Nk(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function Pk(e){let t=Mk(e.mimeType);return e.data?{type:t,source:{type:`data`,value:e.data,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e.url?{type:t,source:{type:`url`,value:e.url,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:((typeof process>`u`||!{}.SUPPRESS_TRANSFORMATION_WARNINGS)&&console.warn(`[ag-ui][compat] A binary content part carries only an id ('${e.id??``}') and cannot be converted to a modern media part; a 1.0 peer will not accept it. Provide data or a url. See the repo-root DEPRECATIONS.md.`),e)}function Fk(e,t,n){if(typeof e!=`object`||!e||!(`type`in e)||e.type!==t.type||!(`source`in e))return!1;let r=e.source;return typeof r!=`object`||!r||!(`type`in r)||r.type!==t.source.type||!(`value`in r)||r.value!==t.source.value||!(`mimeType`in r)||r.mimeType!==t.source.mimeType?!1:!n||`metadata`in e&&typeof e.metadata==`object`&&e.metadata!==null&&`filename`in e.metadata&&e.metadata.filename===n}function Ik(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.flatMap(e=>{if(Nk(e)){let n=Pk(e);return n.type!==`binary`&&t.some(t=>Fk(t,n,e.filename))?[]:[n]}return[e]});return{...e,content:n}}var Lk=`THINKING_START`,Rk=`THINKING_END`,zk=`THINKING_TEXT_MESSAGE_START`,Bk=`THINKING_TEXT_MESSAGE_CONTENT`,Vk=`THINKING_TEXT_MESSAGE_END`;function Hk(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Uk={event:[`rawEvent`,`subagentRunId`],[I.RUN_STARTED]:[`parentRunId`,`input`],[I.RUN_FINISHED]:[`result`,`outcome`],[I.RUN_ERROR]:[`usage`],[I.SUBAGENT_FINISHED]:[`result`],[I.TOOL_CALL_START]:[`parentMessageId`],[I.TOOL_CALL_CHUNK]:[`parentMessageId`],[I.TOOL_CALL_RESULT]:[`role`],"RUN_FINISHED.outcome":[`pendingToolCallIds`],"RUN_FINISHED.usage[]":[`provider`,`reasoningTokens`,`cachedInputTokens`,`cacheWriteInputTokens`],RunAgentInput:[`forwardedProps`],Tool:[`parameters`],ResumeEntry:[`payload`],"input content":[`metadata`]},Wk=new Map(Object.entries(Uk).filter(([e])=>Object.values(I).includes(e))),Gk=e=>VO(e,`an absent field`);function Kk(e,t,n,r){if(!Hk(e))return e;let i;for(let a of t)e[a]===null&&(r(n===void 0?`${a}: null`:`${n}.${a}: null`),i??={...e},delete i[a]);return i??e}function qk(e,t,n){if(!Hk(e)||!Array.isArray(e[t]))return e;let r=e[t],i=r.map(n);return i.some((e,t)=>e!==r[t])?{...e,[t]:i}:e}function Jk(e,t){return qk(e,`content`,e=>{if(!Hk(e))return e;switch(e.type){case`image`:case`audio`:case`video`:case`document`:return Kk(e,Uk[`input content`],`${e.type} input content`,t);default:return e}})}function Yk(e,t=Gk){let n=Kk(e,Uk.RunAgentInput,`RunAgentInput`,t);return n=qk(n,`tools`,e=>Kk(e,Uk.Tool,`Tool`,t)),n=qk(n,`resume`,e=>Kk(e,Uk.ResumeEntry,`ResumeEntry`,t)),qk(n,`messages`,e=>Jk(e,t))}var Xk=class extends Ak{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null,this.nullsNoticedThisRun=new Set,this.noticeNullOncePerRun=e=>{this.nullsNoticedThisRun.has(e)||(this.nullsNoticedThisRun.add(e),VO(e,`an absent field`))}}warn(e,t){VO(e,t)}mintedContinuationId(e,t){if(t!==null)return t;let n=OO();return this.warnAside(`Minting a messageId ('${n}') for ${e}: no THINKING opener preceded it, so there was no id to continue. The id is this client's invention, not the producer's, and verification will reject the translated event for naming something nothing opened.`),n}warnAside(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][compat] ${e} Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.nullsNoticedThisRun.clear(),e.messages=e.messages.map(Ik),t.run(e).pipe(Td(e=>this.transformEvent(e)))}transformEvent(e){let t=this.noticeNullOncePerRun;e.type===I.RUN_STARTED&&this.nullsNoticedThisRun.clear(),e=Kk(e,Uk.event,void 0,t);let n=Wk.get(e.type);switch(n&&(e=Kk(e,n,e.type,t)),e.type){case Lk:{this.currentReasoningId=OO();let{title:t,...n}=e;return this.warn(Lk,I.REASONING_START),t!==void 0&&this.warnAside(`Dropping ${Lk}.title ${JSON.stringify(t)}: ${I.REASONING_START} has no title field, so the span's label cannot be carried and nothing downstream can recover it.`),{...n,type:I.REASONING_START,messageId:this.currentReasoningId}}case zk:return this.currentMessageId=OO(),this.warn(zk,I.REASONING_MESSAGE_START),{...e,type:I.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case Bk:{let{delta:t,...n}=e;return this.warn(Bk,I.REASONING_MESSAGE_CONTENT),{...n,type:I.REASONING_MESSAGE_CONTENT,messageId:this.mintedContinuationId(Bk,this.currentMessageId),delta:t}}case Vk:{let t=this.mintedContinuationId(Vk,this.currentMessageId);return this.currentMessageId=null,this.warn(Vk,I.REASONING_MESSAGE_END),{...e,type:I.REASONING_MESSAGE_END,messageId:t}}case Rk:{let t=this.mintedContinuationId(Rk,this.currentReasoningId);return this.currentReasoningId=null,this.warn(Rk,I.REASONING_END),{...e,type:I.REASONING_END,messageId:t}}case I.RUN_FINISHED:{let n=e,r=Kk(n.outcome,Uk[`RUN_FINISHED.outcome`],`RUN_FINISHED.outcome`,t);return qk(r===n.outcome?n:{...n,outcome:r},`usage`,e=>Kk(e,Uk[`RUN_FINISHED.usage[]`],`RUN_FINISHED.usage[]`,t))}case I.MESSAGES_SNAPSHOT:{let t=e;return Array.isArray(t.messages)?{...t,messages:t.messages.map(e=>this.upgradeInboundMessage(e))}:e}case I.RUN_STARTED:{let n=Yk(e.input,t),r=n===e.input?e:{...e,input:n},i=r;return!i.input||!Array.isArray(i.input.messages)?r:{...i,input:{...i.input,messages:i.input.messages.map(e=>this.upgradeInboundMessage(e))}}}default:return e}}upgradeInboundMessage(e){e=Jk(e,this.noticeNullOncePerRun);let t=e.content;return!Array.isArray(t)||!t.some(e=>typeof e==`object`&&!!e&&e.type===`binary`)?e:(this.warn(`binary input content`,`the modern media content parts`),Ik(e))}},Zk=()=>e=>Ad(()=>{let t=new Xk;return e.pipe(Td(e=>t.transformEvent(e)))});function Qk(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}function $k(){return typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS}function eA(e){$k()||console.warn(`[ag-ui][compat] Flattening message content for a <=0.0.39 peer DROPS non-text parts (${e.join(`, `)}). The peer cannot receive them; upgrade it to keep media content. See the repo-root DEPRECATIONS.md.`)}function tA(e){$k()||console.warn(`[ag-ui][compat] Not flattening message content for a <=0.0.39 peer: ${e} content part(s) claim type "text" but carry a malformed 'text' value. That is a defect in the message, not media the peer cannot represent, and a downgrade must not repair it — the content is passed on unchanged so the outgoing enforcement boundary reports it. See the repo-root DEPRECATIONS.md.`)}function nA(e){let t=e.content;if(Array.isArray(t)){let n=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`,r=e=>n(e)&&typeof e.text==`string`,i=t.filter(e=>n(e)&&!r(e));if(i.length>0)return tA(i.length),e;let a=t.filter(e=>!r(e)).map(e=>typeof e==`object`&&e&&`type`in e?String(e.type):typeof e);a.length>0&&eA(a);let o=t.filter(r).map(e=>e.text).join(``);return{...e,content:o}}return typeof t==`string`?e:t===void 0?{...e,content:``}:e}var rA=class extends Ak{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(nA)};return this.runNext(i,t)}},iA=`THINKING_START`,aA=`THINKING_END`,oA=`THINKING_TEXT_MESSAGE_START`,sA=`THINKING_TEXT_MESSAGE_CONTENT`,cA=`THINKING_TEXT_MESSAGE_END`,lA=class extends Ak{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(Td(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case iA:{this.currentReasoningId=OO();let{title:t,...n}=e;return this.warnAboutTransformation(iA,I.REASONING_START),{...n,type:I.REASONING_START,messageId:this.currentReasoningId}}case oA:return this.currentMessageId=OO(),this.warnAboutTransformation(oA,I.REASONING_MESSAGE_START),{...e,type:I.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case sA:{let{delta:t,...n}=e;return this.warnAboutTransformation(sA,I.REASONING_MESSAGE_CONTENT),{...n,type:I.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??OO(),delta:t}}case cA:{let t=this.currentMessageId??OO();return this.warnAboutTransformation(cA,I.REASONING_MESSAGE_END),{...e,type:I.REASONING_MESSAGE_END,messageId:t}}case aA:{let t=this.currentReasoningId??OO();return this.warnAboutTransformation(aA,I.REASONING_END),{...e,type:I.REASONING_END,messageId:t}}default:return e}}},uA=`SUBAGENT_STARTED`,dA=`SUBAGENT_FINISHED`,fA=`SUBAGENT_ERROR`;function pA(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function mA(e){return e.map(e=>pA(e))}var hA=class extends Ak{warnDroppedLifecycleEvent(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let n={...e,messages:(e.messages??[]).map(e=>pA(e))};return this.runNext(n,t).pipe(Bd(e=>{let t=e.type;(t===uA||t===dA||t===fA)&&this.warnDroppedLifecycleEvent(t)}),jd(e=>{let t=e.type;return t!==uA&&t!==dA&&t!==fA}),Td(e=>{let t=pA(e);if(t.type===I.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:mA(e.messages)}}if(t.type===I.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>pA(e))}}}if(t.type===I.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:mA(e.input.messages)}}}return t}))}},gA=`1.0.2`,_A=!1,vA=new WeakSet,yA=(e,t)=>/^\d+\.\d+$/.test(e)?qT(e,t)>0?`newer`:`not-newer`:`uninterpretable`,bA=e=>{let t=e.protocolVersion;if(t!==void 0&&t!==`1.0`)switch(yA(t,`1.0`)){case`uninterpretable`:console.warn(`[ag-ui] The producer declared protocol version '${t}', which this client cannot interpret.`);return;case`newer`:console.warn(`[ag-ui] The producer speaks protocol ${t}; this client speaks 1.0. Unrecognised material will be stripped with warnings.`);return;case`not-newer`:return}},xA=class e{resolvePeerCeiling(t){if(this.resolvingPeerCeiling)return gA;let n=Object.getOwnPropertyDescriptor(this,`maxVersion`),r=Object.getOwnPropertyDescriptor(this,`maxProtocolVersion`),i=Object.getPrototypeOf(this);for(;i&&i!==e.prototype;)n??=Object.getOwnPropertyDescriptor(i,`maxVersion`),r??=Object.getOwnPropertyDescriptor(i,`maxProtocolVersion`),i=Object.getPrototypeOf(i);if(t===`maxVersion`&&n)return gA;let a=t===`maxProtocolVersion`?n:r;if(!a)return gA;this.resolvingPeerCeiling=!0;try{return a.get?a.get.call(this):a.value}finally{this.resolvingPeerCeiling=!1}}get maxProtocolVersion(){return this.resolvePeerCeiling(`maxProtocolVersion`)}get maxVersion(){return!this.resolvingPeerCeiling&&!_A&&(_A=!0,console.warn(`[ag-ui] AbstractAgent.maxVersion is deprecated — use maxProtocolVersion. Same value; the new name says whose version it is and that it is a ceiling.`)),this.resolvePeerCeiling(`maxVersion`)}get debug(){return this._debug}set debug(e){this._debug=PO(e),this._debugLogger=LO(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?LO(PO(!0)):void 0:e}resolvedCeilingDuringConstruction(){let e=this.maxProtocolVersion;if(typeof e!=`string`||!JT(e))throw new L(`maxProtocolVersion resolved to ${JSON.stringify(e)} during construction, which is not a version this client can compare. A ceiling read from an instance field is not available yet — return a literal from the getter.`);return e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.resolvingPeerCeiling=!1,this.agentId=e,this.description=t??``,this.threadId=n??Qc(),this.messages=DO(r??[]),this.state=DO(i??{}),this._debug=PO(a),this._debugLogger=LO(this._debug);let o=this.resolvedCeilingDuringConstruction();qT(o,`0.0.39`)<=0&&this.middlewares.unshift(new rA),qT(o,`0.0.45`)<=0&&this.middlewares.unshift(new lA),qT(o,`0.0.57`)<=0&&this.middlewares.unshift(new hA)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(e=>typeof e==`function`?new jk(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Qc();let n=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle(`LIFECYCLE`,`Run started:`,{agentId:this.agentId,threadId:this.threadId});let r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunStartedEvent:({event:e})=>bA(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];vA.add(n),await this.onInitialize(n,a),this.activeRunDetach$=new Bu;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await wd(ku(()=>[...this.middlewares,new Xk].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),Ok(this.debugLogger),hk(this.debugLogger),HO(this.debugLogger),e=>e.pipe(zd(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),Md(e=>(this.debugLogger?.lifecycle(`LIFECYCLE`,`Run errored:`,{agentId:this.agentId,error:e instanceof Error?e.message:String(e)}),this.isRunning=!1,this.onError(n,e,a))),Ld(()=>{this.debugLogger?.lifecycle(`LIFECYCLE`,`Run finished:`,{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(Sd(null)));let s=DO(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new rl}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Qc();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunStartedEvent:({event:e})=>bA(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new Bu;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await wd(ku(()=>Ad(()=>this.connect(n)),e=>Ok(this.debugLogger)(Zk()(e)),hk(this.debugLogger),HO(this.debugLogger),e=>e.pipe(zd(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),Md(e=>(this.isRunning=!1,e instanceof rl?Wu:this.onError(n,e,a))),Ld(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(Sd(null)),{defaultValue:void 0});let s=DO(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}applyBeforeSourceError(e,t,n){return Ad(()=>{let r,i=t.pipe(Md(e=>(r={error:e},Wu)));return this.processApplyEvents(e,this.apply(e,i,n),n).pipe(Fd(Ad(()=>{let e=r;return e?z(()=>e.error):Wu})))})}apply(e,t,n){return BO(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(Bd(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state!==void 0&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=DO(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Qc(),...qT(this.maxProtocolVersion,gA)>=0&&{protocolVersion:`1.0`},tools:DO(e?.tools??[]),context:DO(e?.context??[]),forwardedProps:DO(e?.forwardedProps??{}),state:DO(this.state),messages:n,...e?.resume===void 0?{}:{resume:DO(e.resume)}}}async onInitialize(e,t){if(vA.has(e)&&this.pendingInterrupts.length>0){let t=new Set((e.resume??[]).map(e=>e.interruptId)),n=this.pendingInterrupts.map(e=>e.id).filter(e=>!t.has(e));if(n.length>0)throw new L(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let t of this.pendingInterrupts)if(Qk(t)&&(e.resume??[]).find(e=>e.interruptId===t.id)?.status!==`cancelled`)throw new L(`Interrupt ${t.id} expired at ${t.expiresAt} and can no longer be answered. Cancel it to continue the thread.`)}let n=await NO(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages.filter(e=>e.role!==`activity`),t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state!==void 0&&(this.state=n.state,e.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}}onError(e,t,n){return xd(NO(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(Td(r=>{let i=r;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0){let e=String(t);if(t.name!==`AbortError`&&t.message!==`Fetch is aborted`&&t.message!==`signal is aborted without reason`&&t.message!==`component unmounted`&&e!==`component unmounted`)throw console.error(`Agent execution failed:`,t),t}return{}}))}async onFinalize(e,t){let n=await NO(t,this.messages,this.state,(t,n,r)=>t.onRunFinalized?.({messages:n,state:r,agent:this,input:e}));(n.messages!==void 0||n.state!==void 0)&&(n.messages!==void 0&&(this.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state!==void 0&&(this.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=DO(this.messages),e.state=DO(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=DO(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if(e.role===`assistant`&&e.toolCalls)for(let t of e.toolCalls)for(let e of this.subscribers)await e.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let e of this.subscribers)await e.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if(t.role===`assistant`&&t.toolCalls)for(let e of t.toolCalls)for(let t of this.subscribers)await t.onNewToolCall?.({toolCall:e,messages:this.messages,state:this.state,agent:this})}for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=DO(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=DO(e),(async()=>{for(let e of this.subscribers)await e.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Qc();let t=this.prepareRunAgentInput(e);return[...this.middlewares,new Xk].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t).pipe(Ok(this.debugLogger),hk(this.debugLogger),HO(this.debugLogger),tk(this.threadId,t.runId,this.agentId),e=>e.pipe(Td(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function SA(e){if(!Array.isArray(e.messages))return e;let t=!1,n=e.messages.map(e=>{if(e.subagentRunId===null){t=!0;let n={...e};return delete n.subagentRunId,n}return e});return t?{...e,messages:n}:e}var CA=class extends xA{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(SA(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new AbortController,this.url=e.url,this.headers=DO(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return XO(WO(()=>this.fetch(this.url,this.requestInit(kk(e)))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=DO(this.headers??{}),e.fetch=this.fetch;let t=new AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}},wA=M.createContext(void 0),TA=e=>{let t=M.useContext(wA);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},EA=({client:e,children:t})=>(M.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,N.jsx)(wA.Provider,{value:e,children:t})),DA={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},OA=new class{#e=DA;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function kA(e){setTimeout(e,0)}var AA=typeof window>`u`||`Deno`in globalThis;function jA(){}function MA(e,t){return typeof e==`function`?e(t):e}function NA(e){return typeof e==`number`&&e>=0&&e!==1/0}function PA(e,t){return Math.max(e+(t||0)-Date.now(),0)}function FA(e,t){return typeof e==`function`?e(t):e}function IA(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==RA(o,t.options))return!1}else if(!BA(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function LA(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(zA(t.options.mutationKey)!==zA(a))return!1}else if(!BA(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function RA(e,t){return(t?.queryKeyHashFn||zA)(e)}function zA(e){return JSON.stringify(e,(e,t)=>GA(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function BA(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n500)return t;let r=WA(e)&&WA(t);if(!r&&!(GA(e)&&GA(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{OA.setTimeout(t,e)})}function JA(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:HA(e,t)}function YA(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function XA(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ZA=Symbol();function QA(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ZA?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function $A(e,t){return typeof e==`function`?e(...t):!!e}function ej(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var tj=()=>AA,nj=()=>tj(),rj=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ij=new class extends rj{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},aj=kA;function oj(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=aj,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var sj=oj(),cj=new class extends rj{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function lj(e){return Math.min(1e3*2**e,3e4)}function uj(e){return(e??`online`)!==`online`||cj.isOnline()}var dj=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function fj(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(jA);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new dj(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>ij.isFocused()&&(e.networkMode===`always`||cj.isOnline())&&e.canRun(),p=()=>uj(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(nj()?0:3),a=e.retryDelay??lj,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&nf()?void 0:g(f)).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var pj=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),NA(this.gcTime)&&(this.#e=OA.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(nj()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(OA.clearTimeout(this.#e),this.#e=void 0)}};function mj(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ej(e,()=>t.signal,()=>n=!0)},u=QA(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?XA:YA;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?gj:hj,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:hj(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function hj(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function gj(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function _j(e,t){return t?hj(e,t)!=null:!1}function vj(e,t){return!t||!e.getPreviousPageParam?!1:gj(e,t)!=null}var yj=class extends pj{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Sj(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Sj(this.options);e.data!==void 0&&(this.setState(xj(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=JA(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(jA).catch(jA):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>FA(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ZA||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>FA(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!PA(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=QA(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?mj(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=fj({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof dj&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof dj){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...bj(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...xj(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),sj.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function bj(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:uj(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function xj(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Sj(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Cj=class extends rj{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Tj(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ej(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ej(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof FA(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!UA(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Dj(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||FA(this.options.enabled,this.#t)!==FA(t.enabled,this.#t)||FA(this.options.staleTime,this.#t)!==FA(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||FA(this.options.enabled,this.#t)!==FA(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return UA(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(jA)),t}#h(e){return!nj()&&FA(this.options.enabled,this.#t)!==!1&&NA(e)}#g(){this.#b();let e=FA(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=PA(this.#r.dataUpdatedAt,e)+1;this.#u=OA.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return FA(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=OA.setInterval(()=>{(this.options.refetchIntervalInBackground||ij.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(OA.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(OA.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Tj(e,t),o=i&&Dj(e,n,t,r);(a||o)&&(l={...l,...bj(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=JA(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=JA(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Oj(e,t),refetch:this.refetch,isEnabled:FA(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),UA(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();sj.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function wj(e,t){return FA(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||FA(t.retryOnMount,e)!==!1)}function Tj(e,t){return wj(e,t)||e.state.data!==void 0&&Ej(e,t,t.refetchOnMount)}function Ej(e,t,n){if(FA(t.enabled,e)!==!1&&FA(t.staleTime,e)!==`static`){let r=FA(n,e);return r===`always`||r!==!1&&Oj(e,t)}return!1}function Dj(e,t,n,r){return(e!==t||FA(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Oj(e,n)}function Oj(e,t){return FA(t.enabled,e)!==!1&&e.isStaleByTime(FA(t.staleTime,e))}var kj=class extends Cj{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:_j(t,n.data),hasPreviousPage:vj(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Aj=class extends pj{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||jj(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=fj({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),sj.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function jj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Mj=class extends rj{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Aj({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Nj(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Nj(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Nj(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Nj(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){sj.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>LA(t,e))}findAll(e={}){return this.getAll().filter(t=>LA(e,t))}notify(e){sj.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return sj.batch(()=>Promise.all(e.map(e=>e.continue().catch(jA))))}};function Nj(e){return e.options.scope?.id}var Pj=class extends rj{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??RA(r,t),a=this.get(i);return a||(a=new yj({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){sj.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>IA(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>IA(e,t)):t}notify(e){sj.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){sj.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){sj.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Fj=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Pj,this.#t=e.mutationCache||new Mj,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ij.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=cj.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(FA(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=MA(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return sj.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;sj.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return sj.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=sj.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(jA).catch(jA)}invalidateQueries(e,t={}){return sj.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=sj.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(jA)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(jA)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(FA(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(FA(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(jA).catch(jA)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(jA).catch(jA)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return cj.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(zA(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{BA(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(zA(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{BA(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=RA(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===ZA&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ij=M.createContext(!1),Lj=()=>M.useContext(Ij);Ij.Provider;function Rj(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var zj=M.createContext(Rj()),Bj=()=>M.useContext(zj),Vj=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?$A(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Hj=e=>{M.useEffect(()=>{e.clearReset()},[e])},Uj=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||$A(n,[e.error,r])),Wj=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Gj=(e,t)=>e?.suspense&&t.isPending,Kj=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function qj(e,t,n){let r=Lj(),i=Bj(),a=TA(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Wj(o),Vj(o,i,s),Hj(i);let[l]=M.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(M.useSyncExternalStore(M.useCallback(e=>{let t=d?l.subscribe(sj.batchCalls(e)):jA;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),M.useEffect(()=>{l.setOptions(o)},[o,l]),Gj(o,u))throw Kj(o,l,i);if(Uj({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Jj(e,t){return qj(e,Cj,t)}function Yj(e,t){return qj(e,kj,t)}var Xj=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M112,56V200L40,128Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z`}))]]),Zj=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z`}))]]),Qj=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,44H160a43.86,43.86,0,0,0-32,13.85A43.86,43.86,0,0,0,96,44H24A12,12,0,0,0,12,56V200a12,12,0,0,0,12,12H96a20,20,0,0,1,20,20,12,12,0,0,0,24,0,20,20,0,0,1,20-20h72a12,12,0,0,0,12-12V56A12,12,0,0,0,232,44ZM96,188H36V68H96a20,20,0,0,1,20,20V192.81A43.79,43.79,0,0,0,96,188Zm124,0H160a43.71,43.71,0,0,0-20,4.83V88a20,20,0,0,1,20-20h60Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,56V200H160a32,32,0,0,0-32,32,32,32,0,0,0-32-32H24V56H96a32,32,0,0,1,32,32,32,32,0,0,1,32-32Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M240,56V200a8,8,0,0,1-8,8H160a24,24,0,0,0-24,23.94,7.9,7.9,0,0,1-5.12,7.55A8,8,0,0,1,120,232a24,24,0,0,0-24-24H24a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H88a32,32,0,0,1,32,32v87.73a8.17,8.17,0,0,0,7.47,8.25,8,8,0,0,0,8.53-8V80a32,32,0,0,1,32-32h64A8,8,0,0,1,240,56Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,50H160a38,38,0,0,0-32,17.55A38,38,0,0,0,96,50H24a6,6,0,0,0-6,6V200a6,6,0,0,0,6,6H96a26,26,0,0,1,26,26,6,6,0,0,0,12,0,26,26,0,0,1,26-26h72a6,6,0,0,0,6-6V56A6,6,0,0,0,232,50ZM96,194H30V62H96a26,26,0,0,1,26,26V204.31A37.86,37.86,0,0,0,96,194Zm130,0H160a37.87,37.87,0,0,0-26,10.32V88a26,26,0,0,1,26-26h66Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,52H160a36,36,0,0,0-32,19.54A36,36,0,0,0,96,52H24a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H96a28,28,0,0,1,28,28,4,4,0,0,0,8,0,28,28,0,0,1,28-28h72a4,4,0,0,0,4-4V56A4,4,0,0,0,232,52ZM96,196H28V60H96a28,28,0,0,1,28,28V209.4A35.93,35.93,0,0,0,96,196Zm132,0H160a35.94,35.94,0,0,0-28,13.41V88a28,28,0,0,1,28-28h68Z`}))]]),$j=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128ZM60,112a16,16,0,1,0,16,16A16,16,0,0,0,60,112Zm136,0a16,16,0,1,0,16,16A16,16,0,0,0,196,112Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M240,96v64a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V96A16,16,0,0,1,32,80H224A16,16,0,0,1,240,96Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V96A16,16,0,0,0,224,80ZM60,140a12,12,0,1,1,12-12A12,12,0,0,1,60,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,196,140Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM60,118a10,10,0,1,0,10,10A10,10,0,0,0,60,118Zm136,0a10,10,0,1,0,10,10A10,10,0,0,0,196,118Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-76-8a8,8,0,1,0,8,8A8,8,0,0,0,60,120Zm136,0a8,8,0,1,0,8,8A8,8,0,0,0,196,120Z`}))]]),eM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),tM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z`}))]]),nM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),rM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M240.49,15.51a12,12,0,0,0-17,0L173.94,65.09l-2.54-2.55a36.05,36.05,0,0,0-50.91,0L100,83l-3.51-3.52a12,12,0,0,0-17,17L83,100,62.54,120.49a36,36,0,0,0,0,50.91l2.55,2.54L15.51,223.51a12,12,0,0,0,17,17l49.57-49.58,2.54,2.55a36.06,36.06,0,0,0,50.91,0L156,173l3.51,3.52a12,12,0,0,0,17-17L173,156l20.49-20.49a36,36,0,0,0,0-50.91l-2.55-2.54,49.58-49.57A12,12,0,0,0,240.49,15.51Zm-121.95,161a12,12,0,0,1-17,0L79.51,154.43a12,12,0,0,1,0-17L100,117l39,39Zm58-57.95h0L156,139l-39-39,20.49-20.49a12,12,0,0,1,17,0l22.06,22.06a12,12,0,0,1,0,17ZM85.27,33.37a12,12,0,0,1,21.46-10.74l8,16A12,12,0,1,1,93.27,49.37Zm-68,57.26a12,12,0,0,1,16.1-5.36l16,8a12,12,0,1,1-10.74,21.46l-16-8A12,12,0,0,1,17.27,90.63Zm221.46,74.74a12,12,0,0,1-16.1,5.36l-16-8a12,12,0,0,1,10.74-21.46l16,8A12,12,0,0,1,238.73,165.37Zm-68,57.26a12,12,0,1,1-21.46,10.74l-8-16a12,12,0,0,1,21.46-10.74Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M185,127,127,185a24,24,0,0,1-33.94,0L71,162.91A24,24,0,0,1,71,129L129,71a24,24,0,0,1,33.94,0L185,93.09A24,24,0,0,1,185,127Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32.06,32.06,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94h0L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22a16,16,0,0,1,0,22.63ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM29,103.43l20,8A8,8,0,1,0,55,96.57l-20-8A8,8,0,0,0,29,103.43ZM227,152.57l-20-8A8,8,0,1,0,201,159.43l20,8A8,8,0,0,0,227,152.57ZM159.43,201A8,8,0,0,0,144.57,207l8,20A8,8,0,1,0,167.43,221ZM237.91,18.52a8,8,0,0,0-11.5-.18L174,70.75l-5.38-5.38a32,32,0,0,0-45.28,0L106.14,82.54a4,4,0,0,0,0,5.66l61.7,61.66a4,4,0,0,0,5.66,0l16.74-16.74a32.76,32.76,0,0,0,9.81-22.52,31.82,31.82,0,0,0-9.37-23.17l-5.38-5.37,52.2-52.17A8.22,8.22,0,0,0,237.91,18.52ZM85.64,90.34a8,8,0,0,0-11.49.18,8.22,8.22,0,0,0,.41,11.37L80.67,108,65.34,123.31A31.82,31.82,0,0,0,56,146.47,32.75,32.75,0,0,0,65.77,169l5,4.94L18.49,226.13a8.21,8.21,0,0,0-.61,11.1,8,8,0,0,0,11.72.43L82,185.25l5.37,5.38a32.1,32.1,0,0,0,45.29,0L148,175.31l6.34,6.35a8,8,0,0,0,11.32-11.32Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M236.24,19.76a6,6,0,0,0-8.48,0L173.94,73.57l-6.79-6.78a30,30,0,0,0-42.42,0L100,91.51l-7.76-7.75a6,6,0,0,0-8.48,8.48L91.51,100,66.79,124.73a30,30,0,0,0,0,42.42l6.78,6.79L19.76,227.76a6,6,0,1,0,8.48,8.48l53.82-53.81,6.79,6.78a30,30,0,0,0,42.42,0L156,164.49l7.76,7.75a6,6,0,0,0,8.48-8.48L164.49,156l24.72-24.73a30,30,0,0,0,0-42.42l-6.78-6.79,53.81-53.82A6,6,0,0,0,236.24,19.76Zm-113.45,161a18,18,0,0,1-25.46,0L75.27,158.67a18,18,0,0,1,0-25.46L100,108.49,147.51,156Zm57.94-57.94L156,147.51,108.49,100l24.72-24.73a18,18,0,0,1,25.46,0l22.06,22.06a18,18,0,0,1,0,25.46ZM90.43,34.23a6,6,0,0,1,11.14-4.46l8,20a6,6,0,1,1-11.14,4.46Zm-64,59.54a6,6,0,0,1,7.8-3.34l20,8a6,6,0,1,1-4.46,11.14l-20-8A6,6,0,0,1,26.43,93.77Zm203.14,68.46a6,6,0,0,1-7.8,3.34l-20-8a6,6,0,0,1,4.46-11.14l20,8A6,6,0,0,1,229.57,162.23Zm-64,59.54a6,6,0,1,1-11.14,4.46l-8-20a6,6,0,0,1,11.14-4.46Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32,32,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22A16,16,0,0,1,179.31,121.37ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M234.83,21.17a4,4,0,0,0-5.66,0L173.94,76.4l-8.2-8.2a28,28,0,0,0-39.6,0L100,94.34l-9.17-9.17a4,4,0,0,0-5.66,5.66L94.34,100,68.2,126.14a28,28,0,0,0,0,39.6l8.2,8.2L21.17,229.17a4,4,0,0,0,5.66,5.66L82.06,179.6l8.2,8.2a28,28,0,0,0,39.6,0L156,161.66l9.17,9.17a4,4,0,0,0,5.66-5.66L161.66,156l26.14-26.14a28,28,0,0,0,0-39.6l-8.2-8.2,55.23-55.23A4,4,0,0,0,234.83,21.17Zm-110.63,161a20,20,0,0,1-28.28,0L73.86,160.08a20,20,0,0,1,0-28.28L100,105.66,150.34,156Zm57.94-57.94L156,150.34,105.66,100,131.8,73.86a20,20,0,0,1,28.28,0l22.06,22.06A20,20,0,0,1,182.14,124.2ZM92.29,33.49a4,4,0,1,1,7.42-3l8,20a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,104,56a4,4,0,0,1-3.71-2.51Zm-64,61a4,4,0,0,1,5.2-2.22l20,8A4,4,0,0,1,52,108a3.91,3.91,0,0,1-1.49-.29l-20-8A4,4,0,0,1,28.29,94.51Zm199.42,67A4,4,0,0,1,224,164a3.91,3.91,0,0,1-1.49-.29l-20-8a4,4,0,1,1,3-7.42l20,8A4,4,0,0,1,227.71,161.49Zm-64,61a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,160,228a4,4,0,0,1-3.71-2.51l-8-20a4,4,0,0,1,7.42-3Z`}))]]),iM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),aM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z`}))]]),oM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M194.82,151.43l-55.09,20.3-20.3,55.09a7.92,7.92,0,0,1-14.86,0l-20.3-55.09-55.09-20.3a7.92,7.92,0,0,1,0-14.86l55.09-20.3,20.3-55.09a7.92,7.92,0,0,1,14.86,0l20.3,55.09,55.09,20.3A7.92,7.92,0,0,1,194.82,151.43Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M208,144a15.78,15.78,0,0,1-10.42,14.94L146,178l-19,51.62a15.92,15.92,0,0,1-29.88,0L78,178l-51.62-19a15.92,15.92,0,0,1,0-29.88L78,110l19-51.62a15.92,15.92,0,0,1,29.88,0L146,110l51.62,19A15.78,15.78,0,0,1,208,144ZM152,48h16V64a8,8,0,0,0,16,0V48h16a8,8,0,0,0,0-16H184V16a8,8,0,0,0-16,0V32H152a8,8,0,0,0,0,16Zm88,32h-8V72a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0V96h8a8,8,0,0,0,0-16Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M196.89,130.94,144.4,111.6,125.06,59.11a13.92,13.92,0,0,0-26.12,0L79.6,111.6,27.11,130.94a13.92,13.92,0,0,0,0,26.12L79.6,176.4l19.34,52.49a13.92,13.92,0,0,0,26.12,0L144.4,176.4l52.49-19.34a13.92,13.92,0,0,0,0-26.12Zm-4.15,14.86-55.08,20.3a6,6,0,0,0-3.56,3.56l-20.3,55.08a1.92,1.92,0,0,1-3.6,0L89.9,169.66a6,6,0,0,0-3.56-3.56L31.26,145.8a1.92,1.92,0,0,1,0-3.6l55.08-20.3a6,6,0,0,0,3.56-3.56l20.3-55.08a1.92,1.92,0,0,1,3.6,0l20.3,55.08a6,6,0,0,0,3.56,3.56l55.08,20.3a1.92,1.92,0,0,1,0,3.6ZM146,40a6,6,0,0,1,6-6h18V16a6,6,0,0,1,12,0V34h18a6,6,0,0,1,0,12H182V64a6,6,0,0,1-12,0V46H152A6,6,0,0,1,146,40ZM246,88a6,6,0,0,1-6,6H230v10a6,6,0,0,1-12,0V94H208a6,6,0,0,1,0-12h10V72a6,6,0,0,1,12,0V82h10A6,6,0,0,1,246,88Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M196.2,132.81l-53.36-19.65L123.19,59.8a11.93,11.93,0,0,0-22.38,0L81.16,113.16,27.8,132.81a11.93,11.93,0,0,0,0,22.38l53.36,19.65,19.65,53.36a11.93,11.93,0,0,0,22.38,0l19.65-53.36,53.36-19.65a11.93,11.93,0,0,0,0-22.38Zm-2.77,14.87L138.35,168a4,4,0,0,0-2.37,2.37l-20.3,55.08a3.92,3.92,0,0,1-7.36,0L88,170.35A4,4,0,0,0,85.65,168l-55.08-20.3a3.92,3.92,0,0,1,0-7.36L85.65,120A4,4,0,0,0,88,117.65l20.3-55.08a3.92,3.92,0,0,1,7.36,0L136,117.65a4,4,0,0,0,2.37,2.37l55.08,20.3a3.92,3.92,0,0,1,0,7.36ZM148,40a4,4,0,0,1,4-4h20V16a4,4,0,0,1,8,0V36h20a4,4,0,0,1,0,8H180V64a4,4,0,0,1-8,0V44H152A4,4,0,0,1,148,40Zm96,48a4,4,0,0,1-4,4H228v12a4,4,0,0,1-8,0V92H208a4,4,0,0,1,0-8h12V72a4,4,0,0,1,8,0V84h12A4,4,0,0,1,244,88Z`}))]]),sM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z`}))]]),cM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z`}))]]),lM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M256,136a12,12,0,0,1-12,12h-8v8a12,12,0,0,1-24,0v-8h-8a12,12,0,0,1,0-24h8v-8a12,12,0,0,1,24,0v8h8A12,12,0,0,1,256,136Zm-54.81,56.28a12,12,0,1,1-18.38,15.44C169.12,191.42,145,172,108,172c-28.89,0-55.46,12.68-74.81,35.72a12,12,0,0,1-18.38-15.44A124.08,124.08,0,0,1,63.5,156.53a72,72,0,1,1,89,0A124,124,0,0,1,201.19,192.28ZM108,148a48,48,0,1,0-48-48A48.05,48.05,0,0,0,108,148Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136ZM144,157.68a68,68,0,1,0-71.9,0c-20.65,6.76-39.23,19.39-54.17,37.17A8,8,0,0,0,24,208H192a8,8,0,0,0,6.13-13.15C183.18,177.07,164.6,164.44,144,157.68Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M254,136a6,6,0,0,1-6,6H230v18a6,6,0,0,1-12,0V142H200a6,6,0,0,1,0-12h18V112a6,6,0,0,1,12,0v18h18A6,6,0,0,1,254,136Zm-57.41,60.14a6,6,0,1,1-9.18,7.72C166.9,179.45,138.69,166,108,166s-58.89,13.45-79.41,37.86a6,6,0,0,1-9.18-7.72C35.14,177.41,55,164.48,77,158.25a66,66,0,1,1,62,0C161,164.48,180.86,177.41,196.59,196.14ZM108,154a54,54,0,1,0-54-54A54.06,54.06,0,0,0,108,154Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M252,136a4,4,0,0,1-4,4H228v20a4,4,0,0,1-8,0V140H200a4,4,0,0,1,0-8h20V112a4,4,0,0,1,8,0v20h20A4,4,0,0,1,252,136Zm-56.94,61.43a4,4,0,0,1-6.12,5.14C168,177.7,139.3,164,108,164s-60,13.7-80.94,38.57a4,4,0,1,1-6.12-5.14c16.71-19.9,38.13-33.13,61.89-38.59a64,64,0,1,1,50.34,0C156.93,164.3,178.35,177.53,195.06,197.43ZM108,156a56,56,0,1,0-56-56A56.06,56.06,0,0,0,108,156Z`}))]]),uM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:Xj}));uM.displayName=`ArrowLeftIcon`;var dM=uM,fM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:Zj}));fM.displayName=`ArrowRightIcon`;var pM=fM,mM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:Qj}));mM.displayName=`BookOpenIcon`;var hM=mM,gM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:$j}));gM.displayName=`DotsThreeIcon`;var _M=gM,vM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:eM}));vM.displayName=`MagnifyingGlassIcon`;var yM=vM,bM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:tM}));bM.displayName=`MoonIcon`;var xM=bM,SM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:nM}));SM.displayName=`PencilSimpleIcon`;var CM=SM,wM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:rM}));wM.displayName=`PlugsConnectedIcon`;var TM=wM,EM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:iM}));EM.displayName=`PlusIcon`;var DM=EM,OM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:aM}));OM.displayName=`SignOutIcon`;var kM=OM,AM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:oM}));AM.displayName=`SparkleIcon`;var jM=AM,MM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:sM}));MM.displayName=`SunIcon`;var NM=MM,PM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:cM}));PM.displayName=`TrashIcon`;var FM=PM,IM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:lM}));IM.displayName=`UserPlusIcon`;var LM=IM,RM=class extends Error{status;problems;code;constructor(e,t,n=[],r=``){super(e),this.status=t,this.problems=n,this.code=r}},zM=`fanout:unauthorized`;function BM(){let e=new URLSearchParams(window.location.search).get(`return_to`);if(!e)return``;let t=new URL(e,window.location.origin);return t.origin!==window.location.origin||t.pathname!==`/api/auth/oauth/authorize`?``:`${t.pathname}${t.search}`}function VM(e){return!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||e.id===``?`none`:`user`}function HM(){window.dispatchEvent(new Event(zM))}async function UM(e,t={}){let n=new Headers(t.headers);n.set(`Fanout-Request`,`1`);let r=await fetch(e,{...t,headers:n,credentials:`same-origin`});if(r.status===401&&HM(),r.status===403){let e=await r.clone().json().catch(()=>({}));throw new RM(e.message??`You do not have permission to perform this action.`,r.status,[],e.code??``)}return r}async function WM(){let e=await UM(`/api/auth/logout`,{method:`POST`});if(!e.ok&&e.status!==401)throw Error(`Sign-out failed — your session is still active.`);e.status!==401&&HM(),window.location.assign(`/`)}var GM=(0,M.createContext)(null);function KM(){let e=(0,M.useContext)(GM);if(!e)throw Error(`Fanout runtime status is unavailable`);return e}var qM=(0,M.createContext)(null);function JM(){let e=(0,M.useContext)(qM);if(!e)throw Error(`Fanout viewer is unavailable`);return e}function YM(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||t.id===``||t.status!==`active`&&t.status!==`suspended`?null:{id:t.id,email:typeof t.email==`string`?t.email:``,display_name:typeof t.display_name==`string`?t.display_name:``,status:t.status,role:typeof t.role==`string`?t.role:``}}async function XM(e,t){let n=await fetch(e,{method:t===void 0?`GET`:`POST`,headers:t===void 0?void 0:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t),credentials:`same-origin`}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.message??`Request failed (${n.status})`);return r}function ZM({children:e,wide:t=!1}){return(0,N.jsx)(u,{mih:`100dvh`,style:{background:`radial-gradient(circle at 50% -12%, var(--mantine-color-brand-light), transparent 38%), linear-gradient(180deg, var(--mantine-color-default-hover), var(--mantine-color-body) 62%)`},children:(0,N.jsx)(je,{mih:`100dvh`,px:`md`,py:48,children:(0,N.jsx)(ve,{size:t?680:480,w:`100%`,children:(0,N.jsx)(Fe,{radius:28,p:{base:24,sm:40},style:{background:`var(--mantine-color-body)`,border:`1px solid var(--mantine-color-default-border)`,boxShadow:`var(--mantine-shadow-xl)`},children:e})})})})}function QM(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`setup_token`)??``}function $M(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`login_token`)??``}function eN({children:e}){let t=ze(),[n,r]=(0,M.useState)(null),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(`none`),[c,l]=(0,M.useState)(null),[d,f]=(0,M.useState)(!1),[p,m]=(0,M.useState)(``),[h,g]=(0,M.useState)(``),[_,v]=(0,M.useState)(QM),[y,b]=(0,M.useState)($M),[x,S]=(0,M.useState)(``),[C,w]=(0,M.useState)(!1),[T,ee]=(0,M.useState)(0),[E,D]=(0,M.useState)(()=>Date.now()),[O,te]=(0,M.useState)(!1),[re,k]=(0,M.useState)(``),[ie,ae]=(0,M.useState)(null),[se,le]=(0,M.useState)(!1),de=(0,M.useRef)(null),fe=BM(),pe=o===`user`;async function he(){let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok){s(`none`),l(null);return}let t=await e.json().catch(()=>null);s(VM(t)),l(YM(t))}async function ge(){try{let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok)return;l(YM(await e.json().catch(()=>null)))}catch{}}(0,M.useEffect)(()=>{let e=new URL(window.location.href);(e.searchParams.has(`setup_token`)||e.searchParams.has(`login_token`))&&(e.searchParams.delete(`setup_token`),e.searchParams.delete(`login_token`),t({href:e.pathname+e.search+e.hash,replace:!0}))},[t]),(0,M.useEffect)(()=>{XM(`/api/auth/status`).then(r).catch(e=>k(String(e))).finally(()=>a(!0)),he().catch(()=>s(`none`)).finally(()=>f(!0));let e=()=>{s(`none`),l(null)};return window.addEventListener(zM,e),()=>window.removeEventListener(zM,e)},[]),(0,M.useEffect)(()=>{d&&o===`none`&&y&&(te(!0),k(``),XM(`/api/auth/link/verify`,{token:y}).then(()=>{s(`user`),ge()}).catch(e=>k(e instanceof Error?e.message:String(e))).finally(()=>{b(``),te(!1)}))},[y,d,o]),(0,M.useEffect)(()=>{pe&&d&&fe&&window.location.replace(fe)},[pe,fe,d]),(0,M.useEffect)(()=>{if(T<=Date.now())return;let e=setInterval(()=>{D(Date.now()),Date.now()>=T&&clearInterval(e)},1e3);return()=>clearInterval(e)},[T]);let _e=Math.max(0,Math.ceil((T-E)/1e3));(0,M.useEffect)(()=>{C&&!O&&re&&de.current?.querySelector(`input`)?.focus()},[O,C,re]);async function ve(e){try{await navigator.clipboard.writeText(e),le(!0)}catch{k(`Clipboard access failed. Select and copy the token manually.`)}}if(ie?.ingest_token)return(0,N.jsx)(ZM,{wide:!0,children:(0,N.jsxs)(oe,{gap:`lg`,children:[(0,N.jsx)(ke,{}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(ue,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Setup complete`}),(0,N.jsx)(xe,{order:1,mt:`xs`,fz:{base:28,sm:32},lh:1.08,children:`Save your ingest token`})]}),(0,N.jsx)(ue,{c:`dimmed`,children:`Fanout shows this token once. Store it with your collector secrets before continuing.`}),(0,N.jsxs)(oe,{gap:`xs`,children:[(0,N.jsx)(ue,{size:`sm`,fw:600,children:`OTLP endpoint`}),(0,N.jsx)(ms,{block:!0,children:ie.suggested_endpoint??window.location.origin})]}),(0,N.jsxs)(oe,{gap:`xs`,children:[(0,N.jsx)(ue,{size:`sm`,fw:600,children:`Header`}),(0,N.jsxs)(ms,{block:!0,children:[ie.ingest_header_name??`Authorization`,`: Bearer `,ie.ingest_token]})]}),re&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re}),(0,N.jsxs)(ne,{grow:!0,align:`stretch`,children:[(0,N.jsx)(ce,{variant:`light`,radius:`md`,leftSection:se?(0,N.jsx)(me,{size:16,weight:`bold`}):(0,N.jsx)(Ee,{size:16}),onClick:()=>void ve(`${ie.ingest_header_name??`Authorization`}: Bearer ${ie.ingest_token}`),children:se?`Copied`:`Copy header`}),(0,N.jsx)(ce,{radius:`md`,rightSection:(0,N.jsx)(pM,{size:16,weight:`bold`}),onClick:()=>{s(`user`),ae(null),ge()},children:`Continue to Fanout`})]}),(0,N.jsx)(ce,{variant:`subtle`,size:`compact-xs`,onClick:()=>void ve(ie.ingest_token??``),children:`Copy token only`})]})});if(!d||!i||y)return(0,N.jsx)(je,{mih:`100dvh`,children:(0,N.jsx)(Ie,{size:`sm`})});if(!n)return(0,N.jsx)(ZM,{children:(0,N.jsxs)(oe,{gap:`lg`,children:[(0,N.jsx)(ke,{}),(0,N.jsx)(xe,{order:1,children:`Fanout is unavailable`}),(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re||`Authentication status could not be loaded.`})]})});if(pe&&fe)return null;if(pe)return(0,N.jsx)(GM.Provider,{value:n,children:(0,N.jsx)(qM.Provider,{value:c??{id:``,email:p,display_name:h,status:`active`,role:``},children:e})});if(n&&!n.setup_required&&n.auth_mode===`oidc`){let e=fe?`/api/auth/oidc/start?return_to=${encodeURIComponent(fe)}`:`/api/auth/oidc/start`;return(0,N.jsx)(ZM,{children:(0,N.jsxs)(oe,{gap:28,children:[(0,N.jsx)(ke,{}),(0,N.jsxs)(oe,{gap:10,children:[(0,N.jsx)(ue,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Secure workspace`}),(0,N.jsx)(xe,{order:1,fz:{base:28,sm:32},lh:1.08,children:`Sign in`}),(0,N.jsx)(ue,{c:`dimmed`,size:`md`,lh:1.6,children:`Use your organization's identity provider to continue.`})]}),re&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re}),(0,N.jsx)(ce,{component:`a`,href:e,size:`md`,radius:`md`,rightSection:(0,N.jsx)(pM,{size:17,weight:`bold`}),children:`Continue with SSO`})]})})}async function ye(){te(!0),k(``);try{await XM(`/api/auth/code/send`,{email:p}),w(!0),S(``),ee(Date.now()+3e4),D(Date.now())}catch(e){k(e instanceof Error?e.message:String(e))}finally{te(!1)}}async function A(e){te(!0),k(``);try{await XM(`/api/auth/code/verify`,{email:p,code:e}),s(`user`),w(!1),S(``),ee(0),ge()}catch(e){S(``),k(e instanceof Error?e.message:String(e))}finally{te(!1)}}function j(){w(!1),S(``),k(``)}async function be(e){e.preventDefault(),te(!0),k(``);try{if(n?.setup_required){let e=await XM(`/api/auth/setup`,{email:p,display_name:h,setup_token:_});e.ingest_token?ae(e):(s(`user`),ge())}else if(C){await A(x);return}else{await ye();return}}catch(e){k(e instanceof Error?e.message:String(e))}finally{te(!1)}}let Se=C&&!n?.setup_required,we=n?.setup_required?`Create the first admin`:Se?`Check your email`:n?.self_signup?`Sign in or create an account`:`Sign in`,Te=n?.setup_required?`Use the one-time token printed by the Fanout process.`:n?.smtp_configured?Se?`We sent a code to ${p}.`:n?.self_signup?`Enter your email to sign in or create a viewer account. No password needed.`:`Enter your email and we’ll send a short verification code. No password needed.`:`Email delivery is not configured. Ask the operator to run fanout login-link with your email address.`;return(0,N.jsx)(ZM,{children:(0,N.jsxs)(oe,{gap:28,children:[(0,N.jsx)(ke,{}),(0,N.jsxs)(oe,{gap:10,children:[(0,N.jsx)(ue,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:n?.setup_required?`One-time setup`:`Secure workspace`}),(0,N.jsx)(xe,{order:1,fz:{base:28,sm:32},lh:1.08,children:we}),Te&&(0,N.jsx)(ue,{c:`dimmed`,size:`md`,lh:1.6,maw:390,children:Te})]}),(0,N.jsx)(`form`,{onSubmit:be,children:(0,N.jsxs)(oe,{gap:`md`,children:[(0,N.jsx)(Gc,{label:`Email`,placeholder:`you@company.com`,type:`email`,required:!0,value:p,onChange:e=>m(e.currentTarget.value),disabled:C,variant:`filled`,radius:`md`,size:`md`,autoFocus:!C}),n?.setup_required&&(0,N.jsx)(Gc,{label:`Display name`,placeholder:`Your display name`,value:h,onChange:e=>g(e.currentTarget.value),variant:`filled`,radius:`md`,size:`md`}),n?.setup_required&&(0,N.jsx)(Gc,{label:`Setup token`,placeholder:`from the setup URL printed at startup`,required:!0,value:_,onChange:e=>v(e.currentTarget.value),autoComplete:`one-time-code`,variant:`filled`,radius:`md`,size:`md`}),Se&&(0,N.jsxs)(oe,{gap:`xs`,children:[(0,N.jsx)(ue,{size:`sm`,fw:600,children:`Verification code`}),(0,N.jsx)(u,{ref:de,children:(0,N.jsx)(Wc,{length:6,type:`number`,oneTimeCode:!0,autoFocus:!0,value:x,onChange:S,onComplete:e=>void A(e),disabled:O,error:!!re,size:`md`,radius:`md`,"aria-label":`Verification code`,getInputProps:e=>({"aria-label":`Digit ${e+1}`})})}),(0,N.jsxs)(ne,{justify:`space-between`,gap:`xs`,children:[(0,N.jsxs)(ue,{c:`dimmed`,size:`xs`,children:[`Sent to `,p]}),(0,N.jsx)(ce,{variant:`subtle`,size:`compact-xs`,leftSection:(0,N.jsx)(dM,{size:12,weight:`bold`}),onClick:j,disabled:O,children:`Change email`})]}),(0,N.jsxs)(ne,{justify:`space-between`,gap:`xs`,children:[(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,children:`Codes expire in 5 minutes`}),(0,N.jsx)(ce,{variant:`subtle`,size:`compact-xs`,onClick:()=>void ye(),disabled:O||_e>0,children:_e>0?`Resend in ${_e}s`:`Resend code`})]})]}),re&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re}),Se?(0,N.jsx)(ce,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:O,disabled:O||x.length<6,rightSection:(0,N.jsx)(pM,{size:17,weight:`bold`}),children:`Verify code`}):(0,N.jsx)(ce,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:O,disabled:!n||!n.setup_required&&!n.smtp_configured,leftSection:n?.setup_required?(0,N.jsx)(LM,{size:17,weight:`bold`}):void 0,rightSection:n?.setup_required?void 0:(0,N.jsx)(pM,{size:17,weight:`bold`}),children:n?.setup_required?`Create admin`:`Send code`})]})})]})})}var tN=[`agent-threads`];async function nN(e){let t=await UM(e);if(!t.ok)throw Error(`Request failed (${t.status})`);return t.json()}var rN=[];for(let e=0;e<256;++e)rN.push((e+256).toString(16).slice(1));function iN(e,t=0){return(rN[e[t+0]]+rN[e[t+1]]+rN[e[t+2]]+rN[e[t+3]]+`-`+rN[e[t+4]]+rN[e[t+5]]+`-`+rN[e[t+6]]+rN[e[t+7]]+`-`+rN[e[t+8]]+rN[e[t+9]]+`-`+rN[e[t+10]]+rN[e[t+11]]+rN[e[t+12]]+rN[e[t+13]]+rN[e[t+14]]+rN[e[t+15]]).toLowerCase()}var aN=new Uint8Array(16);function oN(){return crypto.getRandomValues(aN)}var sN={};function cN(e,t,n){let r;if(e)r=uN(e.random??e.rng?.()??oN(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=oN();lN(sN,e,i),r=uN(i,sN.msecs,sN.seq,t,n)}return t??iN(r)}function lN(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=dN(n),e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function uN(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=dN(e),r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}function dN(e){return(e[6]&127)<<24|e[7]<<16|e[8]<<8|e[9]}function fN(){return cN()}var pN=[`dashboards`],mN=3e4;async function hN(e,t){let{json:n,...r}=t??{},i=new Headers(r.headers),a=r.body;n!==void 0&&(i.set(`content-type`,`application/json`),a=JSON.stringify(n));let o=await UM(e,{...r,headers:i,body:a}),s=await o.json().catch(()=>({}));if(!o.ok)throw new RM(s.message??`Request failed (${o.status})`,o.status,s.problems??[],s.code??``);return s}var gN=e=>`/api/dashboards/${encodeURIComponent(e)}`,_N=()=>hN(`/api/dashboards`).then(e=>e.dashboards),vN=(e,t)=>hN(gN(e),{signal:t}),yN=(e,t)=>hN(`${gN(e)}/versions`,{signal:t}).then(e=>e.versions),bN=(e,t,n)=>hN(`${gN(e)}/versions/${t}`,{signal:n}),xN=(e,t)=>hN(`${gN(e)}/versions/${t}/restore`,{method:`POST`}),SN=(e,t,n,r)=>hN(gN(e),{method:`PUT`,json:{spec:t,base_version:n,message:r}}),CN=(e,t,n,r)=>hN(gN(e),{method:`PATCH`,json:{operations:t,base_version:n,message:r}}),wN=(e,t)=>hN(`/api/panels/query`,{method:`POST`,json:e,signal:t}).then(e=>e.results),TN=e=>hN(`/api/telemetry/schema`,{signal:e}),EN=(e,t)=>hN(`/api/annotations`,{method:`POST`,json:e,signal:t}),DN=(e,t)=>hN(`/api/panels/variables/resolve`,{method:`POST`,json:e,signal:t}).then(e=>e.options),ON=(e,t)=>hN(`/api/panels/exemplars`,{method:`POST`,json:e,signal:t});function kN(e,t){let n=new URLSearchParams({namespace:e.namespace??``,from:e.window_from,to:e.window_to,limit:`200`});return hN(`/api/traces/${encodeURIComponent(e.trace_id??``)}?${n}`,{signal:t})}function AN(){let{setColorScheme:e}=Br(),t=Ur(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`,[r,i]=(0,M.useState)(!1);return(0,N.jsx)(Ot,{label:`Switch to ${n} theme`,opened:r,children:(0,N.jsx)(Pi,{variant:`subtle`,color:`gray`,"aria-label":`Switch to ${n} theme`,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onFocus:()=>i(!0),onBlur:()=>i(!1),onClick:()=>{i(!1),e(n)},children:t===`dark`?(0,N.jsx)(NM,{size:17,weight:`bold`}):(0,N.jsx)(xM,{size:17,weight:`bold`})})})}var jN={home:`https://fanout.run/start/what-fanout-is`,ingest:`https://fanout.run/start/send-telemetry`};async function MN(e,t){let n=new URLSearchParams({page_size:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await UM(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function NN({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=TA(),[f,p]=(0,M.useState)(``),[m]=pr(f.trim(),250),[h,g]=(0,M.useState)(null),[_,v]=(0,M.useState)(null),[y,b]=(0,M.useState)(``),[x,S]=(0,M.useState)(``),[w,T]=(0,M.useState)(!1),ee=(0,M.useRef)(null);(0,M.useImperativeHandle)(u,()=>({focusSearch:()=>ee.current?.focus()}),[]),(0,M.useEffect)(()=>{r&&requestAnimationFrame(()=>ee.current?.focus())},[r]);let E=Yj({queryKey:[...tN,m],queryFn:({pageParam:e})=>MN(m,e),initialPageParam:``,getNextPageParam:e=>e.next_cursor??void 0,enabled:e}),D=Jj({queryKey:pN,queryFn:_N,refetchInterval:3e4,staleTime:mN}),O=(0,M.useMemo)(()=>E.data?.pages.flatMap(e=>e.items)??[],[E.data]),te=(0,M.useMemo)(()=>zN(O),[O]),re=Jj({queryKey:[`telemetry-schema`,`1h`],queryFn:()=>nN(`/api/telemetry/schema?window=1h`),enabled:!!m&&!!l,staleTime:6e4}),k=(0,M.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(re.data?.services??[]).map(e=>e.value).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[re.data,m]),ie=(0,M.useMemo)(()=>{let e=D.data??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[D.data,m]);function ae(e){S(``),b(e.title),g(e)}async function se(){if(h&&y.trim()){T(!0),S(``);try{let e=await UM(`/api/agent/threads/${encodeURIComponent(h.id)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:y.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:tN}),g(null)}catch(e){S(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{T(!1)}}}async function le(){if(_){T(!0),S(``);try{let e=await UM(`/api/agent/threads/${encodeURIComponent(_.id)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.id;v(null),await d.invalidateQueries({queryKey:tN}),await d.invalidateQueries({queryKey:pN}),o(t)}catch(e){S(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{T(!1)}}}return(0,N.jsxs)(oe,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,N.jsx)(ce,{leftSection:(0,N.jsx)(DM,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,N.jsx)(wt,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,N.jsxs)(oe,{gap:`lg`,pb:`sm`,children:[e&&(0,N.jsxs)(oe,{gap:4,children:[(0,N.jsx)(PN,{children:`Chats`}),E.isLoading&&(0,N.jsx)(je,{py:`md`,children:(0,N.jsx)(Ie,{size:`xs`})}),E.isError&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!E.isLoading&&!E.isError&&O.length===0&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),te.map(e=>(0,N.jsxs)(oe,{gap:2,children:[te.length>1&&(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,N.jsx)(FN,{thread:e,active:e.id===t,onSelect:()=>a(e.id),onRename:()=>ae(e),onDelete:()=>{S(``),v(e)}},e.id))]},e.label)),E.hasNextPage&&(0,N.jsx)(ce,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:E.isFetchingNextPage,onClick:()=>void E.fetchNextPage(),children:`See all`})]}),m&&l&&re.isLoading&&(0,N.jsx)(je,{py:`md`,children:(0,N.jsx)(Ie,{size:`xs`})}),m&&l&&(re.isSuccess||re.isError)&&(0,N.jsxs)(oe,{gap:4,children:[(0,N.jsx)(PN,{children:`Services`}),re.isError&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,children:`Services could not be searched`}),re.isSuccess&&k.length===0&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,children:`No matching services`}),k.map(e=>(0,N.jsx)(C,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,N.jsx)(ue,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,N.jsxs)(oe,{gap:4,children:[(0,N.jsx)(PN,{children:`Dashboards`}),D.isLoading&&(0,N.jsx)(je,{py:`md`,children:(0,N.jsx)(Ie,{size:`xs`})}),D.isError&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!D.isLoading&&!D.isError&&m&&ie.length===0&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),ie.map(e=>{let t=e.id===n;return(0,N.jsxs)(oe,{gap:0,children:[(0,N.jsx)(C,{component:`a`,href:`/dashboards/${encodeURIComponent(e.id)}`,className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),s(e.id))},children:(0,N.jsxs)(ne,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,N.jsx)(ue,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,N.jsx)(cs,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})}),e.origin&&(0,N.jsx)(C,{component:`a`,href:`/chat/${encodeURIComponent(e.origin.thread_id)}`,"data-request-provenance":!0,px:`sm`,pb:`xs`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),a(e.origin.thread_id))},children:(0,N.jsxs)(ue,{size:`xs`,c:`dimmed`,lineClamp:2,children:[`Built from: `,e.origin.request_excerpt]})})]},e.id)}),e&&(0,N.jsx)(ce,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,N.jsx)(jM,{size:14,weight:`fill`}),onClick:c,children:D.data?.length===0?`New dashboard`:`Create with AI`})]})]})}),(0,N.jsx)(Gc,{ref:ee,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,N.jsx)(yM,{size:15}),rightSection:(0,N.jsx)(Ls,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,N.jsx)(Rc,{opened:h!==null,onClose:()=>!w&&g(null),title:`Rename chat`,centered:!0,children:(0,N.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),se()},children:(0,N.jsxs)(oe,{children:[(0,N.jsx)(Gc,{label:`Name`,value:y,onChange:e=>b(e.currentTarget.value),maxLength:120,autoFocus:!0}),x&&(0,N.jsx)(Ce,{color:`bad`,children:x}),(0,N.jsxs)(ne,{justify:`flex-end`,children:[(0,N.jsx)(ce,{variant:`default`,onClick:()=>g(null),disabled:w,children:`Cancel`}),(0,N.jsx)(ce,{type:`submit`,loading:w,disabled:!y.trim(),children:`Save`})]})]})})}),(0,N.jsx)(Rc,{opened:_!==null,onClose:()=>!w&&v(null),title:`Delete chat?`,centered:!0,children:(0,N.jsxs)(oe,{children:[(0,N.jsxs)(ue,{size:`sm`,children:[`This permanently removes `,(0,N.jsx)(ue,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),x&&(0,N.jsx)(Ce,{color:`bad`,children:x}),(0,N.jsxs)(ne,{justify:`flex-end`,children:[(0,N.jsx)(ce,{variant:`default`,onClick:()=>v(null),disabled:w,children:`Cancel`}),(0,N.jsx)(ce,{color:`bad`,loading:w,onClick:()=>void le(),children:`Delete`})]})]})})]})}function PN({children:e}){return(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function FN({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,N.jsx)(u,{"data-active":t||void 0,className:`rail-row`,children:(0,N.jsxs)(ne,{gap:2,wrap:`nowrap`,children:[(0,N.jsx)(C,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,N.jsxs)(oe,{gap:0,children:[(0,N.jsx)(ue,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,children:BN(e.updated_at)})]})}),(0,N.jsxs)(Sc,{position:`bottom-end`,withinPortal:!0,children:[(0,N.jsx)(Sc.Target,{children:(0,N.jsx)(Pi,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,N.jsx)(_M,{size:18,weight:`bold`})})}),(0,N.jsxs)(Sc.Dropdown,{children:[(0,N.jsx)(Sc.Item,{leftSection:(0,N.jsx)(CM,{size:15}),onClick:r,children:`Rename`}),(0,N.jsx)(Sc.Item,{color:`bad`,leftSection:(0,N.jsx)(FM,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function IN(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function LN(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var RN=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function zN(e){let t=LN(new Date),n=new Map;for(let r of e){let e=Math.floor((t-LN(IN(r.updated_at)))/864e5),i=e<=0?`Today`:e===1?`Yesterday`:e<=7?`Previous 7 days`:`Older`,a=n.get(i)??[];a.push(r),n.set(i,a)}return RN.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function BN(e){let t=IN(e),n=LN(new Date);return Math.floor((n-LN(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function VN({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=Qe(),s=ze(),c=Xn({select:e=>e.location.pathname}),{dashboardId:l}=Sn({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=Dr(!1),[p,m]=(0,M.useState)(!1),[h,g]=(0,M.useState)(``),_=(0,M.useRef)(null),v=ie(`(max-width: 62em)`),y=(0,M.useRef)(v);y.current=v,(0,M.useEffect)(()=>{f.close()},[c]),(0,M.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{}}),onCreateDashboard:()=>o(tt),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,N.jsxs)(Jo,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,N.jsx)(Jo.Header,{children:(0,N.jsxs)(ne,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,N.jsxs)(ne,{gap:`sm`,wrap:`nowrap`,children:[(0,N.jsx)(ds,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,N.jsx)(ke,{size:`small`})]}),(0,N.jsxs)(ne,{gap:`xs`,wrap:`nowrap`,children:[(0,N.jsx)(Ot,{label:`Documentation`,children:(0,N.jsx)(Pi,{component:`a`,href:jN.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,N.jsx)(hM,{size:17,weight:`bold`})})}),(0,N.jsx)(AN,{}),(0,N.jsx)(HN,{onError:g})]})]})}),(0,N.jsx)(Jo.Navbar,{p:`sm`,children:(0,N.jsx)(NN,{ref:_,...b})}),(0,N.jsx)(Ps,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,N.jsx)(ke,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,N.jsx)(NN,{...b,autoFocusSearch:d&&p})}),(0,N.jsxs)(Jo.Main,{children:[h&&(0,N.jsx)(Ce,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function HN({onError:e}){let t=ze(),n=JM(),r=(n.display_name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,N.jsxs)(Sc,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,N.jsx)(Sc.Target,{children:(0,N.jsx)(Pi,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`${r} account menu`,children:(0,N.jsx)(as,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,N.jsxs)(Sc.Dropdown,{children:[(0,N.jsx)(Sc.Label,{children:n.email||`Signed in`}),(0,N.jsx)(Sc.Item,{leftSection:(0,N.jsx)(TM,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,N.jsx)(Sc.Divider,{}),(0,N.jsx)(Sc.Item,{leftSection:(0,N.jsx)(kM,{size:15}),onClick:()=>void WM().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function UN(){let{agent_available:e}=KM(),t=ze(),n=TA(),{threadId:r}=Sn({strict:!1}),[i,a]=(0,M.useState)(fN),o=(0,M.useRef)(new Set),s=r??i,[c,l]=(0,M.useState)([]),[u,d]=(0,M.useState)({}),[f,p]=(0,M.useState)(``),[m,h]=(0,M.useState)(!1),[g,_]=(0,M.useState)(!1),[v,y]=(0,M.useState)(``),[b,x]=(0,M.useState)(!1),S=(0,M.useRef)(!1),[C,w]=(0,M.useState)(``),[T,ee]=(0,M.useState)(``),[E,D]=(0,M.useState)(0),O=(0,M.useRef)(null),te=(0,M.useRef)({}),ne=(0,M.useRef)(null),re=(0,M.useRef)(new Map),k=(0,M.useMemo)(()=>new CA({url:`/api/agent/runs`,threadId:s,fetch:(e,t)=>UM(e,t)}),[s]),ie=!e||f===s;function ae(){re.current.clear(),y(``)}function oe(e){return S.current||e instanceof Error&&e.name===`AbortError`}(0,M.useEffect)(()=>{let t=!0;if(l([]),te.current={},d({}),p(``),h(!1),_(!1),S.current=!1,x(!1),ae(),ee(``),!e){p(s);return}!r||o.current.has(s)?(k.setMessages([]),p(s)):UM(`/api/agent/threads/${encodeURIComponent(s)}`).then(async e=>{if(e.status===404)return null;if(!e.ok)throw Error(`Unable to load thread (${e.status})`);return e.json()}).then(e=>{if(t){if(e===null){h(!0),p(s);return}k.setMessages(e.messages??[]),l(e.messages??[]),p(s)}}).catch(()=>{t&&(O.current=null,ee(`This chat could not be restored. Start a new chat or try again.`))});let i=k.subscribe({onMessagesChanged:({messages:e})=>l([...e]),onRunInitialized:()=>{S.current=!1,x(!1),_(!0),ee(``)},onTextMessageContentEvent:({event:e})=>{e.delta&&y(``)},onToolCallStartEvent:({event:e})=>{re.current.set(e.toolCallId,at(e.toolCallName)),y(at(e.toolCallName))},onToolCallResultEvent:({event:e,messages:t})=>{re.current.delete(e.toolCallId),y([...re.current.values()].at(-1)??`Analyzing your system`);let r=$e(e.toolCallId,e.content,t);r&&(n.invalidateQueries({queryKey:pN}),n.invalidateQueries({queryKey:[`dashboard`,r.id]}),n.invalidateQueries({queryKey:[`dashboard-versions`,r.id]}))},onRunErrorEvent:({event:e})=>{e.code===`abort`||S.current?(ee(``),x(!0)):(console.warn(`Agent run error`,e.code),ee(Xe(e.code))),_(!1),ae()},onRunFinalized:({messages:e})=>{let t=[...e];l(t),d(e=>{let n={...e};for(let e of t)e.role===`assistant`&&!n[e.id]&&(n[e.id]=Date.now());return n}),_(!1),ae(),o.current.delete(s),n.invalidateQueries({queryKey:tN})},onRunFailed:e=>{oe(e.error)?(ee(``),x(!0)):(console.error(`Agent run failed`,e),ee(Xe())),_(!1),ae(),o.current.delete(s),n.invalidateQueries({queryKey:tN})}});return()=>{t=!1,i.unsubscribe(),k.abortRun()}},[k,e,n,E,s]),(0,M.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target,i=n?.matches(`input, textarea, [contenteditable='true']`);e.key===`/`&&!i&&(e.preventDefault(),r?requestAnimationFrame(()=>ne.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ne.current?.focus()))),e.key===`Escape`&&n===ne.current&&(w(``),ne.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function se(){_(!0),ee(``);try{let{context:e=[],...t}=te.current;await k.runAgent({context:e,forwardedProps:t})}catch(e){oe(e)?(ee(``),x(!0)):(console.error(`Agent run failed`,e),ee(Xe())),_(!1),ae(),o.current.delete(s)}}async function ce(n,i){let a=n.trim();if(!e||!a||g||!ie||m)return;te.current={...i},r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let c={id:fN(),role:`user`,content:a};k.addMessage(c),l([...k.messages]),d(e=>({...e,[c.id]:Date.now()})),w(``),await se()}(0,M.useEffect)(()=>{let e=O.current;ie&&r&&e&&(O.current=null,ce(e.text,e.options))},[ie,r,s]);function le(e){e.preventDefault(),ce(C)}function ue(){S.current=!0,ee(``),x(!0),k.abortRun(),_(!1),ae(),o.current.delete(s)}function de(){!g&&k.messages.some(e=>e.role===`user`)&&se()}function fe(n,r){if(!e)return;let i=fN();o.current.add(i),O.current=n?{text:n,options:{...r}}:null,t({to:`/chat/$threadId`,params:{threadId:i}})}function pe(){k.abortRun(),O.current=null,te.current={},a(fN()),t({to:`/chat`})}function me(e){O.current=null,te.current={},t({to:`/chat/$threadId`,params:{threadId:e}})}function he(){D(e=>e+1)}return(0,N.jsx)(it.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:ie,running:g,activity:v,stopped:b,input:C,setInput:w,error:T,inputRef:ne,send:ce,submit:le,stop:ue,retry:de,reloadThread:he,openChat:fe,newThread:pe,selectThread:me},children:(0,N.jsx)(VN,{children:(0,N.jsx)(Bn,{})})})}function WN(){let e=(0,M.useMemo)(()=>new Fj,[]);return(0,N.jsx)(EA,{client:e,children:(0,N.jsx)(eN,{children:(0,N.jsx)(UN,{})})})}var GN=On({component:WN,notFoundComponent:()=>(0,N.jsx)(Ve,{to:`/`,replace:!0})}),KN=kn(`/`)({component:An(()=>ot(()=>import(`./routes-D2AdaqvY.js`),__vite__mapDeps([0,1,2])),`component`)}),qN=kn(`/settings`)({component:An(()=>ot(()=>import(`./settings-sUA_tcIn.js`),__vite__mapDeps([3,1,4,5,6])),`component`)}),JN=kn(`/chat/`)({component:An(()=>ot(()=>import(`./chat.index-CpaVOTkg.js`),__vite__mapDeps([7,8,1,4,9,5,10])),`component`)}),YN=kn(`/chat/$threadId`)({component:An(()=>ot(()=>import(`./chat._threadId-CpaVOTkg.js`),__vite__mapDeps([11,8,1,4,9,5,10])),`component`)});function XN(e){try{let t=typeof e==`string`?e:JSON.stringify(e);if(!t||t.length>4096)return;let n=typeof e==`string`?JSON.parse(e):e;if(!n||typeof n!=`object`)return;let r=n;return typeof r.panel_id!=`string`||!/^([a-z][a-z0-9_]{0,39})$/.test(r.panel_id)||r.kind!==`traces`&&r.kind!==`logs`||typeof r.from!=`string`||typeof r.to!=`string`||!Number.isFinite(Date.parse(r.from))||!Number.isFinite(Date.parse(r.to))||Date.parse(r.from)>=Date.parse(r.to)||Date.parse(r.to)-Date.parse(r.from)>2592e6||typeof r.window_from!=`string`||typeof r.window_to!=`string`||!Number.isFinite(Date.parse(r.window_from))||!Number.isFinite(Date.parse(r.window_to))||Date.parse(r.window_from)>=Date.parse(r.window_to)||Date.parse(r.window_to)-Date.parse(r.window_from)>2592e6||Date.parse(r.from)Date.parse(r.window_to)||!r.dimensions||Array.isArray(r.dimensions)||typeof r.dimensions!=`object`||Object.keys(r.dimensions).length>3||Object.values(r.dimensions).some(e=>typeof e!=`string`||e.length>500)||r.trace_id!==void 0&&(typeof r.trace_id!=`string`||r.trace_id.length>128)||r.namespace!==void 0&&(typeof r.namespace!=`string`||r.namespace.length>200)||r.bucket&&(!Number.isFinite(r.bucket.lower)||r.bucket.lower<0||r.bucket.upper!==void 0&&(!Number.isFinite(r.bucket.upper)||r.bucket.upper<=r.bucket.lower))?void 0:{panel_id:r.panel_id,kind:r.kind,from:r.from,to:r.to,window_from:r.window_from,window_to:r.window_to,dimensions:r.dimensions,trace_id:r.trace_id,namespace:r.namespace,bucket:r.bucket}}catch{return}}function ZN(e,t,n){if(!e.drill&&e.viz!==`service_map`&&!n.trace_id||t.from_ms===void 0||t.to_ms===void 0)return;let r=t.from_ms,i=t.to_ms;if(n.from!==void 0&&n.to!==void 0&&(r=Math.max(r,Date.parse(n.from)),i=Math.min(i,Date.parse(n.to))),n.time!==void 0&&!n.trace_id){let e=/^(\d+)(s|m|h|d)$/.exec(t.interval??``),a=e?Number(e[1])*{s:1e3,m:6e4,h:36e5,d:864e5}[e[2]]:6e4;r=Math.max(r,n.time),i=Math.min(i,n.time+a)}return XN(JSON.stringify({panel_id:e.id,kind:n.trace_id||e.viz===`service_map`?`traces`:e.drill,from:n.from&&Date.parse(n.from)===r?n.from:new Date(r).toISOString(),to:n.to&&Date.parse(n.to)===i?n.to:new Date(i).toISOString(),window_from:new Date(t.from_ms).toISOString(),window_to:new Date(t.to_ms).toISOString(),dimensions:n.dimensions,trace_id:n.trace_id,namespace:n.namespace,bucket:n.bucket}))}function QN(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))for(let e of Array.isArray(r)?r:[r]){if(e===void 0)continue;let r=typeof e==`string`&&/^[{"]/.test(e);t.append(n,r||typeof e==`object`&&e?JSON.stringify(e):String(e))}let n=t.toString();return n?`?${n}`:``}function $N(e){let t=Object.create(null),n=e=>{if(e.startsWith(`{`)||e.startsWith(`"`))try{let t=JSON.parse(e);if(typeof t==`string`)return/^[{"]/.test(t)?t:e;if(typeof t==`object`&&t&&!Array.isArray(t))return t}catch{}return e},r=new URLSearchParams(e);for(let e of new Set(r.keys())){let i=r.getAll(e).map(n);t[e]=i.length===1?i[0]:i}return t}var eP=[`5m`,`15m`,`1h`,`3h`,`6h`,`12h`,`24h`,`2d`,`7d`,`30d`],tP=[`off`,`10s`,`30s`,`1m`,`5m`],nP=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}[Tt](?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:[Zz]|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/.test(e)||Number.isNaN(Date.parse(e)))return!1;let[t,n,r]=e.slice(0,10).split(`-`).map(Number),i=new Date(0);return i.setUTCFullYear(t,n-1,r),i.setUTCHours(0,0,0,0),i.getUTCFullYear()===t&&i.getUTCMonth()===n-1&&i.getUTCDate()===r},rP=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):void 0;function iP(e){let t={};typeof e.range==`string`&&eP.includes(e.range)?t.range=e.range:nP(e.from)&&nP(e.to)&&Date.parse(e.from)typeof e==`string`)&&(i[e]=t)}}else{let t=rP(n);t!==void 0&&(i[e]=t)}}}Object.keys(i).length>0&&(t.vars=i);let a=XN(e.drill);return a&&(t.drill=JSON.stringify(a)),t}function aP(e){let t={};e.drill&&(t.drill=JSON.parse(e.drill)),e.range&&(t.range=e.range),e.from&&e.to&&(t.from=e.from,t.to=e.to),e.compare&&(t.compare=e.compare),e.view&&(t.view=e.view),e.edit&&(t.edit=e.edit);for(let[n,r]of Object.entries(e.vars??{}))t[`var-${n}`]=Array.isArray(r)?{values:r}:r;return t}function oP(e,t){let n=new URL(e);return n.search=QN(aP({...iP($N(n.search)),drill:JSON.stringify(t)})),n.href}function sP(e,t){let n=e.time.refresh??`30s`;return t.from&&t.to?{from:t.from,to:t.to,refresh:n}:t.range?{range:t.range,refresh:n}:{...e.time,refresh:n}}var cP=kn(`/dashboards/`)({component:An(()=>ot(()=>import(`./dashboards.index-B3tO4nLJ.js`),__vite__mapDeps([12,1,2,13,4,9,5,10,6])),`component`),validateSearch:e=>aP(iP(e))}),lP=kn(`/dashboards/$dashboardId`)({component:An(()=>ot(()=>import(`./dashboards._dashboardId-BKxXsvyw.js`),__vite__mapDeps([14,1,2,13,4,9,5,10,6])),`component`),validateSearch:e=>aP(iP(e))}),uP=KN.update({id:`/`,path:`/`,getParentRoute:()=>GN}),dP=qN.update({id:`/settings`,path:`/settings`,getParentRoute:()=>GN}),fP=JN.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>GN}),pP=YN.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>GN}),mP=cP.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>GN}),hP={IndexRoute:uP,SettingsRoute:dP,ChatThreadIdRoute:pP,DashboardsDashboardIdRoute:lP.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>GN}),ChatIndexRoute:fP,DashboardsIndexRoute:mP},gP=Kn({routeTree:GN._addFileChildren(hP)._addFileTypes(),parseSearch:$N,stringifySearch:QN,defaultPreload:`intent`,scrollRestoration:!0}),_P=[`#fafafa`,`#e6e4de`,`#bfbdb6`,`#8b8e99`,`#565b69`,`#1d2433`,`#131721`,`#0b0e14`,`#080a10`,`#05070b`],vP=[`#f3ecfd`,`#ece3fb`,`#dcc9f7`,`#d2a6ff`,`#bf94ec`,`#a97ce0`,`#9163d6`,`#7c4dcc`,`#5b32a3`,`#40236f`],yP=[`#eefbe6`,`#dcf7cc`,`#c2f0a6`,`#a5e880`,`#8fe06c`,`#7fd962`,`#66c04b`,`#4f9c3a`,`#3b7a2c`,`#2a5a1f`],bP=[`#fff5e6`,`#ffe9c9`,`#ffd79b`,`#ffc571`,`#ffbc62`,`#ffb454`,`#ef9c33`,`#c87d21`,`#9c5f16`,`#74460f`],xP=[`#fdecee`,`#fbd9dc`,`#f8b6bc`,`#f59099`,`#f37d87`,`#f26d78`,`#e04d5a`,`#c03642`,`#96262f`,`#6f1a21`],SP=[`#e8f6ff`,`#ccebff`,`#a3daff`,`#7dcbff`,`#66c5ff`,`#59c2ff`,`#33a7e6`,`#1e86bd`,`#146694`,`#0d4a6d`],CP={dark:{text:`#bfbdb6`,muted:`#8b8e99`,grid:`#1d2433`,surface:`#131721`,border:`#626777`},light:{text:`#4a5058`,muted:`#6b7280`,grid:`#eceef0`,surface:`#fcfcfc`,border:`#8c939d`}},wP={dark:[`#3987e5`,`#d95926`,`#199e70`,`#9085e9`,`#c98500`,`#d55181`],light:[`#2a78d6`,`#eb6834`,`#1baf7a`,`#4a3aa7`,`#eda100`,`#e87ba4`]},TP={micro:11,small:12,body:14,title:16,section:22,page:32},EP={display:`"Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,body:`"Geist Variable", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`},DP={brand:vP,ok:yP,warn:bP,bad:xP,info:SP},OP={light:7,dark:5};function kP(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function AP(e){let t=kP(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function jP(e){return Object.fromEntries(Object.entries(DP).map(([t,n])=>[`--fanout-color-${t}-contrast`,AP(n[OP[e]])]))}function MP(e){return t=>{let n=t.color??FP.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(DP,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var NP=.25,PP={xs:9,sm:10,md:11,lg:13,xl:16},FP={primaryColor:`brand`,primaryShade:OP,autoContrast:!0,luminanceThreshold:NP,colors:{dark:_P,brand:vP,ok:yP,warn:bP,bad:xP,info:SP},defaultRadius:`md`,fontFamily:EP.body,fontFamilyMonospace:EP.display,headings:{fontFamily:EP.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:RP(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:RP(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:LP(t.size)})},Menu:{defaultProps:{withInitialFocusPlaceholder:!1}},Drawer:{defaultProps:{closeButtonProps:{"aria-label":`Close`}}},Modal:{defaultProps:{closeButtonProps:{"aria-label":`Close`}}}}},IP=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":CP.light.muted,...jP(`light`)},dark:jP(`dark`)});function LP(e){let t=PP[e??`md`];return t===void 0||t>=TP.micro?{}:{"--badge-fz":`${TP.micro/16}rem`}}function RP(e,t){return!e||e===FP.primaryColor?{[t]:`var(--fanout-color-${FP.primaryColor}-contrast)`}:{}}var zP=MP(ee),BP=ri({...FP,variantColorResolver:zP});(0,$c.createRoot)(document.getElementById(`root`)).render((0,N.jsx)(M.StrictMode,{children:(0,N.jsx)(ni,{theme:BP,defaultColorScheme:`auto`,cssVariablesResolver:IP,children:(0,N.jsx)(Yn,{router:gP})})}));export{Wy as $,CN as A,Gc as At,RM as B,Ei as Bt,pN as C,Qy as Ct,bN as D,h_ as Dt,kN as E,y_ as Et,DN as F,ms as Ft,jj as G,Er as Gt,CM as H,ai as Ht,xN as I,cs as It,zA as J,Qn as Jt,sj as K,cr as Kt,nN as L,F as Lt,ON as M,Sc as Mt,wN as N,Ls as Nt,_N as O,m_ as Ot,SN as P,Ps as Pt,TA as Q,JM as R,so as Rt,jN as S,Tb as St,TN as T,xy as Tt,_M as U,Ur as Ut,FM as V,hi as Vt,Jj as W,Ir as Wt,UA as X,on as Xt,jA as Y,gn as Yt,$A as Z,ln as Zt,eP as _,Kb as _t,CP as a,G as at,ZN as b,U as bt,yP as c,Fb as ct,bP as d,dx as dt,Uy as et,lP as f,q as ft,iP as g,jb as gt,sP as h,hb as ht,vP as i,bb as it,EN as j,Rc as jt,yN as k,tp as kt,wP as l,Jy as lt,oP as m,Db as mt,kP as n,Vb as nt,EP as o,kb as ot,cP as p,K as pt,rj as q,rr as qt,xP as r,Sb as rt,SP as s,vb as st,AP as t,mb as tt,TP as u,Lb as ut,tP as v,gx as vt,vN as w,Dy as wt,XN as x,Nb as xt,aP as y,zb as yt,UM as z,Pi as zt}; \ No newline at end of file +`)};function $O(e,t){return ol(t)&&ek(`[ag-ui][legacy] The result of tool call '${e}' carries content parts the legacy protocol cannot represent; only its text parts are bridged and the rest is dropped.`),al(t)}var ek=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(e)},tk=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=!1,p=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(Dd(r=>{switch(r.type){case I.TEXT_MESSAGE_START:{let e=r;return[{type:ZO.TextMessageStart,messageId:e.messageId,role:e.role}]}case I.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:ZO.TextMessageContent,messageId:e.messageId,content:e.delta}]}case I.TEXT_MESSAGE_END:{let e=r;return[{type:ZO.TextMessageEnd,messageId:e.messageId}]}case I.TOOL_CALL_START:{let e=r;return u.push({id:e.toolCallId,type:`function`,function:{name:e.toolCallName,arguments:``}}),o=!0,d[e.toolCallId]=e.toolCallName,[{type:ZO.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case I.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return ek(`[ag-ui][legacy] TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let f=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(Hd(d.function.arguments));e.tool_argument&&e.tool_argument in t?(p({...i,[e.state_key]:t[e.tool_argument]}),f=!0):e.tool_argument||(p({...i,[e.state_key]:t}),f=!0)}catch{}}return[{type:ZO.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...f?[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case I.TOOL_CALL_END:{let e=r;return[{type:ZO.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case I.TOOL_CALL_RESULT:{let e=r,t=d[e.toolCallId];return(t===void 0||t===``)&&ek(`[ag-ui][legacy] No usable tool name was seen for tool call '${e.toolCallId}' (${t===void 0?`no TOOL_CALL_START reached this bridge`:`its TOOL_CALL_START carried an empty toolCallName`}), so its result is being bridged with the fabricated action name "unknown". Downstream consumers route on that name.`),[{type:ZO.ActionExecutionResult,actionExecutionId:e.toolCallId,result:$O(e.toolCallId,e.content),actionName:t||`unknown`}]}case I.RAW:return f||(f=!0,ek(`[ag-ui][legacy] Dropping RAW events: the legacy runtime protocol has no equivalent, so the provider payloads they carry do not reach the legacy stream. Reported once per stream.`)),[];case I.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:ZO.MetaEvent,name:e.name,value:e.value}]}case I.STATE_SNAPSHOT:return p(r.snapshot),[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case I.STATE_DELTA:{let c=r,l;try{l=Hl.applyPatch(i,c.delta,!0,!1).newDocument}catch(e){let t=e instanceof Error?e.message:String(e);return ek(`[ag-ui][legacy] Failed to apply state patch:\nCurrent state: ${JSON.stringify(i,null,2)}\nPatch operations: ${JSON.stringify(c.delta,null,2)}\nError: ${t}`),[]}return p(l),[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]}case I.MESSAGES_SNAPSHOT:return c=r.messages,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case I.RUN_STARTED:return[];case I.RUN_FINISHED:{if(c&&(i.messages=c),Object.keys(i).length===0)return[];let r=null;if(c)try{r=nk(c)}catch(e){return[{type:ZO.RunError,message:e.message}]}return[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...r?{messages:r}:{}}),active:!1}]}case I.RUN_ERROR:{let e=r;return[{type:ZO.RunError,message:e.message,code:e.code}]}case I.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case I.STEP_FINISHED:return u=[],l=null,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function nk(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=QO(n.content);if(e){let r={id:n.id,role:n.role,content:e};t.push(r)}if(n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0)for(let e of n.toolCalls){let r;try{r=JSON.parse(e.function.arguments)}catch(t){throw Error(`Failed to parse arguments for tool call '${e.id}' (${e.function.name}): ${t.message}`)}let i={id:e.id,name:e.function.name,arguments:r,parentMessageId:n.id};t.push(i)}}else if(n.role===`tool`){let r=`unknown`;for(let t of e)if(t.role===`assistant`&&t.toolCalls?.length){for(let e of t.toolCalls)if(e.id===n.toolCallId){r=e.function.name;break}}let i={id:n.id,result:$O(n.toolCallId,n.content),actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var rk=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,ik=e=>e===`tool`?`toolCallId`:`messageId`,ak=(e,t,n,r,i)=>{if(r!==void 0&&r!==i)throw Error(`Cannot continue ${e} '${t}': chunk ${n} '${r}' does not match the open stream's ${n} ${i===void 0?`(absent)`:`'${i}'`}.`)},ok=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},sk=(e,t)=>{let n=ok(e,t);return t.rawEvent===void 0?n:{...n,rawEvent:t.rawEvent}},ck=e=>new Set(Object.keys(e.shape)),lk=ck(Cx),uk=ck(Dx),dk=ck(uS),fk=(e,t)=>{let n;for(let r of Object.keys(e))t.has(r)||((n??={})[r]=e[r]);return n},pk=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][transform] ${e} Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)},mk=(e,t,n,r)=>{if(t===void 0||n||e.length===0)return;let i=e[e.length-1],a=Object.keys(t).filter(e=>Object.prototype.hasOwnProperty.call(i,e));a.length>0&&pk(`A ${r} carried ${a.map(e=>`'${e}'`).join(`, `)}, which the synthesized ${String(i.type)} already describes. The synthesized value is kept and the chunk's is dropped — this stage does not judge a described field, so the producer's value cannot be substituted for its own.`),e[e.length-1]={...t,...i}},hk=e=>t=>{let n=FO(e),r=new Map,i=e=>{let t=r.get(e);if(!t)return[];switch(r.delete(e),t.kind){case`text`:{let e={type:I.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:I.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:I.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`REASONING_MESSAGE_END`,e,{messageId:e.messageId}),[e]}}},a=()=>[...r.keys()].flatMap(e=>i(e)),o=(e,t)=>{for(let[n,i]of r)if(i.kind===e&&rk(i)===t)return{owner:n}},s=(e,t,n,i,a)=>{if(t!==void 0){let r=o(e,t);if(r){if(n!==void 0&&n!==r.owner)throw Error(`Cannot continue ${a} '${t}': chunk subagentRunId '${n}' does not match the open stream's subagent '${r.owner??`(the parent agent)`}'.`);return r.owner}return n}if(n!==void 0)return n;if(r.get(void 0)?.kind===e)return;let s=[...r.entries()].filter(([,t])=>t.kind===e);if(s.length===1)return s[0][0];if(s.length>1)throw Error(`Ambiguous ${i}: it carries neither a ${ik(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(Dd(e=>{switch(e.type){case I.TEXT_MESSAGE_START:case I.TEXT_MESSAGE_CONTENT:case I.TEXT_MESSAGE_END:case I.TOOL_CALL_START:case I.TOOL_CALL_ARGS:case I.TOOL_CALL_END:case I.TOOL_CALL_RESULT:case I.STATE_SNAPSHOT:case I.STATE_DELTA:case I.CUSTOM:case I.STEP_STARTED:case I.STEP_FINISHED:case I.REASONING_START:case I.REASONING_MESSAGE_START:case I.REASONING_MESSAGE_CONTENT:case I.REASONING_MESSAGE_END:case I.REASONING_END:return[...i(e.subagentRunId??void 0),e];case I.RUN_STARTED:case I.RUN_FINISHED:case I.RUN_ERROR:case I.MESSAGES_SNAPSHOT:return[...a(),e];case I.RAW:case I.ACTIVITY_SNAPSHOT:case I.ACTIVITY_DELTA:case I.REASONING_ENCRYPTED_VALUE:case I.SUBAGENT_STARTED:return[e];case I.SUBAGENT_FINISHED:case I.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case I.TEXT_MESSAGE_CHUNK:{let t=e,a=fk(e,lk),o=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`text`&&(t.messageId===void 0||t.messageId===c.fields.messageId))ak(`text message`,c.fields.messageId,`role`,t.role,c.fields.role),ak(`text message`,c.fields.messageId,`name`,t.name,c.fields.name),d=c.fields;else{if(l.push(...i(o)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);d={messageId:t.messageId,role:t.role===void 0?`assistant`:t.role,name:t.name,subagentRunId:t.subagentRunId},r.set(o,{kind:`text`,fields:d});let e=ok({type:I.TEXT_MESSAGE_START,messageId:t.messageId,role:d.role,...t.name!==void 0&&{name:t.name},...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:I.TEXT_MESSAGE_CONTENT,messageId:d.messageId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:d.messageId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:I.TEXT_MESSAGE_CONTENT,messageId:d.messageId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`TEXT_MESSAGE_CHUNK`),l}case I.TOOL_CALL_CHUNK:{let t=e,a=fk(e,uk),o=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===c.fields.toolCallId))ak(`tool call`,c.fields.toolCallId,`toolCallName`,t.toolCallName,c.fields.toolCallName),ak(`tool call`,c.fields.toolCallId,`parentMessageId`,t.parentMessageId,c.fields.parentMessageId),d=c.fields;else{if(l.push(...i(o)),t.toolCallId===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallId`);if(t.toolCallName===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallName`);d={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(o,{kind:`tool`,fields:d});let e=ok({type:I.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,...t.parentMessageId!==void 0&&{parentMessageId:t.parentMessageId},...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:I.TOOL_CALL_ARGS,toolCallId:d.toolCallId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:d.toolCallId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:I.TOOL_CALL_ARGS,toolCallId:d.toolCallId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`TOOL_CALL_CHUNK`),l}case I.REASONING_MESSAGE_CHUNK:{let t=e,a=fk(e,dk),o=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===c.fields.messageId))d=c.fields;else{if(l.push(...i(o)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);d={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(o,{kind:`reasoning`,fields:d});let e=ok({type:I.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:I.REASONING_MESSAGE_CONTENT,messageId:d.messageId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:d.messageId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:I.REASONING_MESSAGE_CONTENT,messageId:d.messageId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`REASONING_MESSAGE_CHUNK`),l}}return e.type,[e]}),Ld(()=>{a()}))},gk=Symbol(`agui.strip.drop`);function _k(e){let t=e;for(;;){if(t instanceof iO||t instanceof oO||t instanceof cO||t instanceof vO||t instanceof mO){t=t.unwrap();continue}if(t instanceof gO){t=t.def.in;continue}if(t instanceof bO){t=t.def.getter();continue}return t}}function vk(e){let t=e.def;return typeof t?.discriminator==`string`?t.discriminator:void 0}function yk(e){let t=e,n=Array.isArray(t.def?.values)?t.def.values:t.values?Array.from(t.values):void 0;return n&&n.length===1?n[0]:t.value}function bk(e){let t=_k(e);return t instanceof tO?yk(t):void 0}function xk(e,t,n,r){let i=_k(t);if(i instanceof qD){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=i.shape,a=e,o={},s=i.meta()?.specOpen===!0;for(let e of Object.keys(a)){let i=Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;if(i===void 0){if(s){o[e]=a[e];continue}r.push(`${n}/${e}`);continue}let c=r.length,l=xk(a[e],i,`${n}/${e}`,r);if(l===gk){if(r.length=c,i.safeParse(void 0).success){r.push(`${n}/${e}`);continue}return gk}o[e]=l}return o}if(i instanceof GD){if(!Array.isArray(e))return e;let t=i.element,a=[];return e.forEach((e,i)=>{let o=r.length,s=xk(e,t,`${n}/${i}`,r);if(s===gk){r.length=o,r.push(`${n}/${i}`);return}a.push(s)}),a}if(i instanceof QD){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=i.def.valueType,a=e,o={};for(let e of Object.keys(a)){let i=r.length,s=xk(a[e],t,`${n}/${e}`,r);if(s===gk){r.length=i,r.push(`${n}/${e}`);continue}o[e]=s}return o}if(i instanceof JD){let t=i.options,a=vk(i);if(a!==void 0){if(typeof e!=`object`||!e||Array.isArray(e))return e;let i=e[a];for(let o of t){let t=_k(o);if(!(t instanceof qD))continue;let s=t.shape;if(bk(s[a])===i)return xk(e,o,n,r)}return gk}let o=t.filter(e=>_k(e)instanceof qD),s=typeof e==`object`&&!!e&&!Array.isArray(e);if(o.length>1&&s)return e;for(let i of t){let t=_k(i);if(t instanceof GD&&Array.isArray(e)||t instanceof qD&&s)return xk(e,i,n,r)}return e}return e}function Sk(e,t){let n=[],r=xk(e,t,``,n);if(r===gk)throw Error(`Internal error: the stripper found the whole value unrecognisable, which the schemas are not supposed to allow — schema/stripper mismatch.`);return{value:r,stripped:n}}var Ck=new Set(Object.values(I));function wk(e){return Ck.has(e.type)}var Tk=new Map(gS.options.map(e=>{let t=e.shape;return[String(yk(t.type)),e]})),Ek=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS;function Dk(e){Ek()||console.warn(`[ag-ui][enforce] ${e}`)}var Ok=e=>t=>{let n=FO(e);return t.pipe(Dd(e=>{if(!wk(e))return Dk(`Dropping unrecognised event '${String(e.type)}': no middleware translated it and the protocol does not describe it.`),n?.event(`ENFORCE`,`Unrecognised event dropped:`,e,{type:e.type}),Wu;let t=Tk.get(e.type);if(t===void 0)throw Error(`No validator for recognised event type '${String(e.type)}'`);let{value:r,stripped:i}=Sk(e,t);for(let t of i)Dk(`Removed unrecognised material at '${t}' on ${String(e.type)}. Nothing handled it; see the repo-root DEPRECATIONS.md if it is a retired shape.`);return Sd(t.parse(r))}))};function kk(e){let{value:t,stripped:n}=Sk(nl(e,`RunAgentInput`),Xx);for(let e of n)Dk(`Removed unrecognised material at '${e}' from the outgoing input.`);return Xx.parse(t)}var Ak=class{runNext(e,t){return t.run(e).pipe(hk(!1))}runNextWithState(e,t){let n=DO(e.messages||[]),r=DO(e.state===void 0?{}:e.state),i=new Uu;return BO(e,i,t,[]).subscribe({next:e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)},error:()=>{}}),this.runNext(e,t).pipe(Nd(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:DO(n),state:DO(r)})))}},jk=class extends Ak{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function Mk(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function Nk(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function Pk(e){let t=Mk(e.mimeType);return e.data?{type:t,source:{type:`data`,value:e.data,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e.url?{type:t,source:{type:`url`,value:e.url,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:((typeof process>`u`||!{}.SUPPRESS_TRANSFORMATION_WARNINGS)&&console.warn(`[ag-ui][compat] A binary content part carries only an id ('${e.id??``}') and cannot be converted to a modern media part; a 1.0 peer will not accept it. Provide data or a url. See the repo-root DEPRECATIONS.md.`),e)}function Fk(e,t,n){if(typeof e!=`object`||!e||!(`type`in e)||e.type!==t.type||!(`source`in e))return!1;let r=e.source;return typeof r!=`object`||!r||!(`type`in r)||r.type!==t.source.type||!(`value`in r)||r.value!==t.source.value||!(`mimeType`in r)||r.mimeType!==t.source.mimeType?!1:!n||`metadata`in e&&typeof e.metadata==`object`&&e.metadata!==null&&`filename`in e.metadata&&e.metadata.filename===n}function Ik(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.flatMap(e=>{if(Nk(e)){let n=Pk(e);return n.type!==`binary`&&t.some(t=>Fk(t,n,e.filename))?[]:[n]}return[e]});return{...e,content:n}}var Lk=`THINKING_START`,Rk=`THINKING_END`,zk=`THINKING_TEXT_MESSAGE_START`,Bk=`THINKING_TEXT_MESSAGE_CONTENT`,Vk=`THINKING_TEXT_MESSAGE_END`;function Hk(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Uk={event:[`rawEvent`,`subagentRunId`],[I.RUN_STARTED]:[`parentRunId`,`input`],[I.RUN_FINISHED]:[`result`,`outcome`],[I.RUN_ERROR]:[`usage`],[I.SUBAGENT_FINISHED]:[`result`],[I.TOOL_CALL_START]:[`parentMessageId`],[I.TOOL_CALL_CHUNK]:[`parentMessageId`],[I.TOOL_CALL_RESULT]:[`role`],"RUN_FINISHED.outcome":[`pendingToolCallIds`],"RUN_FINISHED.usage[]":[`provider`,`reasoningTokens`,`cachedInputTokens`,`cacheWriteInputTokens`],RunAgentInput:[`forwardedProps`],Tool:[`parameters`],ResumeEntry:[`payload`],"input content":[`metadata`]},Wk=new Map(Object.entries(Uk).filter(([e])=>Object.values(I).includes(e))),Gk=e=>VO(e,`an absent field`);function Kk(e,t,n,r){if(!Hk(e))return e;let i;for(let a of t)e[a]===null&&(r(n===void 0?`${a}: null`:`${n}.${a}: null`),i??={...e},delete i[a]);return i??e}function qk(e,t,n){if(!Hk(e)||!Array.isArray(e[t]))return e;let r=e[t],i=r.map(n);return i.some((e,t)=>e!==r[t])?{...e,[t]:i}:e}function Jk(e,t){return qk(e,`content`,e=>{if(!Hk(e))return e;switch(e.type){case`image`:case`audio`:case`video`:case`document`:return Kk(e,Uk[`input content`],`${e.type} input content`,t);default:return e}})}function Yk(e,t=Gk){let n=Kk(e,Uk.RunAgentInput,`RunAgentInput`,t);return n=qk(n,`tools`,e=>Kk(e,Uk.Tool,`Tool`,t)),n=qk(n,`resume`,e=>Kk(e,Uk.ResumeEntry,`ResumeEntry`,t)),qk(n,`messages`,e=>Jk(e,t))}var Xk=class extends Ak{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null,this.nullsNoticedThisRun=new Set,this.noticeNullOncePerRun=e=>{this.nullsNoticedThisRun.has(e)||(this.nullsNoticedThisRun.add(e),VO(e,`an absent field`))}}warn(e,t){VO(e,t)}mintedContinuationId(e,t){if(t!==null)return t;let n=OO();return this.warnAside(`Minting a messageId ('${n}') for ${e}: no THINKING opener preceded it, so there was no id to continue. The id is this client's invention, not the producer's, and verification will reject the translated event for naming something nothing opened.`),n}warnAside(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][compat] ${e} Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.nullsNoticedThisRun.clear(),e.messages=e.messages.map(Ik),t.run(e).pipe(Td(e=>this.transformEvent(e)))}transformEvent(e){let t=this.noticeNullOncePerRun;e.type===I.RUN_STARTED&&this.nullsNoticedThisRun.clear(),e=Kk(e,Uk.event,void 0,t);let n=Wk.get(e.type);switch(n&&(e=Kk(e,n,e.type,t)),e.type){case Lk:{this.currentReasoningId=OO();let{title:t,...n}=e;return this.warn(Lk,I.REASONING_START),t!==void 0&&this.warnAside(`Dropping ${Lk}.title ${JSON.stringify(t)}: ${I.REASONING_START} has no title field, so the span's label cannot be carried and nothing downstream can recover it.`),{...n,type:I.REASONING_START,messageId:this.currentReasoningId}}case zk:return this.currentMessageId=OO(),this.warn(zk,I.REASONING_MESSAGE_START),{...e,type:I.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case Bk:{let{delta:t,...n}=e;return this.warn(Bk,I.REASONING_MESSAGE_CONTENT),{...n,type:I.REASONING_MESSAGE_CONTENT,messageId:this.mintedContinuationId(Bk,this.currentMessageId),delta:t}}case Vk:{let t=this.mintedContinuationId(Vk,this.currentMessageId);return this.currentMessageId=null,this.warn(Vk,I.REASONING_MESSAGE_END),{...e,type:I.REASONING_MESSAGE_END,messageId:t}}case Rk:{let t=this.mintedContinuationId(Rk,this.currentReasoningId);return this.currentReasoningId=null,this.warn(Rk,I.REASONING_END),{...e,type:I.REASONING_END,messageId:t}}case I.RUN_FINISHED:{let n=e,r=Kk(n.outcome,Uk[`RUN_FINISHED.outcome`],`RUN_FINISHED.outcome`,t);return qk(r===n.outcome?n:{...n,outcome:r},`usage`,e=>Kk(e,Uk[`RUN_FINISHED.usage[]`],`RUN_FINISHED.usage[]`,t))}case I.MESSAGES_SNAPSHOT:{let t=e;return Array.isArray(t.messages)?{...t,messages:t.messages.map(e=>this.upgradeInboundMessage(e))}:e}case I.RUN_STARTED:{let n=Yk(e.input,t),r=n===e.input?e:{...e,input:n},i=r;return!i.input||!Array.isArray(i.input.messages)?r:{...i,input:{...i.input,messages:i.input.messages.map(e=>this.upgradeInboundMessage(e))}}}default:return e}}upgradeInboundMessage(e){e=Jk(e,this.noticeNullOncePerRun);let t=e.content;return!Array.isArray(t)||!t.some(e=>typeof e==`object`&&!!e&&e.type===`binary`)?e:(this.warn(`binary input content`,`the modern media content parts`),Ik(e))}},Zk=()=>e=>Ad(()=>{let t=new Xk;return e.pipe(Td(e=>t.transformEvent(e)))});function Qk(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}function $k(){return typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS}function eA(e){$k()||console.warn(`[ag-ui][compat] Flattening message content for a <=0.0.39 peer DROPS non-text parts (${e.join(`, `)}). The peer cannot receive them; upgrade it to keep media content. See the repo-root DEPRECATIONS.md.`)}function tA(e){$k()||console.warn(`[ag-ui][compat] Not flattening message content for a <=0.0.39 peer: ${e} content part(s) claim type "text" but carry a malformed 'text' value. That is a defect in the message, not media the peer cannot represent, and a downgrade must not repair it — the content is passed on unchanged so the outgoing enforcement boundary reports it. See the repo-root DEPRECATIONS.md.`)}function nA(e){let t=e.content;if(Array.isArray(t)){let n=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`,r=e=>n(e)&&typeof e.text==`string`,i=t.filter(e=>n(e)&&!r(e));if(i.length>0)return tA(i.length),e;let a=t.filter(e=>!r(e)).map(e=>typeof e==`object`&&e&&`type`in e?String(e.type):typeof e);a.length>0&&eA(a);let o=t.filter(r).map(e=>e.text).join(``);return{...e,content:o}}return typeof t==`string`?e:t===void 0?{...e,content:``}:e}var rA=class extends Ak{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(nA)};return this.runNext(i,t)}},iA=`THINKING_START`,aA=`THINKING_END`,oA=`THINKING_TEXT_MESSAGE_START`,sA=`THINKING_TEXT_MESSAGE_CONTENT`,cA=`THINKING_TEXT_MESSAGE_END`,lA=class extends Ak{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(Td(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case iA:{this.currentReasoningId=OO();let{title:t,...n}=e;return this.warnAboutTransformation(iA,I.REASONING_START),{...n,type:I.REASONING_START,messageId:this.currentReasoningId}}case oA:return this.currentMessageId=OO(),this.warnAboutTransformation(oA,I.REASONING_MESSAGE_START),{...e,type:I.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case sA:{let{delta:t,...n}=e;return this.warnAboutTransformation(sA,I.REASONING_MESSAGE_CONTENT),{...n,type:I.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??OO(),delta:t}}case cA:{let t=this.currentMessageId??OO();return this.warnAboutTransformation(cA,I.REASONING_MESSAGE_END),{...e,type:I.REASONING_MESSAGE_END,messageId:t}}case aA:{let t=this.currentReasoningId??OO();return this.warnAboutTransformation(aA,I.REASONING_END),{...e,type:I.REASONING_END,messageId:t}}default:return e}}},uA=`SUBAGENT_STARTED`,dA=`SUBAGENT_FINISHED`,fA=`SUBAGENT_ERROR`;function pA(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function mA(e){return e.map(e=>pA(e))}var hA=class extends Ak{warnDroppedLifecycleEvent(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let n={...e,messages:(e.messages??[]).map(e=>pA(e))};return this.runNext(n,t).pipe(Bd(e=>{let t=e.type;(t===uA||t===dA||t===fA)&&this.warnDroppedLifecycleEvent(t)}),jd(e=>{let t=e.type;return t!==uA&&t!==dA&&t!==fA}),Td(e=>{let t=pA(e);if(t.type===I.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:mA(e.messages)}}if(t.type===I.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>pA(e))}}}if(t.type===I.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:mA(e.input.messages)}}}return t}))}},gA=`1.0.2`,_A=!1,vA=new WeakSet,yA=(e,t)=>/^\d+\.\d+$/.test(e)?qT(e,t)>0?`newer`:`not-newer`:`uninterpretable`,bA=e=>{let t=e.protocolVersion;if(t!==void 0&&t!==`1.0`)switch(yA(t,`1.0`)){case`uninterpretable`:console.warn(`[ag-ui] The producer declared protocol version '${t}', which this client cannot interpret.`);return;case`newer`:console.warn(`[ag-ui] The producer speaks protocol ${t}; this client speaks 1.0. Unrecognised material will be stripped with warnings.`);return;case`not-newer`:return}},xA=class e{resolvePeerCeiling(t){if(this.resolvingPeerCeiling)return gA;let n=Object.getOwnPropertyDescriptor(this,`maxVersion`),r=Object.getOwnPropertyDescriptor(this,`maxProtocolVersion`),i=Object.getPrototypeOf(this);for(;i&&i!==e.prototype;)n??=Object.getOwnPropertyDescriptor(i,`maxVersion`),r??=Object.getOwnPropertyDescriptor(i,`maxProtocolVersion`),i=Object.getPrototypeOf(i);if(t===`maxVersion`&&n)return gA;let a=t===`maxProtocolVersion`?n:r;if(!a)return gA;this.resolvingPeerCeiling=!0;try{return a.get?a.get.call(this):a.value}finally{this.resolvingPeerCeiling=!1}}get maxProtocolVersion(){return this.resolvePeerCeiling(`maxProtocolVersion`)}get maxVersion(){return!this.resolvingPeerCeiling&&!_A&&(_A=!0,console.warn(`[ag-ui] AbstractAgent.maxVersion is deprecated — use maxProtocolVersion. Same value; the new name says whose version it is and that it is a ceiling.`)),this.resolvePeerCeiling(`maxVersion`)}get debug(){return this._debug}set debug(e){this._debug=PO(e),this._debugLogger=LO(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?LO(PO(!0)):void 0:e}resolvedCeilingDuringConstruction(){let e=this.maxProtocolVersion;if(typeof e!=`string`||!JT(e))throw new L(`maxProtocolVersion resolved to ${JSON.stringify(e)} during construction, which is not a version this client can compare. A ceiling read from an instance field is not available yet — return a literal from the getter.`);return e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.resolvingPeerCeiling=!1,this.agentId=e,this.description=t??``,this.threadId=n??Qc(),this.messages=DO(r??[]),this.state=DO(i??{}),this._debug=PO(a),this._debugLogger=LO(this._debug);let o=this.resolvedCeilingDuringConstruction();qT(o,`0.0.39`)<=0&&this.middlewares.unshift(new rA),qT(o,`0.0.45`)<=0&&this.middlewares.unshift(new lA),qT(o,`0.0.57`)<=0&&this.middlewares.unshift(new hA)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(e=>typeof e==`function`?new jk(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Qc();let n=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle(`LIFECYCLE`,`Run started:`,{agentId:this.agentId,threadId:this.threadId});let r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunStartedEvent:({event:e})=>bA(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];vA.add(n),await this.onInitialize(n,a),this.activeRunDetach$=new Bu;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await wd(ku(()=>[...this.middlewares,new Xk].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),Ok(this.debugLogger),hk(this.debugLogger),HO(this.debugLogger),e=>e.pipe(zd(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),Md(e=>(this.debugLogger?.lifecycle(`LIFECYCLE`,`Run errored:`,{agentId:this.agentId,error:e instanceof Error?e.message:String(e)}),this.isRunning=!1,this.onError(n,e,a))),Ld(()=>{this.debugLogger?.lifecycle(`LIFECYCLE`,`Run finished:`,{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(Sd(null)));let s=DO(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new rl}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Qc();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunStartedEvent:({event:e})=>bA(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new Bu;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await wd(ku(()=>Ad(()=>this.connect(n)),e=>Ok(this.debugLogger)(Zk()(e)),hk(this.debugLogger),HO(this.debugLogger),e=>e.pipe(zd(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),Md(e=>(this.isRunning=!1,e instanceof rl?Wu:this.onError(n,e,a))),Ld(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(Sd(null)),{defaultValue:void 0});let s=DO(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}applyBeforeSourceError(e,t,n){return Ad(()=>{let r,i=t.pipe(Md(e=>(r={error:e},Wu)));return this.processApplyEvents(e,this.apply(e,i,n),n).pipe(Fd(Ad(()=>{let e=r;return e?z(()=>e.error):Wu})))})}apply(e,t,n){return BO(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(Bd(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state!==void 0&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=DO(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Qc(),...qT(this.maxProtocolVersion,gA)>=0&&{protocolVersion:`1.0`},tools:DO(e?.tools??[]),context:DO(e?.context??[]),forwardedProps:DO(e?.forwardedProps??{}),state:DO(this.state),messages:n,...e?.resume===void 0?{}:{resume:DO(e.resume)}}}async onInitialize(e,t){if(vA.has(e)&&this.pendingInterrupts.length>0){let t=new Set((e.resume??[]).map(e=>e.interruptId)),n=this.pendingInterrupts.map(e=>e.id).filter(e=>!t.has(e));if(n.length>0)throw new L(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let t of this.pendingInterrupts)if(Qk(t)&&(e.resume??[]).find(e=>e.interruptId===t.id)?.status!==`cancelled`)throw new L(`Interrupt ${t.id} expired at ${t.expiresAt} and can no longer be answered. Cancel it to continue the thread.`)}let n=await NO(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages.filter(e=>e.role!==`activity`),t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state!==void 0&&(this.state=n.state,e.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}}onError(e,t,n){return xd(NO(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(Td(r=>{let i=r;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0){let e=String(t);if(t.name!==`AbortError`&&t.message!==`Fetch is aborted`&&t.message!==`signal is aborted without reason`&&t.message!==`component unmounted`&&e!==`component unmounted`)throw console.error(`Agent execution failed:`,t),t}return{}}))}async onFinalize(e,t){let n=await NO(t,this.messages,this.state,(t,n,r)=>t.onRunFinalized?.({messages:n,state:r,agent:this,input:e}));(n.messages!==void 0||n.state!==void 0)&&(n.messages!==void 0&&(this.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state!==void 0&&(this.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=DO(this.messages),e.state=DO(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=DO(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if(e.role===`assistant`&&e.toolCalls)for(let t of e.toolCalls)for(let e of this.subscribers)await e.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let e of this.subscribers)await e.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if(t.role===`assistant`&&t.toolCalls)for(let e of t.toolCalls)for(let t of this.subscribers)await t.onNewToolCall?.({toolCall:e,messages:this.messages,state:this.state,agent:this})}for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=DO(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=DO(e),(async()=>{for(let e of this.subscribers)await e.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Qc();let t=this.prepareRunAgentInput(e);return[...this.middlewares,new Xk].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t).pipe(Ok(this.debugLogger),hk(this.debugLogger),HO(this.debugLogger),tk(this.threadId,t.runId,this.agentId),e=>e.pipe(Td(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function SA(e){if(!Array.isArray(e.messages))return e;let t=!1,n=e.messages.map(e=>{if(e.subagentRunId===null){t=!0;let n={...e};return delete n.subagentRunId,n}return e});return t?{...e,messages:n}:e}var CA=class extends xA{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(SA(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new AbortController,this.url=e.url,this.headers=DO(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return XO(WO(()=>this.fetch(this.url,this.requestInit(kk(e)))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=DO(this.headers??{}),e.fetch=this.fetch;let t=new AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}},wA=M.createContext(void 0),TA=e=>{let t=M.useContext(wA);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},EA=({client:e,children:t})=>(M.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,N.jsx)(wA.Provider,{value:e,children:t})),DA={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},OA=new class{#e=DA;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function kA(e){setTimeout(e,0)}var AA=typeof window>`u`||`Deno`in globalThis;function jA(){}function MA(e,t){return typeof e==`function`?e(t):e}function NA(e){return typeof e==`number`&&e>=0&&e!==1/0}function PA(e,t){return Math.max(e+(t||0)-Date.now(),0)}function FA(e,t){return typeof e==`function`?e(t):e}function IA(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==RA(o,t.options))return!1}else if(!BA(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function LA(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(zA(t.options.mutationKey)!==zA(a))return!1}else if(!BA(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function RA(e,t){return(t?.queryKeyHashFn||zA)(e)}function zA(e){return JSON.stringify(e,(e,t)=>GA(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function BA(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n500)return t;let r=WA(e)&&WA(t);if(!r&&!(GA(e)&&GA(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{OA.setTimeout(t,e)})}function JA(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:HA(e,t)}function YA(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function XA(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ZA=Symbol();function QA(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ZA?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function $A(e,t){return typeof e==`function`?e(...t):!!e}function ej(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var tj=()=>AA,nj=()=>tj(),rj=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ij=new class extends rj{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},aj=kA;function oj(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=aj,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var sj=oj(),cj=new class extends rj{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function lj(e){return Math.min(1e3*2**e,3e4)}function uj(e){return(e??`online`)!==`online`||cj.isOnline()}var dj=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function fj(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(jA);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new dj(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>ij.isFocused()&&(e.networkMode===`always`||cj.isOnline())&&e.canRun(),p=()=>uj(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(nj()?0:3),a=e.retryDelay??lj,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&nf()?void 0:g(f)).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var pj=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),NA(this.gcTime)&&(this.#e=OA.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(nj()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(OA.clearTimeout(this.#e),this.#e=void 0)}};function mj(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ej(e,()=>t.signal,()=>n=!0)},u=QA(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?XA:YA;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?gj:hj,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:hj(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function hj(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function gj(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function _j(e,t){return t?hj(e,t)!=null:!1}function vj(e,t){return!t||!e.getPreviousPageParam?!1:gj(e,t)!=null}var yj=class extends pj{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Sj(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Sj(this.options);e.data!==void 0&&(this.setState(xj(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=JA(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(jA).catch(jA):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>FA(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ZA||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>FA(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!PA(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=QA(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?mj(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=fj({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof dj&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof dj){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...bj(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...xj(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),sj.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function bj(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:uj(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function xj(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Sj(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Cj=class extends rj{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Tj(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ej(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ej(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof FA(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!UA(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Dj(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||FA(this.options.enabled,this.#t)!==FA(t.enabled,this.#t)||FA(this.options.staleTime,this.#t)!==FA(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||FA(this.options.enabled,this.#t)!==FA(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return UA(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(jA)),t}#h(e){return!nj()&&FA(this.options.enabled,this.#t)!==!1&&NA(e)}#g(){this.#b();let e=FA(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=PA(this.#r.dataUpdatedAt,e)+1;this.#u=OA.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return FA(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=OA.setInterval(()=>{(this.options.refetchIntervalInBackground||ij.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(OA.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(OA.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Tj(e,t),o=i&&Dj(e,n,t,r);(a||o)&&(l={...l,...bj(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=JA(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=JA(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Oj(e,t),refetch:this.refetch,isEnabled:FA(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),UA(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();sj.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function wj(e,t){return FA(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||FA(t.retryOnMount,e)!==!1)}function Tj(e,t){return wj(e,t)||e.state.data!==void 0&&Ej(e,t,t.refetchOnMount)}function Ej(e,t,n){if(FA(t.enabled,e)!==!1&&FA(t.staleTime,e)!==`static`){let r=FA(n,e);return r===`always`||r!==!1&&Oj(e,t)}return!1}function Dj(e,t,n,r){return(e!==t||FA(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Oj(e,n)}function Oj(e,t){return FA(t.enabled,e)!==!1&&e.isStaleByTime(FA(t.staleTime,e))}var kj=class extends Cj{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:_j(t,n.data),hasPreviousPage:vj(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Aj=class extends pj{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||jj(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=fj({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),sj.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function jj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Mj=class extends rj{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Aj({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Nj(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Nj(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Nj(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Nj(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){sj.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>LA(t,e))}findAll(e={}){return this.getAll().filter(t=>LA(e,t))}notify(e){sj.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return sj.batch(()=>Promise.all(e.map(e=>e.continue().catch(jA))))}};function Nj(e){return e.options.scope?.id}var Pj=class extends rj{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??RA(r,t),a=this.get(i);return a||(a=new yj({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){sj.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>IA(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>IA(e,t)):t}notify(e){sj.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){sj.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){sj.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Fj=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Pj,this.#t=e.mutationCache||new Mj,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ij.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=cj.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(FA(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=MA(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return sj.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;sj.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return sj.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=sj.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(jA).catch(jA)}invalidateQueries(e,t={}){return sj.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=sj.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(jA)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(jA)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(FA(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(FA(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(jA).catch(jA)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(jA).catch(jA)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return cj.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(zA(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{BA(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(zA(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{BA(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=RA(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===ZA&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ij=M.createContext(!1),Lj=()=>M.useContext(Ij);Ij.Provider;function Rj(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var zj=M.createContext(Rj()),Bj=()=>M.useContext(zj),Vj=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?$A(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Hj=e=>{M.useEffect(()=>{e.clearReset()},[e])},Uj=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||$A(n,[e.error,r])),Wj=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Gj=(e,t)=>e?.suspense&&t.isPending,Kj=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function qj(e,t,n){let r=Lj(),i=Bj(),a=TA(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Wj(o),Vj(o,i,s),Hj(i);let[l]=M.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(M.useSyncExternalStore(M.useCallback(e=>{let t=d?l.subscribe(sj.batchCalls(e)):jA;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),M.useEffect(()=>{l.setOptions(o)},[o,l]),Gj(o,u))throw Kj(o,l,i);if(Uj({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Jj(e,t){return qj(e,Cj,t)}function Yj(e,t){return qj(e,kj,t)}var Xj=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M112,56V200L40,128Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z`}))]]),Zj=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z`}))]]),Qj=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,44H160a43.86,43.86,0,0,0-32,13.85A43.86,43.86,0,0,0,96,44H24A12,12,0,0,0,12,56V200a12,12,0,0,0,12,12H96a20,20,0,0,1,20,20,12,12,0,0,0,24,0,20,20,0,0,1,20-20h72a12,12,0,0,0,12-12V56A12,12,0,0,0,232,44ZM96,188H36V68H96a20,20,0,0,1,20,20V192.81A43.79,43.79,0,0,0,96,188Zm124,0H160a43.71,43.71,0,0,0-20,4.83V88a20,20,0,0,1,20-20h60Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,56V200H160a32,32,0,0,0-32,32,32,32,0,0,0-32-32H24V56H96a32,32,0,0,1,32,32,32,32,0,0,1,32-32Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M240,56V200a8,8,0,0,1-8,8H160a24,24,0,0,0-24,23.94,7.9,7.9,0,0,1-5.12,7.55A8,8,0,0,1,120,232a24,24,0,0,0-24-24H24a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H88a32,32,0,0,1,32,32v87.73a8.17,8.17,0,0,0,7.47,8.25,8,8,0,0,0,8.53-8V80a32,32,0,0,1,32-32h64A8,8,0,0,1,240,56Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,50H160a38,38,0,0,0-32,17.55A38,38,0,0,0,96,50H24a6,6,0,0,0-6,6V200a6,6,0,0,0,6,6H96a26,26,0,0,1,26,26,6,6,0,0,0,12,0,26,26,0,0,1,26-26h72a6,6,0,0,0,6-6V56A6,6,0,0,0,232,50ZM96,194H30V62H96a26,26,0,0,1,26,26V204.31A37.86,37.86,0,0,0,96,194Zm130,0H160a37.87,37.87,0,0,0-26,10.32V88a26,26,0,0,1,26-26h66Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232,52H160a36,36,0,0,0-32,19.54A36,36,0,0,0,96,52H24a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H96a28,28,0,0,1,28,28,4,4,0,0,0,8,0,28,28,0,0,1,28-28h72a4,4,0,0,0,4-4V56A4,4,0,0,0,232,52ZM96,196H28V60H96a28,28,0,0,1,28,28V209.4A35.93,35.93,0,0,0,96,196Zm132,0H160a35.94,35.94,0,0,0-28,13.41V88a28,28,0,0,1,28-28h68Z`}))]]),$j=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128ZM60,112a16,16,0,1,0,16,16A16,16,0,0,0,60,112Zm136,0a16,16,0,1,0,16,16A16,16,0,0,0,196,112Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M240,96v64a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V96A16,16,0,0,1,32,80H224A16,16,0,0,1,240,96Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V96A16,16,0,0,0,224,80ZM60,140a12,12,0,1,1,12-12A12,12,0,0,1,60,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,196,140Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM60,118a10,10,0,1,0,10,10A10,10,0,0,0,60,118Zm136,0a10,10,0,1,0,10,10A10,10,0,0,0,196,118Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-76-8a8,8,0,1,0,8,8A8,8,0,0,0,60,120Zm136,0a8,8,0,1,0,8,8A8,8,0,0,0,196,120Z`}))]]),eM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),tM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z`}))]]),nM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),rM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M240.49,15.51a12,12,0,0,0-17,0L173.94,65.09l-2.54-2.55a36.05,36.05,0,0,0-50.91,0L100,83l-3.51-3.52a12,12,0,0,0-17,17L83,100,62.54,120.49a36,36,0,0,0,0,50.91l2.55,2.54L15.51,223.51a12,12,0,0,0,17,17l49.57-49.58,2.54,2.55a36.06,36.06,0,0,0,50.91,0L156,173l3.51,3.52a12,12,0,0,0,17-17L173,156l20.49-20.49a36,36,0,0,0,0-50.91l-2.55-2.54,49.58-49.57A12,12,0,0,0,240.49,15.51Zm-121.95,161a12,12,0,0,1-17,0L79.51,154.43a12,12,0,0,1,0-17L100,117l39,39Zm58-57.95h0L156,139l-39-39,20.49-20.49a12,12,0,0,1,17,0l22.06,22.06a12,12,0,0,1,0,17ZM85.27,33.37a12,12,0,0,1,21.46-10.74l8,16A12,12,0,1,1,93.27,49.37Zm-68,57.26a12,12,0,0,1,16.1-5.36l16,8a12,12,0,1,1-10.74,21.46l-16-8A12,12,0,0,1,17.27,90.63Zm221.46,74.74a12,12,0,0,1-16.1,5.36l-16-8a12,12,0,0,1,10.74-21.46l16,8A12,12,0,0,1,238.73,165.37Zm-68,57.26a12,12,0,1,1-21.46,10.74l-8-16a12,12,0,0,1,21.46-10.74Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M185,127,127,185a24,24,0,0,1-33.94,0L71,162.91A24,24,0,0,1,71,129L129,71a24,24,0,0,1,33.94,0L185,93.09A24,24,0,0,1,185,127Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32.06,32.06,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94h0L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22a16,16,0,0,1,0,22.63ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM29,103.43l20,8A8,8,0,1,0,55,96.57l-20-8A8,8,0,0,0,29,103.43ZM227,152.57l-20-8A8,8,0,1,0,201,159.43l20,8A8,8,0,0,0,227,152.57ZM159.43,201A8,8,0,0,0,144.57,207l8,20A8,8,0,1,0,167.43,221ZM237.91,18.52a8,8,0,0,0-11.5-.18L174,70.75l-5.38-5.38a32,32,0,0,0-45.28,0L106.14,82.54a4,4,0,0,0,0,5.66l61.7,61.66a4,4,0,0,0,5.66,0l16.74-16.74a32.76,32.76,0,0,0,9.81-22.52,31.82,31.82,0,0,0-9.37-23.17l-5.38-5.37,52.2-52.17A8.22,8.22,0,0,0,237.91,18.52ZM85.64,90.34a8,8,0,0,0-11.49.18,8.22,8.22,0,0,0,.41,11.37L80.67,108,65.34,123.31A31.82,31.82,0,0,0,56,146.47,32.75,32.75,0,0,0,65.77,169l5,4.94L18.49,226.13a8.21,8.21,0,0,0-.61,11.1,8,8,0,0,0,11.72.43L82,185.25l5.37,5.38a32.1,32.1,0,0,0,45.29,0L148,175.31l6.34,6.35a8,8,0,0,0,11.32-11.32Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M236.24,19.76a6,6,0,0,0-8.48,0L173.94,73.57l-6.79-6.78a30,30,0,0,0-42.42,0L100,91.51l-7.76-7.75a6,6,0,0,0-8.48,8.48L91.51,100,66.79,124.73a30,30,0,0,0,0,42.42l6.78,6.79L19.76,227.76a6,6,0,1,0,8.48,8.48l53.82-53.81,6.79,6.78a30,30,0,0,0,42.42,0L156,164.49l7.76,7.75a6,6,0,0,0,8.48-8.48L164.49,156l24.72-24.73a30,30,0,0,0,0-42.42l-6.78-6.79,53.81-53.82A6,6,0,0,0,236.24,19.76Zm-113.45,161a18,18,0,0,1-25.46,0L75.27,158.67a18,18,0,0,1,0-25.46L100,108.49,147.51,156Zm57.94-57.94L156,147.51,108.49,100l24.72-24.73a18,18,0,0,1,25.46,0l22.06,22.06a18,18,0,0,1,0,25.46ZM90.43,34.23a6,6,0,0,1,11.14-4.46l8,20a6,6,0,1,1-11.14,4.46Zm-64,59.54a6,6,0,0,1,7.8-3.34l20,8a6,6,0,1,1-4.46,11.14l-20-8A6,6,0,0,1,26.43,93.77Zm203.14,68.46a6,6,0,0,1-7.8,3.34l-20-8a6,6,0,0,1,4.46-11.14l20,8A6,6,0,0,1,229.57,162.23Zm-64,59.54a6,6,0,1,1-11.14,4.46l-8-20a6,6,0,0,1,11.14-4.46Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32,32,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22A16,16,0,0,1,179.31,121.37ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M234.83,21.17a4,4,0,0,0-5.66,0L173.94,76.4l-8.2-8.2a28,28,0,0,0-39.6,0L100,94.34l-9.17-9.17a4,4,0,0,0-5.66,5.66L94.34,100,68.2,126.14a28,28,0,0,0,0,39.6l8.2,8.2L21.17,229.17a4,4,0,0,0,5.66,5.66L82.06,179.6l8.2,8.2a28,28,0,0,0,39.6,0L156,161.66l9.17,9.17a4,4,0,0,0,5.66-5.66L161.66,156l26.14-26.14a28,28,0,0,0,0-39.6l-8.2-8.2,55.23-55.23A4,4,0,0,0,234.83,21.17Zm-110.63,161a20,20,0,0,1-28.28,0L73.86,160.08a20,20,0,0,1,0-28.28L100,105.66,150.34,156Zm57.94-57.94L156,150.34,105.66,100,131.8,73.86a20,20,0,0,1,28.28,0l22.06,22.06A20,20,0,0,1,182.14,124.2ZM92.29,33.49a4,4,0,1,1,7.42-3l8,20a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,104,56a4,4,0,0,1-3.71-2.51Zm-64,61a4,4,0,0,1,5.2-2.22l20,8A4,4,0,0,1,52,108a3.91,3.91,0,0,1-1.49-.29l-20-8A4,4,0,0,1,28.29,94.51Zm199.42,67A4,4,0,0,1,224,164a3.91,3.91,0,0,1-1.49-.29l-20-8a4,4,0,1,1,3-7.42l20,8A4,4,0,0,1,227.71,161.49Zm-64,61a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,160,228a4,4,0,0,1-3.71-2.51l-8-20a4,4,0,0,1,7.42-3Z`}))]]),iM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),aM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z`}))]]),oM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M194.82,151.43l-55.09,20.3-20.3,55.09a7.92,7.92,0,0,1-14.86,0l-20.3-55.09-55.09-20.3a7.92,7.92,0,0,1,0-14.86l55.09-20.3,20.3-55.09a7.92,7.92,0,0,1,14.86,0l20.3,55.09,55.09,20.3A7.92,7.92,0,0,1,194.82,151.43Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M208,144a15.78,15.78,0,0,1-10.42,14.94L146,178l-19,51.62a15.92,15.92,0,0,1-29.88,0L78,178l-51.62-19a15.92,15.92,0,0,1,0-29.88L78,110l19-51.62a15.92,15.92,0,0,1,29.88,0L146,110l51.62,19A15.78,15.78,0,0,1,208,144ZM152,48h16V64a8,8,0,0,0,16,0V48h16a8,8,0,0,0,0-16H184V16a8,8,0,0,0-16,0V32H152a8,8,0,0,0,0,16Zm88,32h-8V72a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0V96h8a8,8,0,0,0,0-16Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M196.89,130.94,144.4,111.6,125.06,59.11a13.92,13.92,0,0,0-26.12,0L79.6,111.6,27.11,130.94a13.92,13.92,0,0,0,0,26.12L79.6,176.4l19.34,52.49a13.92,13.92,0,0,0,26.12,0L144.4,176.4l52.49-19.34a13.92,13.92,0,0,0,0-26.12Zm-4.15,14.86-55.08,20.3a6,6,0,0,0-3.56,3.56l-20.3,55.08a1.92,1.92,0,0,1-3.6,0L89.9,169.66a6,6,0,0,0-3.56-3.56L31.26,145.8a1.92,1.92,0,0,1,0-3.6l55.08-20.3a6,6,0,0,0,3.56-3.56l20.3-55.08a1.92,1.92,0,0,1,3.6,0l20.3,55.08a6,6,0,0,0,3.56,3.56l55.08,20.3a1.92,1.92,0,0,1,0,3.6ZM146,40a6,6,0,0,1,6-6h18V16a6,6,0,0,1,12,0V34h18a6,6,0,0,1,0,12H182V64a6,6,0,0,1-12,0V46H152A6,6,0,0,1,146,40ZM246,88a6,6,0,0,1-6,6H230v10a6,6,0,0,1-12,0V94H208a6,6,0,0,1,0-12h10V72a6,6,0,0,1,12,0V82h10A6,6,0,0,1,246,88Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M196.2,132.81l-53.36-19.65L123.19,59.8a11.93,11.93,0,0,0-22.38,0L81.16,113.16,27.8,132.81a11.93,11.93,0,0,0,0,22.38l53.36,19.65,19.65,53.36a11.93,11.93,0,0,0,22.38,0l19.65-53.36,53.36-19.65a11.93,11.93,0,0,0,0-22.38Zm-2.77,14.87L138.35,168a4,4,0,0,0-2.37,2.37l-20.3,55.08a3.92,3.92,0,0,1-7.36,0L88,170.35A4,4,0,0,0,85.65,168l-55.08-20.3a3.92,3.92,0,0,1,0-7.36L85.65,120A4,4,0,0,0,88,117.65l20.3-55.08a3.92,3.92,0,0,1,7.36,0L136,117.65a4,4,0,0,0,2.37,2.37l55.08,20.3a3.92,3.92,0,0,1,0,7.36ZM148,40a4,4,0,0,1,4-4h20V16a4,4,0,0,1,8,0V36h20a4,4,0,0,1,0,8H180V64a4,4,0,0,1-8,0V44H152A4,4,0,0,1,148,40Zm96,48a4,4,0,0,1-4,4H228v12a4,4,0,0,1-8,0V92H208a4,4,0,0,1,0-8h12V72a4,4,0,0,1,8,0V84h12A4,4,0,0,1,244,88Z`}))]]),sM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z`}))]]),cM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z`}))]]),lM=new Map([[`bold`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M256,136a12,12,0,0,1-12,12h-8v8a12,12,0,0,1-24,0v-8h-8a12,12,0,0,1,0-24h8v-8a12,12,0,0,1,24,0v8h8A12,12,0,0,1,256,136Zm-54.81,56.28a12,12,0,1,1-18.38,15.44C169.12,191.42,145,172,108,172c-28.89,0-55.46,12.68-74.81,35.72a12,12,0,0,1-18.38-15.44A124.08,124.08,0,0,1,63.5,156.53a72,72,0,1,1,89,0A124,124,0,0,1,201.19,192.28ZM108,148a48,48,0,1,0-48-48A48.05,48.05,0,0,0,108,148Z`}))],[`duotone`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z`,opacity:`0.2`}),M.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`fill`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136ZM144,157.68a68,68,0,1,0-71.9,0c-20.65,6.76-39.23,19.39-54.17,37.17A8,8,0,0,0,24,208H192a8,8,0,0,0,6.13-13.15C183.18,177.07,164.6,164.44,144,157.68Z`}))],[`light`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M254,136a6,6,0,0,1-6,6H230v18a6,6,0,0,1-12,0V142H200a6,6,0,0,1,0-12h18V112a6,6,0,0,1,12,0v18h18A6,6,0,0,1,254,136Zm-57.41,60.14a6,6,0,1,1-9.18,7.72C166.9,179.45,138.69,166,108,166s-58.89,13.45-79.41,37.86a6,6,0,0,1-9.18-7.72C35.14,177.41,55,164.48,77,158.25a66,66,0,1,1,62,0C161,164.48,180.86,177.41,196.59,196.14ZM108,154a54,54,0,1,0-54-54A54.06,54.06,0,0,0,108,154Z`}))],[`regular`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`thin`,M.createElement(M.Fragment,null,M.createElement(`path`,{d:`M252,136a4,4,0,0,1-4,4H228v20a4,4,0,0,1-8,0V140H200a4,4,0,0,1,0-8h20V112a4,4,0,0,1,8,0v20h20A4,4,0,0,1,252,136Zm-56.94,61.43a4,4,0,0,1-6.12,5.14C168,177.7,139.3,164,108,164s-60,13.7-80.94,38.57a4,4,0,1,1-6.12-5.14c16.71-19.9,38.13-33.13,61.89-38.59a64,64,0,1,1,50.34,0C156.93,164.3,178.35,177.53,195.06,197.43ZM108,156a56,56,0,1,0-56-56A56.06,56.06,0,0,0,108,156Z`}))]]),uM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:Xj}));uM.displayName=`ArrowLeftIcon`;var dM=uM,fM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:Zj}));fM.displayName=`ArrowRightIcon`;var pM=fM,mM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:Qj}));mM.displayName=`BookOpenIcon`;var hM=mM,gM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:$j}));gM.displayName=`DotsThreeIcon`;var _M=gM,vM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:eM}));vM.displayName=`MagnifyingGlassIcon`;var yM=vM,bM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:tM}));bM.displayName=`MoonIcon`;var xM=bM,SM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:nM}));SM.displayName=`PencilSimpleIcon`;var CM=SM,wM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:rM}));wM.displayName=`PlugsConnectedIcon`;var TM=wM,EM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:iM}));EM.displayName=`PlusIcon`;var DM=EM,OM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:aM}));OM.displayName=`SignOutIcon`;var kM=OM,AM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:oM}));AM.displayName=`SparkleIcon`;var jM=AM,MM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:sM}));MM.displayName=`SunIcon`;var NM=MM,PM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:cM}));PM.displayName=`TrashIcon`;var FM=PM,IM=M.forwardRef((e,t)=>M.createElement(k,{ref:t,...e,weights:lM}));IM.displayName=`UserPlusIcon`;var LM=IM,RM=class extends Error{status;problems;code;constructor(e,t,n=[],r=``){super(e),this.status=t,this.problems=n,this.code=r}},zM=`fanout:unauthorized`;function BM(){let e=new URLSearchParams(window.location.search).get(`return_to`);if(!e)return``;let t=new URL(e,window.location.origin);return t.origin!==window.location.origin||t.pathname!==`/api/auth/oauth/authorize`?``:`${t.pathname}${t.search}`}function VM(e){return!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||e.id===``?`none`:`user`}function HM(){window.dispatchEvent(new Event(zM))}async function UM(e,t={}){let n=new Headers(t.headers);n.set(`Fanout-Request`,`1`);let r=await fetch(e,{...t,headers:n,credentials:`same-origin`});if(r.status===401&&HM(),r.status===403){let e=await r.clone().json().catch(()=>({}));throw new RM(e.message??`You do not have permission to perform this action.`,r.status,[],e.code??``)}return r}async function WM(){let e=await UM(`/api/auth/logout`,{method:`POST`});if(!e.ok&&e.status!==401)throw Error(`Sign-out failed — your session is still active.`);e.status!==401&&HM(),window.location.assign(`/`)}var GM=(0,M.createContext)(null);function KM(){let e=(0,M.useContext)(GM);if(!e)throw Error(`Fanout runtime status is unavailable`);return e}var qM=(0,M.createContext)(null);function JM(){let e=(0,M.useContext)(qM);if(!e)throw Error(`Fanout viewer is unavailable`);return e}function YM(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||t.id===``||t.status!==`active`&&t.status!==`suspended`?null:{id:t.id,email:typeof t.email==`string`?t.email:``,display_name:typeof t.display_name==`string`?t.display_name:``,status:t.status,role:typeof t.role==`string`?t.role:``}}async function XM(e,t){let n=await fetch(e,{method:t===void 0?`GET`:`POST`,headers:t===void 0?void 0:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t),credentials:`same-origin`}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.message??`Request failed (${n.status})`);return r}function ZM({children:e,wide:t=!1}){return(0,N.jsx)(u,{mih:`100dvh`,style:{background:`radial-gradient(circle at 50% -12%, var(--mantine-color-brand-light), transparent 38%), linear-gradient(180deg, var(--mantine-color-default-hover), var(--mantine-color-body) 62%)`},children:(0,N.jsx)(je,{mih:`100dvh`,px:`md`,py:48,children:(0,N.jsx)(ve,{size:t?680:480,w:`100%`,children:(0,N.jsx)(Fe,{radius:28,p:{base:24,sm:40},style:{background:`var(--mantine-color-body)`,border:`1px solid var(--mantine-color-default-border)`,boxShadow:`var(--mantine-shadow-xl)`},children:e})})})})}function QM(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`setup_token`)??``}function $M(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`login_token`)??``}function eN({children:e}){let t=ze(),[n,r]=(0,M.useState)(null),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(`none`),[c,l]=(0,M.useState)(null),[d,f]=(0,M.useState)(!1),[p,m]=(0,M.useState)(``),[h,g]=(0,M.useState)(``),[_,v]=(0,M.useState)(QM),[y,b]=(0,M.useState)($M),[x,S]=(0,M.useState)(``),[C,w]=(0,M.useState)(!1),[T,ee]=(0,M.useState)(0),[E,D]=(0,M.useState)(()=>Date.now()),[O,te]=(0,M.useState)(!1),[re,k]=(0,M.useState)(``),[ie,ae]=(0,M.useState)(null),[se,le]=(0,M.useState)(!1),de=(0,M.useRef)(null),fe=BM(),pe=o===`user`;async function he(){let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok){s(`none`),l(null);return}let t=await e.json().catch(()=>null);s(VM(t)),l(YM(t))}async function ge(){try{let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok)return;l(YM(await e.json().catch(()=>null)))}catch{}}(0,M.useEffect)(()=>{let e=new URL(window.location.href);(e.searchParams.has(`setup_token`)||e.searchParams.has(`login_token`))&&(e.searchParams.delete(`setup_token`),e.searchParams.delete(`login_token`),t({href:e.pathname+e.search+e.hash,replace:!0}))},[t]),(0,M.useEffect)(()=>{XM(`/api/auth/status`).then(r).catch(e=>k(String(e))).finally(()=>a(!0)),he().catch(()=>s(`none`)).finally(()=>f(!0));let e=()=>{s(`none`),l(null)};return window.addEventListener(zM,e),()=>window.removeEventListener(zM,e)},[]),(0,M.useEffect)(()=>{d&&o===`none`&&y&&(te(!0),k(``),XM(`/api/auth/link/verify`,{token:y}).then(()=>{s(`user`),ge()}).catch(e=>k(e instanceof Error?e.message:String(e))).finally(()=>{b(``),te(!1)}))},[y,d,o]),(0,M.useEffect)(()=>{pe&&d&&fe&&window.location.replace(fe)},[pe,fe,d]),(0,M.useEffect)(()=>{if(T<=Date.now())return;let e=setInterval(()=>{D(Date.now()),Date.now()>=T&&clearInterval(e)},1e3);return()=>clearInterval(e)},[T]);let _e=Math.max(0,Math.ceil((T-E)/1e3));(0,M.useEffect)(()=>{C&&!O&&re&&de.current?.querySelector(`input`)?.focus()},[O,C,re]);async function ve(e){try{await navigator.clipboard.writeText(e),le(!0)}catch{k(`Clipboard access failed. Select and copy the token manually.`)}}if(ie?.ingest_token)return(0,N.jsx)(ZM,{wide:!0,children:(0,N.jsxs)(oe,{gap:`lg`,children:[(0,N.jsx)(ke,{}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(ue,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Setup complete`}),(0,N.jsx)(xe,{order:1,mt:`xs`,fz:{base:28,sm:32},lh:1.08,children:`Save your ingest token`})]}),(0,N.jsx)(ue,{c:`dimmed`,children:`Fanout shows this token once. Store it with your collector secrets before continuing.`}),(0,N.jsxs)(oe,{gap:`xs`,children:[(0,N.jsx)(ue,{size:`sm`,fw:600,children:`OTLP endpoint`}),(0,N.jsx)(ms,{block:!0,children:ie.suggested_endpoint??window.location.origin})]}),(0,N.jsxs)(oe,{gap:`xs`,children:[(0,N.jsx)(ue,{size:`sm`,fw:600,children:`Header`}),(0,N.jsxs)(ms,{block:!0,children:[ie.ingest_header_name??`Authorization`,`: Bearer `,ie.ingest_token]})]}),re&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re}),(0,N.jsxs)(ne,{grow:!0,align:`stretch`,children:[(0,N.jsx)(ce,{variant:`light`,radius:`md`,leftSection:se?(0,N.jsx)(me,{size:16,weight:`bold`}):(0,N.jsx)(Ee,{size:16}),onClick:()=>void ve(`${ie.ingest_header_name??`Authorization`}: Bearer ${ie.ingest_token}`),children:se?`Copied`:`Copy header`}),(0,N.jsx)(ce,{radius:`md`,rightSection:(0,N.jsx)(pM,{size:16,weight:`bold`}),onClick:()=>{s(`user`),ae(null),ge()},children:`Continue to Fanout`})]}),(0,N.jsx)(ce,{variant:`subtle`,size:`compact-xs`,onClick:()=>void ve(ie.ingest_token??``),children:`Copy token only`})]})});if(!d||!i||y)return(0,N.jsx)(je,{mih:`100dvh`,children:(0,N.jsx)(Ie,{size:`sm`})});if(!n)return(0,N.jsx)(ZM,{children:(0,N.jsxs)(oe,{gap:`lg`,children:[(0,N.jsx)(ke,{}),(0,N.jsx)(xe,{order:1,children:`Fanout is unavailable`}),(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re||`Authentication status could not be loaded.`})]})});if(pe&&fe)return null;if(pe)return(0,N.jsx)(GM.Provider,{value:n,children:(0,N.jsx)(qM.Provider,{value:c??{id:``,email:p,display_name:h,status:`active`,role:``},children:e})});if(n&&!n.setup_required&&n.auth_mode===`oidc`){let e=fe?`/api/auth/oidc/start?return_to=${encodeURIComponent(fe)}`:`/api/auth/oidc/start`;return(0,N.jsx)(ZM,{children:(0,N.jsxs)(oe,{gap:28,children:[(0,N.jsx)(ke,{}),(0,N.jsxs)(oe,{gap:10,children:[(0,N.jsx)(ue,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Secure workspace`}),(0,N.jsx)(xe,{order:1,fz:{base:28,sm:32},lh:1.08,children:`Sign in`}),(0,N.jsx)(ue,{c:`dimmed`,size:`md`,lh:1.6,children:`Use your organization's identity provider to continue.`})]}),re&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re}),(0,N.jsx)(ce,{component:`a`,href:e,size:`md`,radius:`md`,rightSection:(0,N.jsx)(pM,{size:17,weight:`bold`}),children:`Continue with SSO`})]})})}async function ye(){te(!0),k(``);try{await XM(`/api/auth/code/send`,{email:p}),w(!0),S(``),ee(Date.now()+3e4),D(Date.now())}catch(e){k(e instanceof Error?e.message:String(e))}finally{te(!1)}}async function A(e){te(!0),k(``);try{await XM(`/api/auth/code/verify`,{email:p,code:e}),s(`user`),w(!1),S(``),ee(0),ge()}catch(e){S(``),k(e instanceof Error?e.message:String(e))}finally{te(!1)}}function j(){w(!1),S(``),k(``)}async function be(e){e.preventDefault(),te(!0),k(``);try{if(n?.setup_required){let e=await XM(`/api/auth/setup`,{email:p,display_name:h,setup_token:_});e.ingest_token?ae(e):(s(`user`),ge())}else if(C){await A(x);return}else{await ye();return}}catch(e){k(e instanceof Error?e.message:String(e))}finally{te(!1)}}let Se=C&&!n?.setup_required,we=n?.setup_required?`Create the first admin`:Se?`Check your email`:n?.self_signup?`Sign in or create an account`:`Sign in`,Te=n?.setup_required?`Use the one-time token printed by the Fanout process.`:n?.smtp_configured?Se?`We sent a code to ${p}.`:n?.self_signup?`Enter your email to sign in or create a viewer account. No password needed.`:`Enter your email and we’ll send a short verification code. No password needed.`:`Email delivery is not configured. Ask the operator to run fanout login-link with your email address.`;return(0,N.jsx)(ZM,{children:(0,N.jsxs)(oe,{gap:28,children:[(0,N.jsx)(ke,{}),(0,N.jsxs)(oe,{gap:10,children:[(0,N.jsx)(ue,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:n?.setup_required?`One-time setup`:`Secure workspace`}),(0,N.jsx)(xe,{order:1,fz:{base:28,sm:32},lh:1.08,children:we}),Te&&(0,N.jsx)(ue,{c:`dimmed`,size:`md`,lh:1.6,maw:390,children:Te})]}),(0,N.jsx)(`form`,{onSubmit:be,children:(0,N.jsxs)(oe,{gap:`md`,children:[(0,N.jsx)(Gc,{label:`Email`,placeholder:`you@company.com`,type:`email`,required:!0,value:p,onChange:e=>m(e.currentTarget.value),disabled:C,variant:`filled`,radius:`md`,size:`md`,autoFocus:!C}),n?.setup_required&&(0,N.jsx)(Gc,{label:`Display name`,placeholder:`Your display name`,value:h,onChange:e=>g(e.currentTarget.value),variant:`filled`,radius:`md`,size:`md`}),n?.setup_required&&(0,N.jsx)(Gc,{label:`Setup token`,placeholder:`from the setup URL printed at startup`,required:!0,value:_,onChange:e=>v(e.currentTarget.value),autoComplete:`one-time-code`,variant:`filled`,radius:`md`,size:`md`}),Se&&(0,N.jsxs)(oe,{gap:`xs`,children:[(0,N.jsx)(ue,{size:`sm`,fw:600,children:`Verification code`}),(0,N.jsx)(u,{ref:de,children:(0,N.jsx)(Wc,{length:6,type:`number`,oneTimeCode:!0,autoFocus:!0,value:x,onChange:S,onComplete:e=>void A(e),disabled:O,error:!!re,size:`md`,radius:`md`,"aria-label":`Verification code`,getInputProps:e=>({"aria-label":`Digit ${e+1}`})})}),(0,N.jsxs)(ne,{justify:`space-between`,gap:`xs`,children:[(0,N.jsxs)(ue,{c:`dimmed`,size:`xs`,children:[`Sent to `,p]}),(0,N.jsx)(ce,{variant:`subtle`,size:`compact-xs`,leftSection:(0,N.jsx)(dM,{size:12,weight:`bold`}),onClick:j,disabled:O,children:`Change email`})]}),(0,N.jsxs)(ne,{justify:`space-between`,gap:`xs`,children:[(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,children:`Codes expire in 5 minutes`}),(0,N.jsx)(ce,{variant:`subtle`,size:`compact-xs`,onClick:()=>void ye(),disabled:O||_e>0,children:_e>0?`Resend in ${_e}s`:`Resend code`})]})]}),re&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,children:re}),Se?(0,N.jsx)(ce,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:O,disabled:O||x.length<6,rightSection:(0,N.jsx)(pM,{size:17,weight:`bold`}),children:`Verify code`}):(0,N.jsx)(ce,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:O,disabled:!n||!n.setup_required&&!n.smtp_configured,leftSection:n?.setup_required?(0,N.jsx)(LM,{size:17,weight:`bold`}):void 0,rightSection:n?.setup_required?void 0:(0,N.jsx)(pM,{size:17,weight:`bold`}),children:n?.setup_required?`Create admin`:`Send code`})]})})]})})}var tN=[`agent-threads`];async function nN(e){let t=await UM(e);if(!t.ok)throw Error(`Request failed (${t.status})`);return t.json()}var rN=[];for(let e=0;e<256;++e)rN.push((e+256).toString(16).slice(1));function iN(e,t=0){return(rN[e[t+0]]+rN[e[t+1]]+rN[e[t+2]]+rN[e[t+3]]+`-`+rN[e[t+4]]+rN[e[t+5]]+`-`+rN[e[t+6]]+rN[e[t+7]]+`-`+rN[e[t+8]]+rN[e[t+9]]+`-`+rN[e[t+10]]+rN[e[t+11]]+rN[e[t+12]]+rN[e[t+13]]+rN[e[t+14]]+rN[e[t+15]]).toLowerCase()}var aN=new Uint8Array(16);function oN(){return crypto.getRandomValues(aN)}var sN={};function cN(e,t,n){let r;if(e)r=uN(e.random??e.rng?.()??oN(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=oN();lN(sN,e,i),r=uN(i,sN.msecs,sN.seq,t,n)}return t??iN(r)}function lN(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=dN(n),e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function uN(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=dN(e),r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}function dN(e){return(e[6]&127)<<24|e[7]<<16|e[8]<<8|e[9]}function fN(){return cN()}var pN=[`dashboards`],mN=3e4;async function hN(e,t){let{json:n,...r}=t??{},i=new Headers(r.headers),a=r.body;n!==void 0&&(i.set(`content-type`,`application/json`),a=JSON.stringify(n));let o=await UM(e,{...r,headers:i,body:a}),s=await o.json().catch(()=>({}));if(!o.ok)throw new RM(s.message??`Request failed (${o.status})`,o.status,s.problems??[],s.code??``);return s}var gN=e=>`/api/dashboards/${encodeURIComponent(e)}`,_N=()=>hN(`/api/dashboards`).then(e=>e.dashboards),vN=(e,t)=>hN(gN(e),{signal:t}),yN=(e,t)=>hN(`${gN(e)}/versions`,{signal:t}).then(e=>e.versions),bN=(e,t,n)=>hN(`${gN(e)}/versions/${t}`,{signal:n}),xN=(e,t)=>hN(`${gN(e)}/versions/${t}/restore`,{method:`POST`}),SN=(e,t,n,r)=>hN(gN(e),{method:`PUT`,json:{spec:t,base_version:n,message:r}}),CN=(e,t,n,r)=>hN(gN(e),{method:`PATCH`,json:{operations:t,base_version:n,message:r}}),wN=(e,t)=>hN(`/api/panels/query`,{method:`POST`,json:e,signal:t}).then(e=>e.results),TN=e=>hN(`/api/telemetry/schema`,{signal:e}),EN=(e,t)=>hN(`/api/annotations`,{method:`POST`,json:e,signal:t}),DN=(e,t)=>hN(`/api/panels/variables/resolve`,{method:`POST`,json:e,signal:t}).then(e=>e.options),ON=(e,t)=>hN(`/api/panels/exemplars`,{method:`POST`,json:e,signal:t});function kN(e,t){let n=new URLSearchParams({namespace:e.namespace??``,from:e.window_from,to:e.window_to,limit:`200`});return hN(`/api/traces/${encodeURIComponent(e.trace_id??``)}?${n}`,{signal:t})}function AN(){let{setColorScheme:e}=Br(),t=Ur(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`,[r,i]=(0,M.useState)(!1);return(0,N.jsx)(Ot,{label:`Switch to ${n} theme`,opened:r,children:(0,N.jsx)(Pi,{variant:`subtle`,color:`gray`,"aria-label":`Switch to ${n} theme`,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onFocus:()=>i(!0),onBlur:()=>i(!1),onClick:()=>{i(!1),e(n)},children:t===`dark`?(0,N.jsx)(NM,{size:17,weight:`bold`}):(0,N.jsx)(xM,{size:17,weight:`bold`})})})}var jN={home:`https://fanout.run/start/what-fanout-is`,ingest:`https://fanout.run/start/send-telemetry`,connect:`https://fanout.run/guides/connect-over-mcp`};async function MN(e,t){let n=new URLSearchParams({page_size:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await UM(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function NN({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=TA(),[f,p]=(0,M.useState)(``),[m]=pr(f.trim(),250),[h,g]=(0,M.useState)(null),[_,v]=(0,M.useState)(null),[y,b]=(0,M.useState)(``),[x,S]=(0,M.useState)(``),[w,T]=(0,M.useState)(!1),ee=(0,M.useRef)(null);(0,M.useImperativeHandle)(u,()=>({focusSearch:()=>ee.current?.focus()}),[]),(0,M.useEffect)(()=>{r&&requestAnimationFrame(()=>ee.current?.focus())},[r]);let E=Yj({queryKey:[...tN,m],queryFn:({pageParam:e})=>MN(m,e),initialPageParam:``,getNextPageParam:e=>e.next_cursor??void 0,enabled:e}),D=Jj({queryKey:pN,queryFn:_N,refetchInterval:3e4,staleTime:mN}),O=(0,M.useMemo)(()=>E.data?.pages.flatMap(e=>e.items)??[],[E.data]),te=(0,M.useMemo)(()=>zN(O),[O]),re=Jj({queryKey:[`telemetry-schema`,`1h`],queryFn:()=>nN(`/api/telemetry/schema?window=1h`),enabled:!!m&&!!l,staleTime:6e4}),k=(0,M.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(re.data?.services??[]).map(e=>e.value).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[re.data,m]),ie=(0,M.useMemo)(()=>{let e=D.data??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[D.data,m]);function ae(e){S(``),b(e.title),g(e)}async function se(){if(h&&y.trim()){T(!0),S(``);try{let e=await UM(`/api/agent/threads/${encodeURIComponent(h.id)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:y.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:tN}),g(null)}catch(e){S(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{T(!1)}}}async function le(){if(_){T(!0),S(``);try{let e=await UM(`/api/agent/threads/${encodeURIComponent(_.id)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.id;v(null),await d.invalidateQueries({queryKey:tN}),await d.invalidateQueries({queryKey:pN}),o(t)}catch(e){S(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{T(!1)}}}return(0,N.jsxs)(oe,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,N.jsx)(ce,{leftSection:(0,N.jsx)(DM,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,N.jsx)(wt,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,N.jsxs)(oe,{gap:`lg`,pb:`sm`,children:[e&&(0,N.jsxs)(oe,{gap:4,children:[(0,N.jsx)(PN,{children:`Chats`}),E.isLoading&&(0,N.jsx)(je,{py:`md`,children:(0,N.jsx)(Ie,{size:`xs`})}),E.isError&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!E.isLoading&&!E.isError&&O.length===0&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),te.map(e=>(0,N.jsxs)(oe,{gap:2,children:[te.length>1&&(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,N.jsx)(FN,{thread:e,active:e.id===t,onSelect:()=>a(e.id),onRename:()=>ae(e),onDelete:()=>{S(``),v(e)}},e.id))]},e.label)),E.hasNextPage&&(0,N.jsx)(ce,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:E.isFetchingNextPage,onClick:()=>void E.fetchNextPage(),children:`See all`})]}),m&&l&&re.isLoading&&(0,N.jsx)(je,{py:`md`,children:(0,N.jsx)(Ie,{size:`xs`})}),m&&l&&(re.isSuccess||re.isError)&&(0,N.jsxs)(oe,{gap:4,children:[(0,N.jsx)(PN,{children:`Services`}),re.isError&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,children:`Services could not be searched`}),re.isSuccess&&k.length===0&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,children:`No matching services`}),k.map(e=>(0,N.jsx)(C,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,N.jsx)(ue,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,N.jsxs)(oe,{gap:4,children:[(0,N.jsx)(PN,{children:`Dashboards`}),D.isLoading&&(0,N.jsx)(je,{py:`md`,children:(0,N.jsx)(Ie,{size:`xs`})}),D.isError&&(0,N.jsx)(Ce,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!D.isLoading&&!D.isError&&m&&ie.length===0&&(0,N.jsx)(ue,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),ie.map(e=>{let t=e.id===n;return(0,N.jsxs)(oe,{gap:0,children:[(0,N.jsx)(C,{component:`a`,href:`/dashboards/${encodeURIComponent(e.id)}`,className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),s(e.id))},children:(0,N.jsxs)(ne,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,N.jsx)(ue,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,N.jsx)(cs,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})}),e.origin&&(0,N.jsx)(C,{component:`a`,href:`/chat/${encodeURIComponent(e.origin.thread_id)}`,"data-request-provenance":!0,px:`sm`,pb:`xs`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),a(e.origin.thread_id))},children:(0,N.jsxs)(ue,{size:`xs`,c:`dimmed`,lineClamp:2,children:[`Built from: `,e.origin.request_excerpt]})})]},e.id)}),e&&(0,N.jsx)(ce,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,N.jsx)(jM,{size:14,weight:`fill`}),onClick:c,children:D.data?.length===0?`New dashboard`:`Create with AI`})]})]})}),(0,N.jsx)(Gc,{ref:ee,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,N.jsx)(yM,{size:15}),rightSection:(0,N.jsx)(Ls,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,N.jsx)(Rc,{opened:h!==null,onClose:()=>!w&&g(null),title:`Rename chat`,centered:!0,children:(0,N.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),se()},children:(0,N.jsxs)(oe,{children:[(0,N.jsx)(Gc,{label:`Name`,value:y,onChange:e=>b(e.currentTarget.value),maxLength:120,autoFocus:!0}),x&&(0,N.jsx)(Ce,{color:`bad`,children:x}),(0,N.jsxs)(ne,{justify:`flex-end`,children:[(0,N.jsx)(ce,{variant:`default`,onClick:()=>g(null),disabled:w,children:`Cancel`}),(0,N.jsx)(ce,{type:`submit`,loading:w,disabled:!y.trim(),children:`Save`})]})]})})}),(0,N.jsx)(Rc,{opened:_!==null,onClose:()=>!w&&v(null),title:`Delete chat?`,centered:!0,children:(0,N.jsxs)(oe,{children:[(0,N.jsxs)(ue,{size:`sm`,children:[`This permanently removes `,(0,N.jsx)(ue,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),x&&(0,N.jsx)(Ce,{color:`bad`,children:x}),(0,N.jsxs)(ne,{justify:`flex-end`,children:[(0,N.jsx)(ce,{variant:`default`,onClick:()=>v(null),disabled:w,children:`Cancel`}),(0,N.jsx)(ce,{color:`bad`,loading:w,onClick:()=>void le(),children:`Delete`})]})]})})]})}function PN({children:e}){return(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function FN({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,N.jsx)(u,{"data-active":t||void 0,className:`rail-row`,children:(0,N.jsxs)(ne,{gap:2,wrap:`nowrap`,children:[(0,N.jsx)(C,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,N.jsxs)(oe,{gap:0,children:[(0,N.jsx)(ue,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,N.jsx)(ue,{c:`dimmed`,size:`xs`,children:BN(e.updated_at)})]})}),(0,N.jsxs)(Sc,{position:`bottom-end`,withinPortal:!0,children:[(0,N.jsx)(Sc.Target,{children:(0,N.jsx)(Pi,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,N.jsx)(_M,{size:18,weight:`bold`})})}),(0,N.jsxs)(Sc.Dropdown,{children:[(0,N.jsx)(Sc.Item,{leftSection:(0,N.jsx)(CM,{size:15}),onClick:r,children:`Rename`}),(0,N.jsx)(Sc.Item,{color:`bad`,leftSection:(0,N.jsx)(FM,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function IN(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function LN(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var RN=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function zN(e){let t=LN(new Date),n=new Map;for(let r of e){let e=Math.floor((t-LN(IN(r.updated_at)))/864e5),i=e<=0?`Today`:e===1?`Yesterday`:e<=7?`Previous 7 days`:`Older`,a=n.get(i)??[];a.push(r),n.set(i,a)}return RN.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function BN(e){let t=IN(e),n=LN(new Date);return Math.floor((n-LN(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function VN({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=Qe(),s=ze(),c=Xn({select:e=>e.location.pathname}),{dashboardId:l}=Sn({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=Dr(!1),[p,m]=(0,M.useState)(!1),[h,g]=(0,M.useState)(``),_=(0,M.useRef)(null),v=ie(`(max-width: 62em)`),y=(0,M.useRef)(v);y.current=v,(0,M.useEffect)(()=>{f.close()},[c]),(0,M.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{}}),onCreateDashboard:()=>o(tt),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,N.jsxs)(Jo,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,N.jsx)(Jo.Header,{children:(0,N.jsxs)(ne,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,N.jsxs)(ne,{gap:`sm`,wrap:`nowrap`,children:[(0,N.jsx)(ds,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,N.jsx)(ke,{size:`small`})]}),(0,N.jsxs)(ne,{gap:`xs`,wrap:`nowrap`,children:[(0,N.jsx)(Ot,{label:`Documentation`,children:(0,N.jsx)(Pi,{component:`a`,href:jN.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,N.jsx)(hM,{size:17,weight:`bold`})})}),(0,N.jsx)(AN,{}),(0,N.jsx)(HN,{onError:g})]})]})}),(0,N.jsx)(Jo.Navbar,{p:`sm`,children:(0,N.jsx)(NN,{ref:_,...b})}),(0,N.jsx)(Ps,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,N.jsx)(ke,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,N.jsx)(NN,{...b,autoFocusSearch:d&&p})}),(0,N.jsxs)(Jo.Main,{children:[h&&(0,N.jsx)(Ce,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function HN({onError:e}){let t=ze(),n=JM(),r=(n.display_name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,N.jsxs)(Sc,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,N.jsx)(Sc.Target,{children:(0,N.jsx)(Pi,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`${r} account menu`,children:(0,N.jsx)(as,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,N.jsxs)(Sc.Dropdown,{children:[(0,N.jsx)(Sc.Label,{children:n.email||`Signed in`}),(0,N.jsx)(Sc.Item,{leftSection:(0,N.jsx)(TM,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,N.jsx)(Sc.Divider,{}),(0,N.jsx)(Sc.Item,{leftSection:(0,N.jsx)(kM,{size:15}),onClick:()=>void WM().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function UN(){let{agent_available:e}=KM(),t=ze(),n=TA(),{threadId:r}=Sn({strict:!1}),[i,a]=(0,M.useState)(fN),o=(0,M.useRef)(new Set),s=r??i,[c,l]=(0,M.useState)([]),[u,d]=(0,M.useState)({}),[f,p]=(0,M.useState)(``),[m,h]=(0,M.useState)(!1),[g,_]=(0,M.useState)(!1),[v,y]=(0,M.useState)(``),[b,x]=(0,M.useState)(!1),S=(0,M.useRef)(!1),[C,w]=(0,M.useState)(``),[T,ee]=(0,M.useState)(``),[E,D]=(0,M.useState)(0),O=(0,M.useRef)(null),te=(0,M.useRef)({}),ne=(0,M.useRef)(null),re=(0,M.useRef)(new Map),k=(0,M.useMemo)(()=>new CA({url:`/api/agent/runs`,threadId:s,fetch:(e,t)=>UM(e,t)}),[s]),ie=!e||f===s;function ae(){re.current.clear(),y(``)}function oe(e){return S.current||e instanceof Error&&e.name===`AbortError`}(0,M.useEffect)(()=>{let t=!0;if(l([]),te.current={},d({}),p(``),h(!1),_(!1),S.current=!1,x(!1),ae(),ee(``),!e){p(s);return}!r||o.current.has(s)?(k.setMessages([]),p(s)):UM(`/api/agent/threads/${encodeURIComponent(s)}`).then(async e=>{if(e.status===404)return null;if(!e.ok)throw Error(`Unable to load thread (${e.status})`);return e.json()}).then(e=>{if(t){if(e===null){h(!0),p(s);return}k.setMessages(e.messages??[]),l(e.messages??[]),p(s)}}).catch(()=>{t&&(O.current=null,ee(`This chat could not be restored. Start a new chat or try again.`))});let i=k.subscribe({onMessagesChanged:({messages:e})=>l([...e]),onRunInitialized:()=>{S.current=!1,x(!1),_(!0),ee(``)},onTextMessageContentEvent:({event:e})=>{e.delta&&y(``)},onToolCallStartEvent:({event:e})=>{re.current.set(e.toolCallId,at(e.toolCallName)),y(at(e.toolCallName))},onToolCallResultEvent:({event:e,messages:t})=>{re.current.delete(e.toolCallId),y([...re.current.values()].at(-1)??`Analyzing your system`);let r=$e(e.toolCallId,e.content,t);r&&(n.invalidateQueries({queryKey:pN}),n.invalidateQueries({queryKey:[`dashboard`,r.id]}),n.invalidateQueries({queryKey:[`dashboard-versions`,r.id]}))},onRunErrorEvent:({event:e})=>{e.code===`abort`||S.current?(ee(``),x(!0)):(console.warn(`Agent run error`,e.code),ee(Xe(e.code))),_(!1),ae()},onRunFinalized:({messages:e})=>{let t=[...e];l(t),d(e=>{let n={...e};for(let e of t)e.role===`assistant`&&!n[e.id]&&(n[e.id]=Date.now());return n}),_(!1),ae(),o.current.delete(s),n.invalidateQueries({queryKey:tN})},onRunFailed:e=>{oe(e.error)?(ee(``),x(!0)):(console.error(`Agent run failed`,e),ee(Xe())),_(!1),ae(),o.current.delete(s),n.invalidateQueries({queryKey:tN})}});return()=>{t=!1,i.unsubscribe(),k.abortRun()}},[k,e,n,E,s]),(0,M.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target,i=n?.matches(`input, textarea, [contenteditable='true']`);e.key===`/`&&!i&&(e.preventDefault(),r?requestAnimationFrame(()=>ne.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ne.current?.focus()))),e.key===`Escape`&&n===ne.current&&(w(``),ne.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function se(){_(!0),ee(``);try{let{context:e=[],...t}=te.current;await k.runAgent({context:e,forwardedProps:t})}catch(e){oe(e)?(ee(``),x(!0)):(console.error(`Agent run failed`,e),ee(Xe())),_(!1),ae(),o.current.delete(s)}}async function ce(n,i){let a=n.trim();if(!e||!a||g||!ie||m)return;te.current={...i},r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let c={id:fN(),role:`user`,content:a};k.addMessage(c),l([...k.messages]),d(e=>({...e,[c.id]:Date.now()})),w(``),await se()}(0,M.useEffect)(()=>{let e=O.current;ie&&r&&e&&(O.current=null,ce(e.text,e.options))},[ie,r,s]);function le(e){e.preventDefault(),ce(C)}function ue(){S.current=!0,ee(``),x(!0),k.abortRun(),_(!1),ae(),o.current.delete(s)}function de(){!g&&k.messages.some(e=>e.role===`user`)&&se()}function fe(n,r){if(!e)return;let i=fN();o.current.add(i),O.current=n?{text:n,options:{...r}}:null,t({to:`/chat/$threadId`,params:{threadId:i}})}function pe(){k.abortRun(),O.current=null,te.current={},a(fN()),t({to:`/chat`})}function me(e){O.current=null,te.current={},t({to:`/chat/$threadId`,params:{threadId:e}})}function he(){D(e=>e+1)}return(0,N.jsx)(it.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:ie,running:g,activity:v,stopped:b,input:C,setInput:w,error:T,inputRef:ne,send:ce,submit:le,stop:ue,retry:de,reloadThread:he,openChat:fe,newThread:pe,selectThread:me},children:(0,N.jsx)(VN,{children:(0,N.jsx)(Bn,{})})})}function WN(){let e=(0,M.useMemo)(()=>new Fj,[]);return(0,N.jsx)(EA,{client:e,children:(0,N.jsx)(eN,{children:(0,N.jsx)(UN,{})})})}var GN=On({component:WN,notFoundComponent:()=>(0,N.jsx)(Ve,{to:`/`,replace:!0})}),KN=kn(`/`)({component:An(()=>ot(()=>import(`./routes-D2AdaqvY.js`),__vite__mapDeps([0,1,2])),`component`)}),qN=kn(`/settings`)({component:An(()=>ot(()=>import(`./settings-NQwuPzSG.js`),__vite__mapDeps([3,1,4,5,6])),`component`)}),JN=kn(`/chat/`)({component:An(()=>ot(()=>import(`./chat.index-BzKwvTFN.js`),__vite__mapDeps([7,8,1,4,9,5,10])),`component`)}),YN=kn(`/chat/$threadId`)({component:An(()=>ot(()=>import(`./chat._threadId-BzKwvTFN.js`),__vite__mapDeps([11,8,1,4,9,5,10])),`component`)});function XN(e){try{let t=typeof e==`string`?e:JSON.stringify(e);if(!t||t.length>4096)return;let n=typeof e==`string`?JSON.parse(e):e;if(!n||typeof n!=`object`)return;let r=n;return typeof r.panel_id!=`string`||!/^([a-z][a-z0-9_]{0,39})$/.test(r.panel_id)||r.kind!==`traces`&&r.kind!==`logs`||typeof r.from!=`string`||typeof r.to!=`string`||!Number.isFinite(Date.parse(r.from))||!Number.isFinite(Date.parse(r.to))||Date.parse(r.from)>=Date.parse(r.to)||Date.parse(r.to)-Date.parse(r.from)>2592e6||typeof r.window_from!=`string`||typeof r.window_to!=`string`||!Number.isFinite(Date.parse(r.window_from))||!Number.isFinite(Date.parse(r.window_to))||Date.parse(r.window_from)>=Date.parse(r.window_to)||Date.parse(r.window_to)-Date.parse(r.window_from)>2592e6||Date.parse(r.from)Date.parse(r.window_to)||!r.dimensions||Array.isArray(r.dimensions)||typeof r.dimensions!=`object`||Object.keys(r.dimensions).length>3||Object.values(r.dimensions).some(e=>typeof e!=`string`||e.length>500)||r.trace_id!==void 0&&(typeof r.trace_id!=`string`||r.trace_id.length>128)||r.namespace!==void 0&&(typeof r.namespace!=`string`||r.namespace.length>200)||r.bucket&&(!Number.isFinite(r.bucket.lower)||r.bucket.lower<0||r.bucket.upper!==void 0&&(!Number.isFinite(r.bucket.upper)||r.bucket.upper<=r.bucket.lower))?void 0:{panel_id:r.panel_id,kind:r.kind,from:r.from,to:r.to,window_from:r.window_from,window_to:r.window_to,dimensions:r.dimensions,trace_id:r.trace_id,namespace:r.namespace,bucket:r.bucket}}catch{return}}function ZN(e,t,n){if(!e.drill&&e.viz!==`service_map`&&!n.trace_id||t.from_ms===void 0||t.to_ms===void 0)return;let r=t.from_ms,i=t.to_ms;if(n.from!==void 0&&n.to!==void 0&&(r=Math.max(r,Date.parse(n.from)),i=Math.min(i,Date.parse(n.to))),n.time!==void 0&&!n.trace_id){let e=/^(\d+)(s|m|h|d)$/.exec(t.interval??``),a=e?Number(e[1])*{s:1e3,m:6e4,h:36e5,d:864e5}[e[2]]:6e4;r=Math.max(r,n.time),i=Math.min(i,n.time+a)}return XN(JSON.stringify({panel_id:e.id,kind:n.trace_id||e.viz===`service_map`?`traces`:e.drill,from:n.from&&Date.parse(n.from)===r?n.from:new Date(r).toISOString(),to:n.to&&Date.parse(n.to)===i?n.to:new Date(i).toISOString(),window_from:new Date(t.from_ms).toISOString(),window_to:new Date(t.to_ms).toISOString(),dimensions:n.dimensions,trace_id:n.trace_id,namespace:n.namespace,bucket:n.bucket}))}function QN(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))for(let e of Array.isArray(r)?r:[r]){if(e===void 0)continue;let r=typeof e==`string`&&/^[{"]/.test(e);t.append(n,r||typeof e==`object`&&e?JSON.stringify(e):String(e))}let n=t.toString();return n?`?${n}`:``}function $N(e){let t=Object.create(null),n=e=>{if(e.startsWith(`{`)||e.startsWith(`"`))try{let t=JSON.parse(e);if(typeof t==`string`)return/^[{"]/.test(t)?t:e;if(typeof t==`object`&&t&&!Array.isArray(t))return t}catch{}return e},r=new URLSearchParams(e);for(let e of new Set(r.keys())){let i=r.getAll(e).map(n);t[e]=i.length===1?i[0]:i}return t}var eP=[`5m`,`15m`,`1h`,`3h`,`6h`,`12h`,`24h`,`2d`,`7d`,`30d`],tP=[`off`,`10s`,`30s`,`1m`,`5m`],nP=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}[Tt](?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:[Zz]|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/.test(e)||Number.isNaN(Date.parse(e)))return!1;let[t,n,r]=e.slice(0,10).split(`-`).map(Number),i=new Date(0);return i.setUTCFullYear(t,n-1,r),i.setUTCHours(0,0,0,0),i.getUTCFullYear()===t&&i.getUTCMonth()===n-1&&i.getUTCDate()===r},rP=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):void 0;function iP(e){let t={};typeof e.range==`string`&&eP.includes(e.range)?t.range=e.range:nP(e.from)&&nP(e.to)&&Date.parse(e.from)typeof e==`string`)&&(i[e]=t)}}else{let t=rP(n);t!==void 0&&(i[e]=t)}}}Object.keys(i).length>0&&(t.vars=i);let a=XN(e.drill);return a&&(t.drill=JSON.stringify(a)),t}function aP(e){let t={};e.drill&&(t.drill=JSON.parse(e.drill)),e.range&&(t.range=e.range),e.from&&e.to&&(t.from=e.from,t.to=e.to),e.compare&&(t.compare=e.compare),e.view&&(t.view=e.view),e.edit&&(t.edit=e.edit);for(let[n,r]of Object.entries(e.vars??{}))t[`var-${n}`]=Array.isArray(r)?{values:r}:r;return t}function oP(e,t){let n=new URL(e);return n.search=QN(aP({...iP($N(n.search)),drill:JSON.stringify(t)})),n.href}function sP(e,t){let n=e.time.refresh??`30s`;return t.from&&t.to?{from:t.from,to:t.to,refresh:n}:t.range?{range:t.range,refresh:n}:{...e.time,refresh:n}}var cP=kn(`/dashboards/`)({component:An(()=>ot(()=>import(`./dashboards.index-D0Pptviw.js`),__vite__mapDeps([12,1,2,13,4,9,5,10,6])),`component`),validateSearch:e=>aP(iP(e))}),lP=kn(`/dashboards/$dashboardId`)({component:An(()=>ot(()=>import(`./dashboards._dashboardId-AkIsvXSZ.js`),__vite__mapDeps([14,1,2,13,4,9,5,10,6])),`component`),validateSearch:e=>aP(iP(e))}),uP=KN.update({id:`/`,path:`/`,getParentRoute:()=>GN}),dP=qN.update({id:`/settings`,path:`/settings`,getParentRoute:()=>GN}),fP=JN.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>GN}),pP=YN.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>GN}),mP=cP.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>GN}),hP={IndexRoute:uP,SettingsRoute:dP,ChatThreadIdRoute:pP,DashboardsDashboardIdRoute:lP.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>GN}),ChatIndexRoute:fP,DashboardsIndexRoute:mP},gP=Kn({routeTree:GN._addFileChildren(hP)._addFileTypes(),parseSearch:$N,stringifySearch:QN,defaultPreload:`intent`,scrollRestoration:!0}),_P=[`#fafafa`,`#e6e4de`,`#bfbdb6`,`#8b8e99`,`#565b69`,`#1d2433`,`#131721`,`#0b0e14`,`#080a10`,`#05070b`],vP=[`#f3ecfd`,`#ece3fb`,`#dcc9f7`,`#d2a6ff`,`#bf94ec`,`#a97ce0`,`#9163d6`,`#7c4dcc`,`#5b32a3`,`#40236f`],yP=[`#eefbe6`,`#dcf7cc`,`#c2f0a6`,`#a5e880`,`#8fe06c`,`#7fd962`,`#66c04b`,`#4f9c3a`,`#3b7a2c`,`#2a5a1f`],bP=[`#fff5e6`,`#ffe9c9`,`#ffd79b`,`#ffc571`,`#ffbc62`,`#ffb454`,`#ef9c33`,`#c87d21`,`#9c5f16`,`#74460f`],xP=[`#fdecee`,`#fbd9dc`,`#f8b6bc`,`#f59099`,`#f37d87`,`#f26d78`,`#e04d5a`,`#c03642`,`#96262f`,`#6f1a21`],SP=[`#e8f6ff`,`#ccebff`,`#a3daff`,`#7dcbff`,`#66c5ff`,`#59c2ff`,`#33a7e6`,`#1e86bd`,`#146694`,`#0d4a6d`],CP={dark:{text:`#bfbdb6`,muted:`#8b8e99`,grid:`#1d2433`,surface:`#131721`,border:`#626777`},light:{text:`#4a5058`,muted:`#6b7280`,grid:`#eceef0`,surface:`#fcfcfc`,border:`#8c939d`}},wP={dark:[`#3987e5`,`#d95926`,`#199e70`,`#9085e9`,`#c98500`,`#d55181`],light:[`#2a78d6`,`#eb6834`,`#1baf7a`,`#4a3aa7`,`#eda100`,`#e87ba4`]},TP={micro:11,small:12,body:14,title:16,section:22,page:32},EP={display:`"Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,body:`"Geist Variable", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`},DP={brand:vP,ok:yP,warn:bP,bad:xP,info:SP},OP={light:7,dark:5};function kP(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function AP(e){let t=kP(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function jP(e){return Object.fromEntries(Object.entries(DP).map(([t,n])=>[`--fanout-color-${t}-contrast`,AP(n[OP[e]])]))}function MP(e){return t=>{let n=t.color??FP.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(DP,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var NP=.25,PP={xs:9,sm:10,md:11,lg:13,xl:16},FP={primaryColor:`brand`,primaryShade:OP,autoContrast:!0,luminanceThreshold:NP,colors:{dark:_P,brand:vP,ok:yP,warn:bP,bad:xP,info:SP},defaultRadius:`md`,fontFamily:EP.body,fontFamilyMonospace:EP.display,headings:{fontFamily:EP.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:RP(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:RP(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:LP(t.size)})},Menu:{defaultProps:{withInitialFocusPlaceholder:!1}},Drawer:{defaultProps:{closeButtonProps:{"aria-label":`Close`}}},Modal:{defaultProps:{closeButtonProps:{"aria-label":`Close`}}}}},IP=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":CP.light.muted,...jP(`light`)},dark:jP(`dark`)});function LP(e){let t=PP[e??`md`];return t===void 0||t>=TP.micro?{}:{"--badge-fz":`${TP.micro/16}rem`}}function RP(e,t){return!e||e===FP.primaryColor?{[t]:`var(--fanout-color-${FP.primaryColor}-contrast)`}:{}}var zP=MP(ee),BP=ri({...FP,variantColorResolver:zP});(0,$c.createRoot)(document.getElementById(`root`)).render((0,N.jsx)(M.StrictMode,{children:(0,N.jsx)(ni,{theme:BP,defaultColorScheme:`auto`,cssVariablesResolver:IP,children:(0,N.jsx)(Yn,{router:gP})})}));export{Wy as $,CN as A,Gc as At,RM as B,Ei as Bt,pN as C,Qy as Ct,bN as D,h_ as Dt,kN as E,y_ as Et,DN as F,ms as Ft,jj as G,Er as Gt,CM as H,ai as Ht,xN as I,cs as It,zA as J,Qn as Jt,sj as K,cr as Kt,nN as L,F as Lt,ON as M,Sc as Mt,wN as N,Ls as Nt,_N as O,m_ as Ot,SN as P,Ps as Pt,TA as Q,JM as R,so as Rt,jN as S,Tb as St,TN as T,xy as Tt,_M as U,Ur as Ut,FM as V,hi as Vt,Jj as W,Ir as Wt,UA as X,on as Xt,jA as Y,gn as Yt,$A as Z,ln as Zt,eP as _,Kb as _t,CP as a,G as at,ZN as b,U as bt,yP as c,Fb as ct,bP as d,dx as dt,Uy as et,lP as f,q as ft,iP as g,jb as gt,sP as h,hb as ht,vP as i,bb as it,EN as j,Rc as jt,yN as k,tp as kt,wP as l,Jy as lt,oP as m,Db as mt,kP as n,Vb as nt,EP as o,kb as ot,cP as p,K as pt,rj as q,rr as qt,xP as r,Sb as rt,SP as s,vb as st,AP as t,mb as tt,TP as u,Lb as ut,tP as v,gx as vt,vN as w,Dy as wt,XN as x,Nb as xt,aP as y,zb as yt,UM as z,Pi as zt}; \ No newline at end of file diff --git a/internal/ui/dist/assets/mcp-app-frame-DHytkU6U.js b/internal/ui/dist/assets/mcp-app-frame-Do9gIdfD.js similarity index 99% rename from internal/ui/dist/assets/mcp-app-frame-DHytkU6U.js rename to internal/ui/dist/assets/mcp-app-frame-Do9gIdfD.js index c7bf49a0..feb31a05 100644 --- a/internal/ui/dist/assets/mcp-app-frame-DHytkU6U.js +++ b/internal/ui/dist/assets/mcp-app-frame-Do9gIdfD.js @@ -1,4 +1,4 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,d as i,f as a,p as o,u as s,y as c}from"./brand-DUaZkIz1.js";import{n as l}from"./chat-BvDR6vN4.js";import{$ as u,Ct as d,Dt as f,Et as p,Ot as m,St as h,Tt as g,Ut as _,Vt as v,_t as y,at as b,bt as x,ct as S,dt as ee,et as C,ft as w,gt as T,ht as E,it as te,kt as ne,lt as re,mt as ie,nt as D,ot as O,pt as k,rt as ae,st as A,tt as oe,ut as se,vt as ce,wt as le,xt as j,yt as M,z as ue}from"./index-BBEH7zHj.js";var de={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},fe;fe||={};function pe(e){return m(C,e)}function me(e){return f(u,e)}function he(e){return p(oe,e)}function N(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function P(e,t){if(!Array.isArray(e))return[];let n=new Set(t);return e.filter(e=>{if(typeof e!=`string`||/[\s;'\"]/.test(e))return!1;let t=e.match(/^([a-z]+):\/\/([^/]+)$/i);return!!(t&&n.has(t[1].toLowerCase()))})}function ge(e){let t=N(N(N(e)?.ui)?.csp),n=P(t?.connectDomains,[`http`,`https`,`ws`,`wss`]),r=P(t?.resourceDomains,[`http`,`https`]),i=P(t?.frameDomains,[`http`,`https`]),a=P(t?.baseUriDomains,[`http`,`https`]),o=r.length?` ${r.join(` `)}`:``,s=[`default-src 'none'`,`worker-src blob:`,`script-src 'self' 'unsafe-inline'${o}`,`style-src 'self' 'unsafe-inline'${o}`,`img-src 'self' data:${o}`,`media-src 'self' data:${o}`,`font-src 'self' data:${o}`,`connect-src ${n.length?n.join(` `):`'none'`}`];return i.length&&s.push(`frame-src ${i.join(` `)}`),a.length&&s.push(`base-uri ${a.join(` `)}`),`${s.join(`; `)};`}var _e=Object.create,ve=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,be=Object.getOwnPropertyNames,F=Object.getPrototypeOf,xe=Object.prototype.hasOwnProperty,Se=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ce=(e,t)=>{let n={};for(var r in e)ve(n,r,{get:e[r],enumerable:!0});return t&&ve(n,Symbol.toStringTag,{value:`Module`}),n},we=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=be(t),a=0,o=i.length,s;at[e]).bind(null,s),enumerable:!(r=ye(t,s))||r.enumerable});return e},Te=(e,t,n)=>(n=e==null?{}:_e(F(e)),we(t||!e||!e.__esModule?ve(n,`default`,{value:e,enumerable:!0}):n,e)),Ee=new Set([`https://json-schema.org/draft/2020-12/schema`,`http://json-schema.org/draft/2020-12/schema`]),De=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]),Oe=new Set([`https://json-schema.org/draft-07/schema`,`http://json-schema.org/draft-07/schema`]),ke=new Set([`https://json-schema.org/draft-06/schema`,`http://json-schema.org/draft-06/schema`]);function Ae(e){return typeof e==`string`&&De.has(e.replace(/#$/,``))}function je(e,t){if(!(`$schema`in e)||typeof e.$schema!=`string`)return`2020-12`;let n=e.$schema.replace(/#$/,``);if(Ee.has(n))return`2020-12`;if(De.has(n))return`2019-09`;if(Oe.has(n)||ke.has(n))return`draft-7`;throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var Me=`2025-11-25`,Ne=[Me,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],Pe=`io.modelcontextprotocol/related-task`,Fe=`io.modelcontextprotocol/protocolVersion`,Ie=`io.modelcontextprotocol/clientInfo`,Le=`io.modelcontextprotocol/serverInfo`,Re=`io.modelcontextprotocol/clientCapabilities`,ze=`io.modelcontextprotocol/subscriptionId`,Be=`io.modelcontextprotocol/logLevel`,Ve=ee(()=>j([x(),E(),A(),ae(),M(x(),Ve),O(Ve)])),I=M(x(),Ve),He=O(Ve),Ue=j([x(),E().int()]),We=x(),Ge=T({ttl:E().optional()}),Ke=T({taskId:x()}),qe=k({progressToken:Ue.optional(),[Pe]:Ke.optional()}),L=T({_meta:qe.optional()}),Je=L.extend({task:Ge.optional()}),R=T({method:x(),params:L.loose().optional()}),z=T({_meta:qe.optional()}),B=T({method:x(),params:z.loose().optional()}),Ye=k({get[Le](){return H.optional().catch(void 0)}}),V=k({_meta:Ye.optional()}),Xe=j([x(),E().int()]),Ze=T({jsonrpc:w(`2.0`),id:Xe,...R.shape}).strict(),Qe=T({jsonrpc:w(`2.0`),...B.shape}).strict(),$e=T({jsonrpc:w(`2.0`),id:Xe,result:V}).strict(),et=T({jsonrpc:w(`2.0`),id:Xe.optional(),error:T({code:E().int(),message:x(),data:h().optional()})}).strict(),tt=j([Ze,Qe,$e,et]),nt=j([$e,et]),rt=V.strict(),it=z.extend({requestId:Xe.optional(),reason:x().optional()}),at=B.extend({method:w(`notifications/cancelled`),params:it}),ot=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),st=T({icons:O(ot).optional()}),ct=T({name:x(),title:x().optional()}),H=ct.extend({...ct.shape,...st.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),lt=se(T({applyDefaults:A().optional()}),I),ut=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:lt.optional(),url:I.optional()}),I.optional())),dt=k({list:I.optional(),cancel:I.optional(),requests:k({sampling:k({createMessage:I.optional()}).optional(),elicitation:k({create:I.optional()}).optional()}).optional()}),ft=k({list:I.optional(),cancel:I.optional(),requests:k({tools:k({call:I.optional()}).optional()}).optional()}),pt=T({experimental:M(x(),I).optional(),sampling:T({context:I.optional(),tools:I.optional()}).optional(),elicitation:ut.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:dt.optional(),extensions:M(x(),I).optional()}),mt=L.extend({protocolVersion:x(),capabilities:pt,clientInfo:H}),ht=R.extend({method:w(`initialize`),params:mt}),gt=T({experimental:M(x(),I).optional(),logging:I.optional(),completions:I.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:ft.optional(),extensions:M(x(),I).optional()}),_t=V.extend({protocolVersion:x(),capabilities:gt,serverInfo:H,instructions:x().optional()}),vt=B.extend({method:w(`notifications/initialized`),params:z.optional()}),yt=R.extend({method:w(`server/discover`),params:L.optional()}),bt=V.extend({supportedVersions:O(x()),capabilities:gt,instructions:x().optional()}),xt=R.extend({method:w(`ping`),params:L.optional()}),St=T({progress:E(),total:y(E()),message:y(x())}),Ct=T({...z.shape,...St.shape,progressToken:Ue}),wt=B.extend({method:w(`notifications/progress`),params:Ct}),Tt=L.extend({cursor:We.optional()}),Et=R.extend({params:Tt.optional()}),Dt=V.extend({nextCursor:We.optional()}),Ot=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),kt=Ot.extend({text:x()}),At=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),jt=Ot.extend({blob:At}),Mt=D([`user`,`assistant`]),Nt=T({audience:O(Mt).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),Pt=T({...ct.shape,...st.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:Nt.optional(),_meta:y(k({}))}),Ft=T({...ct.shape,...st.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:Nt.optional(),_meta:y(k({}))}),It=Et.extend({method:w(`resources/list`)}),Lt=Dt.extend({resources:O(Pt)}),U=Et.extend({method:w(`resources/templates/list`)}),W=Dt.extend({resourceTemplates:O(Ft)}),Rt=L.extend({uri:x()}),zt=Rt,Bt=R.extend({method:w(`resources/read`),params:zt}),Vt=V.extend({contents:O(j([kt,jt]))}),Ht=B.extend({method:w(`notifications/resources/list_changed`),params:z.optional()}),Ut=Rt,Wt=R.extend({method:w(`resources/subscribe`),params:Ut}),Gt=Rt,Kt=R.extend({method:w(`resources/unsubscribe`),params:Gt}),qt=T({toolsListChanged:A().optional(),promptsListChanged:A().optional(),resourcesListChanged:A().optional(),resourceSubscriptions:O(x()).optional()}),Jt=L.extend({notifications:qt}),Yt=R.extend({method:w(`subscriptions/listen`),params:Jt}),Xt=z.extend({notifications:qt}),Zt=B.extend({method:w(`notifications/subscriptions/acknowledged`),params:Xt}),Qt=Ye.extend({[ze]:Xe}),$t=V.extend({_meta:Qt}),en=z.extend({uri:x()}),tn=B.extend({method:w(`notifications/resources/updated`),params:en}),G=T({name:x(),description:y(x()),required:y(A())}),nn=T({...ct.shape,...st.shape,description:y(x()),arguments:y(O(G)),_meta:y(k({}))}),rn=Et.extend({method:w(`prompts/list`)}),an=Dt.extend({prompts:O(nn)}),on=L.extend({name:x(),arguments:M(x(),x()).optional()}),sn=R.extend({method:w(`prompts/get`),params:on}),cn=T({type:w(`text`),text:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),K=T({type:w(`image`),data:At,mimeType:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),ln=T({type:w(`audio`),data:At,mimeType:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),un=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),dn=T({type:w(`resource`),resource:j([kt,jt]),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),fn=Pt.extend({type:w(`resource_link`)}),pn=j([cn,K,ln,fn,dn]),mn=T({role:Mt,content:pn}),hn=V.extend({description:x().optional(),messages:O(mn)}),gn=B.extend({method:w(`notifications/prompts/list_changed`),params:z.optional()}),_n=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),vn=T({taskSupport:D([`required`,`optional`,`forbidden`]).optional()}),yn=T({...ct.shape,...st.shape,description:x().optional(),inputSchema:T({type:w(`object`),properties:M(x(),Ve).optional(),required:O(x()).optional()}).catchall(h()),outputSchema:k({$schema:x().optional()}).optional(),annotations:_n.optional(),execution:vn.optional(),_meta:M(x(),h()).optional()}),bn=Et.extend({method:w(`tools/list`)}),xn=Dt.extend({tools:O(yn)}),Sn=V.extend({content:O(pn).default([]),structuredContent:h().optional(),isError:A().optional()}),Cn=Sn.or(V.extend({toolResult:h()})),wn=Je.extend({name:x(),arguments:M(x(),h()).optional()}),Tn=R.extend({method:w(`tools/call`),params:wn}),En=B.extend({method:w(`notifications/tools/list_changed`),params:z.optional()}),Dn=T({autoRefresh:A().default(!0),debounceMs:E().int().nonnegative().default(300)}),On=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),kn=L.extend({level:On}),An=R.extend({method:w(`logging/setLevel`),params:kn}),jn=z.extend({level:On,logger:x().optional(),data:h()}),Mn=B.extend({method:w(`notifications/message`),params:jn}),Nn=T({name:x().optional()}),Pn=T({hints:O(Nn).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),Fn=T({mode:D([`auto`,`required`,`none`]).optional()}),In=T({type:w(`tool_result`),toolUseId:x().describe(`The unique identifier for the corresponding tool call.`),content:O(pn),structuredContent:h().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),Ln=S(`type`,[cn,K,ln]),Rn=S(`type`,[cn,K,ln,un,In]),zn=T({role:Mt,content:j([Rn,O(Rn)]),_meta:M(x(),h()).optional()}),Bn=Je.extend({messages:O(zn),modelPreferences:Pn.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:I.optional(),tools:O(yn).optional(),toolChoice:Fn.optional()}),Vn=R.extend({method:w(`sampling/createMessage`),params:Bn}),Hn=V.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`]).or(x())),role:Mt,content:Ln}),Un=V.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(x())),role:Mt,content:j([Rn,O(Rn)])}),Wn=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),Gn=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),Kn=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),qn=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),Jn=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Yn=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),Xn=j([qn,Jn]),Zn=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),Qn=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),$n=j([Zn,Qn]),er=j([Yn,Xn,$n]),tr=j([er,Wn,Gn,Kn]),nr=Je.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),tr),required:O(x()).optional()}).catchall(h())}),rr=Je.extend({mode:w(`url`),message:x(),elicitationId:x(),url:x().url()}),ir=j([nr,rr]),ar=R.extend({method:w(`elicitation/create`),params:ir}),or=z.extend({elicitationId:x()}),sr=B.extend({method:w(`notifications/elicitation/complete`),params:or}),cr=V.extend({action:D([`accept`,`decline`,`cancel`]),content:ce(e=>e===null?void 0:e,M(x(),j([x(),E(),A(),O(x())])).optional())}),lr=T({type:w(`ref/resource`),uri:x()}),ur=T({type:w(`ref/prompt`),name:x()}),dr=L.extend({ref:j([ur,lr]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()}),fr=R.extend({method:w(`completion/complete`),params:dr}),pr=V.extend({completion:k({values:O(x()).max(100),total:y(E().int()),hasMore:y(A())})}),mr=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),hr=R.extend({method:w(`roots/list`),params:L.optional()}),gr=V.extend({roots:O(mr)}),_r=B.extend({method:w(`notifications/roots/list_changed`),params:z.optional()}),vr=k({ttl:E().optional(),pollInterval:E().optional()}),yr=D([`working`,`input_required`,`completed`,`failed`,`cancelled`]),br=T({taskId:x(),status:yr,ttl:j([E(),ae()]),createdAt:x(),lastUpdatedAt:x(),pollInterval:y(E()),statusMessage:y(x())}),xr=V.extend({task:br}),Sr=z.merge(br),Cr=B.extend({method:w(`notifications/tasks/status`),params:Sr}),wr=R.extend({method:w(`tasks/get`),params:L.extend({taskId:x()})}),Tr=V.merge(br),Er=R.extend({method:w(`tasks/result`),params:L.extend({taskId:x()})}),Dr=V.loose(),Or=Et.extend({method:w(`tasks/list`)}),kr=Dt.extend({tasks:O(br)}),Ar=R.extend({method:w(`tasks/cancel`),params:L.extend({taskId:x()})}),jr=V.merge(br),Mr=j([xt,ht,yt,fr,An,sn,rn,It,U,Bt,Wt,Kt,Yt,Tn,bn]),Nr=j([at,wt,vt,_r]),Pr=j([rt,Hn,Un,cr,gr]),Fr=j([xt,Vn,ar,hr]),Ir=j([at,wt,Mn,tn,Ht,En,gn,Zt,sr]),Lr=j([rt,_t,bt,pr,hn,an,Lt,W,Vt,Sn,xn,$t]),q=d().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:de.custom,message:`URL must be parseable`,fatal:!0}),ne}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),Rr=k({resource:x().url(),authorization_servers:O(q).optional(),jwks_uri:x().url().optional(),scopes_supported:O(x()).optional(),bearer_methods_supported:O(x()).optional(),resource_signing_alg_values_supported:O(x()).optional(),resource_name:x().optional(),resource_documentation:x().optional(),resource_policy_uri:x().url().optional(),resource_tos_uri:x().url().optional(),tls_client_certificate_bound_access_tokens:A().optional(),authorization_details_types_supported:O(x()).optional(),dpop_signing_alg_values_supported:O(x()).optional(),dpop_bound_access_tokens_required:A().optional()}),zr=k({issuer:x(),authorization_endpoint:q,token_endpoint:q,registration_endpoint:q.optional(),scopes_supported:O(x()).optional(),response_types_supported:O(x()),response_modes_supported:O(x()).optional(),grant_types_supported:O(x()).optional(),token_endpoint_auth_methods_supported:O(x()).optional(),token_endpoint_auth_signing_alg_values_supported:O(x()).optional(),service_documentation:q.optional(),revocation_endpoint:q.optional(),revocation_endpoint_auth_methods_supported:O(x()).optional(),revocation_endpoint_auth_signing_alg_values_supported:O(x()).optional(),introspection_endpoint:x().optional(),introspection_endpoint_auth_methods_supported:O(x()).optional(),introspection_endpoint_auth_signing_alg_values_supported:O(x()).optional(),code_challenge_methods_supported:O(x()).optional(),client_id_metadata_document_supported:A().optional(),authorization_response_iss_parameter_supported:A().optional().catch(void 0),dpop_signing_alg_values_supported:O(x()).optional()}),Br=k({issuer:x(),authorization_endpoint:q,token_endpoint:q,userinfo_endpoint:q.optional(),jwks_uri:q,registration_endpoint:q.optional(),scopes_supported:O(x()).optional(),response_types_supported:O(x()),response_modes_supported:O(x()).optional(),grant_types_supported:O(x()).optional(),acr_values_supported:O(x()).optional(),subject_types_supported:O(x()),id_token_signing_alg_values_supported:O(x()),id_token_encryption_alg_values_supported:O(x()).optional(),id_token_encryption_enc_values_supported:O(x()).optional(),userinfo_signing_alg_values_supported:O(x()).optional(),userinfo_encryption_alg_values_supported:O(x()).optional(),userinfo_encryption_enc_values_supported:O(x()).optional(),request_object_signing_alg_values_supported:O(x()).optional(),request_object_encryption_alg_values_supported:O(x()).optional(),request_object_encryption_enc_values_supported:O(x()).optional(),token_endpoint_auth_methods_supported:O(x()).optional(),token_endpoint_auth_signing_alg_values_supported:O(x()).optional(),display_values_supported:O(x()).optional(),claim_types_supported:O(x()).optional(),claims_supported:O(x()).optional(),service_documentation:x().optional(),claims_locales_supported:O(x()).optional(),ui_locales_supported:O(x()).optional(),claims_parameter_supported:A().optional(),request_parameter_supported:A().optional(),request_uri_parameter_supported:A().optional(),require_request_uri_registration:A().optional(),op_policy_uri:q.optional(),op_tos_uri:q.optional(),client_id_metadata_document_supported:A().optional(),authorization_response_iss_parameter_supported:A().optional().catch(void 0)}),Vr=T({...Br.shape,...zr.pick({code_challenge_methods_supported:!0}).shape}),Hr=T({access_token:x(),id_token:x().optional(),token_type:x(),expires_in:he().optional(),scope:x().optional(),refresh_token:x().optional(),issuer:x().optional().catch(void 0)}).strip(),Ur=T({issued_token_type:w(`urn:ietf:params:oauth:token-type:id-jag`),access_token:x(),token_type:x().optional(),expires_in:E().optional(),scope:x().optional()}).strip(),Wr=T({error:x(),error_description:x().optional(),error_uri:x().optional()}),Gr=q.optional().or(w(``).transform(()=>void 0)),Kr=T({redirect_uris:O(q),token_endpoint_auth_method:x().optional(),grant_types:O(x()).optional(),response_types:O(x()).optional(),application_type:x().optional(),client_name:x().optional(),client_uri:q.optional(),logo_uri:Gr,scope:x().optional(),contacts:O(x()).optional(),tos_uri:Gr,policy_uri:x().optional(),jwks_uri:q.optional(),jwks:b().optional(),software_id:x().optional(),software_version:x().optional(),software_statement:x().optional()}).strip(),qr=T({client_id:x(),client_secret:x().optional(),client_id_issued_at:E().optional(),client_secret_expires_at:E().optional(),issuer:x().optional().catch(void 0)}).strip(),Jr=Kr.merge(qr),Yr=T({error:x(),error_description:x().optional()}).strip(),Xr=T({token:x(),token_type_hint:x().optional()}).strip(),Zr=Symbol.for(`mcp.sdk.errorBrands`);function Qr(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,Zr,{value:n,enumerable:!1,configurable:!0})}function $r(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Zr)){let n=t[Zr];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var ei=function(e){return e.InvalidRequest=`invalid_request`,e.InvalidClient=`invalid_client`,e.InvalidGrant=`invalid_grant`,e.UnauthorizedClient=`unauthorized_client`,e.UnsupportedGrantType=`unsupported_grant_type`,e.InvalidScope=`invalid_scope`,e.AccessDenied=`access_denied`,e.ServerError=`server_error`,e.TemporarilyUnavailable=`temporarily_unavailable`,e.UnsupportedResponseType=`unsupported_response_type`,e.UnsupportedTokenType=`unsupported_token_type`,e.InvalidToken=`invalid_token`,e.MethodNotAllowed=`method_not_allowed`,e.TooManyRequests=`too_many_requests`,e.InvalidClientMetadata=`invalid_client_metadata`,e.InvalidRedirectUri=`invalid_redirect_uri`,e.InsufficientScope=`insufficient_scope`,e.InvalidTarget=`invalid_target`,e.InvalidDpopProof=`invalid_dpop_proof`,e.UseDpopNonce=`use_dpop_nonce`,e}({}),ti=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Qr(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},J=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),Y=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Qr(this,new.target)}},ni=class extends Y{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}};function ri(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function ii(e){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t={...e};return delete t.issuer,t}function ai({requestedResource:e,configuredResource:t}){let n=typeof e==`string`?new URL(e):new URL(e.href),r=typeof t==`string`?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length=oi}function li(e){return e.filter(e=>!ci(e))}function ui(e){return e.filter(e=>ci(e))}function di(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var fi=[`task`,`inputRequests`,`requestState`];function pi(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||fi.some(t=>t in e)?e:{...e,content:[]}}function mi(){let e=ee(()=>j([x(),E(),A(),ae(),M(x(),e),O(e)])),t=M(x(),e),n=j([x(),E().int()]),r=x(),i=T({ttl:E().optional()}),a=T({taskId:x()}),o=k({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=T({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=T({method:x(),params:s.loose().optional()}),u=T({_meta:o.optional()}),d=T({method:x(),params:u.loose().optional()}),f=k({_meta:o.optional()}),p=j([x(),E().int()]),m=f.strict(),g=u.extend({requestId:p.optional(),reason:x().optional()}),_=d.extend({method:w(`notifications/cancelled`),params:g}),v=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),b=T({icons:O(v).optional()}),C=T({name:x(),title:x().optional()}),te=C.extend({...C.shape,...b.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),ne=se(T({applyDefaults:A().optional()}),t),re=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:ne.optional(),url:t.optional()}),t.optional())),ie=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),oe=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),le=T({experimental:M(x(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:re.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:ie.optional(),extensions:M(x(),t).optional()}),ue=s.extend({protocolVersion:x(),capabilities:le,clientInfo:te}),de=l.extend({method:w(`initialize`),params:ue}),fe=T({experimental:M(x(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:oe.optional(),extensions:M(x(),t).optional()}),me=f.extend({protocolVersion:x(),capabilities:fe,serverInfo:te,instructions:x().optional()}),he=d.extend({method:w(`notifications/initialized`),params:u.optional()}),N=l.extend({method:w(`ping`),params:s.optional()}),P=T({progress:E(),total:y(E()),message:y(x())}),ge=T({...u.shape,...P.shape,progressToken:n}),_e=d.extend({method:w(`notifications/progress`),params:ge}),ve=s.extend({cursor:r.optional()}),ye=l.extend({params:ve.optional()}),be=f.extend({nextCursor:r.optional()}),F=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),xe=F.extend({text:x()}),Se=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Ce=F.extend({blob:Se}),we=D([`user`,`assistant`]),Te=T({audience:O(we).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),Ee=T({...C.shape,...b.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:Te.optional(),_meta:y(k({}))}),De=T({...C.shape,...b.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:Te.optional(),_meta:y(k({}))}),Oe=ye.extend({method:w(`resources/list`)}),ke=be.extend({resources:O(Ee)}),Ae=ye.extend({method:w(`resources/templates/list`)}),je=be.extend({resourceTemplates:O(De)}),Me=s.extend({uri:x()}),Ne=Me,Pe=l.extend({method:w(`resources/read`),params:Ne}),Fe=f.extend({contents:O(j([xe,Ce]))}),Ie=d.extend({method:w(`notifications/resources/list_changed`),params:u.optional()}),Le=Me,Re=l.extend({method:w(`resources/subscribe`),params:Le}),ze=Me,Be=l.extend({method:w(`resources/unsubscribe`),params:ze}),Ve=u.extend({uri:x()}),I=d.extend({method:w(`notifications/resources/updated`),params:Ve}),He=T({name:x(),description:y(x()),required:y(A())}),Ue=T({...C.shape,...b.shape,description:y(x()),arguments:y(O(He)),_meta:y(k({}))}),We=ye.extend({method:w(`prompts/list`)}),Ge=be.extend({prompts:O(Ue)}),Ke=s.extend({name:x(),arguments:M(x(),x()).optional()}),qe=l.extend({method:w(`prompts/get`),params:Ke}),L=T({type:w(`text`),text:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),Je=T({type:w(`image`),data:Se,mimeType:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),R=T({type:w(`audio`),data:Se,mimeType:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),z=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),B=T({type:w(`resource`),resource:j([xe,Ce]),annotations:Te.optional(),_meta:M(x(),h()).optional()}),Ye=Ee.extend({type:w(`resource_link`)}),V=j([L,Je,R,Ye,B]),Xe=T({role:we,content:V}),Ze=f.extend({description:x().optional(),messages:O(Xe)}),Qe=d.extend({method:w(`notifications/prompts/list_changed`),params:u.optional()}),$e=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),et=T({taskSupport:D([`required`,`optional`,`forbidden`]).optional()}),tt=T({...C.shape,...b.shape,description:x().optional(),inputSchema:T({type:w(`object`),properties:M(x(),e).optional(),required:O(x()).optional()}).catchall(h()),outputSchema:T({type:w(`object`),properties:M(x(),e).optional(),required:O(x()).optional()}).catchall(h()).optional(),annotations:$e.optional(),execution:et.optional(),_meta:M(x(),h()).optional()}),nt=ye.extend({method:w(`tools/list`)}),rt=be.extend({tools:O(tt)}),it=f.extend({content:O(V),structuredContent:M(x(),h()).optional(),isError:A().optional()}),at=c.extend({name:x(),arguments:M(x(),h()).optional()}),ot=l.extend({method:w(`tools/call`),params:at}),st=d.extend({method:w(`notifications/tools/list_changed`),params:u.optional()}),ct=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),H=s.extend({level:ct}),lt=l.extend({method:w(`logging/setLevel`),params:H}),ut=u.extend({level:ct,logger:x().optional(),data:h()}),dt=d.extend({method:w(`notifications/message`),params:ut}),ft=T({name:x().optional()}),pt=T({hints:O(ft).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),mt=T({mode:D([`auto`,`required`,`none`]).optional()}),ht=T({type:w(`tool_result`),toolUseId:x().describe(`The unique identifier for the corresponding tool call.`),content:O(V),structuredContent:T({}).loose().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),gt=S(`type`,[L,Je,R]),_t=S(`type`,[L,Je,R,z,ht]),vt=T({role:we,content:j([_t,O(_t)]),_meta:M(x(),h()).optional()}),yt=c.extend({messages:O(vt),modelPreferences:pt.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:t.optional(),tools:O(tt).optional(),toolChoice:mt.optional()}),bt=l.extend({method:w(`sampling/createMessage`),params:yt}),xt=f.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`]).or(x())),role:we,content:gt}),St=f.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(x())),role:we,content:j([_t,O(_t)])}),Ct=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),wt=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),Tt=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),Et=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),Dt=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Ot=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),kt=j([Et,Dt]),At=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),jt=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),Mt=j([At,jt]),Nt=j([Ot,kt,Mt]),Pt=j([Nt,Ct,wt,Tt]),Ft=c.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),Pt),required:O(x()).optional()}).catchall(h())}),It=c.extend({mode:w(`url`),message:x(),elicitationId:x(),url:x().url()}),Lt=j([Ft,It]),U=l.extend({method:w(`elicitation/create`),params:Lt}),W=u.extend({elicitationId:x()}),Rt=d.extend({method:w(`notifications/elicitation/complete`),params:W}),zt=f.extend({action:D([`accept`,`decline`,`cancel`]),content:ce(e=>e===null?void 0:e,M(x(),j([x(),E(),A(),O(x())])).optional())}),Bt=T({type:w(`ref/resource`),uri:x()}),Vt=T({type:w(`ref/prompt`),name:x()}),Ht=s.extend({ref:j([Vt,Bt]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()}),Ut=l.extend({method:w(`completion/complete`),params:Ht}),Wt=f.extend({completion:k({values:O(x()).max(100),total:y(E().int()),hasMore:y(A())})}),Gt=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),Kt=l.extend({method:w(`roots/list`),params:s.optional()}),qt=f.extend({roots:O(Gt)}),Jt=d.extend({method:w(`notifications/roots/list_changed`),params:u.optional()}),Yt=k({ttl:E().optional(),pollInterval:E().optional()}),Xt=D([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Zt=T({taskId:x(),status:Xt,ttl:j([E(),ae()]),createdAt:x(),lastUpdatedAt:x(),pollInterval:y(E()),statusMessage:y(x())}),Qt=f.extend({task:Zt}),$t=u.merge(Zt),en=d.extend({method:w(`notifications/tasks/status`),params:$t}),tn=l.extend({method:w(`tasks/get`),params:s.extend({taskId:x()})}),G=f.merge(Zt),nn=l.extend({method:w(`tasks/result`),params:s.extend({taskId:x()})}),rn=f.loose(),an=ye.extend({method:w(`tasks/list`)}),on=be.extend({tasks:O(Zt)}),sn=l.extend({method:w(`tasks/cancel`),params:s.extend({taskId:x()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:_,IconSchema:v,IconsSchema:b,BaseMetadataSchema:C,ImplementationSchema:te,ClientTasksCapabilitySchema:ie,ServerTasksCapabilitySchema:oe,ClientCapabilitiesSchema:le,InitializeRequestParamsSchema:ue,InitializeRequestSchema:de,ServerCapabilitiesSchema:fe,InitializeResultSchema:me,InitializedNotificationSchema:he,PingRequestSchema:N,ProgressSchema:P,ProgressNotificationParamsSchema:ge,ProgressNotificationSchema:_e,PaginatedRequestParamsSchema:ve,PaginatedRequestSchema:ye,PaginatedResultSchema:be,ResourceContentsSchema:F,TextResourceContentsSchema:xe,BlobResourceContentsSchema:Ce,RoleSchema:we,AnnotationsSchema:Te,ResourceSchema:Ee,ResourceTemplateSchema:De,ListResourcesRequestSchema:Oe,ListResourcesResultSchema:ke,ListResourceTemplatesRequestSchema:Ae,ListResourceTemplatesResultSchema:je,ResourceRequestParamsSchema:Me,ReadResourceRequestParamsSchema:Ne,ReadResourceRequestSchema:Pe,ReadResourceResultSchema:Fe,ResourceListChangedNotificationSchema:Ie,SubscribeRequestParamsSchema:Le,SubscribeRequestSchema:Re,UnsubscribeRequestParamsSchema:ze,UnsubscribeRequestSchema:Be,ResourceUpdatedNotificationParamsSchema:Ve,ResourceUpdatedNotificationSchema:I,PromptArgumentSchema:He,PromptSchema:Ue,ListPromptsRequestSchema:We,ListPromptsResultSchema:Ge,GetPromptRequestParamsSchema:Ke,GetPromptRequestSchema:qe,TextContentSchema:L,ImageContentSchema:Je,AudioContentSchema:R,ToolUseContentSchema:z,EmbeddedResourceSchema:B,ResourceLinkSchema:Ye,ContentBlockSchema:V,PromptMessageSchema:Xe,GetPromptResultSchema:Ze,PromptListChangedNotificationSchema:Qe,ToolAnnotationsSchema:$e,ToolExecutionSchema:et,ToolSchema:tt,ListToolsRequestSchema:nt,ListToolsResultSchema:rt,CallToolResultSchema:it,CallToolRequestParamsSchema:at,CallToolRequestSchema:ot,ToolListChangedNotificationSchema:st,LoggingLevelSchema:ct,SetLevelRequestParamsSchema:H,SetLevelRequestSchema:lt,LoggingMessageNotificationParamsSchema:ut,LoggingMessageNotificationSchema:dt,ModelHintSchema:ft,ModelPreferencesSchema:pt,ToolChoiceSchema:mt,ToolResultContentSchema:ht,SamplingContentSchema:gt,SamplingMessageContentBlockSchema:_t,SamplingMessageSchema:vt,CreateMessageRequestParamsSchema:yt,CreateMessageRequestSchema:bt,CreateMessageResultSchema:xt,CreateMessageResultWithToolsSchema:St,BooleanSchemaSchema:Ct,StringSchemaSchema:wt,NumberSchemaSchema:Tt,UntitledSingleSelectEnumSchemaSchema:Et,TitledSingleSelectEnumSchemaSchema:Dt,LegacyTitledEnumSchemaSchema:Ot,SingleSelectEnumSchemaSchema:kt,UntitledMultiSelectEnumSchemaSchema:At,TitledMultiSelectEnumSchemaSchema:jt,MultiSelectEnumSchemaSchema:Mt,EnumSchemaSchema:Nt,PrimitiveSchemaDefinitionSchema:Pt,ElicitRequestFormParamsSchema:Ft,ElicitRequestURLParamsSchema:It,ElicitRequestParamsSchema:Lt,ElicitRequestSchema:U,ElicitationCompleteNotificationParamsSchema:W,ElicitationCompleteNotificationSchema:Rt,ElicitResultSchema:zt,ResourceTemplateReferenceSchema:Bt,PromptReferenceSchema:Vt,CompleteRequestParamsSchema:Ht,CompleteRequestSchema:Ut,CompleteResultSchema:Wt,RootSchema:Gt,ListRootsRequestSchema:Kt,ListRootsResultSchema:qt,RootsListChangedNotificationSchema:Jt,TaskCreationParamsSchema:Yt,TaskStatusSchema:Xt,TaskSchema:Zt,CreateTaskResultSchema:Qt,TaskStatusNotificationParamsSchema:$t,TaskStatusNotificationSchema:en,GetTaskRequestSchema:tn,GetTaskResultSchema:G,GetTaskPayloadRequestSchema:nn,GetTaskPayloadResultSchema:rn,ListTasksRequestSchema:an,ListTasksResultSchema:on,CancelTaskRequestSchema:sn,CancelTaskResultSchema:f.merge(Zt),ClientRequestSchema:j([N,de,Ut,lt,qe,We,Oe,Ae,Pe,Re,Be,ot,nt,tn,nn,an,sn]),ClientNotificationSchema:j([_,_e,he,Jt,en]),ClientResultSchema:j([m,xt,St,zt,qt,G,on,Qt]),ServerRequestSchema:j([N,bt,U,Kt,tn,nn,an,sn]),ServerNotificationSchema:j([_,_e,dt,I,Ie,st,Qe,en,Rt]),ServerResultSchema:j([m,me,Wt,Ze,Ge,ke,je,Fe,it,rt,G,on,Qt]),CallToolResultWireSchema:h().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of fi)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(pi).pipe(it)}}var hi;function gi(){return hi??=mi()}function _i(e){return e.type!==`object`}var vi=new Set([`const`,`enum`,`default`,`examples`]),yi=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function bi(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function xi(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(bi(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=Ae(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&bi(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=vi.has(o)?s:yi.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var Si={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ci={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},wi={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ti;function Ei(){if(Ti)return Ti;let e=gi();return Ti={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Ti}function Di(e){return Object.prototype.hasOwnProperty.call(Si,e)}function Oi(e){return Object.prototype.hasOwnProperty.call(Ci,e)}function ki(e){return Object.prototype.hasOwnProperty.call(wi,e)}function Ai(e){return ki(e)?Ei().resultSchemas[e]:void 0}function ji(e){return Di(e)?Ei().requestSchemas[e]:void 0}function Mi(e){return Oi(e)?Ei().notificationSchemas[e]:void 0}Object.keys(Si),Object.keys(Ci);function Ni(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Pi(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var Fi={ok:!1,reason:`not-in-era`};function Ii(e){return Ni(e)&&Ni(e.outputSchema)&&_i(e.outputSchema)}function Li(e){return e}var Ri={era:`2025-11-25`,hasRequestMethod:Di,hasNotificationMethod:Oi,validateRequest:(e,t)=>Pi(ji(e),t),validateResult:(e,t)=>Pi(Ai(e),t),validateNotification:(e,t)=>Pi(Mi(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Fi,validateInputResponse:()=>Fi,samplingResultVariant:((e,t)=>{let n=gi();return Pi(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=di(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&_i(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(Ni(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:Li(e)}}return{kind:`complete`,result:Li(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>Ii(e))?t:{...t,tools:n.map(e=>Ii(e)?{...e,outputSchema:xi(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function zi(){let e=ee(()=>j([x(),E(),A(),ae(),M(x(),e),O(e)])),t=M(x(),e),n=j([x(),E().int()]),r=x(),i=j([x(),E().int()]),a=D([`user`,`assistant`]),o=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=T({ttl:E().optional()}),l=T({taskId:x()}),u=k({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=T({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=T({_meta:u.optional()}),m=T({method:x(),params:p.loose().optional()}),g=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),_=T({icons:O(g).optional()}),v=T({name:x(),title:x().optional()}),b=v.extend({...v.shape,..._.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),S=se(T({applyDefaults:A().optional()}),t),C=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:S.optional(),url:t.optional()}),t.optional())),te=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),ne=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),re=T({experimental:M(x(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:C.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:te.optional(),extensions:M(x(),t).optional()}),ie=T({experimental:M(x(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:ne.optional(),extensions:M(x(),t).optional()}),oe=T({progress:E(),total:y(E()),message:y(x())}),le=T({...p.shape,...oe.shape,progressToken:n}),ue=m.extend({method:w(`notifications/progress`),params:le}),de=p.extend({level:o,logger:x().optional(),data:h()}),fe=m.extend({method:w(`notifications/message`),params:de}),me=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),he=me.extend({text:x()}),N=me.extend({blob:s}),P=T({audience:O(a).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),ge=T({...v.shape,..._.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:P.optional(),_meta:y(k({}))}),_e=T({...v.shape,..._.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:P.optional(),_meta:y(k({}))}),ve=m.extend({method:w(`notifications/resources/list_changed`),params:p.optional()}),ye=p.extend({uri:x()}),be=m.extend({method:w(`notifications/resources/updated`),params:ye}),F=T({name:x(),description:y(x()),required:y(A())}),xe=T({...v.shape,..._.shape,description:y(x()),arguments:y(O(F)),_meta:y(k({}))}),Se=m.extend({method:w(`notifications/prompts/list_changed`),params:p.optional()}),Ce=T({type:w(`text`),text:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),we=T({type:w(`image`),data:s,mimeType:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),Te=T({type:w(`audio`),data:s,mimeType:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),Ee=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),De=T({type:w(`resource`),resource:j([he,N]),annotations:P.optional(),_meta:M(x(),h()).optional()}),Oe=ge.extend({type:w(`resource_link`)}),ke=j([Ce,we,Te,Oe,De]),Ae=T({role:a,content:ke}),je=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),Me=m.extend({method:w(`notifications/tools/list_changed`),params:p.optional()}),Ne=T({name:x().optional()}),Pe=T({hints:O(Ne).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),ze=T({mode:D([`auto`,`required`,`none`]).optional()}),Ve=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),I=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),He=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),Ue=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),We=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Ge=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),Ke=j([Ue,We]),qe=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),L=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),Je=j([qe,L]),R=j([Ge,Ke,Je]),z=j([R,Ve,I,He]),B=f.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),z),required:O(x()).optional()}).catchall(h())}),Ye=T({type:w(`ref/resource`),uri:x()}),V=T({type:w(`ref/prompt`),name:x()}),Xe=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),Ze=re.shape,Qe=T({experimental:Ze.experimental,sampling:Ze.sampling,elicitation:Ze.elicitation,roots:Ze.roots,extensions:Ze.extensions}),$e=ie.shape,et=T({experimental:$e.experimental,logging:$e.logging,completions:$e.completions,prompts:$e.prompts,resources:$e.resources,tools:$e.tools,extensions:$e.extensions}),tt=k({progressToken:n.optional(),[Fe]:x(),[Ie]:b.optional(),[Re]:Qe,[Be]:o.optional()}),nt=T({...v.shape,..._.shape,description:x().optional(),inputSchema:k({$schema:x().optional(),type:w(`object`)}),outputSchema:k({$schema:x().optional()}).optional(),annotations:je.optional(),_meta:M(x(),h()).optional()}),rt=T({type:w(`tool_result`),toolUseId:x(),content:O(ke),structuredContent:h().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),it=j([Ce,we,Te,Ee,rt]),at=T({role:a,content:j([it,O(it)]),_meta:M(x(),h()).optional()}),ot=x(),st=k({[Le]:b.optional().catch(void 0)}),ct=st.optional();function H(e){return k({_meta:ct,resultType:ot.default(`complete`),...e})}let lt=H({}),ut=H({nextCursor:r.optional()}),dt=H({content:O(ke),structuredContent:h().optional(),isError:A().optional()}),ft=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),tools:O(nt),nextCursor:r.optional()}),pt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),prompts:O(xe),nextCursor:r.optional()}),mt=H({description:x().optional(),messages:O(Ae)}),ht=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resources:O(ge),nextCursor:r.optional()}),gt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resourceTemplates:O(_e),nextCursor:r.optional()}),_t=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),contents:O(j([he,N]))}),vt=H({completion:T({values:O(x()).max(100),total:E().int().optional(),hasMore:A().optional()}).loose()}),yt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`])}),bt=H({ttlMs:E().int().min(0).catch(0),cacheScope:D([`public`,`private`]).catch(`private`),supportedVersions:O(x()),capabilities:et,instructions:x().optional()}),xt=T({messages:O(at),modelPreferences:Pe.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:t.optional(),tools:O(nt).optional(),toolChoice:ze.optional()}),St=T({method:w(`sampling/createMessage`),params:xt}),Ct=T({method:w(`roots/list`),params:T({_meta:M(x(),h()).optional()}).optional()}),wt=T({...at.shape,model:x(),stopReason:x().optional()}),Tt=T({roots:O(Xe)}),Et=T({action:D([`accept`,`decline`,`cancel`]),content:M(x(),j([x(),E(),A(),O(x())])).optional()}),Dt=T({mode:w(`url`),message:x(),url:x().url()}),Ot=j([B,Dt]),kt=T({method:w(`elicitation/create`),params:Ot}),At=j([St,Ct,kt]),jt=j([wt,Tt,Et]),Mt=M(x(),At),Nt=M(x(),jt),Pt=H({inputRequests:Mt.optional(),requestState:x().optional()}),Ft={inputResponses:Nt.optional(),requestState:x().optional()},It=T({_meta:tt,...Ft}),Lt=k({progressToken:n.optional()});function U(e,t){return T({method:w(e),params:T({_meta:tt,...t})})}function W(e,t){return T({method:w(e),params:T({_meta:Lt.optional(),...t}).optional()})}let Rt={name:x(),arguments:M(x(),h()).optional(),...Ft},zt={cursor:r.optional()},Bt=U(`tools/call`,Rt),Vt=U(`tools/list`,zt),Ht=U(`prompts/list`,zt),Ut=U(`prompts/get`,{name:x(),arguments:M(x(),x()).optional(),...Ft}),Wt=U(`resources/list`,zt),Gt=U(`resources/templates/list`,zt),Kt=U(`resources/read`,{uri:x(),...Ft}),qt={ref:j([V,Ye]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()},Jt=U(`completion/complete`,qt),Yt=U(`server/discover`,{}),Xt=T({toolsListChanged:A().optional(),promptsListChanged:A().optional(),resourcesListChanged:A().optional(),resourceSubscriptions:O(x()).optional()}),Zt={notifications:Xt},Qt=U(`subscriptions/listen`,Zt),$t=st.extend({"io.modelcontextprotocol/subscriptionId":i}),en=k({_meta:$t,resultType:ot.default(`complete`)}),tn={"tools/call":W(`tools/call`,Rt),"tools/list":W(`tools/list`,zt),"prompts/get":W(`prompts/get`,{name:x(),arguments:M(x(),x()).optional()}),"prompts/list":W(`prompts/list`,zt),"resources/list":W(`resources/list`,zt),"resources/templates/list":W(`resources/templates/list`,zt),"resources/read":W(`resources/read`,{uri:x()}),"completion/complete":W(`completion/complete`,qt),"server/discover":W(`server/discover`,{}),"subscriptions/listen":W(`subscriptions/listen`,Zt)};function G(e){return k({_meta:ct,...e})}let nn={"tools/call":G({content:O(ke),structuredContent:h().optional(),isError:A().optional()}),"tools/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),tools:O(nt),nextCursor:r.optional()}),"prompts/get":G({description:x().optional(),messages:O(Ae)}),"prompts/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),prompts:O(xe),nextCursor:r.optional()}),"resources/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resources:O(ge),nextCursor:r.optional()}),"resources/templates/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resourceTemplates:O(_e),nextCursor:r.optional()}),"resources/read":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),contents:O(j([he,N]))}),"completion/complete":G({completion:T({values:O(x()).max(100),total:E().int().optional(),hasMore:A().optional()}).loose()}),"server/discover":G({ttlMs:E().int().min(0).catch(0),cacheScope:D([`public`,`private`]).catch(`private`),supportedVersions:O(x()),capabilities:et,instructions:x().optional()}),"subscriptions/listen":G({})},rn=k({"io.modelcontextprotocol/subscriptionId":i.optional()}),an=T({method:w(`notifications/subscriptions/acknowledged`),params:T({_meta:rn.optional(),notifications:Xt})}),on=T({_meta:rn.optional(),requestId:i,reason:x().optional()}),sn=T({method:w(`notifications/cancelled`),params:on}),cn={"notifications/cancelled":sn,"notifications/progress":ue,"notifications/message":fe,"notifications/resources/updated":be,"notifications/resources/list_changed":ve,"notifications/tools/list_changed":Me,"notifications/prompts/list_changed":Se,"notifications/subscriptions/acknowledged":an},K=e=>T({jsonrpc:w(`2.0`),id:j([x(),E().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:g,IconsSchema:_,BaseMetadataSchema:v,ImplementationSchema:b,ClientTasksCapabilitySchema:te,ServerTasksCapabilitySchema:ne,ClientCapabilitiesSchema:re,ServerCapabilitiesSchema:ie,ProgressSchema:oe,ProgressNotificationParamsSchema:le,ProgressNotificationSchema:ue,LoggingMessageNotificationParamsSchema:de,LoggingMessageNotificationSchema:fe,ResourceContentsSchema:me,TextResourceContentsSchema:he,BlobResourceContentsSchema:N,AnnotationsSchema:P,ResourceSchema:ge,ResourceTemplateSchema:_e,ResourceListChangedNotificationSchema:ve,ResourceUpdatedNotificationParamsSchema:ye,ResourceUpdatedNotificationSchema:be,PromptArgumentSchema:F,PromptSchema:xe,PromptListChangedNotificationSchema:Se,TextContentSchema:Ce,ImageContentSchema:we,AudioContentSchema:Te,ToolUseContentSchema:Ee,EmbeddedResourceSchema:De,ResourceLinkSchema:Oe,ContentBlockSchema:ke,PromptMessageSchema:Ae,ToolAnnotationsSchema:je,ToolListChangedNotificationSchema:Me,ModelHintSchema:Ne,ModelPreferencesSchema:Pe,ToolChoiceSchema:ze,BooleanSchemaSchema:Ve,StringSchemaSchema:I,NumberSchemaSchema:He,UntitledSingleSelectEnumSchemaSchema:Ue,TitledSingleSelectEnumSchemaSchema:We,LegacyTitledEnumSchemaSchema:Ge,SingleSelectEnumSchemaSchema:Ke,UntitledMultiSelectEnumSchemaSchema:qe,TitledMultiSelectEnumSchemaSchema:L,MultiSelectEnumSchemaSchema:Je,EnumSchemaSchema:R,PrimitiveSchemaDefinitionSchema:z,ElicitRequestFormParamsSchema:B,ResourceTemplateReferenceSchema:Ye,PromptReferenceSchema:V,RootSchema:Xe,ClientCapabilities2026Schema:Qe,ServerCapabilities2026Schema:et,RequestMetaEnvelopeSchema:tt,ToolSchema:nt,ToolResultContentSchema:rt,SamplingMessageContentBlockSchema:it,SamplingMessageSchema:at,ResultTypeSchema:ot,ResultMetaSchema:st,ResultSchema:lt,PaginatedResultSchema:ut,CallToolResultSchema:dt,ListToolsResultSchema:ft,ListPromptsResultSchema:pt,GetPromptResultSchema:mt,ListResourcesResultSchema:ht,ListResourceTemplatesResultSchema:gt,ReadResourceResultSchema:_t,CompleteResultSchema:vt,CacheableResultSchema:yt,DiscoverResultSchema:bt,CreateMessageRequestParamsSchema:xt,CreateMessageRequestSchema:St,ListRootsRequestSchema:Ct,CreateMessageResultSchema:wt,ListRootsResultSchema:Tt,ElicitResultSchema:Et,ElicitRequestURLParamsSchema:Dt,ElicitRequestParamsSchema:Ot,ElicitRequestSchema:kt,InputRequestSchema:At,InputResponseSchema:jt,InputRequestsSchema:Mt,InputResponsesSchema:Nt,InputRequiredResultSchema:Pt,InputResponseRequestParamsSchema:It,CallToolRequestSchema:Bt,ListToolsRequestSchema:Vt,ListPromptsRequestSchema:Ht,GetPromptRequestSchema:Ut,ListResourcesRequestSchema:Wt,ListResourceTemplatesRequestSchema:Gt,ReadResourceRequestSchema:Kt,CompleteRequestSchema:Jt,DiscoverRequestSchema:Yt,SubscriptionFilterSchema:Xt,SubscriptionsListenRequestSchema:Qt,SubscriptionsListenResultMetaSchema:$t,SubscriptionsListenResultSchema:en,dispatchRequestSchemas:tn,dispatchResultSchemas:nn,NotificationMetaSchema:rn,SubscriptionsAcknowledgedNotificationSchema:an,CancelledNotificationParamsSchema:on,CancelledNotificationSchema:sn,notificationSchemas2026:cn,JSONRPCResultResponseSchema:K(lt),CallToolResultResponseSchema:K(j([dt,Pt])),ListToolsResultResponseSchema:K(ft),ListPromptsResultResponseSchema:K(pt),GetPromptResultResponseSchema:K(j([mt,Pt])),ListResourcesResultResponseSchema:K(ht),ListResourceTemplatesResultResponseSchema:K(gt),ReadResourceResultResponseSchema:K(j([_t,Pt])),CompleteResultResponseSchema:K(vt),DiscoverResultResponseSchema:K(bt),SubscriptionsListenResultResponseSchema:K(en)}}var Bi;function Vi(){return Bi??=zi()}var Hi=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function Ui(e){return Hi.includes(e)}var Wi=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function Gi(e){return e[Wi]}function Ki(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function qi(e){return e===`public`||e===`private`}var X=function(e){return e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),Z=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Qr(this,new.target)}static fromError(t,n,r){if(t===X.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Yi(e.elicitations,n)}if(t===X.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new Xi({supported:e.supported,requested:e.requested},n)}if(t===X.InvalidParams||t===X.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===X.ResourceNotFound||Object.keys(e).length===1))return new Ji(e.uri,n)}if(t===X.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new Zi({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},Ji=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(X.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Yi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(X.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Xi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(X.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Zi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(X.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Qi=0,$i=`private`,ea=[`tools/call`,`prompts/get`,`resources/read`];function ta(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||ea.includes(e))return t;throw new Z(X.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function na(e,t){let n=Gi(t);if(t.resultType!==`complete`||!Ui(e))return n===void 0?t:sa(t);let r=t,i=Ki(r.ttlMs)?r.ttlMs:aa(n),a=qi(r.cacheScope)?r.cacheScope:oa(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Wi],o}function ra(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ia(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[Le]:t}}:!ra(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[Le]:t}}}function aa(e){return e!==void 0&&Ki(e.ttlMs)?e.ttlMs:Qi}function oa(e){return e!==void 0&&qi(e.cacheScope)?e.cacheScope:$i}function sa(e){let t={...e};return delete t[Wi],t}var ca=[`elicitation/create`,`sampling/createMessage`,`roots/list`],la;function ua(){if(la)return la;let e=Vi();return la={request:{"elicitation/create":T({method:w(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":T({method:w(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":T({method:w(`roots/list`),params:k({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},la}function da(e){return ca.includes(e)}function fa(e){return da(e)?ua().request[e]:void 0}function pa(e){return da(e)?ua().response[e]:void 0}var ma={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},ha={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function ga(e){return Object.prototype.hasOwnProperty.call(ma,e)}function _a(e){return Object.prototype.hasOwnProperty.call(ha,e)}function va(e){return Object.prototype.hasOwnProperty.call(ma,e)}function ya(e){return ga(e)?Vi().dispatchRequestSchemas[e]:void 0}function ba(e){return va(e)?Vi().dispatchResultSchemas[e]:void 0}function xa(e){return _a(e)?Vi().notificationSchemas2026[e]:void 0}Object.keys(ma),Object.keys(ha);function Sa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ca(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var wa={ok:!1,reason:`not-in-era`},Ta=[Fe,Re];function Ea(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>Sa(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Sa(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Sa(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Da={era:`2026-07-28`,hasRequestMethod:ga,hasNotificationMethod:_a,hasInputRequestMethod:e=>fa(e)!==void 0,validateRequest:(e,t)=>Ca(ya(e),t),validateResult:(e,t)=>Ca(ba(e),t),validateNotification:(e,t)=>Ca(xa(e),t),validateInputRequest:(e,t)=>Ca(fa(e),t),validateInputResponse:(e,t)=>Ca(pa(e),t),samplingResultVariant:()=>wa,outboundEnvelope(e){return{[Fe]:e.protocolVersion,[Ie]:e.clientInfo,[Re]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Ta)n in e||t.push({key:n,problem:`missing`});let n=Vi().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>di(e),inputRequestSchema:fa,decodeResult(e,t){if(!Sa(t))return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Sa(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:Vi().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new Y(J.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=ka(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return ia(na(e,ta(e,Ea(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=Vi().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},Oa;function ka(){if(Oa)return Oa;let e=Vi();return Oa={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Oa}var Aa=`2026-07-28`;function ja(e){return e!==void 0&&ci(e)?Da:Ri}function Ma(e){return e.revision===void 0?e.era===`modern`?Da.era:Ri.era:ja(e.revision).era}function Na(e){return Ia.some(t=>t.hasRequestMethod(e))}function Pa(e){return Ia.some(t=>t.hasNotificationMethod(e))}function Fa(e){return e===`tasks/get`||e===`tasks/cancel`}var Ia=[Ri,Da],La=Ce({AnnotationsSchema:()=>Nt,AudioContentSchema:()=>ln,BaseMetadataSchema:()=>ct,BaseRequestParamsSchema:()=>L,BlobResourceContentsSchema:()=>jt,BooleanSchemaSchema:()=>Wn,CallToolRequestParamsSchema:()=>wn,CallToolRequestSchema:()=>Tn,CallToolResultSchema:()=>Sn,CancelTaskRequestSchema:()=>Ar,CancelTaskResultSchema:()=>jr,CancelledNotificationParamsSchema:()=>it,CancelledNotificationSchema:()=>at,ClientCapabilitiesSchema:()=>pt,ClientNotificationSchema:()=>Nr,ClientRequestSchema:()=>Mr,ClientResultSchema:()=>Pr,ClientTasksCapabilitySchema:()=>dt,CompatibilityCallToolResultSchema:()=>Cn,CompleteRequestParamsSchema:()=>dr,CompleteRequestSchema:()=>fr,CompleteResultSchema:()=>pr,ContentBlockSchema:()=>pn,CreateMessageRequestParamsSchema:()=>Bn,CreateMessageRequestSchema:()=>Vn,CreateMessageResultSchema:()=>Hn,CreateMessageResultWithToolsSchema:()=>Un,CreateTaskResultSchema:()=>xr,CursorSchema:()=>We,DiscoverRequestSchema:()=>yt,DiscoverResultSchema:()=>bt,ElicitRequestFormParamsSchema:()=>nr,ElicitRequestParamsSchema:()=>ir,ElicitRequestSchema:()=>ar,ElicitRequestURLParamsSchema:()=>rr,ElicitResultSchema:()=>cr,ElicitationCompleteNotificationParamsSchema:()=>or,ElicitationCompleteNotificationSchema:()=>sr,EmbeddedResourceSchema:()=>dn,EmptyResultSchema:()=>rt,EnumSchemaSchema:()=>er,GetPromptRequestParamsSchema:()=>on,GetPromptRequestSchema:()=>sn,GetPromptResultSchema:()=>hn,GetTaskPayloadRequestSchema:()=>Er,GetTaskPayloadResultSchema:()=>Dr,GetTaskRequestSchema:()=>wr,GetTaskResultSchema:()=>Tr,IconSchema:()=>ot,IconsSchema:()=>st,ImageContentSchema:()=>K,ImplementationSchema:()=>H,InitializeRequestParamsSchema:()=>mt,InitializeRequestSchema:()=>ht,InitializeResultSchema:()=>_t,InitializedNotificationSchema:()=>vt,JSONArraySchema:()=>He,JSONObjectSchema:()=>I,JSONRPCErrorResponseSchema:()=>et,JSONRPCMessageSchema:()=>tt,JSONRPCNotificationSchema:()=>Qe,JSONRPCRequestSchema:()=>Ze,JSONRPCResponseSchema:()=>nt,JSONRPCResultResponseSchema:()=>$e,JSONValueSchema:()=>Ve,LegacyTitledEnumSchemaSchema:()=>Yn,ListChangedOptionsBaseSchema:()=>Dn,ListPromptsRequestSchema:()=>rn,ListPromptsResultSchema:()=>an,ListResourceTemplatesRequestSchema:()=>U,ListResourceTemplatesResultSchema:()=>W,ListResourcesRequestSchema:()=>It,ListResourcesResultSchema:()=>Lt,ListRootsRequestSchema:()=>hr,ListRootsResultSchema:()=>gr,ListTasksRequestSchema:()=>Or,ListTasksResultSchema:()=>kr,ListToolsRequestSchema:()=>bn,ListToolsResultSchema:()=>xn,LoggingLevelSchema:()=>On,LoggingMessageNotificationParamsSchema:()=>jn,LoggingMessageNotificationSchema:()=>Mn,ModelHintSchema:()=>Nn,ModelPreferencesSchema:()=>Pn,MultiSelectEnumSchemaSchema:()=>$n,NotificationSchema:()=>B,NotificationsParamsSchema:()=>z,NumberSchemaSchema:()=>Kn,PaginatedRequestParamsSchema:()=>Tt,PaginatedRequestSchema:()=>Et,PaginatedResultSchema:()=>Dt,PingRequestSchema:()=>xt,PrimitiveSchemaDefinitionSchema:()=>tr,ProgressNotificationParamsSchema:()=>Ct,ProgressNotificationSchema:()=>wt,ProgressSchema:()=>St,ProgressTokenSchema:()=>Ue,PromptArgumentSchema:()=>G,PromptListChangedNotificationSchema:()=>gn,PromptMessageSchema:()=>mn,PromptReferenceSchema:()=>ur,PromptSchema:()=>nn,ReadResourceRequestParamsSchema:()=>zt,ReadResourceRequestSchema:()=>Bt,ReadResourceResultSchema:()=>Vt,RelatedTaskMetadataSchema:()=>Ke,RequestIdSchema:()=>Xe,RequestMetaSchema:()=>qe,RequestSchema:()=>R,ResourceContentsSchema:()=>Ot,ResourceLinkSchema:()=>fn,ResourceListChangedNotificationSchema:()=>Ht,ResourceRequestParamsSchema:()=>Rt,ResourceSchema:()=>Pt,ResourceTemplateReferenceSchema:()=>lr,ResourceTemplateSchema:()=>Ft,ResourceUpdatedNotificationParamsSchema:()=>en,ResourceUpdatedNotificationSchema:()=>tn,ResultMetaObjectSchema:()=>Ye,ResultSchema:()=>V,RoleSchema:()=>Mt,RootSchema:()=>mr,RootsListChangedNotificationSchema:()=>_r,SamplingContentSchema:()=>Ln,SamplingMessageContentBlockSchema:()=>Rn,SamplingMessageSchema:()=>zn,ServerCapabilitiesSchema:()=>gt,ServerNotificationSchema:()=>Ir,ServerRequestSchema:()=>Fr,ServerResultSchema:()=>Lr,ServerTasksCapabilitySchema:()=>ft,SetLevelRequestParamsSchema:()=>kn,SetLevelRequestSchema:()=>An,SingleSelectEnumSchemaSchema:()=>Xn,StringSchemaSchema:()=>Gn,SubscribeRequestParamsSchema:()=>Ut,SubscribeRequestSchema:()=>Wt,SubscriptionFilterSchema:()=>qt,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Xt,SubscriptionsAcknowledgedNotificationSchema:()=>Zt,SubscriptionsListenRequestParamsSchema:()=>Jt,SubscriptionsListenRequestSchema:()=>Yt,SubscriptionsListenResultMetaSchema:()=>Qt,SubscriptionsListenResultSchema:()=>$t,TaskAugmentedRequestParamsSchema:()=>Je,TaskCreationParamsSchema:()=>vr,TaskMetadataSchema:()=>Ge,TaskSchema:()=>br,TaskStatusNotificationParamsSchema:()=>Sr,TaskStatusNotificationSchema:()=>Cr,TaskStatusSchema:()=>yr,TextContentSchema:()=>cn,TextResourceContentsSchema:()=>kt,TitledMultiSelectEnumSchemaSchema:()=>Qn,TitledSingleSelectEnumSchemaSchema:()=>Jn,ToolAnnotationsSchema:()=>_n,ToolChoiceSchema:()=>Fn,ToolExecutionSchema:()=>vn,ToolListChangedNotificationSchema:()=>En,ToolResultContentSchema:()=>In,ToolSchema:()=>yn,ToolUseContentSchema:()=>un,UnsubscribeRequestParamsSchema:()=>Gt,UnsubscribeRequestSchema:()=>Kt,UntitledMultiSelectEnumSchemaSchema:()=>Zn,UntitledSingleSelectEnumSchemaSchema:()=>qn}),Ra=e=>Ze.safeParse(e).success,za=e=>Qe.safeParse(e).success,Ba=e=>$e.safeParse(e).success,Va=e=>et.safeParse(e).success,Ha=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.resultType===`input_required`,Ua=e=>ht.safeParse(e).success,Wa=e=>vt.safeParse(e).success,Ga=`Mcp-Param-`,Ka=`x-mcp-header`,qa=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Ja=new Set([`string`,`integer`,`boolean`,`number`]);function Ya(e){let t=[],n=new Map,r=(e,i,a)=>{if(typeof e!=`object`||!e)return;let o=e;if(Ka in o){if(!a||i.length===0)return`${Qa(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let e=o[Ka];if(typeof e!=`string`||e.length===0)return`${Qa(i)}: x-mcp-header MUST be a non-empty string`;if(!qa.test(e))return`${Qa(i)}: x-mcp-header '${e}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let r=typeof o.type==`string`?o.type:void 0;if(r===void 0||!Ja.has(r))return`${Qa(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${r??``}`;let s=e.toLowerCase(),c=n.get(s);if(c!==void 0)return`x-mcp-header '${e}' is not case-insensitively unique (also declared as '${c}')`;n.set(s,e),t.push({path:i,headerName:e,type:r})}let s=o.properties;if(typeof s==`object`&&s)for(let[e,t]of Object.entries(s)){let n=r(t,[...i,e],a);if(n!==void 0)return n}for(let e of Xa){let t=o[e];if(t===void 0)continue;let n=Array.isArray(t)?t:typeof t==`object`&&t&&Za.has(e)?Object.values(t):[t];for(let t of n){let n=r(t,[...i,`<${e}>`],!1);if(n!==void 0)return n}}},i=r(e,[],!0);return i===void 0?{valid:!0,declarations:t}:{valid:!1,reason:i}}var Xa=[`items`,`prefixItems`,`contains`,`additionalProperties`,`unevaluatedProperties`,`unevaluatedItems`,`propertyNames`,`patternProperties`,`dependentSchemas`,`oneOf`,`anyOf`,`allOf`,`not`,`if`,`then`,`else`,`$defs`,`definitions`],Za=new Set([`patternProperties`,`dependentSchemas`,`$defs`,`definitions`]);function Qa(e){return e.length===0?``:e.join(`.`)}var $a=`=?base64?`,eo=`?=`;function to(e){if(typeof e==`string`)return e;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function no(e){if(e.length===0||e.startsWith($a)&&e.endsWith(eo)||e!==e.trim())return!0;for(let t=0;t=32&&n<=126))return!0}return!1}function ro(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCodePoint(e);return btoa(n)}function io(e){return no(e)?`${$a}${ro(e)}${eo}`:e}function ao(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function oo(e,t){let n={};for(let r of e){let e=ao(t,r.path);if(e==null)continue;let i=to(e);i!==void 0&&(n[`${Ga}${r.headerName}`]=io(i))}return n}X.InvalidRequest,X.UnsupportedProtocolVersion,X.InvalidParams,X.MethodNotFound,X.InvalidParams,X.MissingRequiredClientCapability,X.ParseError,X.InvalidRequest,X.MethodNotFound,X.UnsupportedProtocolVersion,X.MissingRequiredClientCapability;var so={"tools/call":`name`,"prompts/get":`name`,"resources/read":`uri`,"tasks/get":`taskId`,"tasks/update":`taskId`,"tasks/cancel":`taskId`};function co(e,t){let n=Object.hasOwn(so,e)?so[e]:void 0;if(n===void 0)return;let r=lo(t)?t[n]:void 0;return{field:n,value:typeof r==`string`?r:void 0}}function lo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function uo(e,t){return le(e,t)}function fo(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function po(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var mo=!1,ho=`draft-2020-12`;function go(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:ho});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);mo||(mo=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=g(e,{target:ho,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&_o(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function _o(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||_o(e)))}return!1}function vo(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function yo(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>vo(e)).join(`, `)}:{success:!0,data:n.value}}function bo(e){let t=g(e,{target:ho,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var xo=/\\\.\\d\{(\d+)\}/;function So(e){let t=xo.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>pe({local:e,offset:t,precision:n}))))}function Co(e,t){let n;switch(e){case`email`:n=[re()];break;case`uri`:n=[d()];break;case`date`:n=[me()];break;case`date-time`:n=So(t)}return new Set(n.map(e=>bo(e)).filter(e=>e!==void 0))}function wo(e,t,n){return n!==`zod`||Co(e,t).has(t)}function To(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Eo(e){try{return go(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new Z(X.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var Do=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Oo(e){return Do.has(e)||e.startsWith(`x-`)}var ko=new Set([`$schema`,...Object.keys(nr.shape.requestedSchema.shape)]),Ao={string:fo([Gn,qn,Jn,Yn]),number:fo([Kn]),integer:fo([Kn]),boolean:fo([Wn]),array:fo([Zn,Qn])},jo=new Set(Gn.shape.format.unwrap().options);function Mo(e,t,n,r){if(!To(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Ao,e.type)?Ao[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Oo(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?jo.has(e.format)?(typeof s!=`string`||!wo(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function No(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&To(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Mo(n,`properties.${e}`,t,r)])):ko.has(i)?n[i]=a:Oo(i)||r.push(i);if(r.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function Po(e,t){if(!To(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!uo(tr,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Fo(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Fo(e,t[r],`${n}[${r}]`)):!To(e)||!To(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Fo(r,t[e],i):Oo(e)?[]:[i]})}function Io(e){if(!po(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=No(Eo(e.requestedSchema),t),r=uo(nr.shape.requestedSchema,n);if(!r.success)throw new Z(X.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Po(n,r.error.message)}`);let i=Fo(n,r.data);if(i.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Lo(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(Lo,{elicit(e){try{return{method:`elicitation/create`,params:Io(e)}}catch(e){throw e instanceof Z?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var Ro=!0,zo=10,Bo=250;function Vo(e){return{autoFulfill:e?.autoFulfill??Ro,maxRounds:e?.maxRounds??zo}}function Ho(e,t,n){let r=t!==void 0&&Object.keys(t).length>0;return!r&&n===void 0?e:{...e,...r&&{inputResponses:t},...n!==void 0&&{requestState:n}}}function Uo(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function Wo(e,t){return new Promise((n,r)=>{if(t?.aborted){r(t.reason instanceof Y?t.reason:new Y(J.RequestTimeout,String(t.reason)));return}let i=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),r(t?.reason instanceof Y?t.reason:new Y(J.RequestTimeout,String(t?.reason)))};t?.addEventListener(`abort`,a,{once:!0})})}function Go(e){let t=new AbortController,n=()=>t.abort(e?.reason);return e?.addEventListener(`abort`,n,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:e=>t.abort(e),dispose:()=>e?.removeEventListener(`abort`,n)}}async function Ko(e){let{config:t,method:n,originalParams:r,requestOptions:i,hooks:a,signal:o}=e,s=e.flowStartedAt??Date.now(),c=e.firstPayload,l=0;for(;;){if(l+=1,l>t.maxRounds)throw new Y(J.InputRequiredRoundsExceeded,Uo(n,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:c.inputRequests,...c.requestState!==void 0&&{requestState:c.requestState}}});i.onprogress?.({progress:l,message:`Fulfilling input required by '${n}' (round ${l})`});let e=Object.entries(c.inputRequests??{}),u;if(e.length>0){let t=Go(o);try{let n=await Promise.all(e.map(async([e,n])=>{try{return[e,await a.dispatchInputRequest(e,n,t.signal)]}catch(e){throw t.abort(e),e}}));u=Object.fromEntries(n)}finally{t.dispose()}}else await Wo(Bo,o);let d={...i.timeout!==void 0&&{timeout:i.timeout}};if(i.maxTotalTimeout!==void 0){let e=Date.now()-s,t=i.maxTotalTimeout-e;if(t<=0)throw new Y(J.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:i.maxTotalTimeout,totalElapsed:e});d.maxTotalTimeout=t}let f=await a.retry(Ho(r,u,c.requestState),d);if(Ha(f)){c={inputRequests:f.inputRequests??{},...f.requestState!==void 0&&{requestState:f.requestState}};continue}return f}}var qo=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),Jo={IdJagTokenExchangeResponseSchema:Ur,OAuthClientInformationFullSchema:Jr,OAuthClientInformationSchema:qr,OAuthClientMetadataSchema:Kr,OAuthClientRegistrationErrorSchema:Yr,OAuthErrorResponseSchema:Wr,OAuthMetadataSchema:zr,OAuthProtectedResourceMetadataSchema:Rr,OAuthTokenRevocationRequestSchema:Xr,OAuthTokensSchema:Hr,OpenIdProviderDiscoveryMetadataSchema:Vr,OpenIdProviderMetadataSchema:Br},Yo={},Xo={};function Zo(e,t){let n=e.slice(0,-6);Yo[n]=t,Xo[n]=e=>t.safeParse(e).success}for(let e of qo)Zo(e,La[e]);for(let[e,t]of Object.entries(Jo))Zo(e,t);Object.freeze(Yo);var Qo=Object.freeze(Xo);function $o(e){switch(e){case`initialize`:case`notifications/initialized`:return ja(void 0);case`server/discover`:return ja(Aa);default:return}}var es=[Fe,Ie,Re,Be],ts=[`inputResponses`,`requestState`];function ns(e,t){let n=e.params;if(!ss(n))return{message:e,lifted:{}};let r=n._meta,i=ss(r)?es.filter(e=>e in r):[],a=t===`request`?ts.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&ss(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function rs(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function is(e){return()=>e}var as=is(void 0),os=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Ne,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new Y(J.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Y(J.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),Ba(e)||Va(e)?this._onresponse(e):Ra(e)?this._onrequest(e,t):za(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new Y(J.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=ns(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=Ma(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(Pa(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=ns(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=Ma(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(X.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(Na(n.method)&&!i.hasRequestMethod(n.method)&&!(Fa(n.method)&&this._customSchemaRequestMethods.has(n.method))){o(X.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(X.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(X.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:us(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?as:is(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),po(t))return u(e,t,n);let i=rs(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(X.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:X.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Ba(e)?n(e):n(Z.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(po(t))return Fa(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=rs(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return ja(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=$o(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Na(t)&&!e.hasRequestMethod(t))throw new Y(J.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof Y?e:new Y(J.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),v=!1,y=e=>{v||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof Y?e:new Y(J.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(v=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(gs(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;yo(n,o).then(e=>{e.success?d(e.data):f(new Y(J.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>y(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let b=r?.timeout??6e4;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new Y(J.RequestTimeout,`Request timed out`,{timeout:b})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new Y(J.NotConnected,`Not connected`);if(Pa(t.method)&&!e.hasNotificationMethod(t.method))throw new Y(J.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&n?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!Na(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new Z(X.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await yo(t.params,{...r.params});if(!a.success)throw new Z(X.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!Pa(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new Z(X.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await yo(t.params,{...r.params});if(!i.success)throw new Z(X.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function ss(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function cs(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];n[r]=ss(a)&&ss(i)?{...a,...i}:i}return n}function ls(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function us(e){let t={},n=[];if(!ls(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!ls(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function ds(e){throw new Y(J.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function fs(e,t,n,r,i){return{sessionId:i,mcpReq:{id:e,method:t,_meta:n?._meta,requestState:is(void 0),signal:r,send:(()=>ds(`send`)),notify:()=>ds(`notify`)}}}async function ps(e,t,n,r,i){if(!ls(r)||typeof r.method!=`string`)throw new Y(J.InvalidResult,`Invalid input request '${n}': each inputRequests entry must be an embedded request object with a method`,{key:n});let a=r.method;if(!t.hasInputRequestMethod(a))throw new Y(J.InvalidResult,`Invalid input request '${n}': '${a}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:n,method:a});let o=e.getRequestHandler(a);if(o===void 0)throw new Y(J.CapabilityNotSupported,`Cannot fulfil input request '${n}': no handler is registered for '${a}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:n,method:a});let s=ls(r.params)?r.params:void 0;return await o({jsonrpc:`2.0`,id:n,method:a,...s!==void 0&&{params:s}},e.buildContext(fs(n,a,s,i,e.sessionId)))}function ms(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function hs(e,t,n,r){let{codec:i,request:a,options:o,flowStartedAt:s}=r,c={inputRequests:n.inputRequests,...n.requestState!==void 0&&{requestState:n.requestState}},l={dispatchInputRequest:(t,n,r)=>ps(e,i,t,n,r),retry:(e,t)=>r.retry(e,ms(o,t))};return Ko({config:t,method:a.method,originalParams:a.params,firstPayload:c,flowStartedAt:s,signal:o?.signal,requestOptions:{...o?.timeout!==void 0&&{timeout:o.timeout},...o?.maxTotalTimeout!==void 0&&{maxTotalTimeout:o.maxTotalTimeout},...o?.onprogress!==void 0&&{onprogress:o.onprogress}},hooks:l})}function gs(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var _s=Te(Se((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),1);function vs(e){if(e)try{return _s.parse(e).type}catch{let t=(e.split(`;`,1)[0]??``).trim().toLowerCase();return t===``||e.slice(t.length).includes(`,`)?void 0:t}}function ys(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function bs(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{...ys(t.headers),...ys(r.headers)}:t.headers}):e}var xs=new Set([301,302,303,307,308]),Ss=5;function Cs(e,t){return e.protocol===t.protocol&&e.host===t.host||e.protocol===`http:`&&t.protocol===`https:`&&e.hostname===t.hostname&&!e.port&&!t.port}function ws(e,t){let n=xs.has(t.status)?t.headers?.get(`location`):void 0;if(n)try{return new URL(n,e)}catch{return}}var Ts=new WeakSet;function Es(e){let t=(t,n)=>e(t,n);return Ts.add(t),t}function Ds(e){return Ts.has(e)?e:async(t,n)=>{if(n?.redirect===`error`||n?.redirect===`manual`)return e(t,n);let r=(n?.method??`GET`).toUpperCase(),i=t;for(let t=0;;t++){let a=await e(i,{...n,redirect:`manual`}),o=ws(i,a);if(!o||t===Ss)return a;let s=new URL(i),c=r===`GET`||a.status===307||a.status===308,l=!(o.username||o.password)||o.username===s.username&&o.password===s.password;if(!c||!l||!Cs(s,o))return a;await a.text?.().catch(()=>{}),i=o}}}function Os(e,t){if(t.type===`opaqueredirect`)return`Redirect not followed: this runtime does not expose where it points`;let n=ws(t.url||e,t);if(n)return n.username=n.password=n.search=n.hash=``,n.protocol===`http:`&&new URL(t.url||e).protocol===`https:`?(n.protocol=`https:`,`Redirect from https to plain http not followed; try ${n.href} as the endpoint`):`Redirect to ${n.href} not followed; use that URL as the endpoint if it is the intended server`}function ks(e,t){let n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r1?t[a.href]=e:(a.hash=``,r===``?n=a:Is(e,t,n))}}else if(e!==!0&&e!==!1)return t;let i=n.href+(r?`#`+r:``);if(t[i]!==void 0)throw Error(`Duplicate schema URI "${i}".`);if(t[i]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:i}),e.$ref&&e.__absolute_ref__===void 0){let t=new URL(e.$ref,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:t.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let t=new URL(e.$recursiveRef,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:t.href})}if(e.$anchor){let r=new URL(`#`+e.$anchor,n.href);t[r.href]=e}for(let i in e){if(Ps[i])continue;let a=`${r}/${As(i)}`,o=e[i];if(Array.isArray(o)){if(Ms[i]){let e=o.length;for(let r=0;r%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Us=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,Ws=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Gs=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ks=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,qs=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Js=e=>{if(e[0]===`"`)return!1;let[t,n,...r]=e.split(`@`);return!t||!n||r.length!==0||t.length>64||n.length>253||t[0]===`.`||t.endsWith(`.`)||t.includes(`..`)||!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:n.split(`.`).every(e=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(e))},Ys=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Xs=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,Zs=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function Qs(e){return e.test.bind(e)}var $s={date:tc,time:nc.bind(void 0,!1),"date-time":ic,duration:Zs,uri:sc,"uri-reference":Qs(Vs),"uri-template":Qs(Hs),url:Qs(Us),email:Js,hostname:Qs(Bs),ipv4:Qs(Ys),ipv6:Qs(Xs),regex:lc,uuid:Qs(Ws),"json-pointer":Qs(Gs),"json-pointer-uri-fragment":Qs(Ks),"relative-json-pointer":Qs(qs)};function ec(e){return e%4==0&&(e%100!=0||e%400==0)}function tc(e){let t=e.match(Ls);if(!t)return!1;let n=+t[1],r=+t[2],i=+t[3];return r>=1&&r<=12&&i>=1&&i<=(r==2&&ec(n)?29:Rs[r])}function nc(e,t){let n=t.match(zs);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}var rc=/t|\s/i;function ic(e){let t=e.split(rc);return t.length==2&&tc(t[0])&&nc(!0,t[1])}var ac=/\/|:/,oc=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function sc(e){return ac.test(e)&&oc.test(e)}var cc=/[^\\]\\Z/;function lc(e){if(cc.test(e))return!1;try{return new RegExp(e,`u`),!0}catch{return!1}}function uc(e){let t=0,n=e.length,r=0,i;for(;r=55296&&i<=56319&&r{if(typeof e!=`string`||/[\s;'\"]/.test(e))return!1;let t=e.match(/^([a-z]+):\/\/([^/]+)$/i);return!!(t&&n.has(t[1].toLowerCase()))})}function ge(e){let t=N(N(N(e)?.ui)?.csp),n=P(t?.connectDomains,[`http`,`https`,`ws`,`wss`]),r=P(t?.resourceDomains,[`http`,`https`]),i=P(t?.frameDomains,[`http`,`https`]),a=P(t?.baseUriDomains,[`http`,`https`]),o=r.length?` ${r.join(` `)}`:``,s=[`default-src 'none'`,`worker-src blob:`,`script-src 'self' 'unsafe-inline'${o}`,`style-src 'self' 'unsafe-inline'${o}`,`img-src 'self' data:${o}`,`media-src 'self' data:${o}`,`font-src 'self' data:${o}`,`connect-src ${n.length?n.join(` `):`'none'`}`];return i.length&&s.push(`frame-src ${i.join(` `)}`),a.length&&s.push(`base-uri ${a.join(` `)}`),`${s.join(`; `)};`}var _e=Object.create,ve=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,be=Object.getOwnPropertyNames,F=Object.getPrototypeOf,xe=Object.prototype.hasOwnProperty,Se=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ce=(e,t)=>{let n={};for(var r in e)ve(n,r,{get:e[r],enumerable:!0});return t&&ve(n,Symbol.toStringTag,{value:`Module`}),n},we=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=be(t),a=0,o=i.length,s;at[e]).bind(null,s),enumerable:!(r=ye(t,s))||r.enumerable});return e},Te=(e,t,n)=>(n=e==null?{}:_e(F(e)),we(t||!e||!e.__esModule?ve(n,`default`,{value:e,enumerable:!0}):n,e)),Ee=new Set([`https://json-schema.org/draft/2020-12/schema`,`http://json-schema.org/draft/2020-12/schema`]),De=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]),Oe=new Set([`https://json-schema.org/draft-07/schema`,`http://json-schema.org/draft-07/schema`]),ke=new Set([`https://json-schema.org/draft-06/schema`,`http://json-schema.org/draft-06/schema`]);function Ae(e){return typeof e==`string`&&De.has(e.replace(/#$/,``))}function je(e,t){if(!(`$schema`in e)||typeof e.$schema!=`string`)return`2020-12`;let n=e.$schema.replace(/#$/,``);if(Ee.has(n))return`2020-12`;if(De.has(n))return`2019-09`;if(Oe.has(n)||ke.has(n))return`draft-7`;throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var Me=`2025-11-25`,Ne=[Me,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],Pe=`io.modelcontextprotocol/related-task`,Fe=`io.modelcontextprotocol/protocolVersion`,Ie=`io.modelcontextprotocol/clientInfo`,Le=`io.modelcontextprotocol/serverInfo`,Re=`io.modelcontextprotocol/clientCapabilities`,ze=`io.modelcontextprotocol/subscriptionId`,Be=`io.modelcontextprotocol/logLevel`,Ve=ee(()=>j([x(),E(),A(),ae(),M(x(),Ve),O(Ve)])),I=M(x(),Ve),He=O(Ve),Ue=j([x(),E().int()]),We=x(),Ge=T({ttl:E().optional()}),Ke=T({taskId:x()}),qe=k({progressToken:Ue.optional(),[Pe]:Ke.optional()}),L=T({_meta:qe.optional()}),Je=L.extend({task:Ge.optional()}),R=T({method:x(),params:L.loose().optional()}),z=T({_meta:qe.optional()}),B=T({method:x(),params:z.loose().optional()}),Ye=k({get[Le](){return H.optional().catch(void 0)}}),V=k({_meta:Ye.optional()}),Xe=j([x(),E().int()]),Ze=T({jsonrpc:w(`2.0`),id:Xe,...R.shape}).strict(),Qe=T({jsonrpc:w(`2.0`),...B.shape}).strict(),$e=T({jsonrpc:w(`2.0`),id:Xe,result:V}).strict(),et=T({jsonrpc:w(`2.0`),id:Xe.optional(),error:T({code:E().int(),message:x(),data:h().optional()})}).strict(),tt=j([Ze,Qe,$e,et]),nt=j([$e,et]),rt=V.strict(),it=z.extend({requestId:Xe.optional(),reason:x().optional()}),at=B.extend({method:w(`notifications/cancelled`),params:it}),ot=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),st=T({icons:O(ot).optional()}),ct=T({name:x(),title:x().optional()}),H=ct.extend({...ct.shape,...st.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),lt=se(T({applyDefaults:A().optional()}),I),ut=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:lt.optional(),url:I.optional()}),I.optional())),dt=k({list:I.optional(),cancel:I.optional(),requests:k({sampling:k({createMessage:I.optional()}).optional(),elicitation:k({create:I.optional()}).optional()}).optional()}),ft=k({list:I.optional(),cancel:I.optional(),requests:k({tools:k({call:I.optional()}).optional()}).optional()}),pt=T({experimental:M(x(),I).optional(),sampling:T({context:I.optional(),tools:I.optional()}).optional(),elicitation:ut.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:dt.optional(),extensions:M(x(),I).optional()}),mt=L.extend({protocolVersion:x(),capabilities:pt,clientInfo:H}),ht=R.extend({method:w(`initialize`),params:mt}),gt=T({experimental:M(x(),I).optional(),logging:I.optional(),completions:I.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:ft.optional(),extensions:M(x(),I).optional()}),_t=V.extend({protocolVersion:x(),capabilities:gt,serverInfo:H,instructions:x().optional()}),vt=B.extend({method:w(`notifications/initialized`),params:z.optional()}),yt=R.extend({method:w(`server/discover`),params:L.optional()}),bt=V.extend({supportedVersions:O(x()),capabilities:gt,instructions:x().optional()}),xt=R.extend({method:w(`ping`),params:L.optional()}),St=T({progress:E(),total:y(E()),message:y(x())}),Ct=T({...z.shape,...St.shape,progressToken:Ue}),wt=B.extend({method:w(`notifications/progress`),params:Ct}),Tt=L.extend({cursor:We.optional()}),Et=R.extend({params:Tt.optional()}),Dt=V.extend({nextCursor:We.optional()}),Ot=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),kt=Ot.extend({text:x()}),At=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),jt=Ot.extend({blob:At}),Mt=D([`user`,`assistant`]),Nt=T({audience:O(Mt).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),Pt=T({...ct.shape,...st.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:Nt.optional(),_meta:y(k({}))}),Ft=T({...ct.shape,...st.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:Nt.optional(),_meta:y(k({}))}),It=Et.extend({method:w(`resources/list`)}),Lt=Dt.extend({resources:O(Pt)}),U=Et.extend({method:w(`resources/templates/list`)}),W=Dt.extend({resourceTemplates:O(Ft)}),Rt=L.extend({uri:x()}),zt=Rt,Bt=R.extend({method:w(`resources/read`),params:zt}),Vt=V.extend({contents:O(j([kt,jt]))}),Ht=B.extend({method:w(`notifications/resources/list_changed`),params:z.optional()}),Ut=Rt,Wt=R.extend({method:w(`resources/subscribe`),params:Ut}),Gt=Rt,Kt=R.extend({method:w(`resources/unsubscribe`),params:Gt}),qt=T({toolsListChanged:A().optional(),promptsListChanged:A().optional(),resourcesListChanged:A().optional(),resourceSubscriptions:O(x()).optional()}),Jt=L.extend({notifications:qt}),Yt=R.extend({method:w(`subscriptions/listen`),params:Jt}),Xt=z.extend({notifications:qt}),Zt=B.extend({method:w(`notifications/subscriptions/acknowledged`),params:Xt}),Qt=Ye.extend({[ze]:Xe}),$t=V.extend({_meta:Qt}),en=z.extend({uri:x()}),tn=B.extend({method:w(`notifications/resources/updated`),params:en}),G=T({name:x(),description:y(x()),required:y(A())}),nn=T({...ct.shape,...st.shape,description:y(x()),arguments:y(O(G)),_meta:y(k({}))}),rn=Et.extend({method:w(`prompts/list`)}),an=Dt.extend({prompts:O(nn)}),on=L.extend({name:x(),arguments:M(x(),x()).optional()}),sn=R.extend({method:w(`prompts/get`),params:on}),cn=T({type:w(`text`),text:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),K=T({type:w(`image`),data:At,mimeType:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),ln=T({type:w(`audio`),data:At,mimeType:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),un=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),dn=T({type:w(`resource`),resource:j([kt,jt]),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),fn=Pt.extend({type:w(`resource_link`)}),pn=j([cn,K,ln,fn,dn]),mn=T({role:Mt,content:pn}),hn=V.extend({description:x().optional(),messages:O(mn)}),gn=B.extend({method:w(`notifications/prompts/list_changed`),params:z.optional()}),_n=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),vn=T({taskSupport:D([`required`,`optional`,`forbidden`]).optional()}),yn=T({...ct.shape,...st.shape,description:x().optional(),inputSchema:T({type:w(`object`),properties:M(x(),Ve).optional(),required:O(x()).optional()}).catchall(h()),outputSchema:k({$schema:x().optional()}).optional(),annotations:_n.optional(),execution:vn.optional(),_meta:M(x(),h()).optional()}),bn=Et.extend({method:w(`tools/list`)}),xn=Dt.extend({tools:O(yn)}),Sn=V.extend({content:O(pn).default([]),structuredContent:h().optional(),isError:A().optional()}),Cn=Sn.or(V.extend({toolResult:h()})),wn=Je.extend({name:x(),arguments:M(x(),h()).optional()}),Tn=R.extend({method:w(`tools/call`),params:wn}),En=B.extend({method:w(`notifications/tools/list_changed`),params:z.optional()}),Dn=T({autoRefresh:A().default(!0),debounceMs:E().int().nonnegative().default(300)}),On=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),kn=L.extend({level:On}),An=R.extend({method:w(`logging/setLevel`),params:kn}),jn=z.extend({level:On,logger:x().optional(),data:h()}),Mn=B.extend({method:w(`notifications/message`),params:jn}),Nn=T({name:x().optional()}),Pn=T({hints:O(Nn).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),Fn=T({mode:D([`auto`,`required`,`none`]).optional()}),In=T({type:w(`tool_result`),toolUseId:x().describe(`The unique identifier for the corresponding tool call.`),content:O(pn),structuredContent:h().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),Ln=S(`type`,[cn,K,ln]),Rn=S(`type`,[cn,K,ln,un,In]),zn=T({role:Mt,content:j([Rn,O(Rn)]),_meta:M(x(),h()).optional()}),Bn=Je.extend({messages:O(zn),modelPreferences:Pn.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:I.optional(),tools:O(yn).optional(),toolChoice:Fn.optional()}),Vn=R.extend({method:w(`sampling/createMessage`),params:Bn}),Hn=V.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`]).or(x())),role:Mt,content:Ln}),Un=V.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(x())),role:Mt,content:j([Rn,O(Rn)])}),Wn=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),Gn=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),Kn=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),qn=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),Jn=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Yn=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),Xn=j([qn,Jn]),Zn=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),Qn=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),$n=j([Zn,Qn]),er=j([Yn,Xn,$n]),tr=j([er,Wn,Gn,Kn]),nr=Je.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),tr),required:O(x()).optional()}).catchall(h())}),rr=Je.extend({mode:w(`url`),message:x(),elicitationId:x(),url:x().url()}),ir=j([nr,rr]),ar=R.extend({method:w(`elicitation/create`),params:ir}),or=z.extend({elicitationId:x()}),sr=B.extend({method:w(`notifications/elicitation/complete`),params:or}),cr=V.extend({action:D([`accept`,`decline`,`cancel`]),content:ce(e=>e===null?void 0:e,M(x(),j([x(),E(),A(),O(x())])).optional())}),lr=T({type:w(`ref/resource`),uri:x()}),ur=T({type:w(`ref/prompt`),name:x()}),dr=L.extend({ref:j([ur,lr]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()}),fr=R.extend({method:w(`completion/complete`),params:dr}),pr=V.extend({completion:k({values:O(x()).max(100),total:y(E().int()),hasMore:y(A())})}),mr=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),hr=R.extend({method:w(`roots/list`),params:L.optional()}),gr=V.extend({roots:O(mr)}),_r=B.extend({method:w(`notifications/roots/list_changed`),params:z.optional()}),vr=k({ttl:E().optional(),pollInterval:E().optional()}),yr=D([`working`,`input_required`,`completed`,`failed`,`cancelled`]),br=T({taskId:x(),status:yr,ttl:j([E(),ae()]),createdAt:x(),lastUpdatedAt:x(),pollInterval:y(E()),statusMessage:y(x())}),xr=V.extend({task:br}),Sr=z.merge(br),Cr=B.extend({method:w(`notifications/tasks/status`),params:Sr}),wr=R.extend({method:w(`tasks/get`),params:L.extend({taskId:x()})}),Tr=V.merge(br),Er=R.extend({method:w(`tasks/result`),params:L.extend({taskId:x()})}),Dr=V.loose(),Or=Et.extend({method:w(`tasks/list`)}),kr=Dt.extend({tasks:O(br)}),Ar=R.extend({method:w(`tasks/cancel`),params:L.extend({taskId:x()})}),jr=V.merge(br),Mr=j([xt,ht,yt,fr,An,sn,rn,It,U,Bt,Wt,Kt,Yt,Tn,bn]),Nr=j([at,wt,vt,_r]),Pr=j([rt,Hn,Un,cr,gr]),Fr=j([xt,Vn,ar,hr]),Ir=j([at,wt,Mn,tn,Ht,En,gn,Zt,sr]),Lr=j([rt,_t,bt,pr,hn,an,Lt,W,Vt,Sn,xn,$t]),q=d().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:de.custom,message:`URL must be parseable`,fatal:!0}),ne}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),Rr=k({resource:x().url(),authorization_servers:O(q).optional(),jwks_uri:x().url().optional(),scopes_supported:O(x()).optional(),bearer_methods_supported:O(x()).optional(),resource_signing_alg_values_supported:O(x()).optional(),resource_name:x().optional(),resource_documentation:x().optional(),resource_policy_uri:x().url().optional(),resource_tos_uri:x().url().optional(),tls_client_certificate_bound_access_tokens:A().optional(),authorization_details_types_supported:O(x()).optional(),dpop_signing_alg_values_supported:O(x()).optional(),dpop_bound_access_tokens_required:A().optional()}),zr=k({issuer:x(),authorization_endpoint:q,token_endpoint:q,registration_endpoint:q.optional(),scopes_supported:O(x()).optional(),response_types_supported:O(x()),response_modes_supported:O(x()).optional(),grant_types_supported:O(x()).optional(),token_endpoint_auth_methods_supported:O(x()).optional(),token_endpoint_auth_signing_alg_values_supported:O(x()).optional(),service_documentation:q.optional(),revocation_endpoint:q.optional(),revocation_endpoint_auth_methods_supported:O(x()).optional(),revocation_endpoint_auth_signing_alg_values_supported:O(x()).optional(),introspection_endpoint:x().optional(),introspection_endpoint_auth_methods_supported:O(x()).optional(),introspection_endpoint_auth_signing_alg_values_supported:O(x()).optional(),code_challenge_methods_supported:O(x()).optional(),client_id_metadata_document_supported:A().optional(),authorization_response_iss_parameter_supported:A().optional().catch(void 0),dpop_signing_alg_values_supported:O(x()).optional()}),Br=k({issuer:x(),authorization_endpoint:q,token_endpoint:q,userinfo_endpoint:q.optional(),jwks_uri:q,registration_endpoint:q.optional(),scopes_supported:O(x()).optional(),response_types_supported:O(x()),response_modes_supported:O(x()).optional(),grant_types_supported:O(x()).optional(),acr_values_supported:O(x()).optional(),subject_types_supported:O(x()),id_token_signing_alg_values_supported:O(x()),id_token_encryption_alg_values_supported:O(x()).optional(),id_token_encryption_enc_values_supported:O(x()).optional(),userinfo_signing_alg_values_supported:O(x()).optional(),userinfo_encryption_alg_values_supported:O(x()).optional(),userinfo_encryption_enc_values_supported:O(x()).optional(),request_object_signing_alg_values_supported:O(x()).optional(),request_object_encryption_alg_values_supported:O(x()).optional(),request_object_encryption_enc_values_supported:O(x()).optional(),token_endpoint_auth_methods_supported:O(x()).optional(),token_endpoint_auth_signing_alg_values_supported:O(x()).optional(),display_values_supported:O(x()).optional(),claim_types_supported:O(x()).optional(),claims_supported:O(x()).optional(),service_documentation:x().optional(),claims_locales_supported:O(x()).optional(),ui_locales_supported:O(x()).optional(),claims_parameter_supported:A().optional(),request_parameter_supported:A().optional(),request_uri_parameter_supported:A().optional(),require_request_uri_registration:A().optional(),op_policy_uri:q.optional(),op_tos_uri:q.optional(),client_id_metadata_document_supported:A().optional(),authorization_response_iss_parameter_supported:A().optional().catch(void 0)}),Vr=T({...Br.shape,...zr.pick({code_challenge_methods_supported:!0}).shape}),Hr=T({access_token:x(),id_token:x().optional(),token_type:x(),expires_in:he().optional(),scope:x().optional(),refresh_token:x().optional(),issuer:x().optional().catch(void 0)}).strip(),Ur=T({issued_token_type:w(`urn:ietf:params:oauth:token-type:id-jag`),access_token:x(),token_type:x().optional(),expires_in:E().optional(),scope:x().optional()}).strip(),Wr=T({error:x(),error_description:x().optional(),error_uri:x().optional()}),Gr=q.optional().or(w(``).transform(()=>void 0)),Kr=T({redirect_uris:O(q),token_endpoint_auth_method:x().optional(),grant_types:O(x()).optional(),response_types:O(x()).optional(),application_type:x().optional(),client_name:x().optional(),client_uri:q.optional(),logo_uri:Gr,scope:x().optional(),contacts:O(x()).optional(),tos_uri:Gr,policy_uri:x().optional(),jwks_uri:q.optional(),jwks:b().optional(),software_id:x().optional(),software_version:x().optional(),software_statement:x().optional()}).strip(),qr=T({client_id:x(),client_secret:x().optional(),client_id_issued_at:E().optional(),client_secret_expires_at:E().optional(),issuer:x().optional().catch(void 0)}).strip(),Jr=Kr.merge(qr),Yr=T({error:x(),error_description:x().optional()}).strip(),Xr=T({token:x(),token_type_hint:x().optional()}).strip(),Zr=Symbol.for(`mcp.sdk.errorBrands`);function Qr(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,Zr,{value:n,enumerable:!1,configurable:!0})}function $r(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Zr)){let n=t[Zr];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var ei=function(e){return e.InvalidRequest=`invalid_request`,e.InvalidClient=`invalid_client`,e.InvalidGrant=`invalid_grant`,e.UnauthorizedClient=`unauthorized_client`,e.UnsupportedGrantType=`unsupported_grant_type`,e.InvalidScope=`invalid_scope`,e.AccessDenied=`access_denied`,e.ServerError=`server_error`,e.TemporarilyUnavailable=`temporarily_unavailable`,e.UnsupportedResponseType=`unsupported_response_type`,e.UnsupportedTokenType=`unsupported_token_type`,e.InvalidToken=`invalid_token`,e.MethodNotAllowed=`method_not_allowed`,e.TooManyRequests=`too_many_requests`,e.InvalidClientMetadata=`invalid_client_metadata`,e.InvalidRedirectUri=`invalid_redirect_uri`,e.InsufficientScope=`insufficient_scope`,e.InvalidTarget=`invalid_target`,e.InvalidDpopProof=`invalid_dpop_proof`,e.UseDpopNonce=`use_dpop_nonce`,e}({}),ti=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Qr(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},J=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),Y=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Qr(this,new.target)}},ni=class extends Y{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}};function ri(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function ii(e){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t={...e};return delete t.issuer,t}function ai({requestedResource:e,configuredResource:t}){let n=typeof e==`string`?new URL(e):new URL(e.href),r=typeof t==`string`?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length=oi}function li(e){return e.filter(e=>!ci(e))}function ui(e){return e.filter(e=>ci(e))}function di(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var fi=[`task`,`inputRequests`,`requestState`];function pi(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||fi.some(t=>t in e)?e:{...e,content:[]}}function mi(){let e=ee(()=>j([x(),E(),A(),ae(),M(x(),e),O(e)])),t=M(x(),e),n=j([x(),E().int()]),r=x(),i=T({ttl:E().optional()}),a=T({taskId:x()}),o=k({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=T({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=T({method:x(),params:s.loose().optional()}),u=T({_meta:o.optional()}),d=T({method:x(),params:u.loose().optional()}),f=k({_meta:o.optional()}),p=j([x(),E().int()]),m=f.strict(),g=u.extend({requestId:p.optional(),reason:x().optional()}),_=d.extend({method:w(`notifications/cancelled`),params:g}),v=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),b=T({icons:O(v).optional()}),C=T({name:x(),title:x().optional()}),te=C.extend({...C.shape,...b.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),ne=se(T({applyDefaults:A().optional()}),t),re=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:ne.optional(),url:t.optional()}),t.optional())),ie=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),oe=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),le=T({experimental:M(x(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:re.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:ie.optional(),extensions:M(x(),t).optional()}),ue=s.extend({protocolVersion:x(),capabilities:le,clientInfo:te}),de=l.extend({method:w(`initialize`),params:ue}),fe=T({experimental:M(x(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:oe.optional(),extensions:M(x(),t).optional()}),me=f.extend({protocolVersion:x(),capabilities:fe,serverInfo:te,instructions:x().optional()}),he=d.extend({method:w(`notifications/initialized`),params:u.optional()}),N=l.extend({method:w(`ping`),params:s.optional()}),P=T({progress:E(),total:y(E()),message:y(x())}),ge=T({...u.shape,...P.shape,progressToken:n}),_e=d.extend({method:w(`notifications/progress`),params:ge}),ve=s.extend({cursor:r.optional()}),ye=l.extend({params:ve.optional()}),be=f.extend({nextCursor:r.optional()}),F=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),xe=F.extend({text:x()}),Se=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Ce=F.extend({blob:Se}),we=D([`user`,`assistant`]),Te=T({audience:O(we).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),Ee=T({...C.shape,...b.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:Te.optional(),_meta:y(k({}))}),De=T({...C.shape,...b.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:Te.optional(),_meta:y(k({}))}),Oe=ye.extend({method:w(`resources/list`)}),ke=be.extend({resources:O(Ee)}),Ae=ye.extend({method:w(`resources/templates/list`)}),je=be.extend({resourceTemplates:O(De)}),Me=s.extend({uri:x()}),Ne=Me,Pe=l.extend({method:w(`resources/read`),params:Ne}),Fe=f.extend({contents:O(j([xe,Ce]))}),Ie=d.extend({method:w(`notifications/resources/list_changed`),params:u.optional()}),Le=Me,Re=l.extend({method:w(`resources/subscribe`),params:Le}),ze=Me,Be=l.extend({method:w(`resources/unsubscribe`),params:ze}),Ve=u.extend({uri:x()}),I=d.extend({method:w(`notifications/resources/updated`),params:Ve}),He=T({name:x(),description:y(x()),required:y(A())}),Ue=T({...C.shape,...b.shape,description:y(x()),arguments:y(O(He)),_meta:y(k({}))}),We=ye.extend({method:w(`prompts/list`)}),Ge=be.extend({prompts:O(Ue)}),Ke=s.extend({name:x(),arguments:M(x(),x()).optional()}),qe=l.extend({method:w(`prompts/get`),params:Ke}),L=T({type:w(`text`),text:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),Je=T({type:w(`image`),data:Se,mimeType:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),R=T({type:w(`audio`),data:Se,mimeType:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),z=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),B=T({type:w(`resource`),resource:j([xe,Ce]),annotations:Te.optional(),_meta:M(x(),h()).optional()}),Ye=Ee.extend({type:w(`resource_link`)}),V=j([L,Je,R,Ye,B]),Xe=T({role:we,content:V}),Ze=f.extend({description:x().optional(),messages:O(Xe)}),Qe=d.extend({method:w(`notifications/prompts/list_changed`),params:u.optional()}),$e=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),et=T({taskSupport:D([`required`,`optional`,`forbidden`]).optional()}),tt=T({...C.shape,...b.shape,description:x().optional(),inputSchema:T({type:w(`object`),properties:M(x(),e).optional(),required:O(x()).optional()}).catchall(h()),outputSchema:T({type:w(`object`),properties:M(x(),e).optional(),required:O(x()).optional()}).catchall(h()).optional(),annotations:$e.optional(),execution:et.optional(),_meta:M(x(),h()).optional()}),nt=ye.extend({method:w(`tools/list`)}),rt=be.extend({tools:O(tt)}),it=f.extend({content:O(V),structuredContent:M(x(),h()).optional(),isError:A().optional()}),at=c.extend({name:x(),arguments:M(x(),h()).optional()}),ot=l.extend({method:w(`tools/call`),params:at}),st=d.extend({method:w(`notifications/tools/list_changed`),params:u.optional()}),ct=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),H=s.extend({level:ct}),lt=l.extend({method:w(`logging/setLevel`),params:H}),ut=u.extend({level:ct,logger:x().optional(),data:h()}),dt=d.extend({method:w(`notifications/message`),params:ut}),ft=T({name:x().optional()}),pt=T({hints:O(ft).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),mt=T({mode:D([`auto`,`required`,`none`]).optional()}),ht=T({type:w(`tool_result`),toolUseId:x().describe(`The unique identifier for the corresponding tool call.`),content:O(V),structuredContent:T({}).loose().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),gt=S(`type`,[L,Je,R]),_t=S(`type`,[L,Je,R,z,ht]),vt=T({role:we,content:j([_t,O(_t)]),_meta:M(x(),h()).optional()}),yt=c.extend({messages:O(vt),modelPreferences:pt.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:t.optional(),tools:O(tt).optional(),toolChoice:mt.optional()}),bt=l.extend({method:w(`sampling/createMessage`),params:yt}),xt=f.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`]).or(x())),role:we,content:gt}),St=f.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(x())),role:we,content:j([_t,O(_t)])}),Ct=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),wt=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),Tt=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),Et=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),Dt=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Ot=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),kt=j([Et,Dt]),At=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),jt=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),Mt=j([At,jt]),Nt=j([Ot,kt,Mt]),Pt=j([Nt,Ct,wt,Tt]),Ft=c.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),Pt),required:O(x()).optional()}).catchall(h())}),It=c.extend({mode:w(`url`),message:x(),elicitationId:x(),url:x().url()}),Lt=j([Ft,It]),U=l.extend({method:w(`elicitation/create`),params:Lt}),W=u.extend({elicitationId:x()}),Rt=d.extend({method:w(`notifications/elicitation/complete`),params:W}),zt=f.extend({action:D([`accept`,`decline`,`cancel`]),content:ce(e=>e===null?void 0:e,M(x(),j([x(),E(),A(),O(x())])).optional())}),Bt=T({type:w(`ref/resource`),uri:x()}),Vt=T({type:w(`ref/prompt`),name:x()}),Ht=s.extend({ref:j([Vt,Bt]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()}),Ut=l.extend({method:w(`completion/complete`),params:Ht}),Wt=f.extend({completion:k({values:O(x()).max(100),total:y(E().int()),hasMore:y(A())})}),Gt=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),Kt=l.extend({method:w(`roots/list`),params:s.optional()}),qt=f.extend({roots:O(Gt)}),Jt=d.extend({method:w(`notifications/roots/list_changed`),params:u.optional()}),Yt=k({ttl:E().optional(),pollInterval:E().optional()}),Xt=D([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Zt=T({taskId:x(),status:Xt,ttl:j([E(),ae()]),createdAt:x(),lastUpdatedAt:x(),pollInterval:y(E()),statusMessage:y(x())}),Qt=f.extend({task:Zt}),$t=u.merge(Zt),en=d.extend({method:w(`notifications/tasks/status`),params:$t}),tn=l.extend({method:w(`tasks/get`),params:s.extend({taskId:x()})}),G=f.merge(Zt),nn=l.extend({method:w(`tasks/result`),params:s.extend({taskId:x()})}),rn=f.loose(),an=ye.extend({method:w(`tasks/list`)}),on=be.extend({tasks:O(Zt)}),sn=l.extend({method:w(`tasks/cancel`),params:s.extend({taskId:x()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:_,IconSchema:v,IconsSchema:b,BaseMetadataSchema:C,ImplementationSchema:te,ClientTasksCapabilitySchema:ie,ServerTasksCapabilitySchema:oe,ClientCapabilitiesSchema:le,InitializeRequestParamsSchema:ue,InitializeRequestSchema:de,ServerCapabilitiesSchema:fe,InitializeResultSchema:me,InitializedNotificationSchema:he,PingRequestSchema:N,ProgressSchema:P,ProgressNotificationParamsSchema:ge,ProgressNotificationSchema:_e,PaginatedRequestParamsSchema:ve,PaginatedRequestSchema:ye,PaginatedResultSchema:be,ResourceContentsSchema:F,TextResourceContentsSchema:xe,BlobResourceContentsSchema:Ce,RoleSchema:we,AnnotationsSchema:Te,ResourceSchema:Ee,ResourceTemplateSchema:De,ListResourcesRequestSchema:Oe,ListResourcesResultSchema:ke,ListResourceTemplatesRequestSchema:Ae,ListResourceTemplatesResultSchema:je,ResourceRequestParamsSchema:Me,ReadResourceRequestParamsSchema:Ne,ReadResourceRequestSchema:Pe,ReadResourceResultSchema:Fe,ResourceListChangedNotificationSchema:Ie,SubscribeRequestParamsSchema:Le,SubscribeRequestSchema:Re,UnsubscribeRequestParamsSchema:ze,UnsubscribeRequestSchema:Be,ResourceUpdatedNotificationParamsSchema:Ve,ResourceUpdatedNotificationSchema:I,PromptArgumentSchema:He,PromptSchema:Ue,ListPromptsRequestSchema:We,ListPromptsResultSchema:Ge,GetPromptRequestParamsSchema:Ke,GetPromptRequestSchema:qe,TextContentSchema:L,ImageContentSchema:Je,AudioContentSchema:R,ToolUseContentSchema:z,EmbeddedResourceSchema:B,ResourceLinkSchema:Ye,ContentBlockSchema:V,PromptMessageSchema:Xe,GetPromptResultSchema:Ze,PromptListChangedNotificationSchema:Qe,ToolAnnotationsSchema:$e,ToolExecutionSchema:et,ToolSchema:tt,ListToolsRequestSchema:nt,ListToolsResultSchema:rt,CallToolResultSchema:it,CallToolRequestParamsSchema:at,CallToolRequestSchema:ot,ToolListChangedNotificationSchema:st,LoggingLevelSchema:ct,SetLevelRequestParamsSchema:H,SetLevelRequestSchema:lt,LoggingMessageNotificationParamsSchema:ut,LoggingMessageNotificationSchema:dt,ModelHintSchema:ft,ModelPreferencesSchema:pt,ToolChoiceSchema:mt,ToolResultContentSchema:ht,SamplingContentSchema:gt,SamplingMessageContentBlockSchema:_t,SamplingMessageSchema:vt,CreateMessageRequestParamsSchema:yt,CreateMessageRequestSchema:bt,CreateMessageResultSchema:xt,CreateMessageResultWithToolsSchema:St,BooleanSchemaSchema:Ct,StringSchemaSchema:wt,NumberSchemaSchema:Tt,UntitledSingleSelectEnumSchemaSchema:Et,TitledSingleSelectEnumSchemaSchema:Dt,LegacyTitledEnumSchemaSchema:Ot,SingleSelectEnumSchemaSchema:kt,UntitledMultiSelectEnumSchemaSchema:At,TitledMultiSelectEnumSchemaSchema:jt,MultiSelectEnumSchemaSchema:Mt,EnumSchemaSchema:Nt,PrimitiveSchemaDefinitionSchema:Pt,ElicitRequestFormParamsSchema:Ft,ElicitRequestURLParamsSchema:It,ElicitRequestParamsSchema:Lt,ElicitRequestSchema:U,ElicitationCompleteNotificationParamsSchema:W,ElicitationCompleteNotificationSchema:Rt,ElicitResultSchema:zt,ResourceTemplateReferenceSchema:Bt,PromptReferenceSchema:Vt,CompleteRequestParamsSchema:Ht,CompleteRequestSchema:Ut,CompleteResultSchema:Wt,RootSchema:Gt,ListRootsRequestSchema:Kt,ListRootsResultSchema:qt,RootsListChangedNotificationSchema:Jt,TaskCreationParamsSchema:Yt,TaskStatusSchema:Xt,TaskSchema:Zt,CreateTaskResultSchema:Qt,TaskStatusNotificationParamsSchema:$t,TaskStatusNotificationSchema:en,GetTaskRequestSchema:tn,GetTaskResultSchema:G,GetTaskPayloadRequestSchema:nn,GetTaskPayloadResultSchema:rn,ListTasksRequestSchema:an,ListTasksResultSchema:on,CancelTaskRequestSchema:sn,CancelTaskResultSchema:f.merge(Zt),ClientRequestSchema:j([N,de,Ut,lt,qe,We,Oe,Ae,Pe,Re,Be,ot,nt,tn,nn,an,sn]),ClientNotificationSchema:j([_,_e,he,Jt,en]),ClientResultSchema:j([m,xt,St,zt,qt,G,on,Qt]),ServerRequestSchema:j([N,bt,U,Kt,tn,nn,an,sn]),ServerNotificationSchema:j([_,_e,dt,I,Ie,st,Qe,en,Rt]),ServerResultSchema:j([m,me,Wt,Ze,Ge,ke,je,Fe,it,rt,G,on,Qt]),CallToolResultWireSchema:h().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of fi)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(pi).pipe(it)}}var hi;function gi(){return hi??=mi()}function _i(e){return e.type!==`object`}var vi=new Set([`const`,`enum`,`default`,`examples`]),yi=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function bi(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function xi(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(bi(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=Ae(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&bi(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=vi.has(o)?s:yi.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var Si={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ci={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},wi={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ti;function Ei(){if(Ti)return Ti;let e=gi();return Ti={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Ti}function Di(e){return Object.prototype.hasOwnProperty.call(Si,e)}function Oi(e){return Object.prototype.hasOwnProperty.call(Ci,e)}function ki(e){return Object.prototype.hasOwnProperty.call(wi,e)}function Ai(e){return ki(e)?Ei().resultSchemas[e]:void 0}function ji(e){return Di(e)?Ei().requestSchemas[e]:void 0}function Mi(e){return Oi(e)?Ei().notificationSchemas[e]:void 0}Object.keys(Si),Object.keys(Ci);function Ni(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Pi(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var Fi={ok:!1,reason:`not-in-era`};function Ii(e){return Ni(e)&&Ni(e.outputSchema)&&_i(e.outputSchema)}function Li(e){return e}var Ri={era:`2025-11-25`,hasRequestMethod:Di,hasNotificationMethod:Oi,validateRequest:(e,t)=>Pi(ji(e),t),validateResult:(e,t)=>Pi(Ai(e),t),validateNotification:(e,t)=>Pi(Mi(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Fi,validateInputResponse:()=>Fi,samplingResultVariant:((e,t)=>{let n=gi();return Pi(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=di(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&_i(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(Ni(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:Li(e)}}return{kind:`complete`,result:Li(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>Ii(e))?t:{...t,tools:n.map(e=>Ii(e)?{...e,outputSchema:xi(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function zi(){let e=ee(()=>j([x(),E(),A(),ae(),M(x(),e),O(e)])),t=M(x(),e),n=j([x(),E().int()]),r=x(),i=j([x(),E().int()]),a=D([`user`,`assistant`]),o=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=T({ttl:E().optional()}),l=T({taskId:x()}),u=k({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=T({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=T({_meta:u.optional()}),m=T({method:x(),params:p.loose().optional()}),g=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),_=T({icons:O(g).optional()}),v=T({name:x(),title:x().optional()}),b=v.extend({...v.shape,..._.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),S=se(T({applyDefaults:A().optional()}),t),C=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:S.optional(),url:t.optional()}),t.optional())),te=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),ne=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),re=T({experimental:M(x(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:C.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:te.optional(),extensions:M(x(),t).optional()}),ie=T({experimental:M(x(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:ne.optional(),extensions:M(x(),t).optional()}),oe=T({progress:E(),total:y(E()),message:y(x())}),le=T({...p.shape,...oe.shape,progressToken:n}),ue=m.extend({method:w(`notifications/progress`),params:le}),de=p.extend({level:o,logger:x().optional(),data:h()}),fe=m.extend({method:w(`notifications/message`),params:de}),me=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),he=me.extend({text:x()}),N=me.extend({blob:s}),P=T({audience:O(a).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),ge=T({...v.shape,..._.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:P.optional(),_meta:y(k({}))}),_e=T({...v.shape,..._.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:P.optional(),_meta:y(k({}))}),ve=m.extend({method:w(`notifications/resources/list_changed`),params:p.optional()}),ye=p.extend({uri:x()}),be=m.extend({method:w(`notifications/resources/updated`),params:ye}),F=T({name:x(),description:y(x()),required:y(A())}),xe=T({...v.shape,..._.shape,description:y(x()),arguments:y(O(F)),_meta:y(k({}))}),Se=m.extend({method:w(`notifications/prompts/list_changed`),params:p.optional()}),Ce=T({type:w(`text`),text:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),we=T({type:w(`image`),data:s,mimeType:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),Te=T({type:w(`audio`),data:s,mimeType:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),Ee=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),De=T({type:w(`resource`),resource:j([he,N]),annotations:P.optional(),_meta:M(x(),h()).optional()}),Oe=ge.extend({type:w(`resource_link`)}),ke=j([Ce,we,Te,Oe,De]),Ae=T({role:a,content:ke}),je=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),Me=m.extend({method:w(`notifications/tools/list_changed`),params:p.optional()}),Ne=T({name:x().optional()}),Pe=T({hints:O(Ne).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),ze=T({mode:D([`auto`,`required`,`none`]).optional()}),Ve=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),I=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),He=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),Ue=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),We=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Ge=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),Ke=j([Ue,We]),qe=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),L=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),Je=j([qe,L]),R=j([Ge,Ke,Je]),z=j([R,Ve,I,He]),B=f.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),z),required:O(x()).optional()}).catchall(h())}),Ye=T({type:w(`ref/resource`),uri:x()}),V=T({type:w(`ref/prompt`),name:x()}),Xe=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),Ze=re.shape,Qe=T({experimental:Ze.experimental,sampling:Ze.sampling,elicitation:Ze.elicitation,roots:Ze.roots,extensions:Ze.extensions}),$e=ie.shape,et=T({experimental:$e.experimental,logging:$e.logging,completions:$e.completions,prompts:$e.prompts,resources:$e.resources,tools:$e.tools,extensions:$e.extensions}),tt=k({progressToken:n.optional(),[Fe]:x(),[Ie]:b.optional(),[Re]:Qe,[Be]:o.optional()}),nt=T({...v.shape,..._.shape,description:x().optional(),inputSchema:k({$schema:x().optional(),type:w(`object`)}),outputSchema:k({$schema:x().optional()}).optional(),annotations:je.optional(),_meta:M(x(),h()).optional()}),rt=T({type:w(`tool_result`),toolUseId:x(),content:O(ke),structuredContent:h().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),it=j([Ce,we,Te,Ee,rt]),at=T({role:a,content:j([it,O(it)]),_meta:M(x(),h()).optional()}),ot=x(),st=k({[Le]:b.optional().catch(void 0)}),ct=st.optional();function H(e){return k({_meta:ct,resultType:ot.default(`complete`),...e})}let lt=H({}),ut=H({nextCursor:r.optional()}),dt=H({content:O(ke),structuredContent:h().optional(),isError:A().optional()}),ft=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),tools:O(nt),nextCursor:r.optional()}),pt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),prompts:O(xe),nextCursor:r.optional()}),mt=H({description:x().optional(),messages:O(Ae)}),ht=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resources:O(ge),nextCursor:r.optional()}),gt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resourceTemplates:O(_e),nextCursor:r.optional()}),_t=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),contents:O(j([he,N]))}),vt=H({completion:T({values:O(x()).max(100),total:E().int().optional(),hasMore:A().optional()}).loose()}),yt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`])}),bt=H({ttlMs:E().int().min(0).catch(0),cacheScope:D([`public`,`private`]).catch(`private`),supportedVersions:O(x()),capabilities:et,instructions:x().optional()}),xt=T({messages:O(at),modelPreferences:Pe.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:t.optional(),tools:O(nt).optional(),toolChoice:ze.optional()}),St=T({method:w(`sampling/createMessage`),params:xt}),Ct=T({method:w(`roots/list`),params:T({_meta:M(x(),h()).optional()}).optional()}),wt=T({...at.shape,model:x(),stopReason:x().optional()}),Tt=T({roots:O(Xe)}),Et=T({action:D([`accept`,`decline`,`cancel`]),content:M(x(),j([x(),E(),A(),O(x())])).optional()}),Dt=T({mode:w(`url`),message:x(),url:x().url()}),Ot=j([B,Dt]),kt=T({method:w(`elicitation/create`),params:Ot}),At=j([St,Ct,kt]),jt=j([wt,Tt,Et]),Mt=M(x(),At),Nt=M(x(),jt),Pt=H({inputRequests:Mt.optional(),requestState:x().optional()}),Ft={inputResponses:Nt.optional(),requestState:x().optional()},It=T({_meta:tt,...Ft}),Lt=k({progressToken:n.optional()});function U(e,t){return T({method:w(e),params:T({_meta:tt,...t})})}function W(e,t){return T({method:w(e),params:T({_meta:Lt.optional(),...t}).optional()})}let Rt={name:x(),arguments:M(x(),h()).optional(),...Ft},zt={cursor:r.optional()},Bt=U(`tools/call`,Rt),Vt=U(`tools/list`,zt),Ht=U(`prompts/list`,zt),Ut=U(`prompts/get`,{name:x(),arguments:M(x(),x()).optional(),...Ft}),Wt=U(`resources/list`,zt),Gt=U(`resources/templates/list`,zt),Kt=U(`resources/read`,{uri:x(),...Ft}),qt={ref:j([V,Ye]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()},Jt=U(`completion/complete`,qt),Yt=U(`server/discover`,{}),Xt=T({toolsListChanged:A().optional(),promptsListChanged:A().optional(),resourcesListChanged:A().optional(),resourceSubscriptions:O(x()).optional()}),Zt={notifications:Xt},Qt=U(`subscriptions/listen`,Zt),$t=st.extend({"io.modelcontextprotocol/subscriptionId":i}),en=k({_meta:$t,resultType:ot.default(`complete`)}),tn={"tools/call":W(`tools/call`,Rt),"tools/list":W(`tools/list`,zt),"prompts/get":W(`prompts/get`,{name:x(),arguments:M(x(),x()).optional()}),"prompts/list":W(`prompts/list`,zt),"resources/list":W(`resources/list`,zt),"resources/templates/list":W(`resources/templates/list`,zt),"resources/read":W(`resources/read`,{uri:x()}),"completion/complete":W(`completion/complete`,qt),"server/discover":W(`server/discover`,{}),"subscriptions/listen":W(`subscriptions/listen`,Zt)};function G(e){return k({_meta:ct,...e})}let nn={"tools/call":G({content:O(ke),structuredContent:h().optional(),isError:A().optional()}),"tools/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),tools:O(nt),nextCursor:r.optional()}),"prompts/get":G({description:x().optional(),messages:O(Ae)}),"prompts/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),prompts:O(xe),nextCursor:r.optional()}),"resources/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resources:O(ge),nextCursor:r.optional()}),"resources/templates/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resourceTemplates:O(_e),nextCursor:r.optional()}),"resources/read":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),contents:O(j([he,N]))}),"completion/complete":G({completion:T({values:O(x()).max(100),total:E().int().optional(),hasMore:A().optional()}).loose()}),"server/discover":G({ttlMs:E().int().min(0).catch(0),cacheScope:D([`public`,`private`]).catch(`private`),supportedVersions:O(x()),capabilities:et,instructions:x().optional()}),"subscriptions/listen":G({})},rn=k({"io.modelcontextprotocol/subscriptionId":i.optional()}),an=T({method:w(`notifications/subscriptions/acknowledged`),params:T({_meta:rn.optional(),notifications:Xt})}),on=T({_meta:rn.optional(),requestId:i,reason:x().optional()}),sn=T({method:w(`notifications/cancelled`),params:on}),cn={"notifications/cancelled":sn,"notifications/progress":ue,"notifications/message":fe,"notifications/resources/updated":be,"notifications/resources/list_changed":ve,"notifications/tools/list_changed":Me,"notifications/prompts/list_changed":Se,"notifications/subscriptions/acknowledged":an},K=e=>T({jsonrpc:w(`2.0`),id:j([x(),E().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:g,IconsSchema:_,BaseMetadataSchema:v,ImplementationSchema:b,ClientTasksCapabilitySchema:te,ServerTasksCapabilitySchema:ne,ClientCapabilitiesSchema:re,ServerCapabilitiesSchema:ie,ProgressSchema:oe,ProgressNotificationParamsSchema:le,ProgressNotificationSchema:ue,LoggingMessageNotificationParamsSchema:de,LoggingMessageNotificationSchema:fe,ResourceContentsSchema:me,TextResourceContentsSchema:he,BlobResourceContentsSchema:N,AnnotationsSchema:P,ResourceSchema:ge,ResourceTemplateSchema:_e,ResourceListChangedNotificationSchema:ve,ResourceUpdatedNotificationParamsSchema:ye,ResourceUpdatedNotificationSchema:be,PromptArgumentSchema:F,PromptSchema:xe,PromptListChangedNotificationSchema:Se,TextContentSchema:Ce,ImageContentSchema:we,AudioContentSchema:Te,ToolUseContentSchema:Ee,EmbeddedResourceSchema:De,ResourceLinkSchema:Oe,ContentBlockSchema:ke,PromptMessageSchema:Ae,ToolAnnotationsSchema:je,ToolListChangedNotificationSchema:Me,ModelHintSchema:Ne,ModelPreferencesSchema:Pe,ToolChoiceSchema:ze,BooleanSchemaSchema:Ve,StringSchemaSchema:I,NumberSchemaSchema:He,UntitledSingleSelectEnumSchemaSchema:Ue,TitledSingleSelectEnumSchemaSchema:We,LegacyTitledEnumSchemaSchema:Ge,SingleSelectEnumSchemaSchema:Ke,UntitledMultiSelectEnumSchemaSchema:qe,TitledMultiSelectEnumSchemaSchema:L,MultiSelectEnumSchemaSchema:Je,EnumSchemaSchema:R,PrimitiveSchemaDefinitionSchema:z,ElicitRequestFormParamsSchema:B,ResourceTemplateReferenceSchema:Ye,PromptReferenceSchema:V,RootSchema:Xe,ClientCapabilities2026Schema:Qe,ServerCapabilities2026Schema:et,RequestMetaEnvelopeSchema:tt,ToolSchema:nt,ToolResultContentSchema:rt,SamplingMessageContentBlockSchema:it,SamplingMessageSchema:at,ResultTypeSchema:ot,ResultMetaSchema:st,ResultSchema:lt,PaginatedResultSchema:ut,CallToolResultSchema:dt,ListToolsResultSchema:ft,ListPromptsResultSchema:pt,GetPromptResultSchema:mt,ListResourcesResultSchema:ht,ListResourceTemplatesResultSchema:gt,ReadResourceResultSchema:_t,CompleteResultSchema:vt,CacheableResultSchema:yt,DiscoverResultSchema:bt,CreateMessageRequestParamsSchema:xt,CreateMessageRequestSchema:St,ListRootsRequestSchema:Ct,CreateMessageResultSchema:wt,ListRootsResultSchema:Tt,ElicitResultSchema:Et,ElicitRequestURLParamsSchema:Dt,ElicitRequestParamsSchema:Ot,ElicitRequestSchema:kt,InputRequestSchema:At,InputResponseSchema:jt,InputRequestsSchema:Mt,InputResponsesSchema:Nt,InputRequiredResultSchema:Pt,InputResponseRequestParamsSchema:It,CallToolRequestSchema:Bt,ListToolsRequestSchema:Vt,ListPromptsRequestSchema:Ht,GetPromptRequestSchema:Ut,ListResourcesRequestSchema:Wt,ListResourceTemplatesRequestSchema:Gt,ReadResourceRequestSchema:Kt,CompleteRequestSchema:Jt,DiscoverRequestSchema:Yt,SubscriptionFilterSchema:Xt,SubscriptionsListenRequestSchema:Qt,SubscriptionsListenResultMetaSchema:$t,SubscriptionsListenResultSchema:en,dispatchRequestSchemas:tn,dispatchResultSchemas:nn,NotificationMetaSchema:rn,SubscriptionsAcknowledgedNotificationSchema:an,CancelledNotificationParamsSchema:on,CancelledNotificationSchema:sn,notificationSchemas2026:cn,JSONRPCResultResponseSchema:K(lt),CallToolResultResponseSchema:K(j([dt,Pt])),ListToolsResultResponseSchema:K(ft),ListPromptsResultResponseSchema:K(pt),GetPromptResultResponseSchema:K(j([mt,Pt])),ListResourcesResultResponseSchema:K(ht),ListResourceTemplatesResultResponseSchema:K(gt),ReadResourceResultResponseSchema:K(j([_t,Pt])),CompleteResultResponseSchema:K(vt),DiscoverResultResponseSchema:K(bt),SubscriptionsListenResultResponseSchema:K(en)}}var Bi;function Vi(){return Bi??=zi()}var Hi=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function Ui(e){return Hi.includes(e)}var Wi=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function Gi(e){return e[Wi]}function Ki(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function qi(e){return e===`public`||e===`private`}var X=function(e){return e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),Z=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Qr(this,new.target)}static fromError(t,n,r){if(t===X.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Yi(e.elicitations,n)}if(t===X.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new Xi({supported:e.supported,requested:e.requested},n)}if(t===X.InvalidParams||t===X.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===X.ResourceNotFound||Object.keys(e).length===1))return new Ji(e.uri,n)}if(t===X.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new Zi({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},Ji=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(X.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Yi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(X.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Xi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(X.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Zi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(X.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Qi=0,$i=`private`,ea=[`tools/call`,`prompts/get`,`resources/read`];function ta(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||ea.includes(e))return t;throw new Z(X.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function na(e,t){let n=Gi(t);if(t.resultType!==`complete`||!Ui(e))return n===void 0?t:sa(t);let r=t,i=Ki(r.ttlMs)?r.ttlMs:aa(n),a=qi(r.cacheScope)?r.cacheScope:oa(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Wi],o}function ra(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ia(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[Le]:t}}:!ra(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[Le]:t}}}function aa(e){return e!==void 0&&Ki(e.ttlMs)?e.ttlMs:Qi}function oa(e){return e!==void 0&&qi(e.cacheScope)?e.cacheScope:$i}function sa(e){let t={...e};return delete t[Wi],t}var ca=[`elicitation/create`,`sampling/createMessage`,`roots/list`],la;function ua(){if(la)return la;let e=Vi();return la={request:{"elicitation/create":T({method:w(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":T({method:w(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":T({method:w(`roots/list`),params:k({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},la}function da(e){return ca.includes(e)}function fa(e){return da(e)?ua().request[e]:void 0}function pa(e){return da(e)?ua().response[e]:void 0}var ma={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},ha={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function ga(e){return Object.prototype.hasOwnProperty.call(ma,e)}function _a(e){return Object.prototype.hasOwnProperty.call(ha,e)}function va(e){return Object.prototype.hasOwnProperty.call(ma,e)}function ya(e){return ga(e)?Vi().dispatchRequestSchemas[e]:void 0}function ba(e){return va(e)?Vi().dispatchResultSchemas[e]:void 0}function xa(e){return _a(e)?Vi().notificationSchemas2026[e]:void 0}Object.keys(ma),Object.keys(ha);function Sa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ca(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var wa={ok:!1,reason:`not-in-era`},Ta=[Fe,Re];function Ea(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>Sa(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Sa(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Sa(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Da={era:`2026-07-28`,hasRequestMethod:ga,hasNotificationMethod:_a,hasInputRequestMethod:e=>fa(e)!==void 0,validateRequest:(e,t)=>Ca(ya(e),t),validateResult:(e,t)=>Ca(ba(e),t),validateNotification:(e,t)=>Ca(xa(e),t),validateInputRequest:(e,t)=>Ca(fa(e),t),validateInputResponse:(e,t)=>Ca(pa(e),t),samplingResultVariant:()=>wa,outboundEnvelope(e){return{[Fe]:e.protocolVersion,[Ie]:e.clientInfo,[Re]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Ta)n in e||t.push({key:n,problem:`missing`});let n=Vi().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>di(e),inputRequestSchema:fa,decodeResult(e,t){if(!Sa(t))return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Sa(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:Vi().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new Y(J.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=ka(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return ia(na(e,ta(e,Ea(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=Vi().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},Oa;function ka(){if(Oa)return Oa;let e=Vi();return Oa={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Oa}var Aa=`2026-07-28`;function ja(e){return e!==void 0&&ci(e)?Da:Ri}function Ma(e){return e.revision===void 0?e.era===`modern`?Da.era:Ri.era:ja(e.revision).era}function Na(e){return Ia.some(t=>t.hasRequestMethod(e))}function Pa(e){return Ia.some(t=>t.hasNotificationMethod(e))}function Fa(e){return e===`tasks/get`||e===`tasks/cancel`}var Ia=[Ri,Da],La=Ce({AnnotationsSchema:()=>Nt,AudioContentSchema:()=>ln,BaseMetadataSchema:()=>ct,BaseRequestParamsSchema:()=>L,BlobResourceContentsSchema:()=>jt,BooleanSchemaSchema:()=>Wn,CallToolRequestParamsSchema:()=>wn,CallToolRequestSchema:()=>Tn,CallToolResultSchema:()=>Sn,CancelTaskRequestSchema:()=>Ar,CancelTaskResultSchema:()=>jr,CancelledNotificationParamsSchema:()=>it,CancelledNotificationSchema:()=>at,ClientCapabilitiesSchema:()=>pt,ClientNotificationSchema:()=>Nr,ClientRequestSchema:()=>Mr,ClientResultSchema:()=>Pr,ClientTasksCapabilitySchema:()=>dt,CompatibilityCallToolResultSchema:()=>Cn,CompleteRequestParamsSchema:()=>dr,CompleteRequestSchema:()=>fr,CompleteResultSchema:()=>pr,ContentBlockSchema:()=>pn,CreateMessageRequestParamsSchema:()=>Bn,CreateMessageRequestSchema:()=>Vn,CreateMessageResultSchema:()=>Hn,CreateMessageResultWithToolsSchema:()=>Un,CreateTaskResultSchema:()=>xr,CursorSchema:()=>We,DiscoverRequestSchema:()=>yt,DiscoverResultSchema:()=>bt,ElicitRequestFormParamsSchema:()=>nr,ElicitRequestParamsSchema:()=>ir,ElicitRequestSchema:()=>ar,ElicitRequestURLParamsSchema:()=>rr,ElicitResultSchema:()=>cr,ElicitationCompleteNotificationParamsSchema:()=>or,ElicitationCompleteNotificationSchema:()=>sr,EmbeddedResourceSchema:()=>dn,EmptyResultSchema:()=>rt,EnumSchemaSchema:()=>er,GetPromptRequestParamsSchema:()=>on,GetPromptRequestSchema:()=>sn,GetPromptResultSchema:()=>hn,GetTaskPayloadRequestSchema:()=>Er,GetTaskPayloadResultSchema:()=>Dr,GetTaskRequestSchema:()=>wr,GetTaskResultSchema:()=>Tr,IconSchema:()=>ot,IconsSchema:()=>st,ImageContentSchema:()=>K,ImplementationSchema:()=>H,InitializeRequestParamsSchema:()=>mt,InitializeRequestSchema:()=>ht,InitializeResultSchema:()=>_t,InitializedNotificationSchema:()=>vt,JSONArraySchema:()=>He,JSONObjectSchema:()=>I,JSONRPCErrorResponseSchema:()=>et,JSONRPCMessageSchema:()=>tt,JSONRPCNotificationSchema:()=>Qe,JSONRPCRequestSchema:()=>Ze,JSONRPCResponseSchema:()=>nt,JSONRPCResultResponseSchema:()=>$e,JSONValueSchema:()=>Ve,LegacyTitledEnumSchemaSchema:()=>Yn,ListChangedOptionsBaseSchema:()=>Dn,ListPromptsRequestSchema:()=>rn,ListPromptsResultSchema:()=>an,ListResourceTemplatesRequestSchema:()=>U,ListResourceTemplatesResultSchema:()=>W,ListResourcesRequestSchema:()=>It,ListResourcesResultSchema:()=>Lt,ListRootsRequestSchema:()=>hr,ListRootsResultSchema:()=>gr,ListTasksRequestSchema:()=>Or,ListTasksResultSchema:()=>kr,ListToolsRequestSchema:()=>bn,ListToolsResultSchema:()=>xn,LoggingLevelSchema:()=>On,LoggingMessageNotificationParamsSchema:()=>jn,LoggingMessageNotificationSchema:()=>Mn,ModelHintSchema:()=>Nn,ModelPreferencesSchema:()=>Pn,MultiSelectEnumSchemaSchema:()=>$n,NotificationSchema:()=>B,NotificationsParamsSchema:()=>z,NumberSchemaSchema:()=>Kn,PaginatedRequestParamsSchema:()=>Tt,PaginatedRequestSchema:()=>Et,PaginatedResultSchema:()=>Dt,PingRequestSchema:()=>xt,PrimitiveSchemaDefinitionSchema:()=>tr,ProgressNotificationParamsSchema:()=>Ct,ProgressNotificationSchema:()=>wt,ProgressSchema:()=>St,ProgressTokenSchema:()=>Ue,PromptArgumentSchema:()=>G,PromptListChangedNotificationSchema:()=>gn,PromptMessageSchema:()=>mn,PromptReferenceSchema:()=>ur,PromptSchema:()=>nn,ReadResourceRequestParamsSchema:()=>zt,ReadResourceRequestSchema:()=>Bt,ReadResourceResultSchema:()=>Vt,RelatedTaskMetadataSchema:()=>Ke,RequestIdSchema:()=>Xe,RequestMetaSchema:()=>qe,RequestSchema:()=>R,ResourceContentsSchema:()=>Ot,ResourceLinkSchema:()=>fn,ResourceListChangedNotificationSchema:()=>Ht,ResourceRequestParamsSchema:()=>Rt,ResourceSchema:()=>Pt,ResourceTemplateReferenceSchema:()=>lr,ResourceTemplateSchema:()=>Ft,ResourceUpdatedNotificationParamsSchema:()=>en,ResourceUpdatedNotificationSchema:()=>tn,ResultMetaObjectSchema:()=>Ye,ResultSchema:()=>V,RoleSchema:()=>Mt,RootSchema:()=>mr,RootsListChangedNotificationSchema:()=>_r,SamplingContentSchema:()=>Ln,SamplingMessageContentBlockSchema:()=>Rn,SamplingMessageSchema:()=>zn,ServerCapabilitiesSchema:()=>gt,ServerNotificationSchema:()=>Ir,ServerRequestSchema:()=>Fr,ServerResultSchema:()=>Lr,ServerTasksCapabilitySchema:()=>ft,SetLevelRequestParamsSchema:()=>kn,SetLevelRequestSchema:()=>An,SingleSelectEnumSchemaSchema:()=>Xn,StringSchemaSchema:()=>Gn,SubscribeRequestParamsSchema:()=>Ut,SubscribeRequestSchema:()=>Wt,SubscriptionFilterSchema:()=>qt,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Xt,SubscriptionsAcknowledgedNotificationSchema:()=>Zt,SubscriptionsListenRequestParamsSchema:()=>Jt,SubscriptionsListenRequestSchema:()=>Yt,SubscriptionsListenResultMetaSchema:()=>Qt,SubscriptionsListenResultSchema:()=>$t,TaskAugmentedRequestParamsSchema:()=>Je,TaskCreationParamsSchema:()=>vr,TaskMetadataSchema:()=>Ge,TaskSchema:()=>br,TaskStatusNotificationParamsSchema:()=>Sr,TaskStatusNotificationSchema:()=>Cr,TaskStatusSchema:()=>yr,TextContentSchema:()=>cn,TextResourceContentsSchema:()=>kt,TitledMultiSelectEnumSchemaSchema:()=>Qn,TitledSingleSelectEnumSchemaSchema:()=>Jn,ToolAnnotationsSchema:()=>_n,ToolChoiceSchema:()=>Fn,ToolExecutionSchema:()=>vn,ToolListChangedNotificationSchema:()=>En,ToolResultContentSchema:()=>In,ToolSchema:()=>yn,ToolUseContentSchema:()=>un,UnsubscribeRequestParamsSchema:()=>Gt,UnsubscribeRequestSchema:()=>Kt,UntitledMultiSelectEnumSchemaSchema:()=>Zn,UntitledSingleSelectEnumSchemaSchema:()=>qn}),Ra=e=>Ze.safeParse(e).success,za=e=>Qe.safeParse(e).success,Ba=e=>$e.safeParse(e).success,Va=e=>et.safeParse(e).success,Ha=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.resultType===`input_required`,Ua=e=>ht.safeParse(e).success,Wa=e=>vt.safeParse(e).success,Ga=`Mcp-Param-`,Ka=`x-mcp-header`,qa=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Ja=new Set([`string`,`integer`,`boolean`,`number`]);function Ya(e){let t=[],n=new Map,r=(e,i,a)=>{if(typeof e!=`object`||!e)return;let o=e;if(Ka in o){if(!a||i.length===0)return`${Qa(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let e=o[Ka];if(typeof e!=`string`||e.length===0)return`${Qa(i)}: x-mcp-header MUST be a non-empty string`;if(!qa.test(e))return`${Qa(i)}: x-mcp-header '${e}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let r=typeof o.type==`string`?o.type:void 0;if(r===void 0||!Ja.has(r))return`${Qa(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${r??``}`;let s=e.toLowerCase(),c=n.get(s);if(c!==void 0)return`x-mcp-header '${e}' is not case-insensitively unique (also declared as '${c}')`;n.set(s,e),t.push({path:i,headerName:e,type:r})}let s=o.properties;if(typeof s==`object`&&s)for(let[e,t]of Object.entries(s)){let n=r(t,[...i,e],a);if(n!==void 0)return n}for(let e of Xa){let t=o[e];if(t===void 0)continue;let n=Array.isArray(t)?t:typeof t==`object`&&t&&Za.has(e)?Object.values(t):[t];for(let t of n){let n=r(t,[...i,`<${e}>`],!1);if(n!==void 0)return n}}},i=r(e,[],!0);return i===void 0?{valid:!0,declarations:t}:{valid:!1,reason:i}}var Xa=[`items`,`prefixItems`,`contains`,`additionalProperties`,`unevaluatedProperties`,`unevaluatedItems`,`propertyNames`,`patternProperties`,`dependentSchemas`,`oneOf`,`anyOf`,`allOf`,`not`,`if`,`then`,`else`,`$defs`,`definitions`],Za=new Set([`patternProperties`,`dependentSchemas`,`$defs`,`definitions`]);function Qa(e){return e.length===0?``:e.join(`.`)}var $a=`=?base64?`,eo=`?=`;function to(e){if(typeof e==`string`)return e;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function no(e){if(e.length===0||e.startsWith($a)&&e.endsWith(eo)||e!==e.trim())return!0;for(let t=0;t=32&&n<=126))return!0}return!1}function ro(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCodePoint(e);return btoa(n)}function io(e){return no(e)?`${$a}${ro(e)}${eo}`:e}function ao(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function oo(e,t){let n={};for(let r of e){let e=ao(t,r.path);if(e==null)continue;let i=to(e);i!==void 0&&(n[`${Ga}${r.headerName}`]=io(i))}return n}X.InvalidRequest,X.UnsupportedProtocolVersion,X.InvalidParams,X.MethodNotFound,X.InvalidParams,X.MissingRequiredClientCapability,X.ParseError,X.InvalidRequest,X.MethodNotFound,X.UnsupportedProtocolVersion,X.MissingRequiredClientCapability;var so={"tools/call":`name`,"prompts/get":`name`,"resources/read":`uri`,"tasks/get":`taskId`,"tasks/update":`taskId`,"tasks/cancel":`taskId`};function co(e,t){let n=Object.hasOwn(so,e)?so[e]:void 0;if(n===void 0)return;let r=lo(t)?t[n]:void 0;return{field:n,value:typeof r==`string`?r:void 0}}function lo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function uo(e,t){return le(e,t)}function fo(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function po(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var mo=!1,ho=`draft-2020-12`;function go(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:ho});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);mo||(mo=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=g(e,{target:ho,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&_o(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function _o(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||_o(e)))}return!1}function vo(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function yo(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>vo(e)).join(`, `)}:{success:!0,data:n.value}}function bo(e){let t=g(e,{target:ho,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var xo=/\\\.\\d\{(\d+)\}/;function So(e){let t=xo.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>pe({local:e,offset:t,precision:n}))))}function Co(e,t){let n;switch(e){case`email`:n=[re()];break;case`uri`:n=[d()];break;case`date`:n=[me()];break;case`date-time`:n=So(t)}return new Set(n.map(e=>bo(e)).filter(e=>e!==void 0))}function wo(e,t,n){return n!==`zod`||Co(e,t).has(t)}function To(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Eo(e){try{return go(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new Z(X.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var Do=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Oo(e){return Do.has(e)||e.startsWith(`x-`)}var ko=new Set([`$schema`,...Object.keys(nr.shape.requestedSchema.shape)]),Ao={string:fo([Gn,qn,Jn,Yn]),number:fo([Kn]),integer:fo([Kn]),boolean:fo([Wn]),array:fo([Zn,Qn])},jo=new Set(Gn.shape.format.unwrap().options);function Mo(e,t,n,r){if(!To(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Ao,e.type)?Ao[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Oo(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?jo.has(e.format)?(typeof s!=`string`||!wo(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function No(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&To(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Mo(n,`properties.${e}`,t,r)])):ko.has(i)?n[i]=a:Oo(i)||r.push(i);if(r.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function Po(e,t){if(!To(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!uo(tr,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Fo(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Fo(e,t[r],`${n}[${r}]`)):!To(e)||!To(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Fo(r,t[e],i):Oo(e)?[]:[i]})}function Io(e){if(!po(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=No(Eo(e.requestedSchema),t),r=uo(nr.shape.requestedSchema,n);if(!r.success)throw new Z(X.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Po(n,r.error.message)}`);let i=Fo(n,r.data);if(i.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Lo(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(Lo,{elicit(e){try{return{method:`elicitation/create`,params:Io(e)}}catch(e){throw e instanceof Z?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var Ro=!0,zo=10,Bo=250;function Vo(e){return{autoFulfill:e?.autoFulfill??Ro,maxRounds:e?.maxRounds??zo}}function Ho(e,t,n){let r=t!==void 0&&Object.keys(t).length>0;return!r&&n===void 0?e:{...e,...r&&{inputResponses:t},...n!==void 0&&{requestState:n}}}function Uo(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function Wo(e,t){return new Promise((n,r)=>{if(t?.aborted){r(t.reason instanceof Y?t.reason:new Y(J.RequestTimeout,String(t.reason)));return}let i=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),r(t?.reason instanceof Y?t.reason:new Y(J.RequestTimeout,String(t?.reason)))};t?.addEventListener(`abort`,a,{once:!0})})}function Go(e){let t=new AbortController,n=()=>t.abort(e?.reason);return e?.addEventListener(`abort`,n,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:e=>t.abort(e),dispose:()=>e?.removeEventListener(`abort`,n)}}async function Ko(e){let{config:t,method:n,originalParams:r,requestOptions:i,hooks:a,signal:o}=e,s=e.flowStartedAt??Date.now(),c=e.firstPayload,l=0;for(;;){if(l+=1,l>t.maxRounds)throw new Y(J.InputRequiredRoundsExceeded,Uo(n,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:c.inputRequests,...c.requestState!==void 0&&{requestState:c.requestState}}});i.onprogress?.({progress:l,message:`Fulfilling input required by '${n}' (round ${l})`});let e=Object.entries(c.inputRequests??{}),u;if(e.length>0){let t=Go(o);try{let n=await Promise.all(e.map(async([e,n])=>{try{return[e,await a.dispatchInputRequest(e,n,t.signal)]}catch(e){throw t.abort(e),e}}));u=Object.fromEntries(n)}finally{t.dispose()}}else await Wo(Bo,o);let d={...i.timeout!==void 0&&{timeout:i.timeout}};if(i.maxTotalTimeout!==void 0){let e=Date.now()-s,t=i.maxTotalTimeout-e;if(t<=0)throw new Y(J.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:i.maxTotalTimeout,totalElapsed:e});d.maxTotalTimeout=t}let f=await a.retry(Ho(r,u,c.requestState),d);if(Ha(f)){c={inputRequests:f.inputRequests??{},...f.requestState!==void 0&&{requestState:f.requestState}};continue}return f}}var qo=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),Jo={IdJagTokenExchangeResponseSchema:Ur,OAuthClientInformationFullSchema:Jr,OAuthClientInformationSchema:qr,OAuthClientMetadataSchema:Kr,OAuthClientRegistrationErrorSchema:Yr,OAuthErrorResponseSchema:Wr,OAuthMetadataSchema:zr,OAuthProtectedResourceMetadataSchema:Rr,OAuthTokenRevocationRequestSchema:Xr,OAuthTokensSchema:Hr,OpenIdProviderDiscoveryMetadataSchema:Vr,OpenIdProviderMetadataSchema:Br},Yo={},Xo={};function Zo(e,t){let n=e.slice(0,-6);Yo[n]=t,Xo[n]=e=>t.safeParse(e).success}for(let e of qo)Zo(e,La[e]);for(let[e,t]of Object.entries(Jo))Zo(e,t);Object.freeze(Yo);var Qo=Object.freeze(Xo);function $o(e){switch(e){case`initialize`:case`notifications/initialized`:return ja(void 0);case`server/discover`:return ja(Aa);default:return}}var es=[Fe,Ie,Re,Be],ts=[`inputResponses`,`requestState`];function ns(e,t){let n=e.params;if(!ss(n))return{message:e,lifted:{}};let r=n._meta,i=ss(r)?es.filter(e=>e in r):[],a=t===`request`?ts.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&ss(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function rs(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function is(e){return()=>e}var as=is(void 0),os=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Ne,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new Y(J.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Y(J.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),Ba(e)||Va(e)?this._onresponse(e):Ra(e)?this._onrequest(e,t):za(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new Y(J.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=ns(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=Ma(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(Pa(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=ns(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=Ma(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(X.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(Na(n.method)&&!i.hasRequestMethod(n.method)&&!(Fa(n.method)&&this._customSchemaRequestMethods.has(n.method))){o(X.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(X.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(X.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:us(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?as:is(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),po(t))return u(e,t,n);let i=rs(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(X.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:X.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Ba(e)?n(e):n(Z.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(po(t))return Fa(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=rs(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return ja(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=$o(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Na(t)&&!e.hasRequestMethod(t))throw new Y(J.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof Y?e:new Y(J.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),v=!1,y=e=>{v||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof Y?e:new Y(J.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(v=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(gs(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;yo(n,o).then(e=>{e.success?d(e.data):f(new Y(J.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>y(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let b=r?.timeout??6e4;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new Y(J.RequestTimeout,`Request timed out`,{timeout:b})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new Y(J.NotConnected,`Not connected`);if(Pa(t.method)&&!e.hasNotificationMethod(t.method))throw new Y(J.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&n?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!Na(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new Z(X.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await yo(t.params,{...r.params});if(!a.success)throw new Z(X.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!Pa(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new Z(X.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await yo(t.params,{...r.params});if(!i.success)throw new Z(X.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function ss(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function cs(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];n[r]=ss(a)&&ss(i)?{...a,...i}:i}return n}function ls(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function us(e){let t={},n=[];if(!ls(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!ls(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function ds(e){throw new Y(J.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function fs(e,t,n,r,i){return{sessionId:i,mcpReq:{id:e,method:t,_meta:n?._meta,requestState:is(void 0),signal:r,send:(()=>ds(`send`)),notify:()=>ds(`notify`)}}}async function ps(e,t,n,r,i){if(!ls(r)||typeof r.method!=`string`)throw new Y(J.InvalidResult,`Invalid input request '${n}': each inputRequests entry must be an embedded request object with a method`,{key:n});let a=r.method;if(!t.hasInputRequestMethod(a))throw new Y(J.InvalidResult,`Invalid input request '${n}': '${a}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:n,method:a});let o=e.getRequestHandler(a);if(o===void 0)throw new Y(J.CapabilityNotSupported,`Cannot fulfil input request '${n}': no handler is registered for '${a}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:n,method:a});let s=ls(r.params)?r.params:void 0;return await o({jsonrpc:`2.0`,id:n,method:a,...s!==void 0&&{params:s}},e.buildContext(fs(n,a,s,i,e.sessionId)))}function ms(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function hs(e,t,n,r){let{codec:i,request:a,options:o,flowStartedAt:s}=r,c={inputRequests:n.inputRequests,...n.requestState!==void 0&&{requestState:n.requestState}},l={dispatchInputRequest:(t,n,r)=>ps(e,i,t,n,r),retry:(e,t)=>r.retry(e,ms(o,t))};return Ko({config:t,method:a.method,originalParams:a.params,firstPayload:c,flowStartedAt:s,signal:o?.signal,requestOptions:{...o?.timeout!==void 0&&{timeout:o.timeout},...o?.maxTotalTimeout!==void 0&&{maxTotalTimeout:o.maxTotalTimeout},...o?.onprogress!==void 0&&{onprogress:o.onprogress}},hooks:l})}function gs(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var _s=Te(Se((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),1);function vs(e){if(e)try{return _s.parse(e).type}catch{let t=(e.split(`;`,1)[0]??``).trim().toLowerCase();return t===``||e.slice(t.length).includes(`,`)?void 0:t}}function ys(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function bs(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{...ys(t.headers),...ys(r.headers)}:t.headers}):e}var xs=new Set([301,302,303,307,308]),Ss=5;function Cs(e,t){return e.protocol===t.protocol&&e.host===t.host||e.protocol===`http:`&&t.protocol===`https:`&&e.hostname===t.hostname&&!e.port&&!t.port}function ws(e,t){let n=xs.has(t.status)?t.headers?.get(`location`):void 0;if(n)try{return new URL(n,e)}catch{return}}var Ts=new WeakSet;function Es(e){let t=(t,n)=>e(t,n);return Ts.add(t),t}function Ds(e){return Ts.has(e)?e:async(t,n)=>{if(n?.redirect===`error`||n?.redirect===`manual`)return e(t,n);let r=(n?.method??`GET`).toUpperCase(),i=t;for(let t=0;;t++){let a=await e(i,{...n,redirect:`manual`}),o=ws(i,a);if(!o||t===Ss)return a;let s=new URL(i),c=r===`GET`||a.status===307||a.status===308,l=!(o.username||o.password)||o.username===s.username&&o.password===s.password;if(!c||!l||!Cs(s,o))return a;await a.text?.().catch(()=>{}),i=o}}}function Os(e,t){if(t.type===`opaqueredirect`)return`Redirect not followed: this runtime does not expose where it points`;let n=ws(t.url||e,t);if(n)return n.username=n.password=n.search=n.hash=``,n.protocol===`http:`&&new URL(t.url||e).protocol===`https:`?(n.protocol=`https:`,`Redirect from https to plain http not followed; try ${n.href} as the endpoint`):`Redirect to ${n.href} not followed; use that URL as the endpoint if it is the intended server`}function ks(e,t){let n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r1?t[a.href]=e:(a.hash=``,r===``?n=a:Is(e,t,n))}}else if(e!==!0&&e!==!1)return t;let i=n.href+(r?`#`+r:``);if(t[i]!==void 0)throw Error(`Duplicate schema URI "${i}".`);if(t[i]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:i}),e.$ref&&e.__absolute_ref__===void 0){let t=new URL(e.$ref,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:t.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let t=new URL(e.$recursiveRef,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:t.href})}if(e.$anchor){let r=new URL(`#`+e.$anchor,n.href);t[r.href]=e}for(let i in e){if(Ps[i])continue;let a=`${r}/${As(i)}`,o=e[i];if(Array.isArray(o)){if(Ms[i]){let e=o.length;for(let r=0;r%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Us=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,Ws=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Gs=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ks=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,qs=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Js=e=>{if(e[0]===`"`)return!1;let[t,n,...r]=e.split(`@`);return!t||!n||r.length!==0||t.length>64||n.length>253||t[0]===`.`||t.endsWith(`.`)||t.includes(`..`)||!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:n.split(`.`).every(e=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(e))},Ys=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Xs=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,Zs=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function Qs(e){return e.test.bind(e)}var $s={date:tc,time:nc.bind(void 0,!1),"date-time":ic,duration:Zs,uri:sc,"uri-reference":Qs(Vs),"uri-template":Qs(Hs),url:Qs(Us),email:Js,hostname:Qs(Bs),ipv4:Qs(Ys),ipv6:Qs(Xs),regex:lc,uuid:Qs(Ws),"json-pointer":Qs(Gs),"json-pointer-uri-fragment":Qs(Ks),"relative-json-pointer":Qs(qs)};function ec(e){return e%4==0&&(e%100!=0||e%400==0)}function tc(e){let t=e.match(Ls);if(!t)return!1;let n=+t[1],r=+t[2],i=+t[3];return r>=1&&r<=12&&i>=1&&i<=(r==2&&ec(n)?29:Rs[r])}function nc(e,t){let n=t.match(zs);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}var rc=/t|\s/i;function ic(e){let t=e.split(rc);return t.length==2&&tc(t[0])&&nc(!0,t[1])}var ac=/\/|:/,oc=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function sc(e){return ac.test(e)&&oc.test(e)}var cc=/[^\\]\\Z/;function lc(e){if(cc.test(e))return!1;try{return new RegExp(e,`u`),!0}catch{return!1}}function uc(e){let t=0,n=e.length,r=0,i;for(;r=55296&&i<=56319&&rks(e,t))||F.push({instanceLocation:o,keyword:`enum`,keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`}):g.some(t=>e===t)||F.push({instanceLocation:o,keyword:`enum`,keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`})),v!==void 0){let t=`${s}/not`;Q(e,v,n,r,i,a,o,t).valid&&F.push({instanceLocation:o,keyword:`not`,keywordLocation:t,error:`Instance matched "not" schema.`})}let xe=[];if(y!==void 0){let t=`${s}/anyOf`,l=F.length,u=!1;for(let s=0;s{let u=Object.create(c),d=Q(e,s,n,r,i,p===!0?a:null,o,`${t}/${l}`,u);return F.push(...d.errors),d.valid&&xe.push(u),d.valid}).length;u===1?F.length=l:F.splice(l,0,{instanceLocation:o,keyword:`oneOf`,keywordLocation:t,error:`Instance does not match exactly one subschema (${u} matches).`})}if((u===`object`||u===`array`)&&Object.assign(c,...xe),S!==void 0){let t=`${s}/if`;if(Q(e,S,n,r,i,a,o,t,c).valid){if(ee!==void 0){let l=Q(e,ee,n,r,i,a,o,`${s}/then`,c);l.valid||F.push({instanceLocation:o,keyword:`if`,keywordLocation:t,error:`Instance does not match "then" schema.`},...l.errors)}}else if(C!==void 0){let l=Q(e,C,n,r,i,a,o,`${s}/else`,c);l.valid||F.push({instanceLocation:o,keyword:`if`,keywordLocation:t,error:`Instance does not match "else" schema.`},...l.errors)}}if(u===`object`){if(_!==void 0)for(let t of _)t in e||F.push({instanceLocation:o,keyword:`required`,keywordLocation:`${s}/required`,error:`Instance does not have required property "${t}".`});let t=Object.keys(e);if(re!==void 0&&t.lengthie&&F.push({instanceLocation:o,keyword:`maxProperties`,keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${ie} properties.`}),D!==void 0){let t=`${s}/propertyNames`;for(let s in e){let e=`${o}/${As(s)}`,c=Q(s,D,n,r,i,a,e,t);c.valid||F.push({instanceLocation:o,keyword:`propertyNames`,keywordLocation:t,error:`Property name "${s}" does not match schema.`},...c.errors)}}if(O!==void 0){let t=`${s}/dependantRequired`;for(let n in O)if(n in e){let r=O[n];for(let i of r)i in e||F.push({instanceLocation:o,keyword:`dependentRequired`,keywordLocation:t,error:`Instance has "${n}" but does not have "${i}".`})}}if(k!==void 0)for(let t in k){let l=`${s}/dependentSchemas`;if(t in e){let s=Q(e,k[t],n,r,i,a,o,`${l}/${As(t)}`,c);s.valid||F.push({instanceLocation:o,keyword:`dependentSchemas`,keywordLocation:l,error:`Instance has "${t}" but does not match dependant schema.`},...s.errors)}}if(ae!==void 0){let t=`${s}/dependencies`;for(let s in ae)if(s in e){let c=ae[s];if(Array.isArray(c))for(let n of c)n in e||F.push({instanceLocation:o,keyword:`dependencies`,keywordLocation:t,error:`Instance has "${s}" but does not have "${n}".`});else{let l=Q(e,c,n,r,i,a,o,`${t}/${As(s)}`);l.valid||F.push({instanceLocation:o,keyword:`dependencies`,keywordLocation:t,error:`Instance has "${s}" but does not match dependant schema.`},...l.errors)}}}let l=Object.create(null),u=!1;if(T!==void 0){let t=`${s}/properties`;for(let s in T){if(!(s in e))continue;let d=`${o}/${As(s)}`,f=Q(e[s],T[s],n,r,i,a,d,`${t}/${As(s)}`);if(f.valid)c[s]=l[s]=!0;else if(u=i,F.push({instanceLocation:o,keyword:`properties`,keywordLocation:t,error:`Property "${s}" does not match schema.`},...f.errors),u)break}}if(!u&&E!==void 0){let t=`${s}/patternProperties`;for(let s in E){let d=new RegExp(s,`u`),f=E[s];for(let p in e){if(!d.test(p))continue;let m=`${o}/${As(p)}`,h=Q(e[p],f,n,r,i,a,m,`${t}/${As(s)}`);h.valid?c[p]=l[p]=!0:(u=i,F.push({instanceLocation:o,keyword:`patternProperties`,keywordLocation:t,error:`Property "${p}" matches pattern "${s}" but does not match associated schema.`},...h.errors))}}}if(!u&&te!==void 0){let t=`${s}/additionalProperties`;for(let s in e){if(l[s])continue;let d=`${o}/${As(s)}`,f=Q(e[s],te,n,r,i,a,d,t);f.valid?c[s]=!0:(u=i,F.push({instanceLocation:o,keyword:`additionalProperties`,keywordLocation:t,error:`Property "${s}" does not match additional properties schema.`},...f.errors))}}else if(!u&&ne!==void 0){let t=`${s}/unevaluatedProperties`;for(let s in e)if(!c[s]){let l=`${o}/${As(s)}`,u=Q(e[s],ne,n,r,i,a,l,t);u.valid?c[s]=!0:F.push({instanceLocation:o,keyword:`unevaluatedProperties`,keywordLocation:t,error:`Property "${s}" does not match unevaluated properties schema.`},...u.errors)}}}else if(u===`array`){de!==void 0&&e.length>de&&F.push({instanceLocation:o,keyword:`maxItems`,keywordLocation:`${s}/maxItems`,error:`Array has too many items (${e.length} > ${de}).`}),ue!==void 0&&e.length=(j||0)&&(F.length=u),j===void 0&&M===void 0&&d===0?F.splice(u,0,{instanceLocation:o,keyword:`contains`,keywordLocation:l,error:`Array does not contain item matching schema.`}):j!==void 0&&dM&&F.push({instanceLocation:o,keyword:`maxContains`,keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${M} items matching schema. ${d} items were found.`})}}if(!u&&ce!==void 0){let u=`${s}/unevaluatedItems`;for(;l=me||e>me)&&F.push({instanceLocation:o,keyword:`maximum`,keywordLocation:`${s}/maximum`,error:`${e} is greater than ${N?`or equal to `:``} ${me}.`})):(pe!==void 0&&eme&&F.push({instanceLocation:o,keyword:`maximum`,keywordLocation:`${s}/maximum`,error:`${e} is greater than ${me}.`}),he!==void 0&&e<=he&&F.push({instanceLocation:o,keyword:`exclusiveMinimum`,keywordLocation:`${s}/exclusiveMinimum`,error:`${e} is less than ${he}.`}),N!==void 0&&e>=N&&F.push({instanceLocation:o,keyword:`exclusiveMaximum`,keywordLocation:`${s}/exclusiveMaximum`,error:`${e} is greater than or equal to ${N}.`})),P!==void 0){let t=e%P;Math.abs(0-t)>=1.1920929e-7&&Math.abs(P-t)>=1.1920929e-7&&F.push({instanceLocation:o,keyword:`multipleOf`,keywordLocation:`${s}/multipleOf`,error:`${e} is not a multiple of ${P}.`})}}else if(u===`string`){let t=ge===void 0&&_e===void 0?0:uc(e);ge!==void 0&&t_e&&F.push({instanceLocation:o,keyword:`maxLength`,keywordLocation:`${s}/maxLength`,error:`String is too long (${t} > ${_e}).`}),ve!==void 0&&!new RegExp(ve,`u`).test(e)&&F.push({instanceLocation:o,keyword:`pattern`,keywordLocation:`${s}/pattern`,error:`String does not match pattern.`}),w!==void 0&&$s[w]&&!$s[w](e)&&F.push({instanceLocation:o,keyword:`format`,keywordLocation:`${s}/format`,error:`String does not match format "${w}".`})}return{valid:F.length===0,errors:F}}var dc=class{schema;draft;shortCircuit;lookup;constructor(e,t=`2019-09`,n=!0){this.schema=e,this.draft=t,this.shortCircuit=n,this.lookup=Is(e)}validate(e){return Q(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){t&&(e={...e,$id:t}),Is(e,this.lookup)}},fc=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=je(e,`pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.`);return t===`draft-7`?`7`:t}getValidator(e){let t=new dc(e,this.draft??this._draftFor(e),this.shortcircuit);return e=>{let n=t.validate(e);return n.valid?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:n.errors.map(e=>`${e.instanceLocation}: ${e.error}`).join(`; `)}}}},pc=globalThis.crypto;async function mc(e){return(await pc).getRandomValues(new Uint8Array(e))}async function hc(e){let t=``;for(;t.length128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await gc(e);return{code_verifier:t,code_challenge:await _c(t)}}var yc=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},bc=10,xc=13,Sc=32;function Cc(e){}function wc(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=Cc,onError:n=Cc,onRetry:r=Cc,onComment:i,maxBufferSize:a}=e,o=[],s=0,c=!0,l,u=``,d=0,f,p=!1;function m(e){if(p)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),o.length===0){let t=g(e);t!==``&&(o.push(t),s=t.length),h();return}if(e.indexOf(` `)===-1&&e.indexOf(`\r`)===-1){o.push(e),s+=e.length,h();return}o.push(e);let t=o.join(``);o.length=0,s=0;let n=g(t);n!==``&&(o.push(n),s=n.length),h()}function h(){a!==void 0&&(s+u.length<=a||(p=!0,o.length=0,s=0,l=void 0,u=``,d=0,f=void 0,n(new yc(`Buffered data exceeded max buffer size of ${a} characters`,{type:`max-buffer-size-exceeded`}))))}function g(e){let n=0;if(e.indexOf(`\r`)===-1){let r=e.indexOf(` `,n);for(;r!==-1;){if(n===r){d>0&&t({id:l,event:f,data:u}),l=void 0,u=``,d=0,f=void 0,n=r+1,r=e.indexOf(` diff --git a/internal/ui/dist/assets/page-BsR2kcwd.js b/internal/ui/dist/assets/page-CFdV4uPH.js similarity index 99% rename from internal/ui/dist/assets/page-BsR2kcwd.js rename to internal/ui/dist/assets/page-CFdV4uPH.js index 83e6e2fc..864d22d4 100644 --- a/internal/ui/dist/assets/page-BsR2kcwd.js +++ b/internal/ui/dist/assets/page-CFdV4uPH.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/panel-sql-editor-DQvDThY1.js","assets/useRouter-ByJ6_rwb.js","assets/brand-DUaZkIz1.js","assets/index-BBEH7zHj.js","assets/useNavigate-B1zgPEUp.js","assets/preload-helper-EHBQhIeL.js","assets/Tooltip-B3r3s_B9.js","assets/index-ADB9ThEc.css"])))=>i.map(i=>d[i]); -import{a as e,i as t,o as n,r,s as i}from"./useRouter-ByJ6_rwb.js";import{A as a,C as o,D as s,E as c,K as l,M as u,O as d,P as f,Q as p,S as m,T as h,X as g,Y as _,Z as v,_ as y,_t as b,a as x,c as S,d as C,dt as w,f as T,ft as E,g as D,gt as O,h as k,j as A,k as j,lt as M,m as N,mt as P,nt as F,o as I,ot as L,p as ee,r as R,s as te,st as ne,tt as re,u as ie,ut as z,v as ae,x as B,y as oe}from"./brand-DUaZkIz1.js";import{c as se,l as ce,t as le}from"./preload-helper-EHBQhIeL.js";import{C as ue,E as de,b as fe,o as pe,t as me,w as he}from"./Tooltip-B3r3s_B9.js";import{a as ge,c as _e,d as ve,i as ye,l as be,n as xe,o as Se,r as Ce,s as we,t as Te,u as Ee}from"./dashboard-change-chips-B-4MjJKf.js";import{n as De,r as Oe,t as ke}from"./WarningCircle.es-BgWO6KzZ.js";import{A as Ae,At as je,B as Me,Bt as Ne,C as Pe,D as Fe,E as Ie,F as Le,Ft as Re,Gt as ze,H as Be,Ht as Ve,I as He,It as Ue,Jt as We,Kt as Ge,Lt as Ke,M as qe,Mt as Je,N as Ye,Nt as Xe,O as Ze,P as Qe,Pt as $e,Q as et,R as tt,Rt as nt,U as rt,Ut as it,V as at,W as ot,Wt as st,Xt as ct,Yt as lt,Zt as ut,_ as dt,a as ft,b as pt,c as mt,d as ht,h as gt,i as _t,j as vt,jt as yt,k as bt,l as xt,m as St,n as Ct,o as wt,qt as Tt,r as Et,s as Dt,t as Ot,u as kt,v as At,w as jt,x as Mt,zt as Nt}from"./index-BBEH7zHj.js";function Pt(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=Ft(e);if(n.length!==Ft(t).length)return!1;for(let r=0;r{if(typeof n!=`string`||n.trim().length===0)throw Error(t);return`${e}-${n}`}}var H=r();function Lt(e){return typeof e==`object`&&e?`base`in e?e.base:void 0:e}function Rt(e,t){if(e===t||Number.isNaN(e)&&Number.isNaN(t))return!0;if(!(e instanceof Object)||!(t instanceof Object))return!1;let n=Object.keys(e),{length:r}=n;if(r!==Object.keys(t).length)return!1;for(let i=0;i{r.current||=window.setTimeout(()=>{i(...e),r.current=null},t)},[t]),o=(0,V.useCallback)(()=>{r.current&&=(window.clearTimeout(r.current),null)},[]);return(0,V.useEffect)(()=>(n.autoInvoke&&a(),o),[o,a]),{start:a,clear:o}}function Ut(e){let t=(0,V.useRef)(void 0);return(0,V.useEffect)(()=>{t.current=e},[e]),t.current}function Wt(e,t,n){let r=(0,V.useRef)(null);(0,V.useEffect)(()=>{r.current&&=(r.current.disconnect(),null);let i=typeof n==`function`?n():n;return i&&(r.current=new MutationObserver(e),r.current.observe(i,t)),()=>{r.current&&=(r.current.disconnect(),null)}},[e,t,n])}function Gt(){let[e,t]=(0,V.useState)(!1);return(0,V.useEffect)(()=>t(!0),[]),e}function Kt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`}function qt(e,t=document){let n=t.querySelector(e);if(n)return n;let r=t.querySelectorAll(`*`);for(let t=0;t{if(!e||!t||!n.current)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=t.offsetWidth===0?1:i.width/t.offsetWidth,o=t.offsetHeight===0?1:i.height/t.offsetHeight,s=window.getComputedStyle(e),c=window.getComputedStyle(t),l=fe(s.borderTopWidth)+fe(c.borderTopWidth),u=fe(s.borderLeftWidth)+fe(c.borderLeftWidth),d={top:(r.top-i.top)/o-l,left:(r.left-i.left)/a-u,width:r.width/a,height:r.height/o};n.current.style.transform=`translateY(${d.top}px) translateX(${d.left}px)`,n.current.style.width=`${d.width}px`,n.current.style.height=`${d.height}px`},p=()=>{window.clearTimeout(o.current),n.current&&(n.current.style.transitionDuration=`0ms`),f(),o.current=window.setTimeout(()=>{n.current&&(n.current.style.transitionDuration=``)},30)},m=(0,V.useRef)(null),h=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(c&&s.current!==e&&i&&i(),s.current=e,f(),e)return m.current=new ResizeObserver(p),m.current.observe(e),t&&(h.current=new ResizeObserver(p),h.current.observe(t)),()=>{m.current?.disconnect(),h.current?.disconnect()}},[t,e]),(0,V.useEffect)(()=>{if(t){let e=e=>{Zt(e.target,t)&&(p(),d(!1))};return t.addEventListener(`transitionend`,e),()=>{t.removeEventListener(`transitionend`,e)}}},[t]),(0,V.useEffect)(()=>{if(n.current&&a){let e=e=>{e.propertyName===`transform`&&a()};return n.current.addEventListener(`transitionend`,e),()=>{n.current?.removeEventListener(`transitionend`,e)}}},[a]),Ht(()=>{ve()!==`test`&&l(!0)},20,{autoInvoke:!0}),Wt(e=>{e.forEach(e=>{e.type===`attributes`&&e.attributeName===`dir`&&p()})},{attributes:!0,attributeFilter:[`dir`]},()=>document.documentElement),{initialized:c,hidden:u}}var $t={root:`m_96b553a6`},en=g((e,{transitionDuration:t},{shouldReduceMotion:n})=>({root:{"--transition-duration":e.respectReducedMotion&&n?`0ms`:typeof t==`number`?`${t}ms`:t||`150ms`}})),tn=h(e=>{let t=u(`FloatingIndicator`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,target:d,parent:f,transitionDuration:m,mod:h,displayAfterTransitionEnd:g,onTransitionStart:_,onTransitionEnd:v,attributes:y,ref:b,...x}=t,S=p(),C=a({name:`FloatingIndicator`,classes:$t,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:y,vars:l,varsResolver:en,stylesCtx:{shouldReduceMotion:S}}),w=(0,V.useRef)(null),{initialized:T,hidden:E}=Qt({target:d,parent:f,ref:w,displayAfterTransitionEnd:g,onTransitionStart:_,onTransitionEnd:v}),D=re(b,w);return!d||!f?null:(0,H.jsx)(o,{ref:D,mod:[{initialized:T,hidden:E},h],...C(`root`),...x})});tn.displayName=`@mantine/core/FloatingIndicator`,tn.classes=$t,tn.varsResolver=en;var[nn,rn]=de(`Accordion component was not found in the tree`),[an,on]=de(`Accordion.Item component was not found in the tree`),sn={root:`m_9bdbb667`,panel:`m_df78851f`,content:`m_4ba554d4`,itemTitle:`m_8fa820a0`,control:`m_4ba585b8`,"control--default":`m_6939a5e9`,"control--contained":`m_4271d21b`,label:`m_df3ffa0f`,chevron:`m_3f35ae96`,icon:`m_9bd771fe`,item:`m_9bd7b098`,"item--default":`m_fe19b709`,"item--contained":`m_1f921b3b`,"item--filled":`m_2cdf939a`,"item--separated":`m_9f59b069`},cn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,chevron:s,icon:c,onClick:l,onKeyDown:d,children:f,disabled:p,mod:h,...g}=u(`AccordionControl`,null,e),{value:_}=on(),v=rn(),y=v.isItemActive(_),b=typeof v.order==`number`,x=`h${v.order}`,S=(0,H.jsxs)(m,{...v.getStyles(`control`,{className:n,classNames:t,style:r,styles:i,variant:v.variant}),unstyled:v.unstyled,mod:[`accordion-control`,{active:y,"chevron-position":v.chevronPosition,disabled:p},h],onClick:e=>{l?.(e),v.onChange(_)},type:`button`,disabled:p,"aria-expanded":y,"aria-controls":v.getRegionId(_),id:v.getControlId(_),onKeyDown:Tt({siblingSelector:`[data-accordion-control]`,parentSelector:`[data-accordion]`,activateOnFocus:!1,loop:v.loop,orientation:`vertical`,onKeyDown:d}),...g,children:[(0,H.jsx)(o,{component:`span`,mod:{rotate:!v.disableChevronRotation&&y,position:v.chevronPosition},...v.getStyles(`chevron`,{classNames:t,styles:i}),children:s||v.chevron}),(0,H.jsx)(`span`,{...v.getStyles(`label`,{classNames:t,styles:i}),children:f}),c&&(0,H.jsx)(o,{component:`span`,mod:{"chevron-position":v.chevronPosition},...v.getStyles(`icon`,{classNames:t,styles:i}),children:c})]});return b?(0,H.jsx)(x,{...v.getStyles(`itemTitle`,{classNames:t,styles:i}),children:S}):S});cn.displayName=`@mantine/core/AccordionControl`,cn.classes=sn;var ln=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:s,mod:c,...l}=u(`AccordionItem`,null,e),d=rn();return(0,H.jsx)(an,{value:{value:s},children:(0,H.jsx)(o,{mod:[{active:d.isItemActive(s)},c],...d.getStyles(`item`,{className:n,classNames:t,styles:i,style:r,variant:d.variant}),...l})})});ln.displayName=`@mantine/core/AccordionItem`,ln.classes=sn;var un=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,keepMounted:s,keepMountedMode:c,...l}=u(`AccordionPanel`,null,e),{value:d}=on(),f=rn();return(0,H.jsx)(Ee,{...f.getStyles(`panel`,{className:n,classNames:t,style:r,styles:i}),expanded:f.isItemActive(d),transitionDuration:f.transitionDuration??200,role:`region`,id:f.getRegionId(d),"aria-labelledby":f.getControlId(d),keepMounted:s??f.keepMounted,keepMountedMode:c??f.keepMountedMode,...l,children:(0,H.jsx)(`div`,{...f.getStyles(`content`,{classNames:t,styles:i}),children:o})})});un.displayName=`@mantine/core/AccordionPanel`,un.classes=sn;var dn={multiple:!1,loop:!0,disableChevronRotation:!1,disableCollapse:!1,chevronPosition:`right`,variant:`default`,chevronSize:`auto`,chevronIconSize:16,keepMountedMode:`activity`},fn=g((e,{transitionDuration:t,chevronSize:n,radius:r})=>({root:{"--accordion-transition-duration":t===void 0?void 0:`${t}ms`,"--accordion-chevron-size":n===void 0?void 0:P(n),"--accordion-radius":r===void 0?void 0:ne(r)}})),pn=c(e=>{let t=u(`Accordion`,dn,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,children:d,multiple:f,value:p,defaultValue:m,onChange:h,id:g,loop:_,transitionDuration:v,disableChevronRotation:y,disableCollapse:b,chevronPosition:x,chevronSize:S,order:C,chevron:w,variant:T,radius:E,chevronIconSize:D,attributes:O,keepMounted:k,keepMountedMode:A,...j}=t,M=F(g),[N,P]=ze({value:p,defaultValue:m,finalValue:f?[]:null,onChange:h}),I=e=>Array.isArray(N)?N.includes(e):e===N,L=e=>{if(!Array.isArray(N)&&b&&e===N)return;let t=Array.isArray(N)?N.includes(e)?N.filter(t=>t!==e):[...N,e]:e===N?null:e;P(t)},ee=a({name:`Accordion`,classes:sn,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:O,vars:l,varsResolver:fn});return(0,H.jsx)(nn,{value:{isItemActive:I,onChange:L,getControlId:It(`${M}-control`,`Accordion.Item component was rendered with invalid value or without value`),getRegionId:It(`${M}-panel`,`Accordion.Item component was rendered with invalid value or without value`),chevron:w===null?null:w||(0,H.jsx)(nt,{size:D}),transitionDuration:v,disableChevronRotation:y,chevronPosition:x,order:C,loop:_,getStyles:ee,variant:T,unstyled:c,keepMounted:k,keepMountedMode:A},children:(0,H.jsx)(o,{...ee(`root`),id:M,...j,variant:T,"data-accordion":!0,children:d})})});pn.classes=sn,pn.varsResolver=fn,pn.displayName=`@mantine/core/Accordion`,pn.Item=ln,pn.Panel=un,pn.Control=cn,pn.Chevron=nt;function mn(e){return typeof e==`string`?{value:e,label:e}:typeof e==`object`&&`value`in e&&!(`label`in e)?{value:e.value,label:`${e.value}`,disabled:e.disabled}:typeof e==`object`&&`group`in e?{group:e.group,items:e.items.map(e=>mn(e))}:typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?{value:e,label:`${e}`}:e}function hn(e){return e?e.map(e=>mn(e)):[]}function gn(e){return e.reduce((e,t)=>`group`in t?{...e,...gn(t.items)}:(e[`${t.value}`]=t,e),{})}var _n={dropdown:`m_88b62a41`,search:`m_985517d8`,options:`m_b2821a6e`,option:`m_92253aa5`,empty:`m_2530cd1d`,header:`m_858f94bd`,footer:`m_82b967cb`,group:`m_254f3e4f`,groupLabel:`m_2bb2e9e5`,chevron:`m_2943220b`,optionsDropdownOption:`m_390b5f4`,optionsDropdownCheckIcon:`m_8ee53fc2`,optionsDropdownCheckPlaceholder:`m_a530ee0a`},vn={error:null},yn=g((e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":M(t,`combobox-chevron-size`),"--combobox-chevron-color":n?l(n,e):void 0}})),bn=h(e=>{let t=u(`ComboboxChevron`,vn,e),{size:n,error:r,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,attributes:p,mod:m,...h}=t,g=a({name:`ComboboxChevron`,classes:_n,props:t,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,varsResolver:yn,attributes:p,rootSelector:`chevron`});return(0,H.jsx)(o,{component:`svg`,...h,...g(`chevron`),size:n,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,mod:[`combobox-chevron`,{error:r},m],children:(0,H.jsx)(`path`,{d:`M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})});bn.classes=_n,bn.varsResolver=yn,bn.displayName=`@mantine/core/ComboboxChevron`;var[xn,Sn]=de(`Combobox component was not found in tree`);function Cn({onMouseDown:e,onClick:t,onClear:n,...r}){return(0,H.jsx)(k.ClearButton,{tabIndex:-1,"aria-hidden":!0,...r,onMouseDown:t=>{t.preventDefault(),e?.(t)},onClick:e=>{n(),t?.(e)}})}Cn.displayName=`@mantine/core/ComboboxClearButton`;var wn=h(e=>{let{classNames:t,styles:n,className:r,style:i,hidden:a,...o}=u(`ComboboxDropdown`,null,e),s=Sn();return(0,H.jsx)(Ne.Dropdown,{...o,role:`presentation`,"data-hidden":a||void 0,"data-floating-height":s.floatingHeight||void 0,...s.getStyles(`dropdown`,{className:r,style:i,classNames:t,styles:n})})});wn.classes=_n,wn.displayName=`@mantine/core/ComboboxDropdown`;var Tn={refProp:`ref`},En=h(e=>{let{children:t,refProp:n,ref:r}=u(`ComboboxDropdownTarget`,Tn,e);if(Sn(),!w(t))throw Error(`Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);return(0,H.jsx)(Ne.Target,{ref:r,refProp:n,children:t})});En.displayName=`@mantine/core/ComboboxDropdownTarget`;var Dn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxEmpty`,null,e),c=Sn();return(0,H.jsx)(o,{...c.getStyles(`empty`,{className:n,classNames:t,styles:i,style:r}),...s})});Dn.classes=_n,Dn.displayName=`@mantine/core/ComboboxEmpty`;function On({onKeyDown:e,onClick:t,withKeyboardNavigation:n,withAriaAttributes:r,withExpandedAttribute:i,targetType:a,autoComplete:o}){let s=Sn(),[c,l]=(0,V.useState)(null),u=t=>{if(e?.(t),!s.readOnly&&n){if(t.nativeEvent.isComposing)return;if(t.nativeEvent.code===`ArrowDown`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectNextOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`ArrowUp`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectPreviousOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`Enter`||t.nativeEvent.code===`NumpadEnter`){if(t.nativeEvent.keyCode===229)return;let e=s.store.getSelectedOptionIndex();s.store.dropdownOpened&&e!==-1?(t.preventDefault(),s.store.clickSelectedOption()):a===`button`&&(t.preventDefault(),s.store.openDropdown(`keyboard`))}t.key===`Escape`&&s.store.closeDropdown(`keyboard`),t.nativeEvent.code===`Space`&&a===`button`&&(t.preventDefault(),s.store.toggleDropdown(`keyboard`))}},d=r?{...i?{role:`combobox`}:{},"aria-haspopup":`listbox`,"aria-expanded":i?!!(s.store.listId&&s.store.dropdownOpened):void 0,"aria-controls":s.store.dropdownOpened&&s.store.listId?s.store.listId:void 0,"aria-activedescendant":s.store.dropdownOpened&&c||void 0,autoComplete:o,"data-expanded":s.store.dropdownOpened||void 0,"data-mantine-stop-propagation":s.store.dropdownOpened||void 0}:{},f=e=>{a===`button`&&e.currentTarget.focus(),t?.(e)};return{...d,onKeyDown:u,onClick:f}}var kn={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},An=h(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:a,targetType:o,autoComplete:s,ref:c,...l}=u(`ComboboxEventsTarget`,kn,e),d=v(t);if(!d)throw Error(`Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=Sn(),p=On({targetType:o,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:a,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:s});return(0,V.cloneElement)(d,{...p,...l,[n]:re(c,f.store.targetRef,ue(d))})});An.displayName=`@mantine/core/ComboboxEventsTarget`;var jn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxFooter`,null,e),c=Sn();return(0,H.jsx)(o,{...c.getStyles(`footer`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});jn.classes=_n,jn.displayName=`@mantine/core/ComboboxFooter`;var Mn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:s,label:c,id:l,...d}=u(`ComboboxGroup`,null,e),f=Sn(),p=F(l),m=c!=null&&c!==!1&&c!==``;return(0,H.jsxs)(o,{role:`group`,"aria-labelledby":m?p:void 0,...f.getStyles(`group`,{className:n,classNames:t,style:r,styles:i}),...d,children:[m&&(0,H.jsx)(`div`,{id:p,...f.getStyles(`groupLabel`,{classNames:t,styles:i}),children:c}),s]})});Mn.classes=_n,Mn.displayName=`@mantine/core/ComboboxGroup`;var Nn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxHeader`,null,e),c=Sn();return(0,H.jsx)(o,{...c.getStyles(`header`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});Nn.classes=_n,Nn.displayName=`@mantine/core/ComboboxHeader`;function Pn({value:e,valuesDivider:t=`,`,...n}){return(0,H.jsx)(`input`,{type:`hidden`,value:Array.isArray(e)?e.join(t):e?`${e}`:``,...n})}Pn.displayName=`@mantine/core/ComboboxHiddenInput`;var Fn=h(e=>{let t=u(`ComboboxOption`,null,e),{classNames:n,className:r,style:i,styles:a,vars:s,onClick:c,id:l,active:d,onMouseDown:f,onMouseOver:p,disabled:m,selected:h,mod:g,..._}=t,v=Sn(),y=(0,V.useId)(),b=l||y;return(0,H.jsx)(o,{...v.getStyles(`option`,{className:r,classNames:n,styles:a,style:i}),"aria-disabled":m||void 0,..._,id:b,mod:[`combobox-option`,{"combobox-active":d,"combobox-disabled":m,"combobox-selected":h},g],role:`option`,onClick:e=>{m?e.preventDefault():(v.onOptionSubmit?.(t.value,t),c?.(e))},onMouseDown:e=>{e.preventDefault(),f?.(e)},onMouseOver:e=>{v.resetSelectionOnOptionHover&&v.store.resetSelectedOption(),p?.(e)}})});Fn.classes=_n,Fn.displayName=`@mantine/core/ComboboxOption`;var In=h(e=>{let{classNames:t,className:n,style:r,styles:i,id:a,onMouseDown:s,labelledBy:c,...l}=u(`ComboboxOptions`,null,e),d=Sn(),f=F(a);return(0,V.useEffect)(()=>{d.store.setListId(f)},[f]),(0,H.jsx)(o,{...d.getStyles(`options`,{className:n,style:r,classNames:t,styles:i}),...l,id:f,role:`listbox`,"aria-labelledby":c,onMouseDown:e=>{e.preventDefault(),s?.(e)}})});In.classes=_n,In.displayName=`@mantine/core/ComboboxOptions`;var Ln={withAriaAttributes:!0,withKeyboardNavigation:!0},Rn=h(e=>{let{classNames:t,styles:n,unstyled:r,vars:i,withAriaAttributes:a,onKeyDown:o,onClick:s,withKeyboardNavigation:c,size:l,ref:d,...f}=u(`ComboboxSearch`,Ln,e),p=Sn(),m=p.getStyles(`search`),h=On({targetType:`input`,withAriaAttributes:a,withKeyboardNavigation:c,withExpandedAttribute:!1,onKeyDown:o,onClick:s,autoComplete:`off`});return(0,H.jsx)(k,{ref:re(d,p.store.searchRef),classNames:[{input:m.className},t],styles:[{input:m.style},n],size:l||p.size,...h,...f,__staticSelector:`Combobox`})});Rn.classes=_n,Rn.displayName=`@mantine/core/ComboboxSearch`;var zn={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},Bn=h(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:a,targetType:o,autoComplete:s,ref:c,...l}=u(`ComboboxTarget`,zn,e),d=v(t);if(!d)throw Error(`Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=Sn(),p=On({targetType:o,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:a,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:s}),m=(0,V.cloneElement)(d,{...p,...l});return(0,H.jsx)(Ne.Target,{refProp:n,ref:re(c,f.store.targetRef),children:m})});Bn.displayName=`@mantine/core/ComboboxTarget`;function Vn(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].hasAttribute(`data-combobox-disabled`))return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].hasAttribute(`data-combobox-disabled`))return e}return e}function Hn(e,t,n){for(let n=e+1;n{s||(c(!0),i?.(e))},[c,i,s]),_=(0,V.useCallback)((e=`unknown`)=>{s&&(c(!1),r?.(e))},[c,r,s]),v=(0,V.useCallback)((e=`unknown`)=>{s?_(e):g(e)},[_,g,s]),y=(0,V.useCallback)(()=>{let e=Yt(f.current);qt(`#${l.current} [data-combobox-selected]`,e)?.removeAttribute(`data-combobox-selected`)},[]),b=(0,V.useCallback)(e=>{let t=Yt(f.current),n=qt(`#${l.current}`,t),r=n?Jt(`[data-combobox-option]`,n):null;if(!r)return null;let i=e>=r.length?0:e<0?r.length-1:e;return u.current=i,r?.[i]&&!r[i].hasAttribute(`data-combobox-disabled`)?(y(),r[i].setAttribute(`data-combobox-selected`,`true`),r[i].scrollIntoView({block:`nearest`,behavior:o}),r[i].id):null},[o,y]),x=(0,V.useCallback)(()=>{let e=Yt(f.current),t=qt(`#${l.current} [data-combobox-active]`,e);if(t){let n=Jt(`#${l.current} [data-combobox-option]`,e).findIndex(e=>e===t);return b(n)}return b(0)},[b]),S=(0,V.useCallback)(()=>{let e=Yt(f.current),t=Jt(`#${l.current} [data-combobox-option]`,e);return b(Hn(u.current,t,a))},[b,a]),C=(0,V.useCallback)(()=>{let e=Yt(f.current),t=Jt(`#${l.current} [data-combobox-option]`,e);return b(Vn(u.current,t,a))},[b,a]),w=(0,V.useCallback)(()=>{let e=Yt(f.current),t=Jt(`#${l.current} [data-combobox-option]`,e);return b(Un(t))},[b]),T=(0,V.useCallback)((e=`selected`,t)=>{if(typeof e==`number`){u.current=e;let n=Yt(f.current),r=Jt(`#${l.current} [data-combobox-option]`,n);t?.scrollIntoView&&r[e]?.scrollIntoView({block:`nearest`,behavior:o});return}h.current=window.setTimeout(()=>{let n=Yt(f.current),r=Jt(`#${l.current} [data-combobox-option]`,n),i=r.findIndex(t=>t.hasAttribute(`data-combobox-${e}`));u.current=i,t?.scrollIntoView&&r[i]?.scrollIntoView({block:`nearest`,behavior:o})},0)},[]),E=(0,V.useCallback)(()=>{u.current=-1,y()},[y]),D=(0,V.useCallback)(()=>{let e=Yt(f.current);(Jt(`#${l.current} [data-combobox-option]`,e)?.[u.current])?.click()},[]),O=(0,V.useCallback)(e=>{l.current=e},[]),k=(0,V.useCallback)(()=>{p.current=window.setTimeout(()=>d.current?.focus(),0)},[]),A=(0,V.useCallback)(()=>{m.current=window.setTimeout(()=>f.current?.focus(),0)},[]),j=(0,V.useCallback)(()=>u.current,[]);return(0,V.useEffect)(()=>()=>{window.clearTimeout(p.current),window.clearTimeout(m.current),window.clearTimeout(h.current)},[]),{dropdownOpened:s,openDropdown:g,closeDropdown:_,toggleDropdown:v,selectedOptionIndex:u.current,getSelectedOptionIndex:j,selectOption:b,selectFirstOption:w,selectActiveOption:x,selectNextOption:S,selectPreviousOption:C,resetSelectedOption:E,updateSelectedOptionIndex:T,listId:l.current,setListId:O,clickSelectedOption:D,searchRef:d,focusSearchInput:k,targetRef:f,focusTarget:A}}var Gn={keepMounted:!0,keepMountedMode:`display-none`,withinPortal:!0,resetSelectionOnOptionHover:!1,width:`target`,transitionProps:{transition:`fade`,duration:0},size:`sm`},Kn=g((e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":L(t),"--combobox-option-padding":M(t,`combobox-option-padding`)},dropdown:{"--combobox-padding":n===void 0?void 0:P(n),"--combobox-option-fz":L(t),"--combobox-option-padding":M(t,`combobox-option-padding`)}})),qn=e=>{let t=u(`Combobox`,Gn,e),{classNames:n,styles:r,unstyled:i,children:o,store:s,vars:c,onOptionSubmit:l,onClose:d,size:f,dropdownPadding:p,resetSelectionOnOptionHover:m,__staticSelector:h,readOnly:g,attributes:_,floatingHeight:v,middlewares:y,...b}=t,x=v===`viewport`?{...y,flip:!1,size:{...typeof y?.size==`object`?y.size:{},padding:typeof y?.size==`object`&&y.size.padding!==void 0?y.size.padding:10,apply:({availableHeight:e,availableWidth:t,elements:n,...r})=>{n.floating.style.setProperty(`--combobox-floating-max-height`,`${e}px`);let i=y?.size;typeof i==`object`&&i.apply?i.apply({availableHeight:e,availableWidth:t,elements:n,...r}):i&&Object.assign(n.floating.style,{maxWidth:`${t}px`,maxHeight:`${e}px`})}}}:y,S=Wn(),C=s||S,w=a({name:h||`Combobox`,classes:_n,props:t,classNames:n,styles:r,unstyled:i,attributes:_,vars:c,varsResolver:Kn}),T=()=>{d?.(),C.closeDropdown()};return(0,H.jsx)(xn,{value:{getStyles:w,store:C,onOptionSubmit:l,size:f,resetSelectionOnOptionHover:m,readOnly:g,floatingHeight:v},children:(0,H.jsx)(Ne,{opened:C.dropdownOpened,...b,middlewares:x,onChange:e=>!e&&T(),withRoles:!1,unstyled:i,children:o})})};qn.extend=e=>e,qn.classes=_n,qn.varsResolver=Kn,qn.displayName=`@mantine/core/Combobox`,qn.Target=Bn,qn.Dropdown=wn,qn.Options=In,qn.Option=Fn,qn.Search=Rn,qn.Empty=Dn,qn.Chevron=bn,qn.Footer=jn,qn.Header=Nn,qn.EventsTarget=An,qn.DropdownTarget=En,qn.Group=Mn,qn.ClearButton=Cn,qn.HiddenInput=Pn;function Jn({children:e,role:t}){let n=(0,V.use)(D);return n?(0,H.jsx)(`div`,{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy,children:e}):(0,H.jsx)(H.Fragment,{children:e})}var Yn={root:`m_5f75b09e`,body:`m_5f6e695e`,labelWrapper:`m_d3ea56bb`,label:`m_8ee546b8`,description:`m_328f68c0`,error:`m_8e8a99cc`},Xn=Yn;function Zn({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:i,unstyled:s,children:c,label:l,description:u,id:d,disabled:f,error:p,size:m,labelPosition:h=`left`,bodyElement:g=`div`,labelElement:_=`label`,variant:v,style:y,vars:b,mod:x,attributes:S,...C}){let w=a({name:e,props:t,className:n,style:y,classes:Yn,classNames:r,styles:i,unstyled:s,attributes:S}),T=u?`${d}-description`:void 0,E=p&&typeof p!=`boolean`?`${d}-error`:void 0;return(0,H.jsx)(o,{...w(`root`),__vars:{"--label-fz":L(m),"--label-lh":M(m,`label-lh`)},mod:[{"label-position":h},x],variant:v,size:m,...C,children:(0,H.jsxs)(o,{component:g,htmlFor:g===`label`?d:void 0,...w(`body`),children:[c,(0,H.jsxs)(`div`,{...w(`labelWrapper`),"data-disabled":f||void 0,children:[l&&(0,H.jsx)(o,{component:_,htmlFor:_===`label`?d:void 0,...w(`label`),"data-disabled":f||void 0,children:l}),u&&(0,H.jsx)(k.Description,{id:T,size:m,__inheritStyles:!1,...w(`description`),children:u}),p&&typeof p!=`boolean`&&(0,H.jsx)(k.Error,{id:E,size:m,__inheritStyles:!1,...w(`error`),children:p})]})]})})}Zn.displayName=`@mantine/core/InlineInput`;function Qn(e){return`group`in e}function $n({options:e,search:t,limit:n}){let r=t.trim().toLowerCase(),i=[];for(let a=0;a0)return!1;return!0}function tr(e,t=new Set){if(Array.isArray(e))for(let n of e)if(Qn(n))tr(n.items,t);else{if(n.value===void 0)throw Error(`[@mantine/core] Each option must have value property`);if(t.has(n.value))throw Error(`[@mantine/core] Duplicate options are not supported. Option with value "${n.value}" was provided more than once`);t.add(n.value)}}function nr(e,t){return Array.isArray(e)?e.includes(t):e===t}function rr({data:e,withCheckIcon:t,withAlignedLabels:n,value:r,checkIconPosition:i,unstyled:a,renderOption:o}){if(!Qn(e)){let s=nr(r,e.value),c=t&&(s?(0,H.jsx)(Ke,{className:_n.optionsDropdownCheckIcon}):n?(0,H.jsx)(`div`,{className:_n.optionsDropdownCheckPlaceholder}):null),l=(0,H.jsxs)(H.Fragment,{children:[i===`left`&&c,(0,H.jsx)(`span`,{children:e.label}),i===`right`&&c]});return(0,H.jsx)(qn.Option,{value:e.value,disabled:e.disabled,className:_({[_n.optionsDropdownOption]:!a}),"data-reverse":i===`right`||void 0,"data-checked":s||void 0,"aria-selected":s,active:s,children:typeof o==`function`?o({option:e,checked:s}):l})}let s=e.items.map(e=>(0,H.jsx)(rr,{data:e,value:r,unstyled:a,withCheckIcon:t,withAlignedLabels:n,checkIconPosition:i,renderOption:o},`${e.value}`));return(0,H.jsx)(qn.Group,{label:e.group,children:s})}function ir({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:i,limit:a,maxDropdownHeight:o,floatingHeight:s,withScrollArea:c=!0,filterOptions:l=!0,withCheckIcon:u=!1,withAlignedLabels:d=!1,value:f,checkIconPosition:p,nothingFoundMessage:m,unstyled:h,labelId:g,renderOption:_,scrollAreaProps:v,"aria-label":y}){let b=Sn();tr(e);let x=typeof i==`string`?(r||$n)({options:e,search:l?i:``,limit:a??1/0}):e,S=er(x),C=x.map((e,t)=>(0,H.jsx)(rr,{data:e,withCheckIcon:u,withAlignedLabels:d,value:f,checkIconPosition:p,unstyled:h,renderOption:_},Qn(e)?`group-${typeof e.group==`string`?e.group:t}`:`${e.value}`));return(0,H.jsx)(qn.Dropdown,{hidden:t||n&&S,"data-composed":!0,children:(0,H.jsxs)(qn.Options,{labelledBy:g,"aria-label":y,children:[c?(0,H.jsx)(pe.Autosize,{mah:(s??b.floatingHeight)===`viewport`?`var(--combobox-floating-options-max-height)`:o??220,type:`scroll`,scrollbarSize:`var(--combobox-padding)`,offsetScrollbars:`y`,...v,children:C}):C,S&&m&&(0,H.jsx)(qn.Empty,{children:m})]})})}function ar(e,t,n,r){if(t===n||r===`before`&&n===t+1||r===`after`&&n===t-1)return e;let i=e.slice(),[a]=i.splice(t,1),o=t{let t=e.lastElementChild;return t?t instanceof HTMLInputElement?t:t.querySelector(`input`):null},sr=(e,t)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let e=i.current;e&&(i.current=null,sr(o.current,e.expectedValue)&&e.container?.querySelector(`[data-mantine-pill-index="${e.index}"]`)?.focus())});let s=(0,V.useCallback)(e=>{a.current=e},[]);return{getPillProps:e=>{if(n)return{draggable:!0,tabIndex:-1,"data-mantine-pill-index":e,"aria-keyshortcuts":`Alt+ArrowLeft Alt+ArrowRight`,onMouseDown:e=>{e.button===0&&e.stopPropagation()},onDragStart:t=>{t.stopPropagation(),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,String(e)),r.current.draggedIndex=e;let n=t.currentTarget,i=n.getBoundingClientRect(),a=n.cloneNode(!0);a.removeAttribute(`data-dragging`),a.removeAttribute(`data-drag-over`),a.style.position=`fixed`,a.style.top=`-9999px`,a.style.left=`-9999px`,a.style.width=`${i.width}px`,a.style.height=`${i.height}px`,a.style.pointerEvents=`none`,document.body.appendChild(a),t.dataTransfer.setDragImage(a,t.clientX-i.left,t.clientY-i.top),setTimeout(()=>a.parentNode?.removeChild(a),0),requestAnimationFrame(()=>{n.setAttribute(`data-dragging`,`true`)})},onDragOver:t=>{let{draggedIndex:n}=r.current;if(n===null||n===e)return;let i=t.currentTarget,a=i.getBoundingClientRect(),o=t.clientX-a.left,s=(getComputedStyle(i).direction===`rtl`?o>a.width/2:o{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||(t.removeAttribute(`data-drag-over`),r.current.currentDropTarget===t&&(r.current.currentDropTarget=null))},onDrop:n=>{n.preventDefault(),n.stopPropagation();let i=n.currentTarget,a=i.getAttribute(`data-drag-over`);i.removeAttribute(`data-drag-over`);let{draggedIndex:s}=r.current;if(s!==null&&a&&s!==e){let n=ar(o.current,s,e,a);n!==o.current&&t(n)}r.current.draggedIndex=null,r.current.currentDropTarget=null},onDragEnd:e=>{e.currentTarget.removeAttribute(`data-dragging`);let t=r.current.currentDropTarget;t&&t.removeAttribute(`data-drag-over`),r.current.draggedIndex=null,r.current.currentDropTarget=null},onKeyDown:n=>{if(n.key!==`ArrowLeft`&&n.key!==`ArrowRight`)return;let r=n.currentTarget,a=getComputedStyle(r).direction===`rtl`?n.key===`ArrowLeft`:n.key===`ArrowRight`,s=a?e+1:e-1;if(n.altKey){if(s<0||s>=o.current.length)return;n.preventDefault(),n.stopPropagation();let c=a?`after`:`before`,l=ar(o.current,e,s,c);if(l===o.current)return;i.current={container:r.parentElement,index:s,expectedValue:l},t(l);return}if(s<0)return;let c=r.parentElement;if(c){if(n.preventDefault(),n.stopPropagation(),s>=o.current.length){or(c)?.focus();return}c.querySelector(`[data-mantine-pill-index="${s}"]`)?.focus()}}}},getListProps:()=>n?{ref:s}:{},handleInputKeyDown:e=>{if(!n||e.key!==`ArrowLeft`)return;let t=e.currentTarget;if(!(t.value.length===0||t.selectionStart===0&&t.selectionEnd===0))return;let r=a.current;if(!r)return;let i=r.querySelectorAll(`[data-mantine-pill-index]`);i.length!==0&&(e.preventDefault(),i[i.length-1].focus())}}}function lr({id:e,label:t,labelProps:n,inputWrapperOrder:r}){if(t&&(!r||r.includes(`label`)))return n?.id||`${e}-label`}function ur(e){let t=e.currentTarget;return Yt(t).activeElement!==t}var dr=(0,V.createContext)(null),fr={root:`m_7cda1cd6`,"root--default":`m_44da308b`,"root--contrast":`m_e3a01f8`,label:`m_1e0e6180`,remove:`m_ae386778`,group:`m_1dcfd90b`},pr=(0,V.createContext)(null),mr=g((e,{gap:t},{size:n})=>({group:{"--pg-gap":t===void 0?M(n,`pg-gap`):M(t)}})),hr=h(e=>{let t=u(`PillGroup`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,size:d,disabled:f,attributes:p,...m}=t,h=(0,V.use)(dr)?.size||d||void 0,g=a({name:`PillGroup`,classes:fr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:p,vars:l,varsResolver:mr,stylesCtx:{size:h},rootSelector:`group`});return(0,H.jsx)(pr,{value:{size:h,disabled:f},children:(0,H.jsx)(o,{size:h,...g(`group`),...m})})});hr.classes=fr,hr.varsResolver=mr,hr.displayName=`@mantine/core/PillGroup`;var gr={variant:`default`},_r=g((e,{radius:t},{size:n})=>({root:{"--pill-fz":M(n,`pill-fz`),"--pill-height":M(n,`pill-height`),"--pill-radius":t===void 0?void 0:ne(t)}})),vr=h(e=>{let t=u(`Pill`,gr,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,variant:d,children:f,withRemoveButton:p,onRemove:m,removeButtonProps:h,radius:g,size:_,disabled:v,mod:y,attributes:b,...x}=t,S=(0,V.use)(pr),C=(0,V.use)(dr),w=_||S?.size||void 0,T=C?.variant===`filled`?`contrast`:d||`default`,E=a({name:`Pill`,classes:fr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:b,vars:l,varsResolver:_r,stylesCtx:{size:w}});return(0,H.jsxs)(o,{component:`span`,variant:T,size:w,...E(`root`,{variant:T}),mod:[{"with-remove":p&&!v,disabled:v||S?.disabled},y],...x,children:[(0,H.jsx)(`span`,{...E(`label`),children:f}),p&&(0,H.jsx)(ae,{variant:`transparent`,radius:g,tabIndex:-1,"aria-hidden":!0,unstyled:c,...h,...E(`remove`,{className:h?.className,style:h?.style}),onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),h?.onMouseDown?.(e)},onClick:e=>{e.stopPropagation(),m?.(),h?.onClick?.(e)}})]})});vr.classes=fr,vr.varsResolver=_r,vr.displayName=`@mantine/core/Pill`,vr.Group=hr;var yr={field:`m_45c4369d`},br={type:`visible`},xr=h(e=>{let t=u(`PillsInputField`,br,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,type:d,disabled:f,id:p,pointer:m,mod:h,attributes:g,ref:_,...v}=t,y=(0,V.use)(dr),b=(0,V.use)(D),x=a({name:`PillsInputField`,classes:yr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:g,rootSelector:`field`}),S=f||y?.disabled;return(0,H.jsx)(o,{component:`input`,ref:re(_,y?.fieldRef),"data-type":d,disabled:S,mod:[{disabled:S,pointer:m},h],...x(`field`),...v,id:b?.inputId||p,"aria-invalid":y?.hasError,"aria-describedby":b?.describedBy,type:`text`,onMouseDown:e=>!m&&e.stopPropagation()})});xr.classes=yr,xr.displayName=`@mantine/core/PillsInputField`;var Sr={size:`sm`},Cr=h(e=>{let{children:t,onMouseDown:n,onClick:r,size:i,disabled:a,__staticSelector:o,error:s,variant:c,...l}=u([`Input`,`InputWrapper`,`PillsInput`],Sr,e),d=(0,V.useRef)(null);return(0,H.jsx)(dr,{value:{fieldRef:d,size:i,disabled:a,hasError:!!s,variant:c},children:(0,H.jsx)(N,{size:i,error:s,variant:c,component:`div`,"data-no-overflow":!0,onMouseDown:e=>{e.preventDefault(),n?.(e),d.current?.focus()},onClick:e=>{e.preventDefault(),e.currentTarget.closest(`fieldset`)?.disabled||(d.current?.focus(),r?.(e))},...l,multiline:!0,disabled:a,__staticSelector:o||`PillsInput`,withAria:!1,children:t})})});Cr.displayName=`@mantine/core/PillsInput`,Cr.classes=N.classes,Cr.Field=xr;function wr(e,t){let n=t.trim().toLowerCase();if(n===``)return;let r=Object.values(e).filter(e=>!e.disabled&&e.label.trim().toLowerCase()===n);return r.length===1?r[0]:void 0}function Tr(e){return typeof e==`string`?e.trim().toLowerCase():e}function Er({data:e,value:t}){let n=t.map(Tr);return e.reduce((e,t)=>(Qn(t)?e.push({group:t.group,items:t.items.filter(e=>n.indexOf(Tr(e.value))===-1)}):n.indexOf(Tr(t.value))===-1&&e.push(t),e),[])}var Dr={xs:41,sm:50,md:60,lg:72,xl:89},Or={maxValues:1/0,withCheckIcon:!0,checkIconPosition:`left`,hiddenInputValuesDivider:`,`,clearSearchOnChange:!0,openOnFocus:!0,size:`sm`},kr=c(e=>{let t=u([`Input`,`InputWrapper`,`MultiSelect`],Or,e),{classNames:n,className:r,style:i,styles:o,unstyled:s,vars:c,size:l,value:f,defaultValue:p,onChange:m,onKeyDown:h,variant:g,data:_,dropdownOpened:v,defaultDropdownOpened:y,onDropdownOpen:b,onDropdownClose:x,selectFirstOptionOnChange:S,selectFirstOptionOnDropdownOpen:C,onOptionSubmit:w,comboboxProps:T,filter:E,limit:D,withScrollArea:O,maxDropdownHeight:k,floatingHeight:j,searchValue:M,defaultSearchValue:N,onSearchChange:P,readOnly:I,disabled:L,onFocus:ee,onBlur:R,radius:te,rightSection:ne,rightSectionWidth:re,rightSectionPointerEvents:ie,rightSectionProps:z,leftSection:ae,leftSectionWidth:B,leftSectionPointerEvents:oe,leftSectionProps:se,inputContainer:ce,inputWrapperOrder:le,withAsterisk:ue,labelProps:de,descriptionProps:fe,errorProps:pe,successProps:me,wrapperProps:he,description:ge,label:_e,error:ve,success:ye,maxValues:be,searchable:xe,nothingFoundMessage:Se,withCheckIcon:Ce,withAlignedLabels:we,checkIconPosition:Te,hidePickedOptions:Ee,withErrorStyles:De,withSuccessStyles:Oe,name:ke,form:Ae,id:je,clearable:Me,clearSectionMode:Ne,clearButtonProps:Pe,hiddenInputProps:Fe,placeholder:Ie,hiddenInputValuesDivider:Le,required:Re,mod:Be,renderOption:Ve,renderPill:He,onRemove:Ue,onClear:We,onMaxValues:Ge,scrollAreaProps:Ke,chevronColor:qe,attributes:Je,clearSearchOnChange:Ye,openOnFocus:Xe,loading:Ze,loadingPosition:Qe,withPillsReorder:$e,...et}=t,tt=F(je),nt=lr({id:tt,label:_e,labelProps:de,inputWrapperOrder:le}),rt=hn(_),it=gn(rt),at=(0,V.useRef)({}),ot=Wn({opened:v,defaultOpened:y,onDropdownOpen:()=>{b?.(),C&&ot.selectFirstOption()},onDropdownClose:()=>{x?.(),ot.resetSelectedOption()}}),{styleProps:st,rest:{type:ct,autoComplete:lt,...ut}}=d(et),[dt,ft]=ze({value:f,defaultValue:p,finalValue:[],onChange:m}),{getPillProps:pt,getListProps:mt,handleInputKeyDown:ht}=cr({value:dt,onChange:ft,enabled:$e&&!L&&!I}),[gt,_t]=ze({value:M,defaultValue:N,finalValue:``,onChange:P}),vt=e=>{_t(e),ot.resetSelectedOption()},yt=a({name:`MultiSelect`,classes:{},props:t,classNames:n,styles:o,unstyled:s,attributes:Je}),{resolvedClassNames:bt,resolvedStyles:xt}=A({props:t,styles:o,classNames:n}),St=e=>{h?.(e),!e.defaultPrevented&&(e.key===` `&&!xe&&(e.preventDefault(),ot.toggleDropdown()),e.key===`Backspace`&>.length===0&&dt.length>0&&!I&&(Ue?.(dt[dt.length-1]),ft(dt.slice(0,dt.length-1))),ht(e))},Ct=dt.map((e,t)=>{let n=it[`${e}`]||at.current[`${e}`],r=pt(t);return He?(0,H.jsx)(V.Fragment,{children:He({option:n,value:e,onRemove:()=>{ft(dt.filter(t=>e!==t)),Ue?.(e)},disabled:L,reorderProps:r})},`${e}-${t}`):(0,H.jsx)(vr,{withRemoveButton:!I&&!it[`${e}`]?.disabled,onRemove:()=>{ft(dt.filter(t=>e!==t)),Ue?.(e)},unstyled:s,disabled:L,...yt(`pill`),...r,children:n?.label||e},`${e}-${t}`)});(0,V.useEffect)(()=>{S&&ot.selectFirstOption()},[S,gt]),(0,V.useEffect)(()=>{dt.forEach(e=>{`${e}`in it&&(at.current[`${e}`]=it[`${e}`])})},[it,dt]);let wt=(0,H.jsx)(qn.ClearButton,{...Pe,onClear:()=>{We?.(),ft([]),vt(``)}}),Tt=Er({data:rt,value:dt}),Et=Me&&dt.length>0&&!L&&!I,Dt=Et?{paddingInlineEnd:Dr[l]??Dr.sm}:void 0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(qn,{store:ot,classNames:bt,styles:xt,unstyled:s,size:l,readOnly:I,__staticSelector:`MultiSelect`,attributes:Je,floatingHeight:j,onOptionSubmit:e=>{w?.(e),Ye&&vt(``),ot.updateSelectedOptionIndex(`selected`),dt.includes(it[`${e}`].value)?(ft(dt.filter(t=>t!==it[`${e}`].value)),Ue?.(it[`${e}`].value)):dt.lengthxe?ot.openDropdown():ot.toggleDropdown(),"data-expanded":ot.dropdownOpened||void 0,id:tt,required:Re,mod:Be,attributes:Je,children:(0,H.jsxs)(vr.Group,{attributes:Je,disabled:L,unstyled:s,...yt(`pillsList`,{style:Dt}),...mt(),children:[Ct,(0,H.jsx)(qn.EventsTarget,{autoComplete:lt,withExpandedAttribute:!0,children:(0,H.jsx)(Cr.Field,{...ut,id:tt,placeholder:Ie,type:!xe&&!Ie?`hidden`:`visible`,...yt(`inputField`),unstyled:s,onFocus:e=>{ee?.(e),Xe&&xe&&ot.openDropdown()},onBlur:e=>{R?.(e),ot.closeDropdown(),vt(``)},onKeyDown:St,value:gt,onChange:e=>{if(ur(e)){if(!I){let t=wr(it,e.currentTarget.value);t&&!dt.includes(t.value)&&dt.length{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ProgressLabel`,null,e),c=jr();return(0,H.jsx)(o,{...c.getStyles(`label`,{className:n,style:r,classNames:t,styles:i}),...s})});Nr.classes=Mr,Nr.displayName=`@mantine/core/ProgressLabel`;var Pr=g((e,{size:t,radius:n,transitionDuration:r})=>({root:{"--progress-size":M(t,`progress-size`),"--progress-radius":n===void 0?void 0:ne(n),"--progress-transition-duration":typeof r==`number`?`${r}ms`:void 0}})),Fr=h(e=>{let t=u(`ProgressRoot`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,autoContrast:d,transitionDuration:f,orientation:p,attributes:m,mod:h,...g}=t,_=a({name:`Progress`,classes:Mr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:m,vars:l,varsResolver:Pr});return(0,H.jsx)(Ar,{value:{getStyles:_,autoContrast:d},children:(0,H.jsx)(o,{mod:[{orientation:p},h],..._(`root`),...g})})});Fr.classes=Mr,Fr.varsResolver=Pr,Fr.displayName=`@mantine/core/ProgressRoot`;var Ir={withAria:!0},Lr=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:s,withAria:c,color:d,striped:p,animated:m,mod:h,...g}=u(`ProgressSection`,Ir,e),_=jr(),v=f(),y=c?{role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":s,"aria-valuetext":`${s}%`}:{};return(0,H.jsx)(o,{..._.getStyles(`section`,{className:n,classNames:t,styles:i,style:r}),...g,...y,mod:[{striped:p||m,animated:m},h],__vars:{"--progress-section-size":`${s}%`,"--progress-section-color":l(d,v),"--progress-label-color":Xt(_.autoContrast,v)?st({color:d,theme:v,autoContrast:_.autoContrast}):void 0}})});Lr.classes=Mr,Lr.displayName=`@mantine/core/ProgressSection`;var Rr=h(e=>{let t=u(`Progress`,null,e),{value:n,classNames:r,styles:i,vars:a,color:o,striped:s,animated:c,"aria-label":l,...d}=t,{resolvedClassNames:f,resolvedStyles:p}=A({classNames:r,styles:i,props:t});return(0,H.jsx)(Fr,{classNames:f,styles:p,vars:a,...d,children:(0,H.jsx)(Lr,{value:n,color:o,striped:s,animated:c,"aria-label":l})})});Rr.classes=Mr,Rr.displayName=`@mantine/core/Progress`,Rr.Section=Lr,Rr.Root=Fr,Rr.Label=Nr;var zr={root:`m_cf365364`,indicator:`m_9e182ccd`,label:`m_1738fcb2`,input:`m_1714d588`,control:`m_69686b9b`,innerLabel:`m_78882f40`},Br={withItemsBorders:!0},Vr=g((e,{radius:t,color:n,transitionDuration:r,size:i,transitionTimingFunction:a})=>({root:{"--sc-radius":t===void 0?void 0:ne(t),"--sc-color":n?l(n,e):void 0,"--sc-shadow":n?void 0:`var(--mantine-shadow-xs)`,"--sc-transition-duration":r===void 0?void 0:`${r}ms`,"--sc-transition-timing-function":a,"--sc-padding":M(i,`sc-padding`),"--sc-font-size":L(i)}})),Hr=c(e=>{let t=u(`SegmentedControl`,Br,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,data:d,value:p,defaultValue:m,onChange:h,size:g,name:_,disabled:v,readOnly:y,fullWidth:b,orientation:x,radius:S,color:C,transitionDuration:w,transitionTimingFunction:T,variant:E,autoContrast:D,withItemsBorders:O,mod:k,attributes:A,ref:j,...M}=t,N=a({name:`SegmentedControl`,props:t,classes:zr,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:A,vars:l,varsResolver:Vr}),P=f(),I=d.map(e=>Kt(e)?{label:`${e}`,value:e}:e),L=Gt(),[ee,R]=(0,V.useState)(0),[te,ne]=(0,V.useState)(null),[ie,z]=(0,V.useState)({}),ae=(e,t)=>{e!==null&&ie[t]!==e&&(ie[t]=e,z({...ie}))},[B,oe]=ze({value:p,defaultValue:m,finalValue:Array.isArray(d)?I.find(e=>!e.disabled)?.value??d[0]?.value??null:null,onChange:h}),se=F(_),ce=I.map(e=>`${e.value}`),le=I.map(e=>(0,V.createElement)(o,{...N(`control`),mod:{active:B===e.value,orientation:x},key:`${e.value}`},(0,V.createElement)(`input`,{...N(`input`),disabled:v||e.disabled,type:`radio`,name:se,value:`${e.value}`,id:`${se}-${e.value}`,checked:B===e.value,onChange:()=>!y&&oe(e.value),"data-focus-ring":P.focusRing,key:`${e.value}-input`}),(0,V.createElement)(o,{component:`label`,...N(`label`),mod:{active:B===e.value&&!(v||e.disabled),disabled:v||e.disabled,"read-only":y},htmlFor:`${se}-${e.value}`,ref:t=>ae(t,`${e.value}`),__vars:{"--sc-label-color":C===void 0?void 0:st({color:C,theme:P,autoContrast:D})},key:`${e.value}-label`},(0,H.jsx)(`span`,{...N(`innerLabel`),children:e.label})))),ue=re(j,ne);return Vt(()=>{R(e=>e+1)},[d.length]),Vt(()=>{z(e=>{let t={};return ce.forEach(n=>{n in e&&(t[n]=e[n])}),Object.keys(t).length===Object.keys(e).length?e:t})},[ce]),d.length===0?null:(0,H.jsxs)(o,{...N(`root`),variant:E,size:g,ref:ue,mod:[{"full-width":b,orientation:x,initialized:L,"with-items-borders":O},k],...M,role:`radiogroup`,"data-disabled":v,children:[B!==void 0&&(0,H.jsx)(tn,{target:ie[`${B}`],parent:te,component:`span`,transitionDuration:`var(--sc-transition-duration)`,...N(`indicator`)},ee),le]})});Hr.classes=zr,Hr.varsResolver=Vr,Hr.displayName=`@mantine/core/SegmentedControl`;var Ur={size:`sm`,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:`left`,openOnFocus:!0},Wr=c(e=>{let t=u([`Input`,`InputWrapper`,`Select`],Ur,e),{classNames:n,styles:r,unstyled:i,vars:a,dropdownOpened:o,defaultDropdownOpened:s,onDropdownClose:c,onDropdownOpen:l,onFocus:d,onBlur:f,onClick:p,onChange:m,data:h,value:g,defaultValue:_,selectFirstOptionOnChange:v,selectFirstOptionOnDropdownOpen:y,onOptionSubmit:b,comboboxProps:x,readOnly:S,disabled:C,filter:w,limit:T,withScrollArea:E,maxDropdownHeight:D,floatingHeight:O,size:k,searchable:j,rightSection:M,checkIconPosition:P,withCheckIcon:I,withAlignedLabels:L,nothingFoundMessage:ee,name:R,form:te,searchValue:ne,defaultSearchValue:re,onSearchChange:ie,allowDeselect:z,error:ae,rightSectionPointerEvents:B,id:oe,clearable:se,clearSectionMode:ce,clearButtonProps:le,hiddenInputProps:ue,renderOption:de,onClear:fe,autoComplete:pe,scrollAreaProps:me,__defaultRightSection:he,__clearSection:ge,__clearable:_e,chevronColor:ve,autoSelectOnBlur:ye,openOnFocus:be,attributes:xe,...Se}=t,Ce=(0,V.useMemo)(()=>hn(h),[h]),we=(0,V.useRef)({}),Te=(0,V.useMemo)(()=>gn(Ce),[Ce]),Ee=F(oe),De=lr({id:Ee,label:Se.label,labelProps:Se.labelProps,inputWrapperOrder:Se.inputWrapperOrder}),[Oe,ke,Ae]=ze({value:g,defaultValue:_,finalValue:null,onChange:m}),je=Oe==null?void 0:`${Oe}`in Te?Te[`${Oe}`]:we.current[`${Oe}`],Me=Ut(je),[Ne,Pe,Fe]=ze({value:ne,defaultValue:re,finalValue:je?je.label:``,onChange:ie}),Ie=Wn({opened:o,defaultOpened:s,onDropdownOpen:()=>{l?.(),y?Ie.selectFirstOption():Ie.updateSelectedOptionIndex(`active`,{scrollIntoView:!0})},onDropdownClose:()=>{c?.(),setTimeout(Ie.resetSelectedOption,0)}}),Le=e=>{Pe(e),Ie.resetSelectedOption()},{resolvedClassNames:Re,resolvedStyles:Be}=A({props:t,styles:r,classNames:n});(0,V.useEffect)(()=>{v&&Ie.selectFirstOption()},[v,Ne]),(0,V.useEffect)(()=>{g===null&&Le(``),g!=null&&je&&(Me?.value!==je.value||Me?.label!==je.label)&&Le(je.label)},[g,je]),(0,V.useEffect)(()=>{!Ae&&!Fe&&Le(Oe==null?``:`${Oe}`in Te?Te[`${Oe}`]?.label:we.current[`${Oe}`]?.label||``)},[Te,Oe]),(0,V.useEffect)(()=>{Oe&&`${Oe}`in Te&&(we.current[`${Oe}`]=Te[`${Oe}`])},[Te,Oe]);let Ve=(0,H.jsx)(qn.ClearButton,{...le,onClear:()=>{ke(null,null),Le(``),fe?.()}}),He=se&&Oe!=null&&!C&&!S;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(qn,{store:Ie,__staticSelector:`Select`,classNames:Re,styles:Be,unstyled:i,readOnly:S,size:k,attributes:xe,floatingHeight:O,keepMounted:ye,onOptionSubmit:e=>{b?.(e);let t=z&&`${Te[e].value}`==`${Oe}`?null:Te[e],n=t?t.value:null;n!==Oe&&ke(n,t),!Ae&&Le(n==null?``:t?.label||``),Ie.closeDropdown()},...x,children:[(0,H.jsx)(qn.Target,{targetType:j?`input`:`button`,autoComplete:pe,withExpandedAttribute:!0,children:(0,H.jsx)(N,{id:Ee,__defaultRightSection:(0,H.jsx)(qn.Chevron,{size:k,error:ae,unstyled:i,color:ve}),__clearSection:Ve,__clearable:He,__clearSectionMode:ce,rightSection:M,rightSectionPointerEvents:B||`none`,...Se,size:k,__staticSelector:`Select`,disabled:C,readOnly:S||!j,value:Ne,onChange:e=>{if(ur(e)){if(!S){let t=wr(Te,e.currentTarget.value);t&&`${t.value}`!=`${Oe}`&&(ke(t.value,t),!Ae&&Le(t.label))}return}Le(e.currentTarget.value),Ie.openDropdown(),v&&Ie.selectFirstOption()},onFocus:e=>{be&&j&&Ie.openDropdown(),d?.(e)},onBlur:e=>{ye&&Ie.clickSelectedOption(),Ie.closeDropdown();let t=Oe!=null&&(`${Oe}`in Te?Te[`${Oe}`]:we.current[`${Oe}`]);Le(t&&t.label||``),f?.(e)},onClick:e=>{j?Ie.openDropdown():Ie.toggleDropdown(),p?.(e)},classNames:Re,styles:Be,unstyled:i,pointer:!j,error:ae,attributes:xe})}),(0,H.jsx)(ir,{data:Ce,hidden:S||C,filter:w,search:Ne,limit:T,hiddenWhenEmpty:!ee,withScrollArea:E,maxDropdownHeight:D,filterOptions:!!j&&je?.label!==Ne,value:Oe,checkIconPosition:P,withCheckIcon:I,withAlignedLabels:L,nothingFoundMessage:ee,unstyled:i,labelId:De,"aria-label":De?void 0:Se[`aria-label`],renderOption:de,scrollAreaProps:me})]}),(0,H.jsx)(qn.HiddenInput,{value:Oe,name:R,form:te,disabled:C,...ue})]})});Wr.classes={...N.classes,...qn.classes},Wr.displayName=`@mantine/core/Select`;function Gr(e){if(e!==void 0)return typeof e==`number`?P(e):e}function Kr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=f(),s=t===void 0?e:t,c=r!==void 0,l=E({"--sg-spacing-x":z(Lt(e)),"--sg-spacing-y":z(Lt(s)),"--sg-auto-rows":i,...c?{"--sg-min-col-width":Gr(r)}:{"--sg-cols":Lt(n)?.toString()}}),u=O(o.breakpoints).reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=z(e[r])),typeof s==`object`&&s[r]!==void 0&&(t[r][`--sg-spacing-y`]=z(s[r])),!c&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),d=Ge(O(u),o.breakpoints).filter(e=>O(u[e.value]).length>0).map(e=>({query:`(min-width: ${o.breakpoints[e.value]})`,styles:u[e.value]}));return(0,H.jsx)(j,{styles:l,media:d,selector:a})}function qr(e){return typeof e==`object`&&e?O(e):[]}function Jr(e){return e.sort((e,t)=>We(e)-We(t))}function Yr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}){return Jr(Array.from(new Set([...qr(e),...qr(t),...r===void 0?qr(n):[]])))}function Xr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=t===void 0?e:t,s=r!==void 0,c=E({"--sg-spacing-x":z(Lt(e)),"--sg-spacing-y":z(Lt(o)),"--sg-auto-rows":i,...s?{"--sg-min-col-width":Gr(r)}:{"--sg-cols":Lt(n)?.toString()}}),l=Yr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}),u=l.reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=z(e[r])),typeof o==`object`&&o[r]!==void 0&&(t[r][`--sg-spacing-y`]=z(o[r])),!s&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),d=l.map(e=>({query:`simple-grid (min-width: ${e})`,styles:u[e]}));return(0,H.jsx)(j,{styles:c,container:d,selector:a})}var Zr={container:`m_925c2d2c`,root:`m_2415a157`},Qr={cols:1,spacing:`md`,type:`media`},$r=h(e=>{let t=u(`SimpleGrid`,Qr,e),{classNames:n,className:r,style:i,styles:c,unstyled:l,vars:d,cols:f,verticalSpacing:p,spacing:m,type:h,minColWidth:g,autoFlow:_,autoRows:v,attributes:y,...b}=t,x=a({name:`SimpleGrid`,classes:Zr,props:t,className:r,style:i,classNames:n,styles:c,unstyled:l,attributes:y,vars:d}),S=s(),C=g===void 0?void 0:_||`auto-fill`;return h===`container`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Xr,{...t,selector:`.${S}`}),(0,H.jsx)(`div`,{...x(`container`),children:(0,H.jsx)(o,{...x(`root`,{className:S}),...b,"data-auto-cols":C})})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Kr,{...t,selector:`.${S}`}),(0,H.jsx)(o,{...x(`root`,{className:S}),...b,"data-auto-cols":C})]})});$r.classes=Zr,$r.displayName=`@mantine/core/SimpleGrid`;var ei=(0,V.createContext)(null),ti={hiddenInputValuesSeparator:`,`},ni=c((e=>{let{value:t,defaultValue:n,onChange:r,size:i,wrapperProps:a,children:o,readOnly:s,name:c,hiddenInputValuesSeparator:l,hiddenInputProps:d,maxSelectedValues:f,disabled:p,...m}=u(`SwitchGroup`,ti,e),[h,g]=ze({value:t,defaultValue:n,finalValue:[],onChange:r}),_=e=>{let t=e.currentTarget.value;if(s)return;let n=h.includes(t);!n&&f&&h.length>=f||g(n?h.filter(e=>e!==t):[...h,t])},v=e=>{if(p)return!0;if(!f)return!1;let t=h.includes(e),n=h.length>=f;return!t&&n},y=h.join(l);return(0,H.jsx)(ei,{value:{value:h,onChange:_,size:i,isDisabled:v},children:(0,H.jsxs)(k.Wrapper,{size:i,...a,...m,labelElement:`div`,__staticSelector:`SwitchGroup`,children:[(0,H.jsx)(Jn,{role:`group`,children:o}),(0,H.jsx)(`input`,{type:`hidden`,name:c,value:y,...d})]})})}));ni.classes=k.Wrapper.classes,ni.displayName=`@mantine/core/SwitchGroup`;var ri={root:`m_5f93f3bb`,input:`m_926b4011`,track:`m_9307d992`,thumb:`m_93039a1d`,trackLabel:`m_8277e082`},ii={labelPosition:`right`,withThumbIndicator:!0},ai=g((e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:ne(t),"--switch-height":M(r,`switch-height`),"--switch-width":M(r,`switch-width`),"--switch-thumb-size":M(r,`switch-thumb-size`),"--switch-label-font-size":M(r,`switch-label-font-size`),"--switch-track-label-padding":M(r,`switch-track-label-padding`),"--switch-color":n?l(n,e):void 0}})),oi=h(e=>{let t=u(`Switch`,ii,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,color:f,label:p,offLabel:m,onLabel:h,id:g,size:_,radius:v,wrapperProps:y,thumbIcon:b,checked:x,defaultChecked:S,onChange:C,labelPosition:w,description:T,error:E,disabled:D,variant:O,rootRef:k,mod:A,withThumbIndicator:j,attributes:M,...N}=t,P=(0,V.use)(ei),I=_||P?.size,L=a({name:`Switch`,props:t,classes:ri,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:M,vars:l,varsResolver:ai}),{styleProps:ee,rest:R}=d(N),te=F(g),ne=[T?`${te}-description`:void 0,E&&typeof E!=`boolean`?`${te}-error`:void 0,R[`aria-describedby`]].filter(Boolean).join(` `)||void 0,re={checked:P?.value.includes(R.value)??x,onChange:e=>{P?.onChange(e),C?.(e)}},ie=D||P?.isDisabled?.(R.value),[z,ae]=ze({value:re.checked??x,defaultValue:S,finalValue:!1});return(0,H.jsxs)(Zn,{...L(`root`),__staticSelector:`Switch`,__stylesApiProps:t,id:te,size:I,labelPosition:w,label:p,description:T,error:E,disabled:ie,bodyElement:`label`,labelElement:`span`,classNames:n,styles:s,unstyled:c,"data-checked":re.checked,variant:O,ref:k,mod:A,attributes:M,inert:R.inert,...ee,...y,children:[(0,H.jsx)(`input`,{...R,...re,disabled:ie,checked:z,"data-checked":re.checked,onChange:e=>{re.onChange?.(e),ae(e.currentTarget.checked)},id:te,type:`checkbox`,role:`switch`,inert:R.inert,"aria-describedby":ne,...L(`input`)}),(0,H.jsxs)(o,{"aria-hidden":`true`,component:`span`,mod:{error:E,"label-position":w,"without-labels":!h&&!m},...L(`track`),children:[(0,H.jsx)(o,{component:`span`,mod:{"reduce-motion":!0,"with-thumb-indicator":j&&!b},...L(`thumb`),children:b}),(0,H.jsx)(`span`,{...L(`trackLabel`),children:z?h:m})]})]})});oi.classes={...ri,...Xn},oi.varsResolver=ai,oi.displayName=`@mantine/core/Switch`,oi.Group=ni;var si=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z`}))]]),ci=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z`}))]]),li=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M220,48V96a12,12,0,0,1-24,0V77l-35.51,35.52a12,12,0,0,1-17-17L179,60H160a12,12,0,0,1,0-24h48A12,12,0,0,1,220,48ZM95.51,143.51,60,179V160a12,12,0,0,0-24,0v48a12,12,0,0,0,12,12H96a12,12,0,0,0,0-24H77l35.52-35.51a12,12,0,0,0-17-17ZM208,148a12,12,0,0,0-12,12v19l-35.51-35.52a12,12,0,0,0-17,17L179,196H160a12,12,0,0,0,0,24h48a12,12,0,0,0,12-12V160A12,12,0,0,0,208,148ZM77,60H96a12,12,0,0,0,0-24H48A12,12,0,0,0,36,48V96a12,12,0,0,0,24,0V77l35.51,35.52a12,12,0,0,0,17-17Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M208,48V208H48V48Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M216,48V96a8,8,0,0,1-16,0V67.31l-42.34,42.35a8,8,0,0,1-11.32-11.32L188.69,56H160a8,8,0,0,1,0-16h48A8,8,0,0,1,216,48ZM98.34,146.34,56,188.69V160a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16H67.31l42.35-42.34a8,8,0,0,0-11.32-11.32ZM208,152a8,8,0,0,0-8,8v28.69l-42.34-42.35a8,8,0,0,0-11.32,11.32L188.69,200H160a8,8,0,0,0,0,16h48a8,8,0,0,0,8-8V160A8,8,0,0,0,208,152ZM67.31,56H96a8,8,0,0,0,0-16H48a8,8,0,0,0-8,8V96a8,8,0,0,0,16,0V67.31l42.34,42.35a8,8,0,0,0,11.32-11.32Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M109.66,146.34a8,8,0,0,1,0,11.32L83.31,184l18.35,18.34A8,8,0,0,1,96,216H48a8,8,0,0,1-8-8V160a8,8,0,0,1,13.66-5.66L72,172.69l26.34-26.35A8,8,0,0,1,109.66,146.34ZM83.31,72l18.35-18.34A8,8,0,0,0,96,40H48a8,8,0,0,0-8,8V96a8,8,0,0,0,13.66,5.66L72,83.31l26.34,26.35a8,8,0,0,0,11.32-11.32ZM208,40H160a8,8,0,0,0-5.66,13.66L172.69,72,146.34,98.34a8,8,0,0,0,11.32,11.32L184,83.31l18.34,18.35A8,8,0,0,0,216,96V48A8,8,0,0,0,208,40Zm3.06,112.61a8,8,0,0,0-8.72,1.73L184,172.69l-26.34-26.35a8,8,0,0,0-11.32,11.32L172.69,184l-18.35,18.34A8,8,0,0,0,160,216h48a8,8,0,0,0,8-8V160A8,8,0,0,0,211.06,152.61Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M214,48V96a6,6,0,0,1-12,0V62.48l-45.76,45.76a6,6,0,0,1-8.48-8.48L193.52,54H160a6,6,0,0,1,0-12h48A6,6,0,0,1,214,48ZM99.76,147.76,54,193.52V160a6,6,0,0,0-12,0v48a6,6,0,0,0,6,6H96a6,6,0,0,0,0-12H62.48l45.76-45.76a6,6,0,0,0-8.48-8.48ZM208,154a6,6,0,0,0-6,6v33.52l-45.76-45.76a6,6,0,0,0-8.48,8.48L193.52,202H160a6,6,0,0,0,0,12h48a6,6,0,0,0,6-6V160A6,6,0,0,0,208,154ZM62.48,54H96a6,6,0,0,0,0-12H48a6,6,0,0,0-6,6V96a6,6,0,0,0,12,0V62.48l45.76,45.76a6,6,0,0,0,8.48-8.48Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,48V96a8,8,0,0,1-16,0V67.31l-42.34,42.35a8,8,0,0,1-11.32-11.32L188.69,56H160a8,8,0,0,1,0-16h48A8,8,0,0,1,216,48ZM98.34,146.34,56,188.69V160a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16H67.31l42.35-42.34a8,8,0,0,0-11.32-11.32ZM208,152a8,8,0,0,0-8,8v28.69l-42.34-42.35a8,8,0,0,0-11.32,11.32L188.69,200H160a8,8,0,0,0,0,16h48a8,8,0,0,0,8-8V160A8,8,0,0,0,208,152ZM67.31,56H96a8,8,0,0,0,0-16H48a8,8,0,0,0-8,8V96a8,8,0,0,0,16,0V67.31l42.34,42.35a8,8,0,0,0,11.32-11.32Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M212,48V96a4,4,0,0,1-8,0V57.66l-49.17,49.17a4,4,0,0,1-5.66-5.66L198.34,52H160a4,4,0,0,1,0-8h48A4,4,0,0,1,212,48ZM101.17,149.17,52,198.34V160a4,4,0,0,0-8,0v48a4,4,0,0,0,4,4H96a4,4,0,0,0,0-8H57.66l49.17-49.17a4,4,0,0,0-5.66-5.66ZM208,156a4,4,0,0,0-4,4v38.34l-49.17-49.17a4,4,0,0,0-5.66,5.66L198.34,204H160a4,4,0,0,0,0,8h48a4,4,0,0,0,4-4V160A4,4,0,0,0,208,156ZM57.66,52H96a4,4,0,0,0,0-8H48a4,4,0,0,0-4,4V96a4,4,0,0,0,8,0V57.66l49.17,49.17a4,4,0,0,0,5.66-5.66Z`}))]]),ui=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M208,160H48l80-80Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z`}))]]),di=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M172,108a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,108Zm-12,28H96a12,12,0,0,0,0,24h64a12,12,0,0,0,0-24Zm76-8A108,108,0,0,1,78.77,224.15L46.34,235A20,20,0,0,1,21,209.66l10.81-32.43A108,108,0,1,1,236,128Zm-24,0A84,84,0,1,0,55.27,170.06a12,12,0,0,1,1,9.81l-9.93,29.79,29.79-9.93a12.1,12.1,0,0,1,3.8-.62,12,12,0,0,1,6,1.62A84,84,0,0,0,212,128Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-4-1.08,7.85,7.85,0,0,0-2.53.42L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Zm40-104a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,112Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,144Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm32,128H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M166,112a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm-6,26H96a6,6,0,0,0,0,12h64a6,6,0,0,0,0-12Zm70-10A102,102,0,0,1,79.31,217.65L44.44,229.27a14,14,0,0,1-17.71-17.71l11.62-34.87A102,102,0,1,1,230,128Zm-12,0A90,90,0,1,0,50.08,173.06a6,6,0,0,1,.5,4.91L38.12,215.35a2,2,0,0,0,2.53,2.53L78,205.42a6.2,6.2,0,0,1,1.9-.31,6.09,6.09,0,0,1,3,.81A90,90,0,0,0,218,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M168,112a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,112Zm-8,24H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16Zm72-8A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Zm-16,0A88,88,0,1,0,51.81,172.06a8,8,0,0,1,.66,6.54L40,216,77.4,203.53a7.85,7.85,0,0,1,2.53-.42,8,8,0,0,1,4,1.08A88,88,0,0,0,216,128Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M164,112a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm-4,28H96a4,4,0,0,0,0,8h64a4,4,0,0,0,0-8Zm68-12A100,100,0,0,1,79.5,215.47l-35.69,11.9a12,12,0,0,1-15.18-15.18l11.9-35.69A100,100,0,1,1,228,128Zm-8,0A92,92,0,1,0,48.35,174.07a4,4,0,0,1,.33,3.27L36.22,214.72a4,4,0,0,0,5.06,5.06l37.38-12.46a3.93,3.93,0,0,1,1.27-.21,4.05,4.05,0,0,1,2,.54A92,92,0,0,0,220,128Z`}))]]),fi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z`}))]]),pi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M140,80v41.21l34.17,20.5a12,12,0,1,1-12.34,20.58l-40-24A12,12,0,0,1,116,128V80a12,12,0,0,1,24,0ZM128,28A99.38,99.38,0,0,0,57.24,57.34c-4.69,4.74-9,9.37-13.24,14V64a12,12,0,0,0-24,0v40a12,12,0,0,0,12,12H72a12,12,0,0,0,0-24H57.77C63,86,68.37,80.22,74.26,74.26a76,76,0,1,1,1.58,109,12,12,0,0,0-16.48,17.46A100,100,0,1,0,128,28Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128A96,96,0,0,1,62.11,197.82a8,8,0,1,1,11-11.64A80,80,0,1,0,71.43,71.43C67.9,75,64.58,78.51,61.35,82L77.66,98.34A8,8,0,0,1,72,112H32a8,8,0,0,1-8-8V64a8,8,0,0,1,13.66-5.66L50,70.7c3.22-3.49,6.54-7,10.06-10.55A96,96,0,0,1,224,128ZM128,72a8,8,0,0,0-8,8v48a8,8,0,0,0,3.88,6.86l40,24a8,8,0,1,0,8.24-13.72L136,123.47V80A8,8,0,0,0,128,72Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M134,80v44.6l37.09,22.25a6,6,0,0,1-6.18,10.3l-40-24A6,6,0,0,1,122,128V80a6,6,0,0,1,12,0Zm-6-46A93.4,93.4,0,0,0,61.51,61.56c-8.58,8.68-16,17-23.51,25.8V64a6,6,0,0,0-12,0v40a6,6,0,0,0,6,6H72a6,6,0,0,0,0-12H44.73C52.86,88.29,60.79,79.35,70,70a82,82,0,1,1,1.7,117.62,6,6,0,1,0-8.24,8.72A94,94,0,1,0,128,34Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M132,80v45.74l38.06,22.83a4,4,0,0,1-4.12,6.86l-40-24A4,4,0,0,1,124,128V80a4,4,0,0,1,8,0Zm-4-44A91.42,91.42,0,0,0,62.93,63C53.05,73,44.66,82.47,36,92.86V64a4,4,0,0,0-8,0v40a4,4,0,0,0,4,4H72a4,4,0,0,0,0-8H40.47C49.61,89,58.3,79,68.6,68.6a84,84,0,1,1,1.75,120.49,4,4,0,1,0-5.5,5.82A92,92,0,1,0,128,36Z`}))]]),mi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),hi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,44H32A20,20,0,0,0,12,64V192a20,20,0,0,0,20,20H224a20,20,0,0,0,20-20V64A20,20,0,0,0,224,44Zm-4,144H36V68H220ZM52,128a12,12,0,0,1,12-12H192a12,12,0,0,1,0,24H64A12,12,0,0,1,52,128Zm0-36A12,12,0,0,1,64,80H192a12,12,0,0,1,0,24H64A12,12,0,0,1,52,92Zm0,72a12,12,0,0,1,12-12h8a12,12,0,0,1,0,24H64A12,12,0,0,1,52,164Zm108,0a12,12,0,0,1-12,12H108a12,12,0,0,1,0-24h40A12,12,0,0,1,160,164Zm44,0a12,12,0,0,1-12,12h-8a12,12,0,0,1,0-24h8A12,12,0,0,1,204,164Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M232,64V192a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H224A8,8,0,0,1,232,64Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48ZM64,168H48a8,8,0,0,1,0-16H64a8,8,0,0,1,0,16Zm96,0H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm48,0H192a8,8,0,0,1,0-16h16a8,8,0,0,1,0,16Zm0-32H48a8,8,0,0,1,0-16H208a8,8,0,0,1,0,16Zm0-32H48a8,8,0,0,1,0-16H208a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,50H32A14,14,0,0,0,18,64V192a14,14,0,0,0,14,14H224a14,14,0,0,0,14-14V64A14,14,0,0,0,224,50Zm2,142a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H224a2,2,0,0,1,2,2Zm-20-64a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12H200A6,6,0,0,1,206,128Zm0-32a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12H200A6,6,0,0,1,206,96ZM70,160a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12h8A6,6,0,0,1,70,160Zm96,0a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,160Zm40,0a6,6,0,0,1-6,6h-8a6,6,0,0,1,0-12h8A6,6,0,0,1,206,160Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,52H32A12,12,0,0,0,20,64V192a12,12,0,0,0,12,12H224a12,12,0,0,0,12-12V64A12,12,0,0,0,224,52Zm4,140a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H224a4,4,0,0,1,4,4Zm-24-64a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8H200A4,4,0,0,1,204,128Zm0-32a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8H200A4,4,0,0,1,204,96ZM68,160a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8h8A4,4,0,0,1,68,160Zm96,0a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,160Zm40,0a4,4,0,0,1-4,4h-8a4,4,0,0,1,0-8h8A4,4,0,0,1,204,160Z`}))]]),gi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M76,64A12,12,0,0,1,88,52H216a12,12,0,0,1,0,24H88A12,12,0,0,1,76,64Zm140,52H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Zm0,64H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,112a16,16,0,1,0,16,16A16,16,0,0,0,44,112Zm0-64A16,16,0,1,0,60,64,16,16,0,0,0,44,48Zm0,128a16,16,0,1,0,16,16A16,16,0,0,0,44,176Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,64V192H88V64Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM68,188a12,12,0,1,1,12-12A12,12,0,0,1,68,188Zm0-48a12,12,0,1,1,12-12A12,12,0,0,1,68,140Zm0-48A12,12,0,1,1,80,80,12,12,0,0,1,68,92Zm124,92H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M82,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H88A6,6,0,0,1,82,64Zm134,58H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Zm0,64H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12ZM44,54A10,10,0,1,0,54,64,10,10,0,0,0,44,54Zm0,128a10,10,0,1,0,10,10A10,10,0,0,0,44,182Zm0-64a10,10,0,1,0,10,10A10,10,0,0,0,44,118Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M84,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H88A4,4,0,0,1,84,64Zm132,60H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Zm0,64H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8ZM44,120a8,8,0,1,0,8,8A8,8,0,0,0,44,120Zm0-64a8,8,0,1,0,8,8A8,8,0,0,0,44,56Zm0,128a8,8,0,1,0,8,8A8,8,0,0,0,44,184Z`}))]]),_i=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M28,64A12,12,0,0,1,40,52H216a12,12,0,0,1,0,24H40A12,12,0,0,1,28,64Zm12,76h64a12,12,0,0,0,0-24H40a12,12,0,0,0,0,24Zm80,40H40a12,12,0,0,0,0,24h80a12,12,0,0,0,0-24Zm120.49,20.49a12,12,0,0,1-17,0l-18.08-18.08a44,44,0,1,1,17-17l18.08,18.07A12,12,0,0,1,240.49,200.49ZM184,164a20,20,0,1,0-20-20A20,20,0,0,0,184,164Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,144a32,32,0,1,1-32-32A32,32,0,0,1,216,144Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,2.34L217.36,166A40,40,0,1,0,206,177.36l20.3,20.3a8,8,0,0,0,11.32-11.32Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M34,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H40A6,6,0,0,1,34,64Zm6,70h72a6,6,0,0,0,0-12H40a6,6,0,0,0,0,12Zm88,52H40a6,6,0,0,0,0,12h88a6,6,0,0,0,0-12Zm108.24,10.24a6,6,0,0,1-8.48,0l-21.49-21.48a38.06,38.06,0,1,1,8.49-8.49l21.48,21.49A6,6,0,0,1,236.24,196.24ZM184,170a26,26,0,1,0-26-26A26,26,0,0,0,184,170Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M36,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H40A4,4,0,0,1,36,64Zm4,68h72a4,4,0,0,0,0-8H40a4,4,0,0,0,0,8Zm88,56H40a4,4,0,0,0,0,8h88a4,4,0,0,0,0-8Zm106.83,6.83a4,4,0,0,1-5.66,0l-22.72-22.72a36.06,36.06,0,1,1,5.66-5.66l22.72,22.72A4,4,0,0,1,234.83,194.83ZM184,172a28,28,0,1,0-28-28A28,28,0,0,0,184,172Z`}))]]),vi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M156,112a12,12,0,0,1-12,12H80a12,12,0,0,1,0-24h64A12,12,0,0,1,156,112Zm76.49,120.49a12,12,0,0,1-17,0L168,185a92.12,92.12,0,1,1,17-17l47.54,47.53A12,12,0,0,1,232.49,232.49ZM112,180a68,68,0,1,0-68-68A68.08,68.08,0,0,0,112,180Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Zm112,0a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM144,120H80a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M150,112a6,6,0,0,1-6,6H80a6,6,0,0,1,0-12h64A6,6,0,0,1,150,112Zm78.24,116.24a6,6,0,0,1-8.48,0l-51.38-51.38a86.15,86.15,0,1,1,8.48-8.48l51.38,51.38A6,6,0,0,1,228.24,228.24ZM112,186a74,74,0,1,0-74-74A74.09,74.09,0,0,0,112,186Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M148,112a4,4,0,0,1-4,4H80a4,4,0,0,1,0-8h64A4,4,0,0,1,148,112Zm78.83,114.83a4,4,0,0,1-5.66,0l-52.7-52.7a84.1,84.1,0,1,1,5.66-5.66l52.7,52.7A4,4,0,0,1,226.83,226.83ZM112,188a76,76,0,1,0-76-76A76.08,76.08,0,0,0,112,188Z`}))]]),yi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M230.47,67.5a12,12,0,0,0-19.26-4.32L172.43,99l-12.68-2.72L157,83.57l35.79-38.78a12,12,0,0,0-4.32-19.26A76.07,76.07,0,0,0,88.41,121.64L30.92,174.18a4.68,4.68,0,0,0-.39.38,36,36,0,0,0,50.91,50.91l.38-.39,52.54-57.49A76.05,76.05,0,0,0,230.47,67.5ZM160,148a51.5,51.5,0,0,1-23.35-5.52,12,12,0,0,0-14.26,2.62L64.31,208.66a12,12,0,0,1-17-17l63.55-58.07a12,12,0,0,0,2.62-14.26A51.5,51.5,0,0,1,108,96a52.06,52.06,0,0,1,52-52h.89L135.17,71.87a12,12,0,0,0-2.91,10.65l5.66,26.35a12,12,0,0,0,9.21,9.21l26.35,5.66a12,12,0,0,0,10.65-2.91L212,95.12c0,.3,0,.59,0,.89A52.06,52.06,0,0,1,160,148Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,96a64,64,0,0,1-94.94,56L73,217A24,24,0,0,1,39,183L104,126.94a64,64,0,0,1,80-90.29L144,80l5.66,26.34L176,112l43.35-40A63.8,63.8,0,0,1,224,96Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M232,96a72,72,0,0,1-100.94,66L79,222.22c-.12.14-.26.29-.39.42a32,32,0,0,1-45.26-45.26c.14-.13.28-.27.43-.39L94,124.94a72.07,72.07,0,0,1,83.54-98.78,8,8,0,0,1,3.93,13.19L144,80l5.66,26.35L176,112l40.65-37.52a8,8,0,0,1,13.19,3.93A72.6,72.6,0,0,1,232,96Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224.91,69.75a6,6,0,0,0-9.63-2.16l-41.07,37.9L154.7,101.3l-4.19-19.51,37.9-41.07a6,6,0,0,0-2.16-9.63,70,70,0,0,0-89.77,94.39l-61.39,53c-.11.09-.21.19-.32.3A30,30,0,0,0,77.2,221.23c.11-.11.21-.21.3-.32l53-61.39a70,70,0,0,0,94.39-89.77ZM160,154a58,58,0,0,1-28-7.22,6,6,0,0,0-7.45,1.33L68.57,212.88a18,18,0,0,1-25.45-25.45l64.76-55.94A6,6,0,0,0,109.2,124a58,58,0,0,1,64-84.53L139.58,75.93a6,6,0,0,0-1.45,5.33l5.65,26.35a6,6,0,0,0,4.61,4.61l26.35,5.65a6,6,0,0,0,5.33-1.45L216.49,82.8A58.06,58.06,0,0,1,160,154Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M223.05,70.5a4,4,0,0,0-6.42-1.44l-41.82,38.6L153,103l-4.68-21.79,38.6-41.82a4,4,0,0,0-1.44-6.43A68,68,0,0,0,98.94,126L36.4,180l-.21.2a28,28,0,0,0,39.6,39.6l.2-.21,54-62.54A68,68,0,0,0,228,96,67.51,67.51,0,0,0,223.05,70.5ZM160,156a60,60,0,0,1-29-7.47,4,4,0,0,0-5,.89L70,214.25A20,20,0,0,1,41.75,186l64.82-56a4,4,0,0,0,.89-5,60,60,0,0,1,69.46-86.59L141.05,77.29a4,4,0,0,0-1,3.55l5.66,26.35a4,4,0,0,0,3.07,3.07l26.35,5.66a4,4,0,0,0,3.55-1l38.87-35.87A60.05,60.05,0,0,1,160,156Z`}))]]),bi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:si}));bi.displayName=`ArrowClockwiseIcon`;var xi=bi,Si=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:ci}));Si.displayName=`ArrowCounterClockwiseIcon`;var Ci=Si,wi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:li}));wi.displayName=`ArrowsOutIcon`;var Ti=wi,Ei=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:ui}));Ei.displayName=`CaretUpIcon`;var Di=Ei,Oi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:di}));Oi.displayName=`ChatCircleTextIcon`;var ki=Oi,Ai=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:fi}));Ai.displayName=`ClockIcon`;var ji=Ai,Mi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:pi}));Mi.displayName=`ClockCounterClockwiseIcon`;var Ni=Mi,Pi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:mi}));Pi.displayName=`InfoIcon`;var Fi=Pi,Ii=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:hi}));Ii.displayName=`KeyboardIcon`;var Li=Ii,Ri=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:gi}));Ri.displayName=`ListBulletsIcon`;var zi=Ri,Bi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:_i}));Bi.displayName=`ListMagnifyingGlassIcon`;var Vi=Bi,Hi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:vi}));Hi.displayName=`MagnifyingGlassMinusIcon`;var Ui=Hi,Wi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:yi}));Wi.displayName=`WrenchIcon`;var Gi=Wi,Ki=i(b(),1),qi=`$__all`;function Ji(e,t,n){if(e.kind===`constant`)return e.value??``;let r=e.kind===`custom`?e.options?.map(e=>({value:e}))??[]:n===null?[]:n,i=t[e.name],a=!e.multi&&Array.isArray(i)&&i.length===0?void 0:i;if(a===`$__all`){if(e.include_all)return qi}else if(a!==void 0){if(e.kind===`text`||r===void 0)return a;let t=new Set(r.map(e=>e.value));if(Array.isArray(a)){if(a.length===0&&e.multi)return[];let n=a.filter(e=>t.has(e));if(n.length>0)return n}else if(t.has(a))return a}return e.default?e.default:e.include_all?qi:r?.[0]?.value??``}var Yi=(e,t)=>e.replace(/\$([a-z][a-z0-9_]*)/g,(e,n)=>{let r=t[n];return r===void 0?e:r===`$__all`?`all`:Array.isArray(r)?r.join(`, `):r});function Xi(e,t,n){let r={};for(let i of e??[]){let e=Ji(i,t,n?.[i.name]);(i.kind!==`query`||e!==``)&&(r[i.name]=e)}return r}function Zi(e){return Array.from({length:e.rows},(t,n)=>Object.fromEntries(e.columns.map((t,r)=>{let i=e.values[r]?.[n]??null;return[t.name,typeof i==`number`&&!Number.isFinite(i)?null:i]})))}function Qi(e,t){return e.viz!==`logs`||!t||t.rows<2?[]:t.columns.flatMap((e,n)=>{if(e.role!==`dimension`||e.type!==`string`||[`body`,`body_template`,`severity`,`status`].includes(e.name)||/(^id$|_id$)/.test(e.name))return[];let r=t.values[n][0];return typeof r==`string`&&r!==``&&t.values[n].slice(0,t.rows).every(e=>e===r)?[{name:e.name,value:r}]:[]})}function $i(e,t){let n=t.frame??{columns:[],values:[],rows:0};return{columns:n.columns.map(e=>e.name),rows:Zi(n),selection:t=>{let n={};for(let r of e.query?.by??[]){let e=r.startsWith(`attributes[`)||r.startsWith(`resource[`)?r.slice(r.indexOf(`'`)+1,r.lastIndexOf(`'`)):r;t[e]!==void 0&&t[e]!==null&&(n[r]=String(t[e]))}return{time:typeof t.time==`number`?t.time:typeof t.start==`number`?t.start:void 0,dimensions:n,trace_id:typeof t.trace_id==`string`?t.trace_id:void 0,namespace:typeof t.namespace==`string`?t.namespace:void 0}}}}function ea(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e])}var ta=e=>e.map(ea).join(`
`);function na(e,t=!1){return n=>{let r=Array.isArray(n)?n:[n];return ta([...r[0]?.axisValueLabel?[r[0].axisValueLabel]:[],...r.map(n=>{let r=n.value,i=Array.isArray(r)?t?r.slice(1):r:[r];return`${n.seriesName??``}${n.name?` · ${n.name}`:``}: ${i.map(t=>typeof t==`number`?e(t,n.seriesName):String(t??`—`)).join(` · `)}`})])}}var ra=e=>/^Other(?: \(\d+\))?$/.test(e??``);function ia(e,t){let n=Math.min(6,Math.max(1,Math.floor(t.options?.top||6))),r=e.filter(e=>!ra(e.name)),i=r.slice(0,n).map(e=>({name:e.name,items:[e]})),a=[...e.filter(e=>ra(e.name)),...r.slice(n)];return a.length&&i.push({name:a.length===1&&ra(a[0].name)?a[0].name:`Other (${a.reduce((e,t)=>e+(ra(t.name)?Number(t.name.match(/\d+/)?.[0]??1):1),0)})`,items:a}),i}function aa(e){let t=e.filter(e=>e!==null);return t.length?t.reduce((e,t)=>e+t,0):null}function oa(e,t){let n=Math.min(6,Math.max(1,Math.floor(t.options?.top||6))),r=e.filter(e=>!ra(e.name));return{shown:[...r.slice(0,n),...e.filter(e=>ra(e.name))],hidden:Math.max(0,r.length-n)}}function sa(e,t){return e>0?[{type:`text`,right:8,bottom:2,silent:!0,style:{text:`${e} more series not shown`,fill:t,fontSize:11}}]:[]}function ca(e,t,n,r,i=`sans-serif`,a){let o=e=>Array.from(e).length>24?`${Array.from(e).slice(0,23).join(``)}…`:e,s=Math.max(1,t-16),c=1,l=0;for(let t of e){let e=15+(a?.(o(t),`12px ${i}`)??Array.from(o(t)).length*7.2);l&&l+10+e>s&&(c++,l=0),l+=(l?10:0)+e}let u=c>2;return{top:n?u?30:c*20+2:12,option:{type:u?`scroll`:`plain`,show:n,top:0,left:0,right:0,padding:0,itemGap:6,icon:`roundRect`,itemWidth:10,itemHeight:10,itemStyle:{borderColor:r,borderWidth:1},textStyle:{color:r,fontSize:12,lineHeight:14},data:e,formatter:o,tooltip:{show:!0,renderMode:`html`,formatter:e=>ea(e.name)}}}}function la(e,t){if(!(!Number.isFinite(e)||!Number.isFinite(t)||e>=t||Math.abs(e)>864e13||Math.abs(t)>864e13))return{from:new Date(Math.floor(e)).toISOString(),to:new Date(Math.ceil(t)).toISOString()}}function ua(e){let t=[e.time?.range?`Range ${e.time.range}`:void 0,e.time?.shift?`Shifted ${e.time.shift}`:void 0].filter(Boolean);return t.length?t.join(` · `):void 0}function da(e,t,n){if(n.interactive===!1||n.data?.value===null)return;let r=n.data?.selection;if(r)return Object.values(r.dimensions).some(ra)?void 0:r;if(ra(n.seriesName)||ra(n.name)||n.value===null||Array.isArray(n.value)&&n.value.at(-1)==null)return;let i=e.query?.by?.[0]??t.frame?.columns.find(e=>e.role===`dimension`)?.name,a=e.viz===`timeseries`?n.seriesName:n.name,o=Array.isArray(n.value)?n.value:[];return{time:e.viz===`timeseries`&&typeof o[0]==`number`?o[0]:void 0,dimensions:i&&a?{[i]:a}:{}}}var fa=new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}),pa=new Intl.NumberFormat(`en`,{maximumFractionDigits:2});function ma(e){return Math.abs(e)<1e-4?e.toExponential(2).replace(/\.?(0+)(?=e)/,``):String(Number(e.toPrecision(3)))}function ha(e,t=pa){return e!==0&&Math.abs(e)<1?ma(e):t.format(e)}function ga(e,t){let n=t===`s`?e*1e3:t===`ns`?e/1e6:e;return e!==0&&n===0?`${ma(e)}${t}`:n!==0&&Math.abs(n)<1?`${ma(n)}ms`:ye(n)}function _a(e){let t=[`B`,`KiB`,`MiB`,`GiB`,`TiB`],n=e,r=0;for(;Math.abs(n)>=1024&&r=1e4?fa:pa);default:return ha(t,Math.abs(t)>=1e4?fa:pa)}}function ya(e){return t=>e===`ms`||e===`s`||e===`ns`?va(e,t).replace(/(\.\d*?)0+([a-z]*)$/,`$1$2`).replace(/\.([a-z]*)$/,`$1`):va(e,t)}function ba(e,t){return ya(e)(t??NaN).replace(/(?<=\d)(ms|ns|s|m|h)\b/g,` $1`)}function xa(e){return Math.max(3,Math.min(10,Math.round(e/70)))-1}function Sa(e,t){let n=t===`ms`?1:t===`s`?1e3:t===`ns`?1e-6:void 0,r=e=>{let t=10**Math.floor(Math.log10(e));return[1,2,5,10].map(e=>e*t).find(t=>t>=e)};if(n===void 0)return r(e);let i=e*n,a=[1,10,100,1e3,1e4,6e4,6e5,36e5,36e6].flatMap(e=>[1,2,5].map(t=>e*t)).sort((e,t)=>e-t);return(i<1?r(i):a.find(e=>e>=i)??r(i/36e5)*36e5)/n}function Ca(e,t,n,r){e=Number.isFinite(e)?Math.min(0,e):0,t=Number.isFinite(t)?Math.max(0,t):1,t===e&&(t=e+1);let i=xa(r),a=Sa(Math.max(t-e,2**-52)/i,n);for(;Math.ceil(t/a)-Math.floor(e/a)>i;)a=Sa(a*1.01,n);return{min:Math.floor(e/a)*a,max:Math.ceil(t/a)*a,interval:a,splitNumber:i,fanout_unit:n}}function wa(e,t){return e.type!==`value`&&e.type!==`log`?e:{...e,...e.type===`value`&&typeof e.min==`number`&&typeof e.max==`number`?Ca(e.min,e.max,typeof e.fanout_unit==`string`?e.fanout_unit:void 0,t):{splitNumber:xa(t)}}}function Ta(e,t,n){let r=e=>va(n,e),i=``;if(n===`ms`||n===`s`||n===`ns`){let a=n===`s`?1e3:n===`ns`?1e-6:1,o=Math.abs((e??t??0)*a),s=o>=6e4?6e4:o>=1e3?1e3:1;i=s===6e4?` min`:s===1e3?` s`:` ms`;let c=s===6e4?1:s===1e3?+(o<1e4):2,l=new Intl.NumberFormat(void 0,{maximumFractionDigits:c});r=e=>l.format(e*a/s)}return t===null&&e!==null?`≥${r(e)}${i}`:(e===null||e===0)&&t!==null?`<${r(t)}${i}`:`${e===null?`−∞`:r(e)}–${t===null?`∞`:r(t)}${i}`}function Ea(e){let t=new Date(e);return t.getHours()===0&&t.getMinutes()===0&&t.getSeconds()===0?t.toLocaleDateString(void 0,{month:`short`,day:`numeric`}):t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}function Da(e,t=new Date,n){let r=new Date(e);if(!Number.isFinite(r.getTime()))return`—`;let i=new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,...r.getFullYear()===t.getFullYear()?{}:{year:`numeric`},hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).formatToParts(r),a=i.filter(e=>[`month`,`day`,`year`].includes(e.type)).map(e=>e.value),o=i.filter(e=>[`hour`,`minute`,`second`].includes(e.type)).map(e=>e.value);return`${a.join(` `)} ${o.join(`:`)}`}function Oa({panel:e,result:t}){let n=t?.frame;return(0,H.jsxs)(`div`,{"data-panel-data":!0,children:[t?.error&&(0,H.jsx)(T,{"data-panel-error-detail":!0,size:`sm`,role:`status`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,userSelect:`text`},children:t.error}),n?(0,H.jsxs)(be,{fz:12,striped:!0,children:[(0,H.jsx)(be.Thead,{children:(0,H.jsx)(be.Tr,{children:n.columns.map(e=>(0,H.jsx)(be.Th,{ff:wt.display,children:e.name},e.name))})}),(0,H.jsx)(be.Tbody,{children:Array.from({length:Math.min(n.rows,500)},(t,r)=>(0,H.jsx)(be.Tr,{children:n.columns.map((t,i)=>{let a=n.values[i][r];return(0,H.jsx)(be.Td,{ff:wt.display,children:a===null?`—`:t.type===`time`?new Date(Number(a)).toISOString():t.role===`measure`?va(t.unit??e.unit,Number(a)):String(a)},t.name)})},r))})]}):(0,H.jsx)(T,{c:`dimmed`,size:`sm`,children:`No data.`}),(0,H.jsxs)(T,{c:`dimmed`,fz:12,mt:8,children:[`Ran in `,t?.elapsed_ms??0,` ms`,t?.interval?`, one point per ${t.interval}`:``,n?`, ${n.rows} rows${n.truncated?` (truncated)`:``}`:``,`.`]}),(t?.sql??e.sql)&&(0,H.jsx)(Re,{block:!0,tabIndex:0,mt:8,children:t?.sql??e.sql})]})}function ka({panel:e,dark:t}){let n=JSON.stringify(e,null,2).split(/("(?:[^"\\]|\\.)*"(?=\s*:)|"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?)/g);return(0,H.jsx)(`pre`,{"data-panel-spec":!0,style:{margin:0,fontFamily:wt.display,fontSize:12,color:ft[t?`dark`:`light`].text},children:n.map((e,r)=>{let i=e.startsWith(`"`)&&/^\s*:/.test(n[r+1]??``)?`key`:e.startsWith(`"`)?`string`:/^(true|false|null)$/.test(e)?`literal`:/^-?\d/.test(e)?`number`:`punctuation`,a=i===`key`?_t[t?4:7]:i===`string`?mt[t?4:8]:i===`number`||i===`literal`?Dt[t?4:8]:void 0;return i===`punctuation`?e:(0,H.jsx)(`span`,{"data-json-token":i,style:{color:a},children:e},r)})})}function Aa(e){let t=e.event.data?.selection,n=e.event.value;return JSON.stringify([e.event.seriesName,e.event.name,t?.from??t?.time??(Array.isArray(n)?n[0]:void 0),t?.dimensions,t?.bucket])}function ja(e){let t=new Date().toISOString().slice(0,10),n=e.from.slice(0,10),r=e.to.slice(0,10),i=e=>e.slice(11,-1).replace(/\.000$/,``);return`${(n===t?``:n+` `)+i(e.from)} – ${(r!==n&&r!==t?r+` `:``)+i(e.to)} UTC · ${ye(Date.parse(e.to)-Date.parse(e.from))}`}var Ma={background:`color-mix(in srgb, var(--mantine-color-body) 92%, transparent)`,border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`,padding:`2px 6px`};function Na(e){return e.replace(`Enter drill`,`↵ drill`).replace(`Shift+←→`,`⇧←→`)}var Pa=(0,V.createContext)(void 0);function Fa({points:e,label:t,summary:n,children:r,onClick:i,canSelect:a,onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d,rangeReset:f,height:p=`100%`,onZoom:m,bounds:h,pointWindow:g}){let[_,v]=(0,V.useState)(!1),[b,x]=(0,V.useState)(``),[S,w]=(0,V.useState)(),[E,D]=(0,V.useState)(null),O=(0,V.useRef)(null),k=(0,V.useRef)(!1);(0,V.useEffect)(()=>{let e=e=>{e.key===`Tab`&&(k.current=!1)};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[]);let A=(0,V.useId)(),j=(0,V.useContext)(Pa),M=(0,V.useRef)(null),N=(0,V.useRef)({onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d});N.current={onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d};let P=(0,V.useMemo)(()=>new Map(e.map(e=>[Aa(e),e])),[e]),F=(0,V.useRef)(void 0),I=e=>g?.(e)?.from??e.event.name??(Array.isArray(e.event.value)?e.event.value[0]:void 0),L=F.current,ee=L?e.filter(e=>e.event.seriesName===L.event.seriesName):e,R=ee.length?ee:e,te=L&&I(L),ne=typeof te==`number`?R.reduce((e,t)=>{let n=I(t),r=e&&I(e);return typeof n==`number`&&(!e||typeof r!=`number`||Math.abs(n-te)I(e)===te),re=S?P.get(S)??ne??R[0]??e[0]:e[0],ie=!!(m&&h&&Number.isFinite(h.from)&&Number.isFinite(h.to)&&h.from[...new Set(e.map(e=>e.event.seriesName))],[e]),ae=(0,V.useMemo)(()=>e.filter(e=>e.event.seriesName===re?.event.seriesName),[e,re?.event.seriesName]),B=re?ae.indexOf(re):-1;(0,V.useEffect)(()=>{re&&(!S||P.has(S)||!ee.length)&&(F.current=re,(!S||!ee.length)&&w(Aa(re))),_&&N.current.onHighlight(re)},[re,S,_]),(0,V.useEffect)(()=>{if(!E)return;let e=Date.parse(E.from),t=Date.parse(E.to);h&&(Number.isFinite(e)&&eh.to)&&D(null)},[h?.from,h?.to,E]),(0,V.useEffect)(()=>{N.current.onRangePending?.(!!E)},[!!E]),(0,V.useEffect)(()=>{N.current.onRangeChange?.(E?{from:Date.parse(E.from),to:Date.parse(E.to)}:void 0)},[E]),(0,V.useEffect)(()=>{D(null)},[f]),(0,V.useEffect)(()=>()=>{N.current.onHighlight(void 0),N.current.onRangePending?.(!1),N.current.onRangeChange?.(void 0)},[]);let oe=(e,t=!1)=>{if(e){if(x(n(e)),t&&ie&&re){let t=E?.anchor??Aa(re),n=P.get(t),r=E?.window??(n&&g?.(n)),i=g?.(e);if(r&&i){let e=Math.max(h.from,Math.min(r.from,i.from)),n=Math.min(h.to,Math.max(r.to,i.to));Number.isFinite(e)&&Number.isFinite(n)&&e{if(!re)return;let n=z[Math.max(0,Math.min(z.length-1,z.indexOf(re.event.seriesName)+t))],r=e.filter(e=>e.event.seriesName===n),i=I(re),a=r.find(e=>I(e)===i),o=typeof i==`number`?r.reduce((e,t)=>{let n=I(t),r=e&&I(e);return typeof n==`number`&&(!e||typeof r!=`number`||Math.abs(n-i){e===`ArrowLeft`||e===`ArrowRight`?oe(ae[Math.max(0,Math.min(ae.length-1,B+(e===`ArrowLeft`?-1:1)))],t):!t&&(e===`ArrowUp`||e===`ArrowDown`)?se(e===`ArrowUp`?-1:1):!t&&(e===`Home`||e===`End`)&&oe(e===`Home`?ae[0]:ae.at(-1))},le=()=>{D(null),O.current?.focus()},ue=ie?`←→ points · ↑↓ series · Enter drill · Shift+←→ range`:`←→ points · ↑↓ series · Enter drill`;return(0,V.useLayoutEffect)(()=>(j?.setHint(_?ue:void 0),()=>j?.setHint(void 0)),[j,_,ue]),(0,V.useLayoutEffect)(()=>{let e=M.current;if(!e)return;N.current.onRangeBarHeight?.(e.getBoundingClientRect().height);let t=new ResizeObserver(([t])=>{if(!t)return;let n=getComputedStyle(e),r=[n.paddingTop,n.paddingBottom,n.borderTopWidth,n.borderBottomWidth].reduce((e,t)=>e+(parseFloat(t)||0),0);N.current.onRangeBarHeight?.(t.borderBoxSize?.[0]?.blockSize??t.contentRect.height+r)});return t.observe(e),()=>{t.disconnect(),N.current.onRangeBarHeight?.(0)}},[!!(E&&ie)]),(0,H.jsxs)(o,{ref:O,"data-chart-plot":!0,tabIndex:0,role:`application`,"aria-roledescription":`chart`,"aria-label":t,"aria-describedby":A,"data-mantine-stop-propagation":E?`true`:void 0,className:`chart-keyboard-point`,style:{position:`relative`,height:p,width:`100%`,flex:`1 1 auto`,minHeight:0,minWidth:0},onPointerDownCapture:e=>{M.current?.contains(e.target)||(k.current=!0,v(!1),_&&N.current.onHighlight(void 0),N.current.onActiveChange?.(!1))},onFocus:e=>{e.target!==e.currentTarget||k.current||(N.current.onActiveChange?.(!0),v(!0))},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(v(!1),D(null),x(``),N.current.onHighlight(void 0),N.current.onActiveChange?.(!1))},onKeyDown:e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey||e.nativeEvent.isComposing)return;if(e.key===`Escape`&&!e.repeat){E?(e.preventDefault(),e.stopPropagation(),le()):e.target===e.currentTarget&&!e.currentTarget.closest(`[data-panel-fullscreen],[data-fragment-fullscreen]`)&&(e.preventDefault(),e.stopPropagation(),e.currentTarget.blur());return}if(e.target!==e.currentTarget||e.repeat&&![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key))return;let t=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key);if(t&&!_&&(k.current=!1,v(!0),N.current.onActiveChange?.(!0),!re)){e.preventDefault();return}e.key===`Enter`&&_&&!e.shiftKey&&re&&i&&(!a||a(re.event))?(e.preventDefault(),i(re.event)):t&&(!e.shiftKey||e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),ce(e.key,e.shiftKey))},children:[r,(0,H.jsx)(o,{"data-chart-overlay":!0,style:{position:`absolute`,inset:0,zIndex:1,pointerEvents:`none`,overflow:`hidden`},children:E&&ie&&(0,H.jsxs)(y,{ref:M,"data-chart-range-bar":!0,gap:6,style:{...Ma,position:`absolute`,bottom:4,left:4,right:4,maxHeight:`100%`,overflow:`auto`,pointerEvents:`auto`},children:[(0,H.jsx)(T,{"data-chart-range-label":!0,size:`xs`,title:E.from+` – `+E.to,truncate:!0,style:{flex:`1 1 140px`,minWidth:0},children:ja(E)}),(0,H.jsx)(C,{size:`compact-xs`,"data-mantine-stop-propagation":`true`,onClick:()=>{m(Date.parse(E.from),Date.parse(E.to)),le()},children:`Zoom to range`}),(0,H.jsx)(C,{size:`compact-xs`,variant:`subtle`,"data-mantine-stop-propagation":`true`,onClick:le,children:`Cancel`})]})}),(0,H.jsx)(Ve,{id:A,children:ue}),(0,H.jsx)(Ve,{"aria-live":`polite`,"aria-atomic":`true`,children:b})]})}var Ia=new Set([`id`,`http`,`https`,`rpc`,`grpc`,`cpu`,`sql`,`url`,`uri`,`ip`,`io`,`db`,`gc`,`tls`,`api`]),La={ms:`ms`,ns:`ns`,s:`s`,us:`µs`,bytes:`bytes`,percent:`%`,ratio:`ratio`,per_second:`/s`,per_minute:`/min`},Ra={body_template:`message template`,parquet_index:`traces`};function za(e,t){let n=typeof e==`string`?e:e.name,r=t?.options?.columns?.find(e=>e.field===n)?.unit??(typeof e==`string`?void 0:e.unit)??(typeof e!=`string`&&e.role===`measure`?t?.unit:void 0),i=Ra[n]??n;/\b(?:duckdb|parquet|sqlite|variant|timestamptz_ns|timestamp_ns)\b|\btelemetry\./i.test(i)&&(i=`value`),i=i.replace(/^(\w+)\(([^()]*)\)$/,(e,t,n)=>[t,n].filter(Boolean).join(`_`));let a=i.match(/_(ms|ns|us|s|bytes|percent)$/i);a&&(i=i.slice(0,-a[0].length));let o=r??a?.[1]?.toLowerCase();return i=i.split(`_`).map((e,t)=>/^p\d+$/i.test(e)||Ia.has(e.toLowerCase())?e.toUpperCase():t===0?e.charAt(0).toUpperCase()+e.slice(1):e).join(` `),i+(o&&o!==`none`&&o!==`count`?` (${La[o]??o})`:``)}function Ba(e){return e===`healthy`?`ok`:e===`degraded`?`warn`:e===`unknown`?`gray`:`bad`}function Va(e){return ft[e?`dark`:`light`]}function Ha(e){let t=e?5:7;return{ok:mt[t],warn:ht[t],bad:Et[t],info:Dt[t]}}function Ua(e,t){return xt[t?`dark`:`light`][e]??Va(t).muted}function Wa(e){return e===`unhealthy`?`diamond`:e===`degraded`?`roundRect`:`circle`}function Ga(e){return e===`unknown`?`dashed`:`solid`}var Ka=e=>typeof e==`number`&&Number.isFinite(e)?e:null;function qa(e){return e.columns.flatMap((e,t)=>e.role===`measure`?[t]:[])}function Ja(e){let t=e.columns.findIndex(e=>e.role===`time`);if(t<0)return[];let n=e.columns.findIndex(e=>e.role===`dimension`),r=qa(e);if(n>=0&&r.length>0){let i=r[0],a=new Map;for(let r=0;r({name:e.columns[n].name,unit:e.columns[n].unit,points:e.values[t].map((t,r)=>[Number(t),Ka(e.values[n][r])])}))}function Ya(e){let t=e.columns.flatMap((e,t)=>e.role===`dimension`?[t]:[]),n=qa(e);if(t.length===0||n.length===0)return{categories:[],series:[]};let r=t[0],i=[];for(let t=0;t1){let a=t[1],o=n[0],s=new Map;for(let t=0;tnull)),s.get(n)[i.indexOf(String(e.values[r][t]??``))]=Ka(e.values[o][t])}return{categories:i,series:[...s.entries()].map(([t,n])=>({name:t,unit:e.columns[o].unit,values:n}))}}return{categories:i,series:n.map(t=>({name:e.columns[t].name,unit:e.columns[t].unit,values:e.values[t].map(Ka)}))}}function Xa(e,t){let n=e.filter(e=>e!==null);if(n.length===0)return null;switch(t){case`last`:return n[n.length-1];case`min`:return Math.min(...n);case`max`:return Math.max(...n);case`sum`:return n.reduce((e,t)=>e+t,0);default:return n.reduce((e,t)=>e+t,0)/n.length}}function Za(e,t){let n=qa(t)[0];return n===void 0?null:(e.reduce??`window`)===`window`?t.totals?Ka(t.totals[n]):Xa(t.values[n].map(Ka),`mean`):Xa(t.values[n].map(Ka),e.reduce??`mean`)}function Qa(e){let t=qa(e)[0];return t===void 0?[]:e.values[t].map(Ka)}var $a={ok:0,warn:1,bad:2};function eo(e){if(!e?.length)return;let t=[...e].sort((e,t)=>$a[e.status]-$a[t.status]),n=t[0],r=t[t.length-1];return $a[r.status]>$a[n.status]&&r.value!==n.value?r.value>n.value?`lower`:`higher`:`lower`}function to(e,t,n){if(e===null||!t||t.length===0)return null;n??=eo(t);let r=`ok`;for(let i of t)(n===`lower`?e>=i.value:e<=i.value)&&$a[i.status]>$a[r]&&(r=i.status);return r}function no(e,t){let n=Ct(e),r=Ct(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function ro(e,t){return`rgba(${[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)).join(`, `)}, ${t})`}function io(e,t){return{color:e,...no(e,t.surface)<3?{borderColor:t.text,borderWidth:1}:{}}}function ao(e,t){return{color:e,...no(e,t.surface)<3?{shadowColor:t.text,shadowBlur:2}:{}}}function oo(e,t){return{ok:mt,warn:ht,bad:Et}[e][t?5:8]}function so(e){let t=Va(e),n=Ha(e);return{dark:e,text:t.text,muted:t.muted,grid:t.grid,surface:t.surface,border:t.border,status:{ok:n.ok,warn:n.warn,bad:n.bad},font:wt.display}}function co(e,t,n){if(!Array.isArray(e.series))return e;let r=e.series,i=Array.isArray(e.yAxis)?e.yAxis:[e.yAxis],a=[],o=r.map((e,o)=>{let s=e.endLabel;if(!s?.show||!Array.isArray(e.data))return e;let c;for(let t=e.data.length-1;t>=0;t--){let n=e.data[t];if(Array.isArray(n)&&typeof n[1]==`number`&&Number.isFinite(n[1])){c=n;break}}let l=i[Number(e.yAxisIndex??0)];if(!c||!l)return{...e,endLabel:{...s,show:!1}};let u=l.type===`log`?Math.log:e=>e,d=l.min??1/0,f=l.max??0;if(l.type===`log`&&(l.min===void 0||l.max===void 0)){for(let t of r)if(Number(t.yAxisIndex??0)===Number(e.yAxisIndex??0)&&Array.isArray(t.data))for(let e of t.data)Array.isArray(e)&&typeof e[1]==`number`&&Number.isFinite(e[1])&&e[1]>0&&(l.min===void 0&&(d=Math.min(d,e[1])),l.max===void 0&&(f=Math.max(f,e[1])))}Number.isFinite(d)||(d=1);let p=u(l.type===`log`?d:l.min??0),m=u(l.type===`log`?Math.max(f,d*1.01):l.max??1),h=n?.(o,c),g=Number.isFinite(h)?h:t.y+t.height*(1-(u(c[1])-p)/(m-p)),_=((s.lineHeight??14)+2)/2,v=[Math.max(t.y+_,Math.min(t.y+t.height-_,g)),...a.flatMap(e=>[e.y-e.half-_,e.y+e.half+_])].filter(e=>Number.isFinite(e)&&e-_>=t.y&&e+_<=t.y+t.height&&a.every(t=>Math.abs(t.y-e)>=t.half+_)).sort((e,t)=>Math.abs(e-g)-Math.abs(t-g))[0];return v===void 0?{...e,endLabel:{...s,show:!1}}:(a.push({y:v,half:_}),{...e,labelLayout:{dy:v-g,hideOverlap:!0}})});return{...e,series:o}}var lo=(e,t,n)=>ra(e)?n.muted:Ua(t,n.dark);function uo(e,t){let n=Ja(e);if(!e.columns.some(e=>e.role===`dimension`))for(let r of n)r.name=za(e.columns.find(e=>e.name===r.name)??r.name,t);return oa(n,t)}function fo(e,t){return{animationDuration:200,textStyle:{fontFamily:e.font,color:e.muted,fontSize:11},grid:{left:8,right:16,top:28,bottom:8,containLabel:!0},tooltip:{trigger:`axis`,formatter:na(e=>va(t,e)),confine:!0,backgroundColor:e.surface,borderColor:e.border,textStyle:{color:e.text,fontSize:12},valueFormatter:e=>va(t,e),axisPointer:{type:`line`,lineStyle:{color:e.border}}},aria:{enabled:!0}}}function po(e,t,n,r){return(e.thresholds??[]).map(i=>({yAxis:i.value,label:{formatter:`${i.label??i.status} ${ya(r??e.unit)(i.value).replace(/(?<=\d)(ms|s|m|h)$/,` $1`)}`,position:i.value<=(n.min+n.max)/2?`insideEndTop`:`insideEndBottom`,distance:8,color:t.muted,textBorderColor:t.surface,textBorderWidth:3,fontSize:12},lineStyle:{color:t.status[i.status],type:[4,3],width:1}}))}function mo(e,t,n,r={width:500,height:248}){let i=t.frame?uo(t.frame,e):{shown:[],hidden:0},a=i.shown,o=a[0]?.unit??e.unit,s=new Set(a.map(e=>e.name)),c=a.find(e=>ra(e.name)),l=t.previous&&t.shift_ms!==void 0?uo(t.previous,e).shown.flatMap(e=>ra(e.name)?c?[e]:[]:s.has(e.name)?[e]:[]):[],u=[...new Set([...a,...l].map(t=>t.unit??e.unit))];u.length===0&&u.push(e.unit);let d=e.options?.style??`line`,f=a.length>=2&&a.length<=6&&i.hidden===0&&d!==`bars`&&d!==`stacked`,p=f?Math.max(40,...a.map(e=>{let t=Array.from(e.name).slice(0,24).join(``);return r.measureText?.(t,`12px ${n.font}`)??Array.from(t).length*7.2}))+12:0,m=f?p+8:0,h=(e.options?.legend??`auto`)!==`hidden`&&a.length>1,g=ca(a.map(e=>e.name),r.width,h,n.text,n.font,r.measureText),_=r.height-g.top-(i.hidden?24:8)-22,v=Math.max(0,Math.floor(_/16)),y=t.shift_ms,b=u.map(t=>{let n=[...a,...l].filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.points.flatMap(([,e])=>e===null?[]:[e]));if(d===`stacked`){let r=new Map;for(let n of a.filter(n=>(n.unit??e.unit)===t))for(let[e,t]of n.points){let n=r.get(e)??{positive:0,negative:0};t!==null&&(t>0?n.positive+=t:n.negative+=t),r.set(e,n)}n.push(...[...r.values()].flatMap(e=>[e.positive,e.negative]))}return Ca(Math.min(0,...n),Math.max(0,...n),t,_)}),x=a.map((t,r)=>{let i=lo(t.name,r,n);return{name:t.name,interactive:!0,yAxisIndex:u.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>va(t.unit??e.unit,n)},type:d===`bars`||d===`stacked`?`bar`:`line`,data:t.points,endLabel:f?{show:r0?{symbol:[`none`,`none`],silent:!0,data:po(e,n,b[0],o)}:void 0}}),S=y===void 0?[]:l.map(t=>({name:`${t.name} · previous`,interactive:!1,yAxisIndex:u.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>va(t.unit??e.unit,n)},type:`line`,data:t.points.map(([e,t])=>[e+y,t]),showSymbol:!1,silent:!0,z:1,lineStyle:{width:1,type:`dashed`,color:n.muted},itemStyle:{color:n.muted}})),C=u.map((t,r)=>({...e.options?.scale===`log`?{splitNumber:xa(_)}:b[r],type:e.options?.scale===`log`?`log`:`value`,position:r===0?`left`:`right`,offset:Math.max(0,r-1)*56,axisLine:{show:!1},splitLine:{show:r===0,lineStyle:{color:n.grid}},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,hideOverlap:!0,formatter:ya(t)}}));return co({...fo(n,o),tooltip:{...fo(n,o).tooltip,formatter:na((t,n)=>va([...a,...l].find(e=>e.name===n||`${e.name} · previous`===n)?.unit??e.unit,t),!0)},legend:g.option,grid:{left:8,right:16+(f?m:0)+Math.max(0,u.length-2)*56,top:g.top,bottom:i.hidden?24:8,containLabel:!0},xAxis:{type:`time`,min:t.from_ms,max:t.to_ms,axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,hideOverlap:!0,formatter:Ea}},yAxis:C.length===1?C[0]:C,series:[...x,...S],graphic:sa(i.hidden,n.muted)},{y:g.top,height:_})}function ho(e,t,n){if(n(e)<=t)return e;let r=Array.from(e);for(let e=r.length-1;e>0;e--){let i=Math.floor(e*.45),a=e-i,o=r.slice(0,i).join(``)+`…`+r.slice(-a).join(``);if(n(o)<=t)return o}return`…`}function go(e,t,n,r={width:500,height:248}){let i=Ya(t);if(t.columns.filter(e=>e.role===`dimension`).length<2)for(let n of i.series)n.name=za(t.columns.find(e=>e.name===n.name)??n.name,e);let a=i.categories,{shown:o,hidden:s}=oa(i.series,e),c=t.columns.flatMap((e,t)=>e.role===`dimension`?[t]:[]),l=new Map;for(let n=0;nString(t.values[e][n]??``))),{dimensions:r,...i})}let u=o[0]?.unit??e.unit,d=[...new Set(o.map(t=>t.unit??e.unit))];d.length===0&&d.push(e.unit);let f=o.length>1,p=!!(t.periods?.[`Before deploy`]||t.periods?.[`Since deploy`]),m=e=>r.measureText?.(e,`11px ${n.font}`)??Array.from(e).length*6.6,h=Math.min(r.width*.4,Math.max(40,...a.map(m))),g=ca(o.map(e=>e.name),r.width,f&&e.options?.legend!==`hidden`,n.text,n.font,r.measureText),_=d.map((t,i)=>({...Ca(Math.min(0,...o.filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.values.filter(e=>e!==null))),Math.max(0,...o.filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.values.filter(e=>e!==null))),t,r.width-h-80),type:`value`,position:i===0?`bottom`:`top`,offset:Math.max(0,i-1)*36,splitLine:{show:i===0,lineStyle:{color:n.grid}},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,formatter:e=>ba(t,e),hideOverlap:!0}}));return{...fo(n,u),tooltip:{...fo(n,u).tooltip,formatter:na((t,n)=>va(o.find(e=>e.name===n)?.unit??e.unit,t)),axisPointer:{type:`shadow`}},legend:g.option,grid:{left:8,right:56,top:(f?g.top:8)+Math.max(0,d.length-1)*36,bottom:s?24:8,containLabel:!0},yAxis:{type:`category`,inverse:!0,data:a,splitLine:{show:!1},axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,width:h,overflow:`truncate`,formatter:e=>ho(e,h,m)}},xAxis:_.length===1?_[0]:_,series:o.map((t,r)=>({name:t.name,interactive:!0,xAxisIndex:d.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>va(t.unit??e.unit,n)},type:`bar`,data:t.values.map((e,n)=>({value:e,selection:l.get(JSON.stringify(c.length>1?[a[n],t.name]:[a[n]]))})),barMaxWidth:p&&t.name===`Before deploy`?7:14,barGap:`20%`,itemStyle:{...io(p?t.name===`Before deploy`?n.muted:Ua(0,n.dark):lo(t.name,r,n),n),borderRadius:[0,4,4,0]},label:{show:p?t.name===`Since deploy`:!f||r===0,position:`right`,color:n.text,fontFamily:n.font,fontSize:11,formatter:({value:n})=>ba(t.unit??e.unit,n)}})),graphic:sa(s,n.muted)}}function _o(e,t,n,r=e.unit,i={width:270,height:140}){let a=e.min??0,o=e.max??100,s=vo(e,a,o,n),c=va(r,t),l=to(t,e.thresholds,e.better),u=l===`bad`?`◆ Bad`:l===`warn`?`■ Warn`:l===`ok`?`● OK`:t===null?`○ Unknown`:void 0,d=e=>`${e}40`,f=i.measureText?.(c,`600 28px ${n.font}`)??c.length*28*.6,p=i.measureText?.(u??``,`11px ${n.font}`)??(u?.length??0)*11*.6,m=i.width{let r=y;return y=e,{type:`rect`,shape:{x:4+r*_,y:g,width:(e-r)*_,height:10,r:[n===0?5:0,n===s.length-1?5:0,n===s.length-1?5:0,n===0?5:0]},style:{fill:d(t)}}}),{id:`gauge-fill`,type:`rect`,shape:{x:4,y:g,width:v*_,height:10,r:5},style:{fill:l?n.status[l]:Ua(0,n.dark)}},{id:`gauge-marker`,type:`rect`,shape:{x:3+v*_,y:g-2,width:2,height:14,r:1},style:{fill:n.text}},{type:`text`,left:4,top:g+12,style:{text:va(r,a),fill:n.muted,fontSize:11,fontFamily:n.font}},{type:`text`,right:4,top:g+12,style:{text:va(r,o),fill:n.muted,fontSize:11,fontFamily:n.font}}]}}function vo(e,t,n,r){let i=n-t||1,a=[t,...(e.thresholds??[]).map(e=>Math.min(n,Math.max(t,e.value))),n].sort((e,t)=>e-t),o=[];for(let t=0;t[(e.end-t)/i,r.status[e.status]])}var yo=function(e,t){return yo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},yo(e,t)};function U(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);yo(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var bo=`12px sans-serif`,xo=20,So=100,Co=`007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N`;function wo(e){var t={};if(typeof JSON>`u`)return t;for(var n=0;n=0)s=o*n.length;else for(var c=0;c=zo&&(Ro=0),Ro++}function Vo(){var e=[...arguments];typeof console<`u`&&console.error.apply(console,e)}function Ho(e){if(typeof e!=`object`||!e)return e;var t=e,n=ko.call(e);if(n===`[object Array]`){if(!xs(e)){t=[];for(var r=0,i=e.length;r`u`&&typeof self<`u`?Ns.worker=!0:!Ns.hasGlobalWindow||`Deno`in window||typeof navigator<`u`&&typeof navigator.userAgent==`string`&&navigator.userAgent.indexOf(`Node.js`)>-1?(Ns.node=!0,Ns.svgSupported=!0):Ps(navigator.userAgent,Ns);function Ps(e,t){var n=t.browser,r=e.match(/Firefox\/([\d.]+)/),i=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),a=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);if(r&&(n.firefox=!0,n.version=r[1]),i&&(n.ie=!0,n.version=i[1]),a&&(n.edge=!0,n.version=a[1],n.newEdge=+a[1].split(`.`)[0]>18),o&&(n.weChat=!0),t.svgSupported=typeof SVGRect<`u`,t.touchEventsSupported=`ontouchstart`in window&&!n.ie&&!n.edge,t.pointerEventsSupported=`onpointerdown`in window&&(n.edge||n.ie&&+n.version>=11),t.domSupported=typeof document<`u`){var s=document.documentElement.style;t.transform3dSupported=(n.ie&&`transition`in s||n.edge||`WebKitCSSMatrix`in window&&`m11`in new WebKitCSSMatrix||`MozPerspective`in s)&&!(`OTransition`in s),t.transformSupported=t.transform3dSupported||n.ie&&+n.version>=9}}var Fs=1e-4,Is=20;function Ls(e){return e.replace(/^\s+|\s+$/g,``)}var Rs=Math.min,zs=Math.max,Bs=Math.abs,Vs=Math.round,Hs=Math.floor,Us=Math.ceil,Ws=Math.pow,Gs=Math.log,Ks=Math.LN10,qs=Math.PI,Js=Math.random;function Ys(e,t,n,r){var i=t[0],a=t[1],o=n[0],s=n[1],c=a-i,l=s-o;if(c===0)return l===0?o:(o+s)/2;if(r){if(c>0){if(e<=i)return o;if(e>=a)return s}else if(e>=i)return o;else if(e<=a)return s}else{if(e===i)return o;if(e===a)return s}return(e-i)/c*l+o}var Xs=Zs;function Zs(e,t,n){switch(e){case`center`:case`middle`:e=`50%`;break;case`left`:case`top`:e=`0%`;break;case`right`:case`bottom`:e=`100%`}return Qs(e,t,n)}function Qs(e,t,n){return Y(e)?$s(e)?parseFloat(e)/100*t+(n||0):parseFloat(e):e==null?NaN:+e}function $s(e){return!!Ls(e).match(/%$/)}function ec(e,t,n){return isNaN(t)?n?``+e:+e:(t=Rs(zs(0,t),Is),e=(+e).toFixed(t),n?e:+e)}function tc(e){return e.sort(function(e,t){return e-t}),e}function nc(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,n=0;n<15;n++,t*=10)if(Vs(e*t)/t===e)return n}return rc(e)}function rc(e){var t=e.toString().toLowerCase(),n=t.indexOf(`e`),r=n>0?+t.slice(n+1):0,i=n>0?n:t.length,a=t.indexOf(`.`);return zs(0,(a<0?0:i-1-a)-r)}function ic(e,t,n){var r=Bs(e[1]-e[0]);if(!isFinite(r)||r===0)return NaN;var i=Gs(2*Bs(n||1)*Bs(r))/Ks,a=Gs(Bs(t))/Ks,o=zs(0,Us(-i+a));return isFinite(o)||(o=NaN),o}function ac(e,t){var n=zs(nc(e),nc(t)),r=e+t;return n>Is?r:ec(r,n)}var oc=Ws(2,53)-1;function sc(e){var t=qs*2;return(e%t+t)%t}function cc(e){return e>-Fs&&e=10&&t++,t}function pc(e,t){var n=fc(e),r=Ws(10,n),i=e/r;return e=(t===2?1:t?i<1.5?1:i<2.5?2:i<4?3:i<7?5:10:i<1?1:i<2?2:i<3?3:i<5?5:10)*r,ec(e,-n)}function mc(e){e.sort(function(e,t){return s(e,t,0)?-1:1});for(var t=-1/0,n=1,r=0;r0?e.length:0),this.item=null,this.key=NaN,this},e.prototype.next=function(){return(this._step>0?this._idx=this._end)&&(this.item=this._list[this._idx],this.key=this._idx+=this._step,!0)},e})();function ul(){return[1/0,-1/0]}function dl(e,t){hl(t)&&(te[1]&&(e[1]=t))}function fl(e,t){hl(t)&&te[1]&&(e[1]=t)}function ml(e,t){gl(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function hl(e){return e!=null&&isFinite(e)}function gl(e,t){return hl(e)&&hl(t)&&e<=t}function _l(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function vl(e){gl(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function yl(){var e=`__ec_once_`+bl++;return function(t,n){Z(t,e)||(t[e]=1,n())}}var bl=_c();function xl(e,t,n){var r=Es(),i=0;G(e,function(a){var o=t(a),s=r.get(o)||0;n&&n(a,s),!s&&!n&&(e[i++]=a),r.set(o,s+1)}),n||(e.length=i)}function Sl(e){return e.value+``}function Cl(e){return e+``}function wl(e,t){return X(t,!0)?e.seriesIndex+2:0}function Tl(e,t,n){var r=e.getData().count();return{progressiveRender:n.progressiveEnabled&&t.incrementalPrepareRender&&r>=n.threshold,large:e.get(`large`)&&r>=e.get(`largeThreshold`),modDataCount:e.get(`progressiveChunkMode`)===`mod`?e.getData().count():null}}function El(e){return{overallReset:e}}var Dl=`.`,Ol=`___EC__COMPONENT__CONTAINER___`,kl=`___EC__EXTENDED_CLASS___`;function Al(e){var t={main:``,sub:``};if(e){var n=e.split(Dl);t.main=n[0]||``,t.sub=n[1]||``}return t}function jl(e){_s(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),`componentType "`+e+`" illegal`)}function Ml(e){return!!(e&&e[kl])}function Nl(e,t){e.$constructor=e,e.extend=function(e){var t=this,n;return Pl(t)?n=function(e){U(t,e);function t(){return e.apply(this,arguments)||this}return t}(t):(n=function(){(e.$constructor||t).apply(this,arguments)},Jo(n,this)),W(n.prototype,e),n[kl]=!0,n.extend=this.extend,n.superCall=Rl,n.superApply=zl,n.superClass=t,n}}function Pl(e){return rs(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function Fl(e,t){e.extend=t.extend}var Il=Math.round(Math.random()*10);function Ll(e){var t=[`__\0is_clz`,Il++].join(`_`);e.prototype[t]=!0,e.isInstance=function(e){return!!(e&&e[t])}}function Rl(e,t){var n=[...arguments].slice(2);return this.superClass.prototype[t].apply(e,n)}function zl(e,t,n){return this.superClass.prototype[t].apply(e,n)}function Bl(e){var t={};e.registerClass=function(e){var r=e.type||e.prototype.type;if(r){jl(r),e.prototype.type=r;var i=Al(r);if(!i.sub)t[i.main]=e;else if(i.sub!==Ol){var a=n(i);a[i.sub]=e}}return e},e.getClass=function(e,n,r){var i=t[e];if(i&&i[Ol]&&(i=n?i[n]:null),r&&!i)throw Error(n?`Component `+e+`.`+(n||``)+` is used but not imported.`:e+`.type should be specified.`);return i},e.getClassesByMainType=function(e){var n=Al(e),r=[],i=t[n.main];return i&&i[Ol]?G(i,function(e,t){t!==Ol&&r.push(e)}):r.push(i),r},e.hasClass=function(e){return!!t[Al(e).main]},e.getAllClassMainTypes=function(){var e=[];return G(t,function(t,n){e.push(n)}),e},e.hasSubTypes=function(e){var n=t[Al(e).main];return n&&n[Ol]};function n(e){var n=t[e.main];return(!n||!n[Ol])&&(n=t[e.main]={},n[Ol]=!0),n}}function Vl(e,t){for(var n=0;n=0||i&&qo(i,s)<0)){var c=n.getShallow(s,t);c!=null&&(a[e[o][0]]=c)}}return a}}var Hl=Vl([[`fill`,`color`],[`shadowBlur`],[`shadowOffsetX`],[`shadowOffsetY`],[`opacity`],[`shadowColor`]]),Ul=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return Hl(this,e,t)},e}(),Wl=function(){function e(e){this.value=e}return e}(),Gl=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new Wl(e);return this.insertEntry(t),t},e.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},e.prototype.remove=function(e){var t=e.prev,n=e.next;t?t.next=n:this.head=n,n?n.prev=t:this.tail=t,e.next=e.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),Kl=function(){function e(e){this._list=new Gl,this._maxSize=10,this._map={},this._maxSize=e}return e.prototype.put=function(e,t){var n=this._list,r=this._map,i=null;if(r[e]==null){var a=n.len(),o=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=n.head;n.remove(s),delete r[s.key],i=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new Wl(t),o.key=e,n.insertEntry(o),r[e]=o}return i},e.prototype.get=function(e){var t=this._map[e],n=this._list;if(t!=null)return t!==n.tail&&(n.remove(t),n.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),ql=new Kl(50);function Jl(e){if(typeof e==`string`){var t=ql.get(e);return t&&t.image}return e}function Yl(e,t,n,r,i){if(!e)return t;if(typeof e==`string`){if(t&&t.__zrImageSrc===e||!n)return t;var a=ql.get(e),o={hostEl:n,cb:r,cbPayload:i};return a?(t=a.image,!Zl(t)&&a.pending.push(o)):(t=Eo.loadImage(e,Xl,Xl),t.__zrImageSrc=e,ql.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}return e}function Xl(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;tu||d>f||p>m||h>g)return!1;var _=!(u=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height},e.prototype.contain=function(t,n){return e.contain(this,t,n)},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(e){Vu(this,e)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t?t.x:0,t?t.y:0,t?t.width:0,t?t.height:0)},e.copy=function(e,t){return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e},e.applyTransform=function(e,t,n){if(!n){e!==t&&Vu(e,t);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var r=n[0],i=n[3],a=n[4],o=n[5];e.x=t.x*r+a,e.y=t.y*i+o,e.width=t.width*r,e.height=t.height*i,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}Au.x=Mu.x=t.x,Au.y=Nu.y=t.y,ju.x=Nu.x=t.x+t.width,ju.y=Mu.y=t.y+t.height,Au.transform(n),Nu.transform(n),ju.transform(n),Mu.transform(n),e.x=Tu(Au.x,ju.x,Mu.x,Nu.x),e.y=Tu(Au.y,ju.y,Mu.y,Nu.y);var s=Eu(Au.x,ju.x,Mu.x,Nu.x),c=Eu(Au.y,ju.y,Mu.y,Nu.y);e.width=s-e.x,e.height=c-e.y},e.calculateTransform=function(e,t,n){var r=n.width/t.width,i=n.height/t.height;return e=$l(e||[]),nu(e,e,lu(qu,-t.x,-t.y)),iu(e,e,lu(qu,r,i)),nu(e,e,lu(qu,n.x,n.y)),e},e}(),zu=Ru.create,Bu=Ru.set,Vu=Ru.copy,Hu=Ru.calculateTransform,Uu=Ru.applyTransform,Wu=Ru.contain,Gu=new Ru(0,0,0,0),Ku=new Ru(0,0,0,0),qu=[];function Ju(e,t,n,r,i,a,o,s){var c=Du(t-n),l=Du(r-e),u=Tu(c,l),d=Ou[i],f=Ou[1-i],p=ku[i];t=l||!Pu.bidirectional)&&(Fu[d]=-l,Fu[f]=0,Pu.useDir&&Pu.calcDirMTV())))}function Yu(){var e=0,t=new wu,n=new wu,r={minTv:new wu,maxTv:new wu,useDir:!1,dirMinTv:new wu,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(i,a){r.touchThreshold=0,i&&i.touchThreshold!=null&&(r.touchThreshold=Eu(0,i.touchThreshold)),r.negativeSize=!1,a&&(r.minTv.set(1/0,1/0),r.maxTv.set(0,0),r.useDir=!1,i&&i.direction!=null&&(r.useDir=!0,r.dirMinTv.copy(r.minTv),n.copy(r.minTv),e=i.direction,r.bidirectional=i.bidirectional==null||!!i.bidirectional,r.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var a=r.minTv,o=r.dirMinTv,s=a.y*a.y+a.x*a.x,c=Math.sin(e),l=Math.cos(e),u=c*a.y+l*a.x;if(i(u)){i(a.x)&&i(a.y)&&o.set(0,0);return}if(n.x=s*l/u,n.y=s*c/u,i(n.x)&&i(n.y)){o.set(0,0);return}(r.bidirectional||t.dot(n)>0)&&n.len()=ed)){e||=`12px sans-serif`;for(var t=[],n=+new Date,r=0;r<=127;r++)t[r]=Eo.measureText(String.fromCharCode(r),e).width;var i=+new Date-n;return i>16?$u=ed:i>2&&$u++,t}}var $u=0,ed=5;function td(e,t){return e.asciiWidthMapTried||=(e.asciiWidthMap=Qu(e.font),!0),0<=t&&t<=127?e.asciiWidthMap==null?e.asciiCharWidth:e.asciiWidthMap[t]:e.stWideCharWidth}function nd(e,t){var n=e.strWidthCache,r=n.get(t);return r??(r=Eo.measureText(t,e.font).width,n.put(t,r)),r}function rd(e,t,n,r){var i=nd(Xu(t),e),a=sd(t);return new Ru(ad(0,i,n),od(0,a,r),i,a)}function id(e,t,n,r){var i=((e||``)+``).split(` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/panel-sql-editor-BFXSBGw8.js","assets/useRouter-ByJ6_rwb.js","assets/brand-DUaZkIz1.js","assets/index-CEp3GmPL.js","assets/useNavigate-B1zgPEUp.js","assets/preload-helper-EHBQhIeL.js","assets/Tooltip-B3r3s_B9.js","assets/index-ADB9ThEc.css"])))=>i.map(i=>d[i]); +import{a as e,i as t,o as n,r,s as i}from"./useRouter-ByJ6_rwb.js";import{A as a,C as o,D as s,E as c,K as l,M as u,O as d,P as f,Q as p,S as m,T as h,X as g,Y as _,Z as v,_ as y,_t as b,a as x,c as S,d as C,dt as w,f as T,ft as E,g as D,gt as O,h as k,j as A,k as j,lt as M,m as N,mt as P,nt as F,o as I,ot as L,p as ee,r as R,s as te,st as ne,tt as re,u as ie,ut as z,v as ae,x as B,y as oe}from"./brand-DUaZkIz1.js";import{c as se,l as ce,t as le}from"./preload-helper-EHBQhIeL.js";import{C as ue,E as de,b as fe,o as pe,t as me,w as he}from"./Tooltip-B3r3s_B9.js";import{a as ge,c as _e,d as ve,i as ye,l as be,n as xe,o as Se,r as Ce,s as we,t as Te,u as Ee}from"./dashboard-change-chips-DHVvGnTI.js";import{n as De,r as Oe,t as ke}from"./WarningCircle.es-DWFLwubM.js";import{A as Ae,At as je,B as Me,Bt as Ne,C as Pe,D as Fe,E as Ie,F as Le,Ft as Re,Gt as ze,H as Be,Ht as Ve,I as He,It as Ue,Jt as We,Kt as Ge,Lt as Ke,M as qe,Mt as Je,N as Ye,Nt as Xe,O as Ze,P as Qe,Pt as $e,Q as et,R as tt,Rt as nt,U as rt,Ut as it,V as at,W as ot,Wt as st,Xt as ct,Yt as lt,Zt as ut,_ as dt,a as ft,b as pt,c as mt,d as ht,h as gt,i as _t,j as vt,jt as yt,k as bt,l as xt,m as St,n as Ct,o as wt,qt as Tt,r as Et,s as Dt,t as Ot,u as kt,v as At,w as jt,x as Mt,zt as Nt}from"./index-CEp3GmPL.js";function Pt(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=Ft(e);if(n.length!==Ft(t).length)return!1;for(let r=0;r{if(typeof n!=`string`||n.trim().length===0)throw Error(t);return`${e}-${n}`}}var H=r();function Lt(e){return typeof e==`object`&&e?`base`in e?e.base:void 0:e}function Rt(e,t){if(e===t||Number.isNaN(e)&&Number.isNaN(t))return!0;if(!(e instanceof Object)||!(t instanceof Object))return!1;let n=Object.keys(e),{length:r}=n;if(r!==Object.keys(t).length)return!1;for(let i=0;i{r.current||=window.setTimeout(()=>{i(...e),r.current=null},t)},[t]),o=(0,V.useCallback)(()=>{r.current&&=(window.clearTimeout(r.current),null)},[]);return(0,V.useEffect)(()=>(n.autoInvoke&&a(),o),[o,a]),{start:a,clear:o}}function Ut(e){let t=(0,V.useRef)(void 0);return(0,V.useEffect)(()=>{t.current=e},[e]),t.current}function Wt(e,t,n){let r=(0,V.useRef)(null);(0,V.useEffect)(()=>{r.current&&=(r.current.disconnect(),null);let i=typeof n==`function`?n():n;return i&&(r.current=new MutationObserver(e),r.current.observe(i,t)),()=>{r.current&&=(r.current.disconnect(),null)}},[e,t,n])}function Gt(){let[e,t]=(0,V.useState)(!1);return(0,V.useEffect)(()=>t(!0),[]),e}function Kt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`}function qt(e,t=document){let n=t.querySelector(e);if(n)return n;let r=t.querySelectorAll(`*`);for(let t=0;t{if(!e||!t||!n.current)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=t.offsetWidth===0?1:i.width/t.offsetWidth,o=t.offsetHeight===0?1:i.height/t.offsetHeight,s=window.getComputedStyle(e),c=window.getComputedStyle(t),l=fe(s.borderTopWidth)+fe(c.borderTopWidth),u=fe(s.borderLeftWidth)+fe(c.borderLeftWidth),d={top:(r.top-i.top)/o-l,left:(r.left-i.left)/a-u,width:r.width/a,height:r.height/o};n.current.style.transform=`translateY(${d.top}px) translateX(${d.left}px)`,n.current.style.width=`${d.width}px`,n.current.style.height=`${d.height}px`},p=()=>{window.clearTimeout(o.current),n.current&&(n.current.style.transitionDuration=`0ms`),f(),o.current=window.setTimeout(()=>{n.current&&(n.current.style.transitionDuration=``)},30)},m=(0,V.useRef)(null),h=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(c&&s.current!==e&&i&&i(),s.current=e,f(),e)return m.current=new ResizeObserver(p),m.current.observe(e),t&&(h.current=new ResizeObserver(p),h.current.observe(t)),()=>{m.current?.disconnect(),h.current?.disconnect()}},[t,e]),(0,V.useEffect)(()=>{if(t){let e=e=>{Zt(e.target,t)&&(p(),d(!1))};return t.addEventListener(`transitionend`,e),()=>{t.removeEventListener(`transitionend`,e)}}},[t]),(0,V.useEffect)(()=>{if(n.current&&a){let e=e=>{e.propertyName===`transform`&&a()};return n.current.addEventListener(`transitionend`,e),()=>{n.current?.removeEventListener(`transitionend`,e)}}},[a]),Ht(()=>{ve()!==`test`&&l(!0)},20,{autoInvoke:!0}),Wt(e=>{e.forEach(e=>{e.type===`attributes`&&e.attributeName===`dir`&&p()})},{attributes:!0,attributeFilter:[`dir`]},()=>document.documentElement),{initialized:c,hidden:u}}var $t={root:`m_96b553a6`},en=g((e,{transitionDuration:t},{shouldReduceMotion:n})=>({root:{"--transition-duration":e.respectReducedMotion&&n?`0ms`:typeof t==`number`?`${t}ms`:t||`150ms`}})),tn=h(e=>{let t=u(`FloatingIndicator`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,target:d,parent:f,transitionDuration:m,mod:h,displayAfterTransitionEnd:g,onTransitionStart:_,onTransitionEnd:v,attributes:y,ref:b,...x}=t,S=p(),C=a({name:`FloatingIndicator`,classes:$t,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:y,vars:l,varsResolver:en,stylesCtx:{shouldReduceMotion:S}}),w=(0,V.useRef)(null),{initialized:T,hidden:E}=Qt({target:d,parent:f,ref:w,displayAfterTransitionEnd:g,onTransitionStart:_,onTransitionEnd:v}),D=re(b,w);return!d||!f?null:(0,H.jsx)(o,{ref:D,mod:[{initialized:T,hidden:E},h],...C(`root`),...x})});tn.displayName=`@mantine/core/FloatingIndicator`,tn.classes=$t,tn.varsResolver=en;var[nn,rn]=de(`Accordion component was not found in the tree`),[an,on]=de(`Accordion.Item component was not found in the tree`),sn={root:`m_9bdbb667`,panel:`m_df78851f`,content:`m_4ba554d4`,itemTitle:`m_8fa820a0`,control:`m_4ba585b8`,"control--default":`m_6939a5e9`,"control--contained":`m_4271d21b`,label:`m_df3ffa0f`,chevron:`m_3f35ae96`,icon:`m_9bd771fe`,item:`m_9bd7b098`,"item--default":`m_fe19b709`,"item--contained":`m_1f921b3b`,"item--filled":`m_2cdf939a`,"item--separated":`m_9f59b069`},cn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,chevron:s,icon:c,onClick:l,onKeyDown:d,children:f,disabled:p,mod:h,...g}=u(`AccordionControl`,null,e),{value:_}=on(),v=rn(),y=v.isItemActive(_),b=typeof v.order==`number`,x=`h${v.order}`,S=(0,H.jsxs)(m,{...v.getStyles(`control`,{className:n,classNames:t,style:r,styles:i,variant:v.variant}),unstyled:v.unstyled,mod:[`accordion-control`,{active:y,"chevron-position":v.chevronPosition,disabled:p},h],onClick:e=>{l?.(e),v.onChange(_)},type:`button`,disabled:p,"aria-expanded":y,"aria-controls":v.getRegionId(_),id:v.getControlId(_),onKeyDown:Tt({siblingSelector:`[data-accordion-control]`,parentSelector:`[data-accordion]`,activateOnFocus:!1,loop:v.loop,orientation:`vertical`,onKeyDown:d}),...g,children:[(0,H.jsx)(o,{component:`span`,mod:{rotate:!v.disableChevronRotation&&y,position:v.chevronPosition},...v.getStyles(`chevron`,{classNames:t,styles:i}),children:s||v.chevron}),(0,H.jsx)(`span`,{...v.getStyles(`label`,{classNames:t,styles:i}),children:f}),c&&(0,H.jsx)(o,{component:`span`,mod:{"chevron-position":v.chevronPosition},...v.getStyles(`icon`,{classNames:t,styles:i}),children:c})]});return b?(0,H.jsx)(x,{...v.getStyles(`itemTitle`,{classNames:t,styles:i}),children:S}):S});cn.displayName=`@mantine/core/AccordionControl`,cn.classes=sn;var ln=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:s,mod:c,...l}=u(`AccordionItem`,null,e),d=rn();return(0,H.jsx)(an,{value:{value:s},children:(0,H.jsx)(o,{mod:[{active:d.isItemActive(s)},c],...d.getStyles(`item`,{className:n,classNames:t,styles:i,style:r,variant:d.variant}),...l})})});ln.displayName=`@mantine/core/AccordionItem`,ln.classes=sn;var un=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,keepMounted:s,keepMountedMode:c,...l}=u(`AccordionPanel`,null,e),{value:d}=on(),f=rn();return(0,H.jsx)(Ee,{...f.getStyles(`panel`,{className:n,classNames:t,style:r,styles:i}),expanded:f.isItemActive(d),transitionDuration:f.transitionDuration??200,role:`region`,id:f.getRegionId(d),"aria-labelledby":f.getControlId(d),keepMounted:s??f.keepMounted,keepMountedMode:c??f.keepMountedMode,...l,children:(0,H.jsx)(`div`,{...f.getStyles(`content`,{classNames:t,styles:i}),children:o})})});un.displayName=`@mantine/core/AccordionPanel`,un.classes=sn;var dn={multiple:!1,loop:!0,disableChevronRotation:!1,disableCollapse:!1,chevronPosition:`right`,variant:`default`,chevronSize:`auto`,chevronIconSize:16,keepMountedMode:`activity`},fn=g((e,{transitionDuration:t,chevronSize:n,radius:r})=>({root:{"--accordion-transition-duration":t===void 0?void 0:`${t}ms`,"--accordion-chevron-size":n===void 0?void 0:P(n),"--accordion-radius":r===void 0?void 0:ne(r)}})),pn=c(e=>{let t=u(`Accordion`,dn,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,children:d,multiple:f,value:p,defaultValue:m,onChange:h,id:g,loop:_,transitionDuration:v,disableChevronRotation:y,disableCollapse:b,chevronPosition:x,chevronSize:S,order:C,chevron:w,variant:T,radius:E,chevronIconSize:D,attributes:O,keepMounted:k,keepMountedMode:A,...j}=t,M=F(g),[N,P]=ze({value:p,defaultValue:m,finalValue:f?[]:null,onChange:h}),I=e=>Array.isArray(N)?N.includes(e):e===N,L=e=>{if(!Array.isArray(N)&&b&&e===N)return;let t=Array.isArray(N)?N.includes(e)?N.filter(t=>t!==e):[...N,e]:e===N?null:e;P(t)},ee=a({name:`Accordion`,classes:sn,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:O,vars:l,varsResolver:fn});return(0,H.jsx)(nn,{value:{isItemActive:I,onChange:L,getControlId:It(`${M}-control`,`Accordion.Item component was rendered with invalid value or without value`),getRegionId:It(`${M}-panel`,`Accordion.Item component was rendered with invalid value or without value`),chevron:w===null?null:w||(0,H.jsx)(nt,{size:D}),transitionDuration:v,disableChevronRotation:y,chevronPosition:x,order:C,loop:_,getStyles:ee,variant:T,unstyled:c,keepMounted:k,keepMountedMode:A},children:(0,H.jsx)(o,{...ee(`root`),id:M,...j,variant:T,"data-accordion":!0,children:d})})});pn.classes=sn,pn.varsResolver=fn,pn.displayName=`@mantine/core/Accordion`,pn.Item=ln,pn.Panel=un,pn.Control=cn,pn.Chevron=nt;function mn(e){return typeof e==`string`?{value:e,label:e}:typeof e==`object`&&`value`in e&&!(`label`in e)?{value:e.value,label:`${e.value}`,disabled:e.disabled}:typeof e==`object`&&`group`in e?{group:e.group,items:e.items.map(e=>mn(e))}:typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?{value:e,label:`${e}`}:e}function hn(e){return e?e.map(e=>mn(e)):[]}function gn(e){return e.reduce((e,t)=>`group`in t?{...e,...gn(t.items)}:(e[`${t.value}`]=t,e),{})}var _n={dropdown:`m_88b62a41`,search:`m_985517d8`,options:`m_b2821a6e`,option:`m_92253aa5`,empty:`m_2530cd1d`,header:`m_858f94bd`,footer:`m_82b967cb`,group:`m_254f3e4f`,groupLabel:`m_2bb2e9e5`,chevron:`m_2943220b`,optionsDropdownOption:`m_390b5f4`,optionsDropdownCheckIcon:`m_8ee53fc2`,optionsDropdownCheckPlaceholder:`m_a530ee0a`},vn={error:null},yn=g((e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":M(t,`combobox-chevron-size`),"--combobox-chevron-color":n?l(n,e):void 0}})),bn=h(e=>{let t=u(`ComboboxChevron`,vn,e),{size:n,error:r,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,attributes:p,mod:m,...h}=t,g=a({name:`ComboboxChevron`,classes:_n,props:t,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,varsResolver:yn,attributes:p,rootSelector:`chevron`});return(0,H.jsx)(o,{component:`svg`,...h,...g(`chevron`),size:n,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,mod:[`combobox-chevron`,{error:r},m],children:(0,H.jsx)(`path`,{d:`M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})});bn.classes=_n,bn.varsResolver=yn,bn.displayName=`@mantine/core/ComboboxChevron`;var[xn,Sn]=de(`Combobox component was not found in tree`);function Cn({onMouseDown:e,onClick:t,onClear:n,...r}){return(0,H.jsx)(k.ClearButton,{tabIndex:-1,"aria-hidden":!0,...r,onMouseDown:t=>{t.preventDefault(),e?.(t)},onClick:e=>{n(),t?.(e)}})}Cn.displayName=`@mantine/core/ComboboxClearButton`;var wn=h(e=>{let{classNames:t,styles:n,className:r,style:i,hidden:a,...o}=u(`ComboboxDropdown`,null,e),s=Sn();return(0,H.jsx)(Ne.Dropdown,{...o,role:`presentation`,"data-hidden":a||void 0,"data-floating-height":s.floatingHeight||void 0,...s.getStyles(`dropdown`,{className:r,style:i,classNames:t,styles:n})})});wn.classes=_n,wn.displayName=`@mantine/core/ComboboxDropdown`;var Tn={refProp:`ref`},En=h(e=>{let{children:t,refProp:n,ref:r}=u(`ComboboxDropdownTarget`,Tn,e);if(Sn(),!w(t))throw Error(`Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);return(0,H.jsx)(Ne.Target,{ref:r,refProp:n,children:t})});En.displayName=`@mantine/core/ComboboxDropdownTarget`;var Dn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxEmpty`,null,e),c=Sn();return(0,H.jsx)(o,{...c.getStyles(`empty`,{className:n,classNames:t,styles:i,style:r}),...s})});Dn.classes=_n,Dn.displayName=`@mantine/core/ComboboxEmpty`;function On({onKeyDown:e,onClick:t,withKeyboardNavigation:n,withAriaAttributes:r,withExpandedAttribute:i,targetType:a,autoComplete:o}){let s=Sn(),[c,l]=(0,V.useState)(null),u=t=>{if(e?.(t),!s.readOnly&&n){if(t.nativeEvent.isComposing)return;if(t.nativeEvent.code===`ArrowDown`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectNextOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`ArrowUp`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectPreviousOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`Enter`||t.nativeEvent.code===`NumpadEnter`){if(t.nativeEvent.keyCode===229)return;let e=s.store.getSelectedOptionIndex();s.store.dropdownOpened&&e!==-1?(t.preventDefault(),s.store.clickSelectedOption()):a===`button`&&(t.preventDefault(),s.store.openDropdown(`keyboard`))}t.key===`Escape`&&s.store.closeDropdown(`keyboard`),t.nativeEvent.code===`Space`&&a===`button`&&(t.preventDefault(),s.store.toggleDropdown(`keyboard`))}},d=r?{...i?{role:`combobox`}:{},"aria-haspopup":`listbox`,"aria-expanded":i?!!(s.store.listId&&s.store.dropdownOpened):void 0,"aria-controls":s.store.dropdownOpened&&s.store.listId?s.store.listId:void 0,"aria-activedescendant":s.store.dropdownOpened&&c||void 0,autoComplete:o,"data-expanded":s.store.dropdownOpened||void 0,"data-mantine-stop-propagation":s.store.dropdownOpened||void 0}:{},f=e=>{a===`button`&&e.currentTarget.focus(),t?.(e)};return{...d,onKeyDown:u,onClick:f}}var kn={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},An=h(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:a,targetType:o,autoComplete:s,ref:c,...l}=u(`ComboboxEventsTarget`,kn,e),d=v(t);if(!d)throw Error(`Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=Sn(),p=On({targetType:o,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:a,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:s});return(0,V.cloneElement)(d,{...p,...l,[n]:re(c,f.store.targetRef,ue(d))})});An.displayName=`@mantine/core/ComboboxEventsTarget`;var jn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxFooter`,null,e),c=Sn();return(0,H.jsx)(o,{...c.getStyles(`footer`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});jn.classes=_n,jn.displayName=`@mantine/core/ComboboxFooter`;var Mn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:s,label:c,id:l,...d}=u(`ComboboxGroup`,null,e),f=Sn(),p=F(l),m=c!=null&&c!==!1&&c!==``;return(0,H.jsxs)(o,{role:`group`,"aria-labelledby":m?p:void 0,...f.getStyles(`group`,{className:n,classNames:t,style:r,styles:i}),...d,children:[m&&(0,H.jsx)(`div`,{id:p,...f.getStyles(`groupLabel`,{classNames:t,styles:i}),children:c}),s]})});Mn.classes=_n,Mn.displayName=`@mantine/core/ComboboxGroup`;var Nn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxHeader`,null,e),c=Sn();return(0,H.jsx)(o,{...c.getStyles(`header`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});Nn.classes=_n,Nn.displayName=`@mantine/core/ComboboxHeader`;function Pn({value:e,valuesDivider:t=`,`,...n}){return(0,H.jsx)(`input`,{type:`hidden`,value:Array.isArray(e)?e.join(t):e?`${e}`:``,...n})}Pn.displayName=`@mantine/core/ComboboxHiddenInput`;var Fn=h(e=>{let t=u(`ComboboxOption`,null,e),{classNames:n,className:r,style:i,styles:a,vars:s,onClick:c,id:l,active:d,onMouseDown:f,onMouseOver:p,disabled:m,selected:h,mod:g,..._}=t,v=Sn(),y=(0,V.useId)(),b=l||y;return(0,H.jsx)(o,{...v.getStyles(`option`,{className:r,classNames:n,styles:a,style:i}),"aria-disabled":m||void 0,..._,id:b,mod:[`combobox-option`,{"combobox-active":d,"combobox-disabled":m,"combobox-selected":h},g],role:`option`,onClick:e=>{m?e.preventDefault():(v.onOptionSubmit?.(t.value,t),c?.(e))},onMouseDown:e=>{e.preventDefault(),f?.(e)},onMouseOver:e=>{v.resetSelectionOnOptionHover&&v.store.resetSelectedOption(),p?.(e)}})});Fn.classes=_n,Fn.displayName=`@mantine/core/ComboboxOption`;var In=h(e=>{let{classNames:t,className:n,style:r,styles:i,id:a,onMouseDown:s,labelledBy:c,...l}=u(`ComboboxOptions`,null,e),d=Sn(),f=F(a);return(0,V.useEffect)(()=>{d.store.setListId(f)},[f]),(0,H.jsx)(o,{...d.getStyles(`options`,{className:n,style:r,classNames:t,styles:i}),...l,id:f,role:`listbox`,"aria-labelledby":c,onMouseDown:e=>{e.preventDefault(),s?.(e)}})});In.classes=_n,In.displayName=`@mantine/core/ComboboxOptions`;var Ln={withAriaAttributes:!0,withKeyboardNavigation:!0},Rn=h(e=>{let{classNames:t,styles:n,unstyled:r,vars:i,withAriaAttributes:a,onKeyDown:o,onClick:s,withKeyboardNavigation:c,size:l,ref:d,...f}=u(`ComboboxSearch`,Ln,e),p=Sn(),m=p.getStyles(`search`),h=On({targetType:`input`,withAriaAttributes:a,withKeyboardNavigation:c,withExpandedAttribute:!1,onKeyDown:o,onClick:s,autoComplete:`off`});return(0,H.jsx)(k,{ref:re(d,p.store.searchRef),classNames:[{input:m.className},t],styles:[{input:m.style},n],size:l||p.size,...h,...f,__staticSelector:`Combobox`})});Rn.classes=_n,Rn.displayName=`@mantine/core/ComboboxSearch`;var zn={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},Bn=h(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:a,targetType:o,autoComplete:s,ref:c,...l}=u(`ComboboxTarget`,zn,e),d=v(t);if(!d)throw Error(`Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=Sn(),p=On({targetType:o,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:a,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:s}),m=(0,V.cloneElement)(d,{...p,...l});return(0,H.jsx)(Ne.Target,{refProp:n,ref:re(c,f.store.targetRef),children:m})});Bn.displayName=`@mantine/core/ComboboxTarget`;function Vn(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].hasAttribute(`data-combobox-disabled`))return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].hasAttribute(`data-combobox-disabled`))return e}return e}function Hn(e,t,n){for(let n=e+1;n{s||(c(!0),i?.(e))},[c,i,s]),_=(0,V.useCallback)((e=`unknown`)=>{s&&(c(!1),r?.(e))},[c,r,s]),v=(0,V.useCallback)((e=`unknown`)=>{s?_(e):g(e)},[_,g,s]),y=(0,V.useCallback)(()=>{let e=Yt(f.current);qt(`#${l.current} [data-combobox-selected]`,e)?.removeAttribute(`data-combobox-selected`)},[]),b=(0,V.useCallback)(e=>{let t=Yt(f.current),n=qt(`#${l.current}`,t),r=n?Jt(`[data-combobox-option]`,n):null;if(!r)return null;let i=e>=r.length?0:e<0?r.length-1:e;return u.current=i,r?.[i]&&!r[i].hasAttribute(`data-combobox-disabled`)?(y(),r[i].setAttribute(`data-combobox-selected`,`true`),r[i].scrollIntoView({block:`nearest`,behavior:o}),r[i].id):null},[o,y]),x=(0,V.useCallback)(()=>{let e=Yt(f.current),t=qt(`#${l.current} [data-combobox-active]`,e);if(t){let n=Jt(`#${l.current} [data-combobox-option]`,e).findIndex(e=>e===t);return b(n)}return b(0)},[b]),S=(0,V.useCallback)(()=>{let e=Yt(f.current),t=Jt(`#${l.current} [data-combobox-option]`,e);return b(Hn(u.current,t,a))},[b,a]),C=(0,V.useCallback)(()=>{let e=Yt(f.current),t=Jt(`#${l.current} [data-combobox-option]`,e);return b(Vn(u.current,t,a))},[b,a]),w=(0,V.useCallback)(()=>{let e=Yt(f.current),t=Jt(`#${l.current} [data-combobox-option]`,e);return b(Un(t))},[b]),T=(0,V.useCallback)((e=`selected`,t)=>{if(typeof e==`number`){u.current=e;let n=Yt(f.current),r=Jt(`#${l.current} [data-combobox-option]`,n);t?.scrollIntoView&&r[e]?.scrollIntoView({block:`nearest`,behavior:o});return}h.current=window.setTimeout(()=>{let n=Yt(f.current),r=Jt(`#${l.current} [data-combobox-option]`,n),i=r.findIndex(t=>t.hasAttribute(`data-combobox-${e}`));u.current=i,t?.scrollIntoView&&r[i]?.scrollIntoView({block:`nearest`,behavior:o})},0)},[]),E=(0,V.useCallback)(()=>{u.current=-1,y()},[y]),D=(0,V.useCallback)(()=>{let e=Yt(f.current);(Jt(`#${l.current} [data-combobox-option]`,e)?.[u.current])?.click()},[]),O=(0,V.useCallback)(e=>{l.current=e},[]),k=(0,V.useCallback)(()=>{p.current=window.setTimeout(()=>d.current?.focus(),0)},[]),A=(0,V.useCallback)(()=>{m.current=window.setTimeout(()=>f.current?.focus(),0)},[]),j=(0,V.useCallback)(()=>u.current,[]);return(0,V.useEffect)(()=>()=>{window.clearTimeout(p.current),window.clearTimeout(m.current),window.clearTimeout(h.current)},[]),{dropdownOpened:s,openDropdown:g,closeDropdown:_,toggleDropdown:v,selectedOptionIndex:u.current,getSelectedOptionIndex:j,selectOption:b,selectFirstOption:w,selectActiveOption:x,selectNextOption:S,selectPreviousOption:C,resetSelectedOption:E,updateSelectedOptionIndex:T,listId:l.current,setListId:O,clickSelectedOption:D,searchRef:d,focusSearchInput:k,targetRef:f,focusTarget:A}}var Gn={keepMounted:!0,keepMountedMode:`display-none`,withinPortal:!0,resetSelectionOnOptionHover:!1,width:`target`,transitionProps:{transition:`fade`,duration:0},size:`sm`},Kn=g((e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":L(t),"--combobox-option-padding":M(t,`combobox-option-padding`)},dropdown:{"--combobox-padding":n===void 0?void 0:P(n),"--combobox-option-fz":L(t),"--combobox-option-padding":M(t,`combobox-option-padding`)}})),qn=e=>{let t=u(`Combobox`,Gn,e),{classNames:n,styles:r,unstyled:i,children:o,store:s,vars:c,onOptionSubmit:l,onClose:d,size:f,dropdownPadding:p,resetSelectionOnOptionHover:m,__staticSelector:h,readOnly:g,attributes:_,floatingHeight:v,middlewares:y,...b}=t,x=v===`viewport`?{...y,flip:!1,size:{...typeof y?.size==`object`?y.size:{},padding:typeof y?.size==`object`&&y.size.padding!==void 0?y.size.padding:10,apply:({availableHeight:e,availableWidth:t,elements:n,...r})=>{n.floating.style.setProperty(`--combobox-floating-max-height`,`${e}px`);let i=y?.size;typeof i==`object`&&i.apply?i.apply({availableHeight:e,availableWidth:t,elements:n,...r}):i&&Object.assign(n.floating.style,{maxWidth:`${t}px`,maxHeight:`${e}px`})}}}:y,S=Wn(),C=s||S,w=a({name:h||`Combobox`,classes:_n,props:t,classNames:n,styles:r,unstyled:i,attributes:_,vars:c,varsResolver:Kn}),T=()=>{d?.(),C.closeDropdown()};return(0,H.jsx)(xn,{value:{getStyles:w,store:C,onOptionSubmit:l,size:f,resetSelectionOnOptionHover:m,readOnly:g,floatingHeight:v},children:(0,H.jsx)(Ne,{opened:C.dropdownOpened,...b,middlewares:x,onChange:e=>!e&&T(),withRoles:!1,unstyled:i,children:o})})};qn.extend=e=>e,qn.classes=_n,qn.varsResolver=Kn,qn.displayName=`@mantine/core/Combobox`,qn.Target=Bn,qn.Dropdown=wn,qn.Options=In,qn.Option=Fn,qn.Search=Rn,qn.Empty=Dn,qn.Chevron=bn,qn.Footer=jn,qn.Header=Nn,qn.EventsTarget=An,qn.DropdownTarget=En,qn.Group=Mn,qn.ClearButton=Cn,qn.HiddenInput=Pn;function Jn({children:e,role:t}){let n=(0,V.use)(D);return n?(0,H.jsx)(`div`,{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy,children:e}):(0,H.jsx)(H.Fragment,{children:e})}var Yn={root:`m_5f75b09e`,body:`m_5f6e695e`,labelWrapper:`m_d3ea56bb`,label:`m_8ee546b8`,description:`m_328f68c0`,error:`m_8e8a99cc`},Xn=Yn;function Zn({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:i,unstyled:s,children:c,label:l,description:u,id:d,disabled:f,error:p,size:m,labelPosition:h=`left`,bodyElement:g=`div`,labelElement:_=`label`,variant:v,style:y,vars:b,mod:x,attributes:S,...C}){let w=a({name:e,props:t,className:n,style:y,classes:Yn,classNames:r,styles:i,unstyled:s,attributes:S}),T=u?`${d}-description`:void 0,E=p&&typeof p!=`boolean`?`${d}-error`:void 0;return(0,H.jsx)(o,{...w(`root`),__vars:{"--label-fz":L(m),"--label-lh":M(m,`label-lh`)},mod:[{"label-position":h},x],variant:v,size:m,...C,children:(0,H.jsxs)(o,{component:g,htmlFor:g===`label`?d:void 0,...w(`body`),children:[c,(0,H.jsxs)(`div`,{...w(`labelWrapper`),"data-disabled":f||void 0,children:[l&&(0,H.jsx)(o,{component:_,htmlFor:_===`label`?d:void 0,...w(`label`),"data-disabled":f||void 0,children:l}),u&&(0,H.jsx)(k.Description,{id:T,size:m,__inheritStyles:!1,...w(`description`),children:u}),p&&typeof p!=`boolean`&&(0,H.jsx)(k.Error,{id:E,size:m,__inheritStyles:!1,...w(`error`),children:p})]})]})})}Zn.displayName=`@mantine/core/InlineInput`;function Qn(e){return`group`in e}function $n({options:e,search:t,limit:n}){let r=t.trim().toLowerCase(),i=[];for(let a=0;a0)return!1;return!0}function tr(e,t=new Set){if(Array.isArray(e))for(let n of e)if(Qn(n))tr(n.items,t);else{if(n.value===void 0)throw Error(`[@mantine/core] Each option must have value property`);if(t.has(n.value))throw Error(`[@mantine/core] Duplicate options are not supported. Option with value "${n.value}" was provided more than once`);t.add(n.value)}}function nr(e,t){return Array.isArray(e)?e.includes(t):e===t}function rr({data:e,withCheckIcon:t,withAlignedLabels:n,value:r,checkIconPosition:i,unstyled:a,renderOption:o}){if(!Qn(e)){let s=nr(r,e.value),c=t&&(s?(0,H.jsx)(Ke,{className:_n.optionsDropdownCheckIcon}):n?(0,H.jsx)(`div`,{className:_n.optionsDropdownCheckPlaceholder}):null),l=(0,H.jsxs)(H.Fragment,{children:[i===`left`&&c,(0,H.jsx)(`span`,{children:e.label}),i===`right`&&c]});return(0,H.jsx)(qn.Option,{value:e.value,disabled:e.disabled,className:_({[_n.optionsDropdownOption]:!a}),"data-reverse":i===`right`||void 0,"data-checked":s||void 0,"aria-selected":s,active:s,children:typeof o==`function`?o({option:e,checked:s}):l})}let s=e.items.map(e=>(0,H.jsx)(rr,{data:e,value:r,unstyled:a,withCheckIcon:t,withAlignedLabels:n,checkIconPosition:i,renderOption:o},`${e.value}`));return(0,H.jsx)(qn.Group,{label:e.group,children:s})}function ir({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:i,limit:a,maxDropdownHeight:o,floatingHeight:s,withScrollArea:c=!0,filterOptions:l=!0,withCheckIcon:u=!1,withAlignedLabels:d=!1,value:f,checkIconPosition:p,nothingFoundMessage:m,unstyled:h,labelId:g,renderOption:_,scrollAreaProps:v,"aria-label":y}){let b=Sn();tr(e);let x=typeof i==`string`?(r||$n)({options:e,search:l?i:``,limit:a??1/0}):e,S=er(x),C=x.map((e,t)=>(0,H.jsx)(rr,{data:e,withCheckIcon:u,withAlignedLabels:d,value:f,checkIconPosition:p,unstyled:h,renderOption:_},Qn(e)?`group-${typeof e.group==`string`?e.group:t}`:`${e.value}`));return(0,H.jsx)(qn.Dropdown,{hidden:t||n&&S,"data-composed":!0,children:(0,H.jsxs)(qn.Options,{labelledBy:g,"aria-label":y,children:[c?(0,H.jsx)(pe.Autosize,{mah:(s??b.floatingHeight)===`viewport`?`var(--combobox-floating-options-max-height)`:o??220,type:`scroll`,scrollbarSize:`var(--combobox-padding)`,offsetScrollbars:`y`,...v,children:C}):C,S&&m&&(0,H.jsx)(qn.Empty,{children:m})]})})}function ar(e,t,n,r){if(t===n||r===`before`&&n===t+1||r===`after`&&n===t-1)return e;let i=e.slice(),[a]=i.splice(t,1),o=t{let t=e.lastElementChild;return t?t instanceof HTMLInputElement?t:t.querySelector(`input`):null},sr=(e,t)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let e=i.current;e&&(i.current=null,sr(o.current,e.expectedValue)&&e.container?.querySelector(`[data-mantine-pill-index="${e.index}"]`)?.focus())});let s=(0,V.useCallback)(e=>{a.current=e},[]);return{getPillProps:e=>{if(n)return{draggable:!0,tabIndex:-1,"data-mantine-pill-index":e,"aria-keyshortcuts":`Alt+ArrowLeft Alt+ArrowRight`,onMouseDown:e=>{e.button===0&&e.stopPropagation()},onDragStart:t=>{t.stopPropagation(),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,String(e)),r.current.draggedIndex=e;let n=t.currentTarget,i=n.getBoundingClientRect(),a=n.cloneNode(!0);a.removeAttribute(`data-dragging`),a.removeAttribute(`data-drag-over`),a.style.position=`fixed`,a.style.top=`-9999px`,a.style.left=`-9999px`,a.style.width=`${i.width}px`,a.style.height=`${i.height}px`,a.style.pointerEvents=`none`,document.body.appendChild(a),t.dataTransfer.setDragImage(a,t.clientX-i.left,t.clientY-i.top),setTimeout(()=>a.parentNode?.removeChild(a),0),requestAnimationFrame(()=>{n.setAttribute(`data-dragging`,`true`)})},onDragOver:t=>{let{draggedIndex:n}=r.current;if(n===null||n===e)return;let i=t.currentTarget,a=i.getBoundingClientRect(),o=t.clientX-a.left,s=(getComputedStyle(i).direction===`rtl`?o>a.width/2:o{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||(t.removeAttribute(`data-drag-over`),r.current.currentDropTarget===t&&(r.current.currentDropTarget=null))},onDrop:n=>{n.preventDefault(),n.stopPropagation();let i=n.currentTarget,a=i.getAttribute(`data-drag-over`);i.removeAttribute(`data-drag-over`);let{draggedIndex:s}=r.current;if(s!==null&&a&&s!==e){let n=ar(o.current,s,e,a);n!==o.current&&t(n)}r.current.draggedIndex=null,r.current.currentDropTarget=null},onDragEnd:e=>{e.currentTarget.removeAttribute(`data-dragging`);let t=r.current.currentDropTarget;t&&t.removeAttribute(`data-drag-over`),r.current.draggedIndex=null,r.current.currentDropTarget=null},onKeyDown:n=>{if(n.key!==`ArrowLeft`&&n.key!==`ArrowRight`)return;let r=n.currentTarget,a=getComputedStyle(r).direction===`rtl`?n.key===`ArrowLeft`:n.key===`ArrowRight`,s=a?e+1:e-1;if(n.altKey){if(s<0||s>=o.current.length)return;n.preventDefault(),n.stopPropagation();let c=a?`after`:`before`,l=ar(o.current,e,s,c);if(l===o.current)return;i.current={container:r.parentElement,index:s,expectedValue:l},t(l);return}if(s<0)return;let c=r.parentElement;if(c){if(n.preventDefault(),n.stopPropagation(),s>=o.current.length){or(c)?.focus();return}c.querySelector(`[data-mantine-pill-index="${s}"]`)?.focus()}}}},getListProps:()=>n?{ref:s}:{},handleInputKeyDown:e=>{if(!n||e.key!==`ArrowLeft`)return;let t=e.currentTarget;if(!(t.value.length===0||t.selectionStart===0&&t.selectionEnd===0))return;let r=a.current;if(!r)return;let i=r.querySelectorAll(`[data-mantine-pill-index]`);i.length!==0&&(e.preventDefault(),i[i.length-1].focus())}}}function lr({id:e,label:t,labelProps:n,inputWrapperOrder:r}){if(t&&(!r||r.includes(`label`)))return n?.id||`${e}-label`}function ur(e){let t=e.currentTarget;return Yt(t).activeElement!==t}var dr=(0,V.createContext)(null),fr={root:`m_7cda1cd6`,"root--default":`m_44da308b`,"root--contrast":`m_e3a01f8`,label:`m_1e0e6180`,remove:`m_ae386778`,group:`m_1dcfd90b`},pr=(0,V.createContext)(null),mr=g((e,{gap:t},{size:n})=>({group:{"--pg-gap":t===void 0?M(n,`pg-gap`):M(t)}})),hr=h(e=>{let t=u(`PillGroup`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,size:d,disabled:f,attributes:p,...m}=t,h=(0,V.use)(dr)?.size||d||void 0,g=a({name:`PillGroup`,classes:fr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:p,vars:l,varsResolver:mr,stylesCtx:{size:h},rootSelector:`group`});return(0,H.jsx)(pr,{value:{size:h,disabled:f},children:(0,H.jsx)(o,{size:h,...g(`group`),...m})})});hr.classes=fr,hr.varsResolver=mr,hr.displayName=`@mantine/core/PillGroup`;var gr={variant:`default`},_r=g((e,{radius:t},{size:n})=>({root:{"--pill-fz":M(n,`pill-fz`),"--pill-height":M(n,`pill-height`),"--pill-radius":t===void 0?void 0:ne(t)}})),vr=h(e=>{let t=u(`Pill`,gr,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,variant:d,children:f,withRemoveButton:p,onRemove:m,removeButtonProps:h,radius:g,size:_,disabled:v,mod:y,attributes:b,...x}=t,S=(0,V.use)(pr),C=(0,V.use)(dr),w=_||S?.size||void 0,T=C?.variant===`filled`?`contrast`:d||`default`,E=a({name:`Pill`,classes:fr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:b,vars:l,varsResolver:_r,stylesCtx:{size:w}});return(0,H.jsxs)(o,{component:`span`,variant:T,size:w,...E(`root`,{variant:T}),mod:[{"with-remove":p&&!v,disabled:v||S?.disabled},y],...x,children:[(0,H.jsx)(`span`,{...E(`label`),children:f}),p&&(0,H.jsx)(ae,{variant:`transparent`,radius:g,tabIndex:-1,"aria-hidden":!0,unstyled:c,...h,...E(`remove`,{className:h?.className,style:h?.style}),onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),h?.onMouseDown?.(e)},onClick:e=>{e.stopPropagation(),m?.(),h?.onClick?.(e)}})]})});vr.classes=fr,vr.varsResolver=_r,vr.displayName=`@mantine/core/Pill`,vr.Group=hr;var yr={field:`m_45c4369d`},br={type:`visible`},xr=h(e=>{let t=u(`PillsInputField`,br,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,type:d,disabled:f,id:p,pointer:m,mod:h,attributes:g,ref:_,...v}=t,y=(0,V.use)(dr),b=(0,V.use)(D),x=a({name:`PillsInputField`,classes:yr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:g,rootSelector:`field`}),S=f||y?.disabled;return(0,H.jsx)(o,{component:`input`,ref:re(_,y?.fieldRef),"data-type":d,disabled:S,mod:[{disabled:S,pointer:m},h],...x(`field`),...v,id:b?.inputId||p,"aria-invalid":y?.hasError,"aria-describedby":b?.describedBy,type:`text`,onMouseDown:e=>!m&&e.stopPropagation()})});xr.classes=yr,xr.displayName=`@mantine/core/PillsInputField`;var Sr={size:`sm`},Cr=h(e=>{let{children:t,onMouseDown:n,onClick:r,size:i,disabled:a,__staticSelector:o,error:s,variant:c,...l}=u([`Input`,`InputWrapper`,`PillsInput`],Sr,e),d=(0,V.useRef)(null);return(0,H.jsx)(dr,{value:{fieldRef:d,size:i,disabled:a,hasError:!!s,variant:c},children:(0,H.jsx)(N,{size:i,error:s,variant:c,component:`div`,"data-no-overflow":!0,onMouseDown:e=>{e.preventDefault(),n?.(e),d.current?.focus()},onClick:e=>{e.preventDefault(),e.currentTarget.closest(`fieldset`)?.disabled||(d.current?.focus(),r?.(e))},...l,multiline:!0,disabled:a,__staticSelector:o||`PillsInput`,withAria:!1,children:t})})});Cr.displayName=`@mantine/core/PillsInput`,Cr.classes=N.classes,Cr.Field=xr;function wr(e,t){let n=t.trim().toLowerCase();if(n===``)return;let r=Object.values(e).filter(e=>!e.disabled&&e.label.trim().toLowerCase()===n);return r.length===1?r[0]:void 0}function Tr(e){return typeof e==`string`?e.trim().toLowerCase():e}function Er({data:e,value:t}){let n=t.map(Tr);return e.reduce((e,t)=>(Qn(t)?e.push({group:t.group,items:t.items.filter(e=>n.indexOf(Tr(e.value))===-1)}):n.indexOf(Tr(t.value))===-1&&e.push(t),e),[])}var Dr={xs:41,sm:50,md:60,lg:72,xl:89},Or={maxValues:1/0,withCheckIcon:!0,checkIconPosition:`left`,hiddenInputValuesDivider:`,`,clearSearchOnChange:!0,openOnFocus:!0,size:`sm`},kr=c(e=>{let t=u([`Input`,`InputWrapper`,`MultiSelect`],Or,e),{classNames:n,className:r,style:i,styles:o,unstyled:s,vars:c,size:l,value:f,defaultValue:p,onChange:m,onKeyDown:h,variant:g,data:_,dropdownOpened:v,defaultDropdownOpened:y,onDropdownOpen:b,onDropdownClose:x,selectFirstOptionOnChange:S,selectFirstOptionOnDropdownOpen:C,onOptionSubmit:w,comboboxProps:T,filter:E,limit:D,withScrollArea:O,maxDropdownHeight:k,floatingHeight:j,searchValue:M,defaultSearchValue:N,onSearchChange:P,readOnly:I,disabled:L,onFocus:ee,onBlur:R,radius:te,rightSection:ne,rightSectionWidth:re,rightSectionPointerEvents:ie,rightSectionProps:z,leftSection:ae,leftSectionWidth:B,leftSectionPointerEvents:oe,leftSectionProps:se,inputContainer:ce,inputWrapperOrder:le,withAsterisk:ue,labelProps:de,descriptionProps:fe,errorProps:pe,successProps:me,wrapperProps:he,description:ge,label:_e,error:ve,success:ye,maxValues:be,searchable:xe,nothingFoundMessage:Se,withCheckIcon:Ce,withAlignedLabels:we,checkIconPosition:Te,hidePickedOptions:Ee,withErrorStyles:De,withSuccessStyles:Oe,name:ke,form:Ae,id:je,clearable:Me,clearSectionMode:Ne,clearButtonProps:Pe,hiddenInputProps:Fe,placeholder:Ie,hiddenInputValuesDivider:Le,required:Re,mod:Be,renderOption:Ve,renderPill:He,onRemove:Ue,onClear:We,onMaxValues:Ge,scrollAreaProps:Ke,chevronColor:qe,attributes:Je,clearSearchOnChange:Ye,openOnFocus:Xe,loading:Ze,loadingPosition:Qe,withPillsReorder:$e,...et}=t,tt=F(je),nt=lr({id:tt,label:_e,labelProps:de,inputWrapperOrder:le}),rt=hn(_),it=gn(rt),at=(0,V.useRef)({}),ot=Wn({opened:v,defaultOpened:y,onDropdownOpen:()=>{b?.(),C&&ot.selectFirstOption()},onDropdownClose:()=>{x?.(),ot.resetSelectedOption()}}),{styleProps:st,rest:{type:ct,autoComplete:lt,...ut}}=d(et),[dt,ft]=ze({value:f,defaultValue:p,finalValue:[],onChange:m}),{getPillProps:pt,getListProps:mt,handleInputKeyDown:ht}=cr({value:dt,onChange:ft,enabled:$e&&!L&&!I}),[gt,_t]=ze({value:M,defaultValue:N,finalValue:``,onChange:P}),vt=e=>{_t(e),ot.resetSelectedOption()},yt=a({name:`MultiSelect`,classes:{},props:t,classNames:n,styles:o,unstyled:s,attributes:Je}),{resolvedClassNames:bt,resolvedStyles:xt}=A({props:t,styles:o,classNames:n}),St=e=>{h?.(e),!e.defaultPrevented&&(e.key===` `&&!xe&&(e.preventDefault(),ot.toggleDropdown()),e.key===`Backspace`&>.length===0&&dt.length>0&&!I&&(Ue?.(dt[dt.length-1]),ft(dt.slice(0,dt.length-1))),ht(e))},Ct=dt.map((e,t)=>{let n=it[`${e}`]||at.current[`${e}`],r=pt(t);return He?(0,H.jsx)(V.Fragment,{children:He({option:n,value:e,onRemove:()=>{ft(dt.filter(t=>e!==t)),Ue?.(e)},disabled:L,reorderProps:r})},`${e}-${t}`):(0,H.jsx)(vr,{withRemoveButton:!I&&!it[`${e}`]?.disabled,onRemove:()=>{ft(dt.filter(t=>e!==t)),Ue?.(e)},unstyled:s,disabled:L,...yt(`pill`),...r,children:n?.label||e},`${e}-${t}`)});(0,V.useEffect)(()=>{S&&ot.selectFirstOption()},[S,gt]),(0,V.useEffect)(()=>{dt.forEach(e=>{`${e}`in it&&(at.current[`${e}`]=it[`${e}`])})},[it,dt]);let wt=(0,H.jsx)(qn.ClearButton,{...Pe,onClear:()=>{We?.(),ft([]),vt(``)}}),Tt=Er({data:rt,value:dt}),Et=Me&&dt.length>0&&!L&&!I,Dt=Et?{paddingInlineEnd:Dr[l]??Dr.sm}:void 0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(qn,{store:ot,classNames:bt,styles:xt,unstyled:s,size:l,readOnly:I,__staticSelector:`MultiSelect`,attributes:Je,floatingHeight:j,onOptionSubmit:e=>{w?.(e),Ye&&vt(``),ot.updateSelectedOptionIndex(`selected`),dt.includes(it[`${e}`].value)?(ft(dt.filter(t=>t!==it[`${e}`].value)),Ue?.(it[`${e}`].value)):dt.lengthxe?ot.openDropdown():ot.toggleDropdown(),"data-expanded":ot.dropdownOpened||void 0,id:tt,required:Re,mod:Be,attributes:Je,children:(0,H.jsxs)(vr.Group,{attributes:Je,disabled:L,unstyled:s,...yt(`pillsList`,{style:Dt}),...mt(),children:[Ct,(0,H.jsx)(qn.EventsTarget,{autoComplete:lt,withExpandedAttribute:!0,children:(0,H.jsx)(Cr.Field,{...ut,id:tt,placeholder:Ie,type:!xe&&!Ie?`hidden`:`visible`,...yt(`inputField`),unstyled:s,onFocus:e=>{ee?.(e),Xe&&xe&&ot.openDropdown()},onBlur:e=>{R?.(e),ot.closeDropdown(),vt(``)},onKeyDown:St,value:gt,onChange:e=>{if(ur(e)){if(!I){let t=wr(it,e.currentTarget.value);t&&!dt.includes(t.value)&&dt.length{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ProgressLabel`,null,e),c=jr();return(0,H.jsx)(o,{...c.getStyles(`label`,{className:n,style:r,classNames:t,styles:i}),...s})});Nr.classes=Mr,Nr.displayName=`@mantine/core/ProgressLabel`;var Pr=g((e,{size:t,radius:n,transitionDuration:r})=>({root:{"--progress-size":M(t,`progress-size`),"--progress-radius":n===void 0?void 0:ne(n),"--progress-transition-duration":typeof r==`number`?`${r}ms`:void 0}})),Fr=h(e=>{let t=u(`ProgressRoot`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,autoContrast:d,transitionDuration:f,orientation:p,attributes:m,mod:h,...g}=t,_=a({name:`Progress`,classes:Mr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:m,vars:l,varsResolver:Pr});return(0,H.jsx)(Ar,{value:{getStyles:_,autoContrast:d},children:(0,H.jsx)(o,{mod:[{orientation:p},h],..._(`root`),...g})})});Fr.classes=Mr,Fr.varsResolver=Pr,Fr.displayName=`@mantine/core/ProgressRoot`;var Ir={withAria:!0},Lr=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:s,withAria:c,color:d,striped:p,animated:m,mod:h,...g}=u(`ProgressSection`,Ir,e),_=jr(),v=f(),y=c?{role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":s,"aria-valuetext":`${s}%`}:{};return(0,H.jsx)(o,{..._.getStyles(`section`,{className:n,classNames:t,styles:i,style:r}),...g,...y,mod:[{striped:p||m,animated:m},h],__vars:{"--progress-section-size":`${s}%`,"--progress-section-color":l(d,v),"--progress-label-color":Xt(_.autoContrast,v)?st({color:d,theme:v,autoContrast:_.autoContrast}):void 0}})});Lr.classes=Mr,Lr.displayName=`@mantine/core/ProgressSection`;var Rr=h(e=>{let t=u(`Progress`,null,e),{value:n,classNames:r,styles:i,vars:a,color:o,striped:s,animated:c,"aria-label":l,...d}=t,{resolvedClassNames:f,resolvedStyles:p}=A({classNames:r,styles:i,props:t});return(0,H.jsx)(Fr,{classNames:f,styles:p,vars:a,...d,children:(0,H.jsx)(Lr,{value:n,color:o,striped:s,animated:c,"aria-label":l})})});Rr.classes=Mr,Rr.displayName=`@mantine/core/Progress`,Rr.Section=Lr,Rr.Root=Fr,Rr.Label=Nr;var zr={root:`m_cf365364`,indicator:`m_9e182ccd`,label:`m_1738fcb2`,input:`m_1714d588`,control:`m_69686b9b`,innerLabel:`m_78882f40`},Br={withItemsBorders:!0},Vr=g((e,{radius:t,color:n,transitionDuration:r,size:i,transitionTimingFunction:a})=>({root:{"--sc-radius":t===void 0?void 0:ne(t),"--sc-color":n?l(n,e):void 0,"--sc-shadow":n?void 0:`var(--mantine-shadow-xs)`,"--sc-transition-duration":r===void 0?void 0:`${r}ms`,"--sc-transition-timing-function":a,"--sc-padding":M(i,`sc-padding`),"--sc-font-size":L(i)}})),Hr=c(e=>{let t=u(`SegmentedControl`,Br,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,data:d,value:p,defaultValue:m,onChange:h,size:g,name:_,disabled:v,readOnly:y,fullWidth:b,orientation:x,radius:S,color:C,transitionDuration:w,transitionTimingFunction:T,variant:E,autoContrast:D,withItemsBorders:O,mod:k,attributes:A,ref:j,...M}=t,N=a({name:`SegmentedControl`,props:t,classes:zr,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:A,vars:l,varsResolver:Vr}),P=f(),I=d.map(e=>Kt(e)?{label:`${e}`,value:e}:e),L=Gt(),[ee,R]=(0,V.useState)(0),[te,ne]=(0,V.useState)(null),[ie,z]=(0,V.useState)({}),ae=(e,t)=>{e!==null&&ie[t]!==e&&(ie[t]=e,z({...ie}))},[B,oe]=ze({value:p,defaultValue:m,finalValue:Array.isArray(d)?I.find(e=>!e.disabled)?.value??d[0]?.value??null:null,onChange:h}),se=F(_),ce=I.map(e=>`${e.value}`),le=I.map(e=>(0,V.createElement)(o,{...N(`control`),mod:{active:B===e.value,orientation:x},key:`${e.value}`},(0,V.createElement)(`input`,{...N(`input`),disabled:v||e.disabled,type:`radio`,name:se,value:`${e.value}`,id:`${se}-${e.value}`,checked:B===e.value,onChange:()=>!y&&oe(e.value),"data-focus-ring":P.focusRing,key:`${e.value}-input`}),(0,V.createElement)(o,{component:`label`,...N(`label`),mod:{active:B===e.value&&!(v||e.disabled),disabled:v||e.disabled,"read-only":y},htmlFor:`${se}-${e.value}`,ref:t=>ae(t,`${e.value}`),__vars:{"--sc-label-color":C===void 0?void 0:st({color:C,theme:P,autoContrast:D})},key:`${e.value}-label`},(0,H.jsx)(`span`,{...N(`innerLabel`),children:e.label})))),ue=re(j,ne);return Vt(()=>{R(e=>e+1)},[d.length]),Vt(()=>{z(e=>{let t={};return ce.forEach(n=>{n in e&&(t[n]=e[n])}),Object.keys(t).length===Object.keys(e).length?e:t})},[ce]),d.length===0?null:(0,H.jsxs)(o,{...N(`root`),variant:E,size:g,ref:ue,mod:[{"full-width":b,orientation:x,initialized:L,"with-items-borders":O},k],...M,role:`radiogroup`,"data-disabled":v,children:[B!==void 0&&(0,H.jsx)(tn,{target:ie[`${B}`],parent:te,component:`span`,transitionDuration:`var(--sc-transition-duration)`,...N(`indicator`)},ee),le]})});Hr.classes=zr,Hr.varsResolver=Vr,Hr.displayName=`@mantine/core/SegmentedControl`;var Ur={size:`sm`,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:`left`,openOnFocus:!0},Wr=c(e=>{let t=u([`Input`,`InputWrapper`,`Select`],Ur,e),{classNames:n,styles:r,unstyled:i,vars:a,dropdownOpened:o,defaultDropdownOpened:s,onDropdownClose:c,onDropdownOpen:l,onFocus:d,onBlur:f,onClick:p,onChange:m,data:h,value:g,defaultValue:_,selectFirstOptionOnChange:v,selectFirstOptionOnDropdownOpen:y,onOptionSubmit:b,comboboxProps:x,readOnly:S,disabled:C,filter:w,limit:T,withScrollArea:E,maxDropdownHeight:D,floatingHeight:O,size:k,searchable:j,rightSection:M,checkIconPosition:P,withCheckIcon:I,withAlignedLabels:L,nothingFoundMessage:ee,name:R,form:te,searchValue:ne,defaultSearchValue:re,onSearchChange:ie,allowDeselect:z,error:ae,rightSectionPointerEvents:B,id:oe,clearable:se,clearSectionMode:ce,clearButtonProps:le,hiddenInputProps:ue,renderOption:de,onClear:fe,autoComplete:pe,scrollAreaProps:me,__defaultRightSection:he,__clearSection:ge,__clearable:_e,chevronColor:ve,autoSelectOnBlur:ye,openOnFocus:be,attributes:xe,...Se}=t,Ce=(0,V.useMemo)(()=>hn(h),[h]),we=(0,V.useRef)({}),Te=(0,V.useMemo)(()=>gn(Ce),[Ce]),Ee=F(oe),De=lr({id:Ee,label:Se.label,labelProps:Se.labelProps,inputWrapperOrder:Se.inputWrapperOrder}),[Oe,ke,Ae]=ze({value:g,defaultValue:_,finalValue:null,onChange:m}),je=Oe==null?void 0:`${Oe}`in Te?Te[`${Oe}`]:we.current[`${Oe}`],Me=Ut(je),[Ne,Pe,Fe]=ze({value:ne,defaultValue:re,finalValue:je?je.label:``,onChange:ie}),Ie=Wn({opened:o,defaultOpened:s,onDropdownOpen:()=>{l?.(),y?Ie.selectFirstOption():Ie.updateSelectedOptionIndex(`active`,{scrollIntoView:!0})},onDropdownClose:()=>{c?.(),setTimeout(Ie.resetSelectedOption,0)}}),Le=e=>{Pe(e),Ie.resetSelectedOption()},{resolvedClassNames:Re,resolvedStyles:Be}=A({props:t,styles:r,classNames:n});(0,V.useEffect)(()=>{v&&Ie.selectFirstOption()},[v,Ne]),(0,V.useEffect)(()=>{g===null&&Le(``),g!=null&&je&&(Me?.value!==je.value||Me?.label!==je.label)&&Le(je.label)},[g,je]),(0,V.useEffect)(()=>{!Ae&&!Fe&&Le(Oe==null?``:`${Oe}`in Te?Te[`${Oe}`]?.label:we.current[`${Oe}`]?.label||``)},[Te,Oe]),(0,V.useEffect)(()=>{Oe&&`${Oe}`in Te&&(we.current[`${Oe}`]=Te[`${Oe}`])},[Te,Oe]);let Ve=(0,H.jsx)(qn.ClearButton,{...le,onClear:()=>{ke(null,null),Le(``),fe?.()}}),He=se&&Oe!=null&&!C&&!S;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(qn,{store:Ie,__staticSelector:`Select`,classNames:Re,styles:Be,unstyled:i,readOnly:S,size:k,attributes:xe,floatingHeight:O,keepMounted:ye,onOptionSubmit:e=>{b?.(e);let t=z&&`${Te[e].value}`==`${Oe}`?null:Te[e],n=t?t.value:null;n!==Oe&&ke(n,t),!Ae&&Le(n==null?``:t?.label||``),Ie.closeDropdown()},...x,children:[(0,H.jsx)(qn.Target,{targetType:j?`input`:`button`,autoComplete:pe,withExpandedAttribute:!0,children:(0,H.jsx)(N,{id:Ee,__defaultRightSection:(0,H.jsx)(qn.Chevron,{size:k,error:ae,unstyled:i,color:ve}),__clearSection:Ve,__clearable:He,__clearSectionMode:ce,rightSection:M,rightSectionPointerEvents:B||`none`,...Se,size:k,__staticSelector:`Select`,disabled:C,readOnly:S||!j,value:Ne,onChange:e=>{if(ur(e)){if(!S){let t=wr(Te,e.currentTarget.value);t&&`${t.value}`!=`${Oe}`&&(ke(t.value,t),!Ae&&Le(t.label))}return}Le(e.currentTarget.value),Ie.openDropdown(),v&&Ie.selectFirstOption()},onFocus:e=>{be&&j&&Ie.openDropdown(),d?.(e)},onBlur:e=>{ye&&Ie.clickSelectedOption(),Ie.closeDropdown();let t=Oe!=null&&(`${Oe}`in Te?Te[`${Oe}`]:we.current[`${Oe}`]);Le(t&&t.label||``),f?.(e)},onClick:e=>{j?Ie.openDropdown():Ie.toggleDropdown(),p?.(e)},classNames:Re,styles:Be,unstyled:i,pointer:!j,error:ae,attributes:xe})}),(0,H.jsx)(ir,{data:Ce,hidden:S||C,filter:w,search:Ne,limit:T,hiddenWhenEmpty:!ee,withScrollArea:E,maxDropdownHeight:D,filterOptions:!!j&&je?.label!==Ne,value:Oe,checkIconPosition:P,withCheckIcon:I,withAlignedLabels:L,nothingFoundMessage:ee,unstyled:i,labelId:De,"aria-label":De?void 0:Se[`aria-label`],renderOption:de,scrollAreaProps:me})]}),(0,H.jsx)(qn.HiddenInput,{value:Oe,name:R,form:te,disabled:C,...ue})]})});Wr.classes={...N.classes,...qn.classes},Wr.displayName=`@mantine/core/Select`;function Gr(e){if(e!==void 0)return typeof e==`number`?P(e):e}function Kr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=f(),s=t===void 0?e:t,c=r!==void 0,l=E({"--sg-spacing-x":z(Lt(e)),"--sg-spacing-y":z(Lt(s)),"--sg-auto-rows":i,...c?{"--sg-min-col-width":Gr(r)}:{"--sg-cols":Lt(n)?.toString()}}),u=O(o.breakpoints).reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=z(e[r])),typeof s==`object`&&s[r]!==void 0&&(t[r][`--sg-spacing-y`]=z(s[r])),!c&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),d=Ge(O(u),o.breakpoints).filter(e=>O(u[e.value]).length>0).map(e=>({query:`(min-width: ${o.breakpoints[e.value]})`,styles:u[e.value]}));return(0,H.jsx)(j,{styles:l,media:d,selector:a})}function qr(e){return typeof e==`object`&&e?O(e):[]}function Jr(e){return e.sort((e,t)=>We(e)-We(t))}function Yr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}){return Jr(Array.from(new Set([...qr(e),...qr(t),...r===void 0?qr(n):[]])))}function Xr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=t===void 0?e:t,s=r!==void 0,c=E({"--sg-spacing-x":z(Lt(e)),"--sg-spacing-y":z(Lt(o)),"--sg-auto-rows":i,...s?{"--sg-min-col-width":Gr(r)}:{"--sg-cols":Lt(n)?.toString()}}),l=Yr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}),u=l.reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=z(e[r])),typeof o==`object`&&o[r]!==void 0&&(t[r][`--sg-spacing-y`]=z(o[r])),!s&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),d=l.map(e=>({query:`simple-grid (min-width: ${e})`,styles:u[e]}));return(0,H.jsx)(j,{styles:c,container:d,selector:a})}var Zr={container:`m_925c2d2c`,root:`m_2415a157`},Qr={cols:1,spacing:`md`,type:`media`},$r=h(e=>{let t=u(`SimpleGrid`,Qr,e),{classNames:n,className:r,style:i,styles:c,unstyled:l,vars:d,cols:f,verticalSpacing:p,spacing:m,type:h,minColWidth:g,autoFlow:_,autoRows:v,attributes:y,...b}=t,x=a({name:`SimpleGrid`,classes:Zr,props:t,className:r,style:i,classNames:n,styles:c,unstyled:l,attributes:y,vars:d}),S=s(),C=g===void 0?void 0:_||`auto-fill`;return h===`container`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Xr,{...t,selector:`.${S}`}),(0,H.jsx)(`div`,{...x(`container`),children:(0,H.jsx)(o,{...x(`root`,{className:S}),...b,"data-auto-cols":C})})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Kr,{...t,selector:`.${S}`}),(0,H.jsx)(o,{...x(`root`,{className:S}),...b,"data-auto-cols":C})]})});$r.classes=Zr,$r.displayName=`@mantine/core/SimpleGrid`;var ei=(0,V.createContext)(null),ti={hiddenInputValuesSeparator:`,`},ni=c((e=>{let{value:t,defaultValue:n,onChange:r,size:i,wrapperProps:a,children:o,readOnly:s,name:c,hiddenInputValuesSeparator:l,hiddenInputProps:d,maxSelectedValues:f,disabled:p,...m}=u(`SwitchGroup`,ti,e),[h,g]=ze({value:t,defaultValue:n,finalValue:[],onChange:r}),_=e=>{let t=e.currentTarget.value;if(s)return;let n=h.includes(t);!n&&f&&h.length>=f||g(n?h.filter(e=>e!==t):[...h,t])},v=e=>{if(p)return!0;if(!f)return!1;let t=h.includes(e),n=h.length>=f;return!t&&n},y=h.join(l);return(0,H.jsx)(ei,{value:{value:h,onChange:_,size:i,isDisabled:v},children:(0,H.jsxs)(k.Wrapper,{size:i,...a,...m,labelElement:`div`,__staticSelector:`SwitchGroup`,children:[(0,H.jsx)(Jn,{role:`group`,children:o}),(0,H.jsx)(`input`,{type:`hidden`,name:c,value:y,...d})]})})}));ni.classes=k.Wrapper.classes,ni.displayName=`@mantine/core/SwitchGroup`;var ri={root:`m_5f93f3bb`,input:`m_926b4011`,track:`m_9307d992`,thumb:`m_93039a1d`,trackLabel:`m_8277e082`},ii={labelPosition:`right`,withThumbIndicator:!0},ai=g((e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:ne(t),"--switch-height":M(r,`switch-height`),"--switch-width":M(r,`switch-width`),"--switch-thumb-size":M(r,`switch-thumb-size`),"--switch-label-font-size":M(r,`switch-label-font-size`),"--switch-track-label-padding":M(r,`switch-track-label-padding`),"--switch-color":n?l(n,e):void 0}})),oi=h(e=>{let t=u(`Switch`,ii,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,color:f,label:p,offLabel:m,onLabel:h,id:g,size:_,radius:v,wrapperProps:y,thumbIcon:b,checked:x,defaultChecked:S,onChange:C,labelPosition:w,description:T,error:E,disabled:D,variant:O,rootRef:k,mod:A,withThumbIndicator:j,attributes:M,...N}=t,P=(0,V.use)(ei),I=_||P?.size,L=a({name:`Switch`,props:t,classes:ri,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:M,vars:l,varsResolver:ai}),{styleProps:ee,rest:R}=d(N),te=F(g),ne=[T?`${te}-description`:void 0,E&&typeof E!=`boolean`?`${te}-error`:void 0,R[`aria-describedby`]].filter(Boolean).join(` `)||void 0,re={checked:P?.value.includes(R.value)??x,onChange:e=>{P?.onChange(e),C?.(e)}},ie=D||P?.isDisabled?.(R.value),[z,ae]=ze({value:re.checked??x,defaultValue:S,finalValue:!1});return(0,H.jsxs)(Zn,{...L(`root`),__staticSelector:`Switch`,__stylesApiProps:t,id:te,size:I,labelPosition:w,label:p,description:T,error:E,disabled:ie,bodyElement:`label`,labelElement:`span`,classNames:n,styles:s,unstyled:c,"data-checked":re.checked,variant:O,ref:k,mod:A,attributes:M,inert:R.inert,...ee,...y,children:[(0,H.jsx)(`input`,{...R,...re,disabled:ie,checked:z,"data-checked":re.checked,onChange:e=>{re.onChange?.(e),ae(e.currentTarget.checked)},id:te,type:`checkbox`,role:`switch`,inert:R.inert,"aria-describedby":ne,...L(`input`)}),(0,H.jsxs)(o,{"aria-hidden":`true`,component:`span`,mod:{error:E,"label-position":w,"without-labels":!h&&!m},...L(`track`),children:[(0,H.jsx)(o,{component:`span`,mod:{"reduce-motion":!0,"with-thumb-indicator":j&&!b},...L(`thumb`),children:b}),(0,H.jsx)(`span`,{...L(`trackLabel`),children:z?h:m})]})]})});oi.classes={...ri,...Xn},oi.varsResolver=ai,oi.displayName=`@mantine/core/Switch`,oi.Group=ni;var si=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z`}))]]),ci=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z`}))]]),li=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M220,48V96a12,12,0,0,1-24,0V77l-35.51,35.52a12,12,0,0,1-17-17L179,60H160a12,12,0,0,1,0-24h48A12,12,0,0,1,220,48ZM95.51,143.51,60,179V160a12,12,0,0,0-24,0v48a12,12,0,0,0,12,12H96a12,12,0,0,0,0-24H77l35.52-35.51a12,12,0,0,0-17-17ZM208,148a12,12,0,0,0-12,12v19l-35.51-35.52a12,12,0,0,0-17,17L179,196H160a12,12,0,0,0,0,24h48a12,12,0,0,0,12-12V160A12,12,0,0,0,208,148ZM77,60H96a12,12,0,0,0,0-24H48A12,12,0,0,0,36,48V96a12,12,0,0,0,24,0V77l35.51,35.52a12,12,0,0,0,17-17Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M208,48V208H48V48Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M216,48V96a8,8,0,0,1-16,0V67.31l-42.34,42.35a8,8,0,0,1-11.32-11.32L188.69,56H160a8,8,0,0,1,0-16h48A8,8,0,0,1,216,48ZM98.34,146.34,56,188.69V160a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16H67.31l42.35-42.34a8,8,0,0,0-11.32-11.32ZM208,152a8,8,0,0,0-8,8v28.69l-42.34-42.35a8,8,0,0,0-11.32,11.32L188.69,200H160a8,8,0,0,0,0,16h48a8,8,0,0,0,8-8V160A8,8,0,0,0,208,152ZM67.31,56H96a8,8,0,0,0,0-16H48a8,8,0,0,0-8,8V96a8,8,0,0,0,16,0V67.31l42.34,42.35a8,8,0,0,0,11.32-11.32Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M109.66,146.34a8,8,0,0,1,0,11.32L83.31,184l18.35,18.34A8,8,0,0,1,96,216H48a8,8,0,0,1-8-8V160a8,8,0,0,1,13.66-5.66L72,172.69l26.34-26.35A8,8,0,0,1,109.66,146.34ZM83.31,72l18.35-18.34A8,8,0,0,0,96,40H48a8,8,0,0,0-8,8V96a8,8,0,0,0,13.66,5.66L72,83.31l26.34,26.35a8,8,0,0,0,11.32-11.32ZM208,40H160a8,8,0,0,0-5.66,13.66L172.69,72,146.34,98.34a8,8,0,0,0,11.32,11.32L184,83.31l18.34,18.35A8,8,0,0,0,216,96V48A8,8,0,0,0,208,40Zm3.06,112.61a8,8,0,0,0-8.72,1.73L184,172.69l-26.34-26.35a8,8,0,0,0-11.32,11.32L172.69,184l-18.35,18.34A8,8,0,0,0,160,216h48a8,8,0,0,0,8-8V160A8,8,0,0,0,211.06,152.61Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M214,48V96a6,6,0,0,1-12,0V62.48l-45.76,45.76a6,6,0,0,1-8.48-8.48L193.52,54H160a6,6,0,0,1,0-12h48A6,6,0,0,1,214,48ZM99.76,147.76,54,193.52V160a6,6,0,0,0-12,0v48a6,6,0,0,0,6,6H96a6,6,0,0,0,0-12H62.48l45.76-45.76a6,6,0,0,0-8.48-8.48ZM208,154a6,6,0,0,0-6,6v33.52l-45.76-45.76a6,6,0,0,0-8.48,8.48L193.52,202H160a6,6,0,0,0,0,12h48a6,6,0,0,0,6-6V160A6,6,0,0,0,208,154ZM62.48,54H96a6,6,0,0,0,0-12H48a6,6,0,0,0-6,6V96a6,6,0,0,0,12,0V62.48l45.76,45.76a6,6,0,0,0,8.48-8.48Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,48V96a8,8,0,0,1-16,0V67.31l-42.34,42.35a8,8,0,0,1-11.32-11.32L188.69,56H160a8,8,0,0,1,0-16h48A8,8,0,0,1,216,48ZM98.34,146.34,56,188.69V160a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16H67.31l42.35-42.34a8,8,0,0,0-11.32-11.32ZM208,152a8,8,0,0,0-8,8v28.69l-42.34-42.35a8,8,0,0,0-11.32,11.32L188.69,200H160a8,8,0,0,0,0,16h48a8,8,0,0,0,8-8V160A8,8,0,0,0,208,152ZM67.31,56H96a8,8,0,0,0,0-16H48a8,8,0,0,0-8,8V96a8,8,0,0,0,16,0V67.31l42.34,42.35a8,8,0,0,0,11.32-11.32Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M212,48V96a4,4,0,0,1-8,0V57.66l-49.17,49.17a4,4,0,0,1-5.66-5.66L198.34,52H160a4,4,0,0,1,0-8h48A4,4,0,0,1,212,48ZM101.17,149.17,52,198.34V160a4,4,0,0,0-8,0v48a4,4,0,0,0,4,4H96a4,4,0,0,0,0-8H57.66l49.17-49.17a4,4,0,0,0-5.66-5.66ZM208,156a4,4,0,0,0-4,4v38.34l-49.17-49.17a4,4,0,0,0-5.66,5.66L198.34,204H160a4,4,0,0,0,0,8h48a4,4,0,0,0,4-4V160A4,4,0,0,0,208,156ZM57.66,52H96a4,4,0,0,0,0-8H48a4,4,0,0,0-4,4V96a4,4,0,0,0,8,0V57.66l49.17,49.17a4,4,0,0,0,5.66-5.66Z`}))]]),ui=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M208,160H48l80-80Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z`}))]]),di=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M172,108a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,108Zm-12,28H96a12,12,0,0,0,0,24h64a12,12,0,0,0,0-24Zm76-8A108,108,0,0,1,78.77,224.15L46.34,235A20,20,0,0,1,21,209.66l10.81-32.43A108,108,0,1,1,236,128Zm-24,0A84,84,0,1,0,55.27,170.06a12,12,0,0,1,1,9.81l-9.93,29.79,29.79-9.93a12.1,12.1,0,0,1,3.8-.62,12,12,0,0,1,6,1.62A84,84,0,0,0,212,128Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-4-1.08,7.85,7.85,0,0,0-2.53.42L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Zm40-104a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,112Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,144Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm32,128H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M166,112a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm-6,26H96a6,6,0,0,0,0,12h64a6,6,0,0,0,0-12Zm70-10A102,102,0,0,1,79.31,217.65L44.44,229.27a14,14,0,0,1-17.71-17.71l11.62-34.87A102,102,0,1,1,230,128Zm-12,0A90,90,0,1,0,50.08,173.06a6,6,0,0,1,.5,4.91L38.12,215.35a2,2,0,0,0,2.53,2.53L78,205.42a6.2,6.2,0,0,1,1.9-.31,6.09,6.09,0,0,1,3,.81A90,90,0,0,0,218,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M168,112a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,112Zm-8,24H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16Zm72-8A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Zm-16,0A88,88,0,1,0,51.81,172.06a8,8,0,0,1,.66,6.54L40,216,77.4,203.53a7.85,7.85,0,0,1,2.53-.42,8,8,0,0,1,4,1.08A88,88,0,0,0,216,128Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M164,112a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm-4,28H96a4,4,0,0,0,0,8h64a4,4,0,0,0,0-8Zm68-12A100,100,0,0,1,79.5,215.47l-35.69,11.9a12,12,0,0,1-15.18-15.18l11.9-35.69A100,100,0,1,1,228,128Zm-8,0A92,92,0,1,0,48.35,174.07a4,4,0,0,1,.33,3.27L36.22,214.72a4,4,0,0,0,5.06,5.06l37.38-12.46a3.93,3.93,0,0,1,1.27-.21,4.05,4.05,0,0,1,2,.54A92,92,0,0,0,220,128Z`}))]]),fi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z`}))]]),pi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M140,80v41.21l34.17,20.5a12,12,0,1,1-12.34,20.58l-40-24A12,12,0,0,1,116,128V80a12,12,0,0,1,24,0ZM128,28A99.38,99.38,0,0,0,57.24,57.34c-4.69,4.74-9,9.37-13.24,14V64a12,12,0,0,0-24,0v40a12,12,0,0,0,12,12H72a12,12,0,0,0,0-24H57.77C63,86,68.37,80.22,74.26,74.26a76,76,0,1,1,1.58,109,12,12,0,0,0-16.48,17.46A100,100,0,1,0,128,28Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128A96,96,0,0,1,62.11,197.82a8,8,0,1,1,11-11.64A80,80,0,1,0,71.43,71.43C67.9,75,64.58,78.51,61.35,82L77.66,98.34A8,8,0,0,1,72,112H32a8,8,0,0,1-8-8V64a8,8,0,0,1,13.66-5.66L50,70.7c3.22-3.49,6.54-7,10.06-10.55A96,96,0,0,1,224,128ZM128,72a8,8,0,0,0-8,8v48a8,8,0,0,0,3.88,6.86l40,24a8,8,0,1,0,8.24-13.72L136,123.47V80A8,8,0,0,0,128,72Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M134,80v44.6l37.09,22.25a6,6,0,0,1-6.18,10.3l-40-24A6,6,0,0,1,122,128V80a6,6,0,0,1,12,0Zm-6-46A93.4,93.4,0,0,0,61.51,61.56c-8.58,8.68-16,17-23.51,25.8V64a6,6,0,0,0-12,0v40a6,6,0,0,0,6,6H72a6,6,0,0,0,0-12H44.73C52.86,88.29,60.79,79.35,70,70a82,82,0,1,1,1.7,117.62,6,6,0,1,0-8.24,8.72A94,94,0,1,0,128,34Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M132,80v45.74l38.06,22.83a4,4,0,0,1-4.12,6.86l-40-24A4,4,0,0,1,124,128V80a4,4,0,0,1,8,0Zm-4-44A91.42,91.42,0,0,0,62.93,63C53.05,73,44.66,82.47,36,92.86V64a4,4,0,0,0-8,0v40a4,4,0,0,0,4,4H72a4,4,0,0,0,0-8H40.47C49.61,89,58.3,79,68.6,68.6a84,84,0,1,1,1.75,120.49,4,4,0,1,0-5.5,5.82A92,92,0,1,0,128,36Z`}))]]),mi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),hi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,44H32A20,20,0,0,0,12,64V192a20,20,0,0,0,20,20H224a20,20,0,0,0,20-20V64A20,20,0,0,0,224,44Zm-4,144H36V68H220ZM52,128a12,12,0,0,1,12-12H192a12,12,0,0,1,0,24H64A12,12,0,0,1,52,128Zm0-36A12,12,0,0,1,64,80H192a12,12,0,0,1,0,24H64A12,12,0,0,1,52,92Zm0,72a12,12,0,0,1,12-12h8a12,12,0,0,1,0,24H64A12,12,0,0,1,52,164Zm108,0a12,12,0,0,1-12,12H108a12,12,0,0,1,0-24h40A12,12,0,0,1,160,164Zm44,0a12,12,0,0,1-12,12h-8a12,12,0,0,1,0-24h8A12,12,0,0,1,204,164Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M232,64V192a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H224A8,8,0,0,1,232,64Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48ZM64,168H48a8,8,0,0,1,0-16H64a8,8,0,0,1,0,16Zm96,0H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm48,0H192a8,8,0,0,1,0-16h16a8,8,0,0,1,0,16Zm0-32H48a8,8,0,0,1,0-16H208a8,8,0,0,1,0,16Zm0-32H48a8,8,0,0,1,0-16H208a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,50H32A14,14,0,0,0,18,64V192a14,14,0,0,0,14,14H224a14,14,0,0,0,14-14V64A14,14,0,0,0,224,50Zm2,142a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H224a2,2,0,0,1,2,2Zm-20-64a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12H200A6,6,0,0,1,206,128Zm0-32a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12H200A6,6,0,0,1,206,96ZM70,160a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12h8A6,6,0,0,1,70,160Zm96,0a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,160Zm40,0a6,6,0,0,1-6,6h-8a6,6,0,0,1,0-12h8A6,6,0,0,1,206,160Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,52H32A12,12,0,0,0,20,64V192a12,12,0,0,0,12,12H224a12,12,0,0,0,12-12V64A12,12,0,0,0,224,52Zm4,140a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H224a4,4,0,0,1,4,4Zm-24-64a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8H200A4,4,0,0,1,204,128Zm0-32a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8H200A4,4,0,0,1,204,96ZM68,160a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8h8A4,4,0,0,1,68,160Zm96,0a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,160Zm40,0a4,4,0,0,1-4,4h-8a4,4,0,0,1,0-8h8A4,4,0,0,1,204,160Z`}))]]),gi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M76,64A12,12,0,0,1,88,52H216a12,12,0,0,1,0,24H88A12,12,0,0,1,76,64Zm140,52H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Zm0,64H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,112a16,16,0,1,0,16,16A16,16,0,0,0,44,112Zm0-64A16,16,0,1,0,60,64,16,16,0,0,0,44,48Zm0,128a16,16,0,1,0,16,16A16,16,0,0,0,44,176Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,64V192H88V64Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM68,188a12,12,0,1,1,12-12A12,12,0,0,1,68,188Zm0-48a12,12,0,1,1,12-12A12,12,0,0,1,68,140Zm0-48A12,12,0,1,1,80,80,12,12,0,0,1,68,92Zm124,92H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M82,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H88A6,6,0,0,1,82,64Zm134,58H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Zm0,64H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12ZM44,54A10,10,0,1,0,54,64,10,10,0,0,0,44,54Zm0,128a10,10,0,1,0,10,10A10,10,0,0,0,44,182Zm0-64a10,10,0,1,0,10,10A10,10,0,0,0,44,118Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M84,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H88A4,4,0,0,1,84,64Zm132,60H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Zm0,64H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8ZM44,120a8,8,0,1,0,8,8A8,8,0,0,0,44,120Zm0-64a8,8,0,1,0,8,8A8,8,0,0,0,44,56Zm0,128a8,8,0,1,0,8,8A8,8,0,0,0,44,184Z`}))]]),_i=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M28,64A12,12,0,0,1,40,52H216a12,12,0,0,1,0,24H40A12,12,0,0,1,28,64Zm12,76h64a12,12,0,0,0,0-24H40a12,12,0,0,0,0,24Zm80,40H40a12,12,0,0,0,0,24h80a12,12,0,0,0,0-24Zm120.49,20.49a12,12,0,0,1-17,0l-18.08-18.08a44,44,0,1,1,17-17l18.08,18.07A12,12,0,0,1,240.49,200.49ZM184,164a20,20,0,1,0-20-20A20,20,0,0,0,184,164Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M216,144a32,32,0,1,1-32-32A32,32,0,0,1,216,144Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,2.34L217.36,166A40,40,0,1,0,206,177.36l20.3,20.3a8,8,0,0,0,11.32-11.32Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M34,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H40A6,6,0,0,1,34,64Zm6,70h72a6,6,0,0,0,0-12H40a6,6,0,0,0,0,12Zm88,52H40a6,6,0,0,0,0,12h88a6,6,0,0,0,0-12Zm108.24,10.24a6,6,0,0,1-8.48,0l-21.49-21.48a38.06,38.06,0,1,1,8.49-8.49l21.48,21.49A6,6,0,0,1,236.24,196.24ZM184,170a26,26,0,1,0-26-26A26,26,0,0,0,184,170Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M36,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H40A4,4,0,0,1,36,64Zm4,68h72a4,4,0,0,0,0-8H40a4,4,0,0,0,0,8Zm88,56H40a4,4,0,0,0,0,8h88a4,4,0,0,0,0-8Zm106.83,6.83a4,4,0,0,1-5.66,0l-22.72-22.72a36.06,36.06,0,1,1,5.66-5.66l22.72,22.72A4,4,0,0,1,234.83,194.83ZM184,172a28,28,0,1,0-28-28A28,28,0,0,0,184,172Z`}))]]),vi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M156,112a12,12,0,0,1-12,12H80a12,12,0,0,1,0-24h64A12,12,0,0,1,156,112Zm76.49,120.49a12,12,0,0,1-17,0L168,185a92.12,92.12,0,1,1,17-17l47.54,47.53A12,12,0,0,1,232.49,232.49ZM112,180a68,68,0,1,0-68-68A68.08,68.08,0,0,0,112,180Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Zm112,0a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM144,120H80a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M150,112a6,6,0,0,1-6,6H80a6,6,0,0,1,0-12h64A6,6,0,0,1,150,112Zm78.24,116.24a6,6,0,0,1-8.48,0l-51.38-51.38a86.15,86.15,0,1,1,8.48-8.48l51.38,51.38A6,6,0,0,1,228.24,228.24ZM112,186a74,74,0,1,0-74-74A74.09,74.09,0,0,0,112,186Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M148,112a4,4,0,0,1-4,4H80a4,4,0,0,1,0-8h64A4,4,0,0,1,148,112Zm78.83,114.83a4,4,0,0,1-5.66,0l-52.7-52.7a84.1,84.1,0,1,1,5.66-5.66l52.7,52.7A4,4,0,0,1,226.83,226.83ZM112,188a76,76,0,1,0-76-76A76.08,76.08,0,0,0,112,188Z`}))]]),yi=new Map([[`bold`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M230.47,67.5a12,12,0,0,0-19.26-4.32L172.43,99l-12.68-2.72L157,83.57l35.79-38.78a12,12,0,0,0-4.32-19.26A76.07,76.07,0,0,0,88.41,121.64L30.92,174.18a4.68,4.68,0,0,0-.39.38,36,36,0,0,0,50.91,50.91l.38-.39,52.54-57.49A76.05,76.05,0,0,0,230.47,67.5ZM160,148a51.5,51.5,0,0,1-23.35-5.52,12,12,0,0,0-14.26,2.62L64.31,208.66a12,12,0,0,1-17-17l63.55-58.07a12,12,0,0,0,2.62-14.26A51.5,51.5,0,0,1,108,96a52.06,52.06,0,0,1,52-52h.89L135.17,71.87a12,12,0,0,0-2.91,10.65l5.66,26.35a12,12,0,0,0,9.21,9.21l26.35,5.66a12,12,0,0,0,10.65-2.91L212,95.12c0,.3,0,.59,0,.89A52.06,52.06,0,0,1,160,148Z`}))],[`duotone`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224,96a64,64,0,0,1-94.94,56L73,217A24,24,0,0,1,39,183L104,126.94a64,64,0,0,1,80-90.29L144,80l5.66,26.34L176,112l43.35-40A63.8,63.8,0,0,1,224,96Z`,opacity:`0.2`}),V.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`fill`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M232,96a72,72,0,0,1-100.94,66L79,222.22c-.12.14-.26.29-.39.42a32,32,0,0,1-45.26-45.26c.14-.13.28-.27.43-.39L94,124.94a72.07,72.07,0,0,1,83.54-98.78,8,8,0,0,1,3.93,13.19L144,80l5.66,26.35L176,112l40.65-37.52a8,8,0,0,1,13.19,3.93A72.6,72.6,0,0,1,232,96Z`}))],[`light`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M224.91,69.75a6,6,0,0,0-9.63-2.16l-41.07,37.9L154.7,101.3l-4.19-19.51,37.9-41.07a6,6,0,0,0-2.16-9.63,70,70,0,0,0-89.77,94.39l-61.39,53c-.11.09-.21.19-.32.3A30,30,0,0,0,77.2,221.23c.11-.11.21-.21.3-.32l53-61.39a70,70,0,0,0,94.39-89.77ZM160,154a58,58,0,0,1-28-7.22,6,6,0,0,0-7.45,1.33L68.57,212.88a18,18,0,0,1-25.45-25.45l64.76-55.94A6,6,0,0,0,109.2,124a58,58,0,0,1,64-84.53L139.58,75.93a6,6,0,0,0-1.45,5.33l5.65,26.35a6,6,0,0,0,4.61,4.61l26.35,5.65a6,6,0,0,0,5.33-1.45L216.49,82.8A58.06,58.06,0,0,1,160,154Z`}))],[`regular`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`thin`,V.createElement(V.Fragment,null,V.createElement(`path`,{d:`M223.05,70.5a4,4,0,0,0-6.42-1.44l-41.82,38.6L153,103l-4.68-21.79,38.6-41.82a4,4,0,0,0-1.44-6.43A68,68,0,0,0,98.94,126L36.4,180l-.21.2a28,28,0,0,0,39.6,39.6l.2-.21,54-62.54A68,68,0,0,0,228,96,67.51,67.51,0,0,0,223.05,70.5ZM160,156a60,60,0,0,1-29-7.47,4,4,0,0,0-5,.89L70,214.25A20,20,0,0,1,41.75,186l64.82-56a4,4,0,0,0,.89-5,60,60,0,0,1,69.46-86.59L141.05,77.29a4,4,0,0,0-1,3.55l5.66,26.35a4,4,0,0,0,3.07,3.07l26.35,5.66a4,4,0,0,0,3.55-1l38.87-35.87A60.05,60.05,0,0,1,160,156Z`}))]]),bi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:si}));bi.displayName=`ArrowClockwiseIcon`;var xi=bi,Si=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:ci}));Si.displayName=`ArrowCounterClockwiseIcon`;var Ci=Si,wi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:li}));wi.displayName=`ArrowsOutIcon`;var Ti=wi,Ei=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:ui}));Ei.displayName=`CaretUpIcon`;var Di=Ei,Oi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:di}));Oi.displayName=`ChatCircleTextIcon`;var ki=Oi,Ai=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:fi}));Ai.displayName=`ClockIcon`;var ji=Ai,Mi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:pi}));Mi.displayName=`ClockCounterClockwiseIcon`;var Ni=Mi,Pi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:mi}));Pi.displayName=`InfoIcon`;var Fi=Pi,Ii=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:hi}));Ii.displayName=`KeyboardIcon`;var Li=Ii,Ri=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:gi}));Ri.displayName=`ListBulletsIcon`;var zi=Ri,Bi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:_i}));Bi.displayName=`ListMagnifyingGlassIcon`;var Vi=Bi,Hi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:vi}));Hi.displayName=`MagnifyingGlassMinusIcon`;var Ui=Hi,Wi=V.forwardRef((e,t)=>V.createElement(x,{ref:t,...e,weights:yi}));Wi.displayName=`WrenchIcon`;var Gi=Wi,Ki=i(b(),1),qi=`$__all`;function Ji(e,t,n){if(e.kind===`constant`)return e.value??``;let r=e.kind===`custom`?e.options?.map(e=>({value:e}))??[]:n===null?[]:n,i=t[e.name],a=!e.multi&&Array.isArray(i)&&i.length===0?void 0:i;if(a===`$__all`){if(e.include_all)return qi}else if(a!==void 0){if(e.kind===`text`||r===void 0)return a;let t=new Set(r.map(e=>e.value));if(Array.isArray(a)){if(a.length===0&&e.multi)return[];let n=a.filter(e=>t.has(e));if(n.length>0)return n}else if(t.has(a))return a}return e.default?e.default:e.include_all?qi:r?.[0]?.value??``}var Yi=(e,t)=>e.replace(/\$([a-z][a-z0-9_]*)/g,(e,n)=>{let r=t[n];return r===void 0?e:r===`$__all`?`all`:Array.isArray(r)?r.join(`, `):r});function Xi(e,t,n){let r={};for(let i of e??[]){let e=Ji(i,t,n?.[i.name]);(i.kind!==`query`||e!==``)&&(r[i.name]=e)}return r}function Zi(e){return Array.from({length:e.rows},(t,n)=>Object.fromEntries(e.columns.map((t,r)=>{let i=e.values[r]?.[n]??null;return[t.name,typeof i==`number`&&!Number.isFinite(i)?null:i]})))}function Qi(e,t){return e.viz!==`logs`||!t||t.rows<2?[]:t.columns.flatMap((e,n)=>{if(e.role!==`dimension`||e.type!==`string`||[`body`,`body_template`,`severity`,`status`].includes(e.name)||/(^id$|_id$)/.test(e.name))return[];let r=t.values[n][0];return typeof r==`string`&&r!==``&&t.values[n].slice(0,t.rows).every(e=>e===r)?[{name:e.name,value:r}]:[]})}function $i(e,t){let n=t.frame??{columns:[],values:[],rows:0};return{columns:n.columns.map(e=>e.name),rows:Zi(n),selection:t=>{let n={};for(let r of e.query?.by??[]){let e=r.startsWith(`attributes[`)||r.startsWith(`resource[`)?r.slice(r.indexOf(`'`)+1,r.lastIndexOf(`'`)):r;t[e]!==void 0&&t[e]!==null&&(n[r]=String(t[e]))}return{time:typeof t.time==`number`?t.time:typeof t.start==`number`?t.start:void 0,dimensions:n,trace_id:typeof t.trace_id==`string`?t.trace_id:void 0,namespace:typeof t.namespace==`string`?t.namespace:void 0}}}}function ea(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e])}var ta=e=>e.map(ea).join(`
`);function na(e,t=!1){return n=>{let r=Array.isArray(n)?n:[n];return ta([...r[0]?.axisValueLabel?[r[0].axisValueLabel]:[],...r.map(n=>{let r=n.value,i=Array.isArray(r)?t?r.slice(1):r:[r];return`${n.seriesName??``}${n.name?` · ${n.name}`:``}: ${i.map(t=>typeof t==`number`?e(t,n.seriesName):String(t??`—`)).join(` · `)}`})])}}var ra=e=>/^Other(?: \(\d+\))?$/.test(e??``);function ia(e,t){let n=Math.min(6,Math.max(1,Math.floor(t.options?.top||6))),r=e.filter(e=>!ra(e.name)),i=r.slice(0,n).map(e=>({name:e.name,items:[e]})),a=[...e.filter(e=>ra(e.name)),...r.slice(n)];return a.length&&i.push({name:a.length===1&&ra(a[0].name)?a[0].name:`Other (${a.reduce((e,t)=>e+(ra(t.name)?Number(t.name.match(/\d+/)?.[0]??1):1),0)})`,items:a}),i}function aa(e){let t=e.filter(e=>e!==null);return t.length?t.reduce((e,t)=>e+t,0):null}function oa(e,t){let n=Math.min(6,Math.max(1,Math.floor(t.options?.top||6))),r=e.filter(e=>!ra(e.name));return{shown:[...r.slice(0,n),...e.filter(e=>ra(e.name))],hidden:Math.max(0,r.length-n)}}function sa(e,t){return e>0?[{type:`text`,right:8,bottom:2,silent:!0,style:{text:`${e} more series not shown`,fill:t,fontSize:11}}]:[]}function ca(e,t,n,r,i=`sans-serif`,a){let o=e=>Array.from(e).length>24?`${Array.from(e).slice(0,23).join(``)}…`:e,s=Math.max(1,t-16),c=1,l=0;for(let t of e){let e=15+(a?.(o(t),`12px ${i}`)??Array.from(o(t)).length*7.2);l&&l+10+e>s&&(c++,l=0),l+=(l?10:0)+e}let u=c>2;return{top:n?u?30:c*20+2:12,option:{type:u?`scroll`:`plain`,show:n,top:0,left:0,right:0,padding:0,itemGap:6,icon:`roundRect`,itemWidth:10,itemHeight:10,itemStyle:{borderColor:r,borderWidth:1},textStyle:{color:r,fontSize:12,lineHeight:14},data:e,formatter:o,tooltip:{show:!0,renderMode:`html`,formatter:e=>ea(e.name)}}}}function la(e,t){if(!(!Number.isFinite(e)||!Number.isFinite(t)||e>=t||Math.abs(e)>864e13||Math.abs(t)>864e13))return{from:new Date(Math.floor(e)).toISOString(),to:new Date(Math.ceil(t)).toISOString()}}function ua(e){let t=[e.time?.range?`Range ${e.time.range}`:void 0,e.time?.shift?`Shifted ${e.time.shift}`:void 0].filter(Boolean);return t.length?t.join(` · `):void 0}function da(e,t,n){if(n.interactive===!1||n.data?.value===null)return;let r=n.data?.selection;if(r)return Object.values(r.dimensions).some(ra)?void 0:r;if(ra(n.seriesName)||ra(n.name)||n.value===null||Array.isArray(n.value)&&n.value.at(-1)==null)return;let i=e.query?.by?.[0]??t.frame?.columns.find(e=>e.role===`dimension`)?.name,a=e.viz===`timeseries`?n.seriesName:n.name,o=Array.isArray(n.value)?n.value:[];return{time:e.viz===`timeseries`&&typeof o[0]==`number`?o[0]:void 0,dimensions:i&&a?{[i]:a}:{}}}var fa=new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}),pa=new Intl.NumberFormat(`en`,{maximumFractionDigits:2});function ma(e){return Math.abs(e)<1e-4?e.toExponential(2).replace(/\.?(0+)(?=e)/,``):String(Number(e.toPrecision(3)))}function ha(e,t=pa){return e!==0&&Math.abs(e)<1?ma(e):t.format(e)}function ga(e,t){let n=t===`s`?e*1e3:t===`ns`?e/1e6:e;return e!==0&&n===0?`${ma(e)}${t}`:n!==0&&Math.abs(n)<1?`${ma(n)}ms`:ye(n)}function _a(e){let t=[`B`,`KiB`,`MiB`,`GiB`,`TiB`],n=e,r=0;for(;Math.abs(n)>=1024&&r=1e4?fa:pa);default:return ha(t,Math.abs(t)>=1e4?fa:pa)}}function ya(e){return t=>e===`ms`||e===`s`||e===`ns`?va(e,t).replace(/(\.\d*?)0+([a-z]*)$/,`$1$2`).replace(/\.([a-z]*)$/,`$1`):va(e,t)}function ba(e,t){return ya(e)(t??NaN).replace(/(?<=\d)(ms|ns|s|m|h)\b/g,` $1`)}function xa(e){return Math.max(3,Math.min(10,Math.round(e/70)))-1}function Sa(e,t){let n=t===`ms`?1:t===`s`?1e3:t===`ns`?1e-6:void 0,r=e=>{let t=10**Math.floor(Math.log10(e));return[1,2,5,10].map(e=>e*t).find(t=>t>=e)};if(n===void 0)return r(e);let i=e*n,a=[1,10,100,1e3,1e4,6e4,6e5,36e5,36e6].flatMap(e=>[1,2,5].map(t=>e*t)).sort((e,t)=>e-t);return(i<1?r(i):a.find(e=>e>=i)??r(i/36e5)*36e5)/n}function Ca(e,t,n,r){e=Number.isFinite(e)?Math.min(0,e):0,t=Number.isFinite(t)?Math.max(0,t):1,t===e&&(t=e+1);let i=xa(r),a=Sa(Math.max(t-e,2**-52)/i,n);for(;Math.ceil(t/a)-Math.floor(e/a)>i;)a=Sa(a*1.01,n);return{min:Math.floor(e/a)*a,max:Math.ceil(t/a)*a,interval:a,splitNumber:i,fanout_unit:n}}function wa(e,t){return e.type!==`value`&&e.type!==`log`?e:{...e,...e.type===`value`&&typeof e.min==`number`&&typeof e.max==`number`?Ca(e.min,e.max,typeof e.fanout_unit==`string`?e.fanout_unit:void 0,t):{splitNumber:xa(t)}}}function Ta(e,t,n){let r=e=>va(n,e),i=``;if(n===`ms`||n===`s`||n===`ns`){let a=n===`s`?1e3:n===`ns`?1e-6:1,o=Math.abs((e??t??0)*a),s=o>=6e4?6e4:o>=1e3?1e3:1;i=s===6e4?` min`:s===1e3?` s`:` ms`;let c=s===6e4?1:s===1e3?+(o<1e4):2,l=new Intl.NumberFormat(void 0,{maximumFractionDigits:c});r=e=>l.format(e*a/s)}return t===null&&e!==null?`≥${r(e)}${i}`:(e===null||e===0)&&t!==null?`<${r(t)}${i}`:`${e===null?`−∞`:r(e)}–${t===null?`∞`:r(t)}${i}`}function Ea(e){let t=new Date(e);return t.getHours()===0&&t.getMinutes()===0&&t.getSeconds()===0?t.toLocaleDateString(void 0,{month:`short`,day:`numeric`}):t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}function Da(e,t=new Date,n){let r=new Date(e);if(!Number.isFinite(r.getTime()))return`—`;let i=new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,...r.getFullYear()===t.getFullYear()?{}:{year:`numeric`},hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).formatToParts(r),a=i.filter(e=>[`month`,`day`,`year`].includes(e.type)).map(e=>e.value),o=i.filter(e=>[`hour`,`minute`,`second`].includes(e.type)).map(e=>e.value);return`${a.join(` `)} ${o.join(`:`)}`}function Oa({panel:e,result:t}){let n=t?.frame;return(0,H.jsxs)(`div`,{"data-panel-data":!0,children:[t?.error&&(0,H.jsx)(T,{"data-panel-error-detail":!0,size:`sm`,role:`status`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,userSelect:`text`},children:t.error}),n?(0,H.jsxs)(be,{fz:12,striped:!0,children:[(0,H.jsx)(be.Thead,{children:(0,H.jsx)(be.Tr,{children:n.columns.map(e=>(0,H.jsx)(be.Th,{ff:wt.display,children:e.name},e.name))})}),(0,H.jsx)(be.Tbody,{children:Array.from({length:Math.min(n.rows,500)},(t,r)=>(0,H.jsx)(be.Tr,{children:n.columns.map((t,i)=>{let a=n.values[i][r];return(0,H.jsx)(be.Td,{ff:wt.display,children:a===null?`—`:t.type===`time`?new Date(Number(a)).toISOString():t.role===`measure`?va(t.unit??e.unit,Number(a)):String(a)},t.name)})},r))})]}):(0,H.jsx)(T,{c:`dimmed`,size:`sm`,children:`No data.`}),(0,H.jsxs)(T,{c:`dimmed`,fz:12,mt:8,children:[`Ran in `,t?.elapsed_ms??0,` ms`,t?.interval?`, one point per ${t.interval}`:``,n?`, ${n.rows} rows${n.truncated?` (truncated)`:``}`:``,`.`]}),(t?.sql??e.sql)&&(0,H.jsx)(Re,{block:!0,tabIndex:0,mt:8,children:t?.sql??e.sql})]})}function ka({panel:e,dark:t}){let n=JSON.stringify(e,null,2).split(/("(?:[^"\\]|\\.)*"(?=\s*:)|"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?)/g);return(0,H.jsx)(`pre`,{"data-panel-spec":!0,style:{margin:0,fontFamily:wt.display,fontSize:12,color:ft[t?`dark`:`light`].text},children:n.map((e,r)=>{let i=e.startsWith(`"`)&&/^\s*:/.test(n[r+1]??``)?`key`:e.startsWith(`"`)?`string`:/^(true|false|null)$/.test(e)?`literal`:/^-?\d/.test(e)?`number`:`punctuation`,a=i===`key`?_t[t?4:7]:i===`string`?mt[t?4:8]:i===`number`||i===`literal`?Dt[t?4:8]:void 0;return i===`punctuation`?e:(0,H.jsx)(`span`,{"data-json-token":i,style:{color:a},children:e},r)})})}function Aa(e){let t=e.event.data?.selection,n=e.event.value;return JSON.stringify([e.event.seriesName,e.event.name,t?.from??t?.time??(Array.isArray(n)?n[0]:void 0),t?.dimensions,t?.bucket])}function ja(e){let t=new Date().toISOString().slice(0,10),n=e.from.slice(0,10),r=e.to.slice(0,10),i=e=>e.slice(11,-1).replace(/\.000$/,``);return`${(n===t?``:n+` `)+i(e.from)} – ${(r!==n&&r!==t?r+` `:``)+i(e.to)} UTC · ${ye(Date.parse(e.to)-Date.parse(e.from))}`}var Ma={background:`color-mix(in srgb, var(--mantine-color-body) 92%, transparent)`,border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`,padding:`2px 6px`};function Na(e){return e.replace(`Enter drill`,`↵ drill`).replace(`Shift+←→`,`⇧←→`)}var Pa=(0,V.createContext)(void 0);function Fa({points:e,label:t,summary:n,children:r,onClick:i,canSelect:a,onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d,rangeReset:f,height:p=`100%`,onZoom:m,bounds:h,pointWindow:g}){let[_,v]=(0,V.useState)(!1),[b,x]=(0,V.useState)(``),[S,w]=(0,V.useState)(),[E,D]=(0,V.useState)(null),O=(0,V.useRef)(null),k=(0,V.useRef)(!1);(0,V.useEffect)(()=>{let e=e=>{e.key===`Tab`&&(k.current=!1)};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[]);let A=(0,V.useId)(),j=(0,V.useContext)(Pa),M=(0,V.useRef)(null),N=(0,V.useRef)({onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d});N.current={onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d};let P=(0,V.useMemo)(()=>new Map(e.map(e=>[Aa(e),e])),[e]),F=(0,V.useRef)(void 0),I=e=>g?.(e)?.from??e.event.name??(Array.isArray(e.event.value)?e.event.value[0]:void 0),L=F.current,ee=L?e.filter(e=>e.event.seriesName===L.event.seriesName):e,R=ee.length?ee:e,te=L&&I(L),ne=typeof te==`number`?R.reduce((e,t)=>{let n=I(t),r=e&&I(e);return typeof n==`number`&&(!e||typeof r!=`number`||Math.abs(n-te)I(e)===te),re=S?P.get(S)??ne??R[0]??e[0]:e[0],ie=!!(m&&h&&Number.isFinite(h.from)&&Number.isFinite(h.to)&&h.from[...new Set(e.map(e=>e.event.seriesName))],[e]),ae=(0,V.useMemo)(()=>e.filter(e=>e.event.seriesName===re?.event.seriesName),[e,re?.event.seriesName]),B=re?ae.indexOf(re):-1;(0,V.useEffect)(()=>{re&&(!S||P.has(S)||!ee.length)&&(F.current=re,(!S||!ee.length)&&w(Aa(re))),_&&N.current.onHighlight(re)},[re,S,_]),(0,V.useEffect)(()=>{if(!E)return;let e=Date.parse(E.from),t=Date.parse(E.to);h&&(Number.isFinite(e)&&eh.to)&&D(null)},[h?.from,h?.to,E]),(0,V.useEffect)(()=>{N.current.onRangePending?.(!!E)},[!!E]),(0,V.useEffect)(()=>{N.current.onRangeChange?.(E?{from:Date.parse(E.from),to:Date.parse(E.to)}:void 0)},[E]),(0,V.useEffect)(()=>{D(null)},[f]),(0,V.useEffect)(()=>()=>{N.current.onHighlight(void 0),N.current.onRangePending?.(!1),N.current.onRangeChange?.(void 0)},[]);let oe=(e,t=!1)=>{if(e){if(x(n(e)),t&&ie&&re){let t=E?.anchor??Aa(re),n=P.get(t),r=E?.window??(n&&g?.(n)),i=g?.(e);if(r&&i){let e=Math.max(h.from,Math.min(r.from,i.from)),n=Math.min(h.to,Math.max(r.to,i.to));Number.isFinite(e)&&Number.isFinite(n)&&e{if(!re)return;let n=z[Math.max(0,Math.min(z.length-1,z.indexOf(re.event.seriesName)+t))],r=e.filter(e=>e.event.seriesName===n),i=I(re),a=r.find(e=>I(e)===i),o=typeof i==`number`?r.reduce((e,t)=>{let n=I(t),r=e&&I(e);return typeof n==`number`&&(!e||typeof r!=`number`||Math.abs(n-i){e===`ArrowLeft`||e===`ArrowRight`?oe(ae[Math.max(0,Math.min(ae.length-1,B+(e===`ArrowLeft`?-1:1)))],t):!t&&(e===`ArrowUp`||e===`ArrowDown`)?se(e===`ArrowUp`?-1:1):!t&&(e===`Home`||e===`End`)&&oe(e===`Home`?ae[0]:ae.at(-1))},le=()=>{D(null),O.current?.focus()},ue=ie?`←→ points · ↑↓ series · Enter drill · Shift+←→ range`:`←→ points · ↑↓ series · Enter drill`;return(0,V.useLayoutEffect)(()=>(j?.setHint(_?ue:void 0),()=>j?.setHint(void 0)),[j,_,ue]),(0,V.useLayoutEffect)(()=>{let e=M.current;if(!e)return;N.current.onRangeBarHeight?.(e.getBoundingClientRect().height);let t=new ResizeObserver(([t])=>{if(!t)return;let n=getComputedStyle(e),r=[n.paddingTop,n.paddingBottom,n.borderTopWidth,n.borderBottomWidth].reduce((e,t)=>e+(parseFloat(t)||0),0);N.current.onRangeBarHeight?.(t.borderBoxSize?.[0]?.blockSize??t.contentRect.height+r)});return t.observe(e),()=>{t.disconnect(),N.current.onRangeBarHeight?.(0)}},[!!(E&&ie)]),(0,H.jsxs)(o,{ref:O,"data-chart-plot":!0,tabIndex:0,role:`application`,"aria-roledescription":`chart`,"aria-label":t,"aria-describedby":A,"data-mantine-stop-propagation":E?`true`:void 0,className:`chart-keyboard-point`,style:{position:`relative`,height:p,width:`100%`,flex:`1 1 auto`,minHeight:0,minWidth:0},onPointerDownCapture:e=>{M.current?.contains(e.target)||(k.current=!0,v(!1),_&&N.current.onHighlight(void 0),N.current.onActiveChange?.(!1))},onFocus:e=>{e.target!==e.currentTarget||k.current||(N.current.onActiveChange?.(!0),v(!0))},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(v(!1),D(null),x(``),N.current.onHighlight(void 0),N.current.onActiveChange?.(!1))},onKeyDown:e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey||e.nativeEvent.isComposing)return;if(e.key===`Escape`&&!e.repeat){E?(e.preventDefault(),e.stopPropagation(),le()):e.target===e.currentTarget&&!e.currentTarget.closest(`[data-panel-fullscreen],[data-fragment-fullscreen]`)&&(e.preventDefault(),e.stopPropagation(),e.currentTarget.blur());return}if(e.target!==e.currentTarget||e.repeat&&![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key))return;let t=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key);if(t&&!_&&(k.current=!1,v(!0),N.current.onActiveChange?.(!0),!re)){e.preventDefault();return}e.key===`Enter`&&_&&!e.shiftKey&&re&&i&&(!a||a(re.event))?(e.preventDefault(),i(re.event)):t&&(!e.shiftKey||e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),ce(e.key,e.shiftKey))},children:[r,(0,H.jsx)(o,{"data-chart-overlay":!0,style:{position:`absolute`,inset:0,zIndex:1,pointerEvents:`none`,overflow:`hidden`},children:E&&ie&&(0,H.jsxs)(y,{ref:M,"data-chart-range-bar":!0,gap:6,style:{...Ma,position:`absolute`,bottom:4,left:4,right:4,maxHeight:`100%`,overflow:`auto`,pointerEvents:`auto`},children:[(0,H.jsx)(T,{"data-chart-range-label":!0,size:`xs`,title:E.from+` – `+E.to,truncate:!0,style:{flex:`1 1 140px`,minWidth:0},children:ja(E)}),(0,H.jsx)(C,{size:`compact-xs`,"data-mantine-stop-propagation":`true`,onClick:()=>{m(Date.parse(E.from),Date.parse(E.to)),le()},children:`Zoom to range`}),(0,H.jsx)(C,{size:`compact-xs`,variant:`subtle`,"data-mantine-stop-propagation":`true`,onClick:le,children:`Cancel`})]})}),(0,H.jsx)(Ve,{id:A,children:ue}),(0,H.jsx)(Ve,{"aria-live":`polite`,"aria-atomic":`true`,children:b})]})}var Ia=new Set([`id`,`http`,`https`,`rpc`,`grpc`,`cpu`,`sql`,`url`,`uri`,`ip`,`io`,`db`,`gc`,`tls`,`api`]),La={ms:`ms`,ns:`ns`,s:`s`,us:`µs`,bytes:`bytes`,percent:`%`,ratio:`ratio`,per_second:`/s`,per_minute:`/min`},Ra={body_template:`message template`,parquet_index:`traces`};function za(e,t){let n=typeof e==`string`?e:e.name,r=t?.options?.columns?.find(e=>e.field===n)?.unit??(typeof e==`string`?void 0:e.unit)??(typeof e!=`string`&&e.role===`measure`?t?.unit:void 0),i=Ra[n]??n;/\b(?:duckdb|parquet|sqlite|variant|timestamptz_ns|timestamp_ns)\b|\btelemetry\./i.test(i)&&(i=`value`),i=i.replace(/^(\w+)\(([^()]*)\)$/,(e,t,n)=>[t,n].filter(Boolean).join(`_`));let a=i.match(/_(ms|ns|us|s|bytes|percent)$/i);a&&(i=i.slice(0,-a[0].length));let o=r??a?.[1]?.toLowerCase();return i=i.split(`_`).map((e,t)=>/^p\d+$/i.test(e)||Ia.has(e.toLowerCase())?e.toUpperCase():t===0?e.charAt(0).toUpperCase()+e.slice(1):e).join(` `),i+(o&&o!==`none`&&o!==`count`?` (${La[o]??o})`:``)}function Ba(e){return e===`healthy`?`ok`:e===`degraded`?`warn`:e===`unknown`?`gray`:`bad`}function Va(e){return ft[e?`dark`:`light`]}function Ha(e){let t=e?5:7;return{ok:mt[t],warn:ht[t],bad:Et[t],info:Dt[t]}}function Ua(e,t){return xt[t?`dark`:`light`][e]??Va(t).muted}function Wa(e){return e===`unhealthy`?`diamond`:e===`degraded`?`roundRect`:`circle`}function Ga(e){return e===`unknown`?`dashed`:`solid`}var Ka=e=>typeof e==`number`&&Number.isFinite(e)?e:null;function qa(e){return e.columns.flatMap((e,t)=>e.role===`measure`?[t]:[])}function Ja(e){let t=e.columns.findIndex(e=>e.role===`time`);if(t<0)return[];let n=e.columns.findIndex(e=>e.role===`dimension`),r=qa(e);if(n>=0&&r.length>0){let i=r[0],a=new Map;for(let r=0;r({name:e.columns[n].name,unit:e.columns[n].unit,points:e.values[t].map((t,r)=>[Number(t),Ka(e.values[n][r])])}))}function Ya(e){let t=e.columns.flatMap((e,t)=>e.role===`dimension`?[t]:[]),n=qa(e);if(t.length===0||n.length===0)return{categories:[],series:[]};let r=t[0],i=[];for(let t=0;t1){let a=t[1],o=n[0],s=new Map;for(let t=0;tnull)),s.get(n)[i.indexOf(String(e.values[r][t]??``))]=Ka(e.values[o][t])}return{categories:i,series:[...s.entries()].map(([t,n])=>({name:t,unit:e.columns[o].unit,values:n}))}}return{categories:i,series:n.map(t=>({name:e.columns[t].name,unit:e.columns[t].unit,values:e.values[t].map(Ka)}))}}function Xa(e,t){let n=e.filter(e=>e!==null);if(n.length===0)return null;switch(t){case`last`:return n[n.length-1];case`min`:return Math.min(...n);case`max`:return Math.max(...n);case`sum`:return n.reduce((e,t)=>e+t,0);default:return n.reduce((e,t)=>e+t,0)/n.length}}function Za(e,t){let n=qa(t)[0];return n===void 0?null:(e.reduce??`window`)===`window`?t.totals?Ka(t.totals[n]):Xa(t.values[n].map(Ka),`mean`):Xa(t.values[n].map(Ka),e.reduce??`mean`)}function Qa(e){let t=qa(e)[0];return t===void 0?[]:e.values[t].map(Ka)}var $a={ok:0,warn:1,bad:2};function eo(e){if(!e?.length)return;let t=[...e].sort((e,t)=>$a[e.status]-$a[t.status]),n=t[0],r=t[t.length-1];return $a[r.status]>$a[n.status]&&r.value!==n.value?r.value>n.value?`lower`:`higher`:`lower`}function to(e,t,n){if(e===null||!t||t.length===0)return null;n??=eo(t);let r=`ok`;for(let i of t)(n===`lower`?e>=i.value:e<=i.value)&&$a[i.status]>$a[r]&&(r=i.status);return r}function no(e,t){let n=Ct(e),r=Ct(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function ro(e,t){return`rgba(${[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)).join(`, `)}, ${t})`}function io(e,t){return{color:e,...no(e,t.surface)<3?{borderColor:t.text,borderWidth:1}:{}}}function ao(e,t){return{color:e,...no(e,t.surface)<3?{shadowColor:t.text,shadowBlur:2}:{}}}function oo(e,t){return{ok:mt,warn:ht,bad:Et}[e][t?5:8]}function so(e){let t=Va(e),n=Ha(e);return{dark:e,text:t.text,muted:t.muted,grid:t.grid,surface:t.surface,border:t.border,status:{ok:n.ok,warn:n.warn,bad:n.bad},font:wt.display}}function co(e,t,n){if(!Array.isArray(e.series))return e;let r=e.series,i=Array.isArray(e.yAxis)?e.yAxis:[e.yAxis],a=[],o=r.map((e,o)=>{let s=e.endLabel;if(!s?.show||!Array.isArray(e.data))return e;let c;for(let t=e.data.length-1;t>=0;t--){let n=e.data[t];if(Array.isArray(n)&&typeof n[1]==`number`&&Number.isFinite(n[1])){c=n;break}}let l=i[Number(e.yAxisIndex??0)];if(!c||!l)return{...e,endLabel:{...s,show:!1}};let u=l.type===`log`?Math.log:e=>e,d=l.min??1/0,f=l.max??0;if(l.type===`log`&&(l.min===void 0||l.max===void 0)){for(let t of r)if(Number(t.yAxisIndex??0)===Number(e.yAxisIndex??0)&&Array.isArray(t.data))for(let e of t.data)Array.isArray(e)&&typeof e[1]==`number`&&Number.isFinite(e[1])&&e[1]>0&&(l.min===void 0&&(d=Math.min(d,e[1])),l.max===void 0&&(f=Math.max(f,e[1])))}Number.isFinite(d)||(d=1);let p=u(l.type===`log`?d:l.min??0),m=u(l.type===`log`?Math.max(f,d*1.01):l.max??1),h=n?.(o,c),g=Number.isFinite(h)?h:t.y+t.height*(1-(u(c[1])-p)/(m-p)),_=((s.lineHeight??14)+2)/2,v=[Math.max(t.y+_,Math.min(t.y+t.height-_,g)),...a.flatMap(e=>[e.y-e.half-_,e.y+e.half+_])].filter(e=>Number.isFinite(e)&&e-_>=t.y&&e+_<=t.y+t.height&&a.every(t=>Math.abs(t.y-e)>=t.half+_)).sort((e,t)=>Math.abs(e-g)-Math.abs(t-g))[0];return v===void 0?{...e,endLabel:{...s,show:!1}}:(a.push({y:v,half:_}),{...e,labelLayout:{dy:v-g,hideOverlap:!0}})});return{...e,series:o}}var lo=(e,t,n)=>ra(e)?n.muted:Ua(t,n.dark);function uo(e,t){let n=Ja(e);if(!e.columns.some(e=>e.role===`dimension`))for(let r of n)r.name=za(e.columns.find(e=>e.name===r.name)??r.name,t);return oa(n,t)}function fo(e,t){return{animationDuration:200,textStyle:{fontFamily:e.font,color:e.muted,fontSize:11},grid:{left:8,right:16,top:28,bottom:8,containLabel:!0},tooltip:{trigger:`axis`,formatter:na(e=>va(t,e)),confine:!0,backgroundColor:e.surface,borderColor:e.border,textStyle:{color:e.text,fontSize:12},valueFormatter:e=>va(t,e),axisPointer:{type:`line`,lineStyle:{color:e.border}}},aria:{enabled:!0}}}function po(e,t,n,r){return(e.thresholds??[]).map(i=>({yAxis:i.value,label:{formatter:`${i.label??i.status} ${ya(r??e.unit)(i.value).replace(/(?<=\d)(ms|s|m|h)$/,` $1`)}`,position:i.value<=(n.min+n.max)/2?`insideEndTop`:`insideEndBottom`,distance:8,color:t.muted,textBorderColor:t.surface,textBorderWidth:3,fontSize:12},lineStyle:{color:t.status[i.status],type:[4,3],width:1}}))}function mo(e,t,n,r={width:500,height:248}){let i=t.frame?uo(t.frame,e):{shown:[],hidden:0},a=i.shown,o=a[0]?.unit??e.unit,s=new Set(a.map(e=>e.name)),c=a.find(e=>ra(e.name)),l=t.previous&&t.shift_ms!==void 0?uo(t.previous,e).shown.flatMap(e=>ra(e.name)?c?[e]:[]:s.has(e.name)?[e]:[]):[],u=[...new Set([...a,...l].map(t=>t.unit??e.unit))];u.length===0&&u.push(e.unit);let d=e.options?.style??`line`,f=a.length>=2&&a.length<=6&&i.hidden===0&&d!==`bars`&&d!==`stacked`,p=f?Math.max(40,...a.map(e=>{let t=Array.from(e.name).slice(0,24).join(``);return r.measureText?.(t,`12px ${n.font}`)??Array.from(t).length*7.2}))+12:0,m=f?p+8:0,h=(e.options?.legend??`auto`)!==`hidden`&&a.length>1,g=ca(a.map(e=>e.name),r.width,h,n.text,n.font,r.measureText),_=r.height-g.top-(i.hidden?24:8)-22,v=Math.max(0,Math.floor(_/16)),y=t.shift_ms,b=u.map(t=>{let n=[...a,...l].filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.points.flatMap(([,e])=>e===null?[]:[e]));if(d===`stacked`){let r=new Map;for(let n of a.filter(n=>(n.unit??e.unit)===t))for(let[e,t]of n.points){let n=r.get(e)??{positive:0,negative:0};t!==null&&(t>0?n.positive+=t:n.negative+=t),r.set(e,n)}n.push(...[...r.values()].flatMap(e=>[e.positive,e.negative]))}return Ca(Math.min(0,...n),Math.max(0,...n),t,_)}),x=a.map((t,r)=>{let i=lo(t.name,r,n);return{name:t.name,interactive:!0,yAxisIndex:u.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>va(t.unit??e.unit,n)},type:d===`bars`||d===`stacked`?`bar`:`line`,data:t.points,endLabel:f?{show:r0?{symbol:[`none`,`none`],silent:!0,data:po(e,n,b[0],o)}:void 0}}),S=y===void 0?[]:l.map(t=>({name:`${t.name} · previous`,interactive:!1,yAxisIndex:u.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>va(t.unit??e.unit,n)},type:`line`,data:t.points.map(([e,t])=>[e+y,t]),showSymbol:!1,silent:!0,z:1,lineStyle:{width:1,type:`dashed`,color:n.muted},itemStyle:{color:n.muted}})),C=u.map((t,r)=>({...e.options?.scale===`log`?{splitNumber:xa(_)}:b[r],type:e.options?.scale===`log`?`log`:`value`,position:r===0?`left`:`right`,offset:Math.max(0,r-1)*56,axisLine:{show:!1},splitLine:{show:r===0,lineStyle:{color:n.grid}},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,hideOverlap:!0,formatter:ya(t)}}));return co({...fo(n,o),tooltip:{...fo(n,o).tooltip,formatter:na((t,n)=>va([...a,...l].find(e=>e.name===n||`${e.name} · previous`===n)?.unit??e.unit,t),!0)},legend:g.option,grid:{left:8,right:16+(f?m:0)+Math.max(0,u.length-2)*56,top:g.top,bottom:i.hidden?24:8,containLabel:!0},xAxis:{type:`time`,min:t.from_ms,max:t.to_ms,axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,hideOverlap:!0,formatter:Ea}},yAxis:C.length===1?C[0]:C,series:[...x,...S],graphic:sa(i.hidden,n.muted)},{y:g.top,height:_})}function ho(e,t,n){if(n(e)<=t)return e;let r=Array.from(e);for(let e=r.length-1;e>0;e--){let i=Math.floor(e*.45),a=e-i,o=r.slice(0,i).join(``)+`…`+r.slice(-a).join(``);if(n(o)<=t)return o}return`…`}function go(e,t,n,r={width:500,height:248}){let i=Ya(t);if(t.columns.filter(e=>e.role===`dimension`).length<2)for(let n of i.series)n.name=za(t.columns.find(e=>e.name===n.name)??n.name,e);let a=i.categories,{shown:o,hidden:s}=oa(i.series,e),c=t.columns.flatMap((e,t)=>e.role===`dimension`?[t]:[]),l=new Map;for(let n=0;nString(t.values[e][n]??``))),{dimensions:r,...i})}let u=o[0]?.unit??e.unit,d=[...new Set(o.map(t=>t.unit??e.unit))];d.length===0&&d.push(e.unit);let f=o.length>1,p=!!(t.periods?.[`Before deploy`]||t.periods?.[`Since deploy`]),m=e=>r.measureText?.(e,`11px ${n.font}`)??Array.from(e).length*6.6,h=Math.min(r.width*.4,Math.max(40,...a.map(m))),g=ca(o.map(e=>e.name),r.width,f&&e.options?.legend!==`hidden`,n.text,n.font,r.measureText),_=d.map((t,i)=>({...Ca(Math.min(0,...o.filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.values.filter(e=>e!==null))),Math.max(0,...o.filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.values.filter(e=>e!==null))),t,r.width-h-80),type:`value`,position:i===0?`bottom`:`top`,offset:Math.max(0,i-1)*36,splitLine:{show:i===0,lineStyle:{color:n.grid}},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,formatter:e=>ba(t,e),hideOverlap:!0}}));return{...fo(n,u),tooltip:{...fo(n,u).tooltip,formatter:na((t,n)=>va(o.find(e=>e.name===n)?.unit??e.unit,t)),axisPointer:{type:`shadow`}},legend:g.option,grid:{left:8,right:56,top:(f?g.top:8)+Math.max(0,d.length-1)*36,bottom:s?24:8,containLabel:!0},yAxis:{type:`category`,inverse:!0,data:a,splitLine:{show:!1},axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,width:h,overflow:`truncate`,formatter:e=>ho(e,h,m)}},xAxis:_.length===1?_[0]:_,series:o.map((t,r)=>({name:t.name,interactive:!0,xAxisIndex:d.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>va(t.unit??e.unit,n)},type:`bar`,data:t.values.map((e,n)=>({value:e,selection:l.get(JSON.stringify(c.length>1?[a[n],t.name]:[a[n]]))})),barMaxWidth:p&&t.name===`Before deploy`?7:14,barGap:`20%`,itemStyle:{...io(p?t.name===`Before deploy`?n.muted:Ua(0,n.dark):lo(t.name,r,n),n),borderRadius:[0,4,4,0]},label:{show:p?t.name===`Since deploy`:!f||r===0,position:`right`,color:n.text,fontFamily:n.font,fontSize:11,formatter:({value:n})=>ba(t.unit??e.unit,n)}})),graphic:sa(s,n.muted)}}function _o(e,t,n,r=e.unit,i={width:270,height:140}){let a=e.min??0,o=e.max??100,s=vo(e,a,o,n),c=va(r,t),l=to(t,e.thresholds,e.better),u=l===`bad`?`◆ Bad`:l===`warn`?`■ Warn`:l===`ok`?`● OK`:t===null?`○ Unknown`:void 0,d=e=>`${e}40`,f=i.measureText?.(c,`600 28px ${n.font}`)??c.length*28*.6,p=i.measureText?.(u??``,`11px ${n.font}`)??(u?.length??0)*11*.6,m=i.width{let r=y;return y=e,{type:`rect`,shape:{x:4+r*_,y:g,width:(e-r)*_,height:10,r:[n===0?5:0,n===s.length-1?5:0,n===s.length-1?5:0,n===0?5:0]},style:{fill:d(t)}}}),{id:`gauge-fill`,type:`rect`,shape:{x:4,y:g,width:v*_,height:10,r:5},style:{fill:l?n.status[l]:Ua(0,n.dark)}},{id:`gauge-marker`,type:`rect`,shape:{x:3+v*_,y:g-2,width:2,height:14,r:1},style:{fill:n.text}},{type:`text`,left:4,top:g+12,style:{text:va(r,a),fill:n.muted,fontSize:11,fontFamily:n.font}},{type:`text`,right:4,top:g+12,style:{text:va(r,o),fill:n.muted,fontSize:11,fontFamily:n.font}}]}}function vo(e,t,n,r){let i=n-t||1,a=[t,...(e.thresholds??[]).map(e=>Math.min(n,Math.max(t,e.value))),n].sort((e,t)=>e-t),o=[];for(let t=0;t[(e.end-t)/i,r.status[e.status]])}var yo=function(e,t){return yo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},yo(e,t)};function U(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);yo(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var bo=`12px sans-serif`,xo=20,So=100,Co=`007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N`;function wo(e){var t={};if(typeof JSON>`u`)return t;for(var n=0;n=0)s=o*n.length;else for(var c=0;c=zo&&(Ro=0),Ro++}function Vo(){var e=[...arguments];typeof console<`u`&&console.error.apply(console,e)}function Ho(e){if(typeof e!=`object`||!e)return e;var t=e,n=ko.call(e);if(n===`[object Array]`){if(!xs(e)){t=[];for(var r=0,i=e.length;r`u`&&typeof self<`u`?Ns.worker=!0:!Ns.hasGlobalWindow||`Deno`in window||typeof navigator<`u`&&typeof navigator.userAgent==`string`&&navigator.userAgent.indexOf(`Node.js`)>-1?(Ns.node=!0,Ns.svgSupported=!0):Ps(navigator.userAgent,Ns);function Ps(e,t){var n=t.browser,r=e.match(/Firefox\/([\d.]+)/),i=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),a=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);if(r&&(n.firefox=!0,n.version=r[1]),i&&(n.ie=!0,n.version=i[1]),a&&(n.edge=!0,n.version=a[1],n.newEdge=+a[1].split(`.`)[0]>18),o&&(n.weChat=!0),t.svgSupported=typeof SVGRect<`u`,t.touchEventsSupported=`ontouchstart`in window&&!n.ie&&!n.edge,t.pointerEventsSupported=`onpointerdown`in window&&(n.edge||n.ie&&+n.version>=11),t.domSupported=typeof document<`u`){var s=document.documentElement.style;t.transform3dSupported=(n.ie&&`transition`in s||n.edge||`WebKitCSSMatrix`in window&&`m11`in new WebKitCSSMatrix||`MozPerspective`in s)&&!(`OTransition`in s),t.transformSupported=t.transform3dSupported||n.ie&&+n.version>=9}}var Fs=1e-4,Is=20;function Ls(e){return e.replace(/^\s+|\s+$/g,``)}var Rs=Math.min,zs=Math.max,Bs=Math.abs,Vs=Math.round,Hs=Math.floor,Us=Math.ceil,Ws=Math.pow,Gs=Math.log,Ks=Math.LN10,qs=Math.PI,Js=Math.random;function Ys(e,t,n,r){var i=t[0],a=t[1],o=n[0],s=n[1],c=a-i,l=s-o;if(c===0)return l===0?o:(o+s)/2;if(r){if(c>0){if(e<=i)return o;if(e>=a)return s}else if(e>=i)return o;else if(e<=a)return s}else{if(e===i)return o;if(e===a)return s}return(e-i)/c*l+o}var Xs=Zs;function Zs(e,t,n){switch(e){case`center`:case`middle`:e=`50%`;break;case`left`:case`top`:e=`0%`;break;case`right`:case`bottom`:e=`100%`}return Qs(e,t,n)}function Qs(e,t,n){return Y(e)?$s(e)?parseFloat(e)/100*t+(n||0):parseFloat(e):e==null?NaN:+e}function $s(e){return!!Ls(e).match(/%$/)}function ec(e,t,n){return isNaN(t)?n?``+e:+e:(t=Rs(zs(0,t),Is),e=(+e).toFixed(t),n?e:+e)}function tc(e){return e.sort(function(e,t){return e-t}),e}function nc(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,n=0;n<15;n++,t*=10)if(Vs(e*t)/t===e)return n}return rc(e)}function rc(e){var t=e.toString().toLowerCase(),n=t.indexOf(`e`),r=n>0?+t.slice(n+1):0,i=n>0?n:t.length,a=t.indexOf(`.`);return zs(0,(a<0?0:i-1-a)-r)}function ic(e,t,n){var r=Bs(e[1]-e[0]);if(!isFinite(r)||r===0)return NaN;var i=Gs(2*Bs(n||1)*Bs(r))/Ks,a=Gs(Bs(t))/Ks,o=zs(0,Us(-i+a));return isFinite(o)||(o=NaN),o}function ac(e,t){var n=zs(nc(e),nc(t)),r=e+t;return n>Is?r:ec(r,n)}var oc=Ws(2,53)-1;function sc(e){var t=qs*2;return(e%t+t)%t}function cc(e){return e>-Fs&&e=10&&t++,t}function pc(e,t){var n=fc(e),r=Ws(10,n),i=e/r;return e=(t===2?1:t?i<1.5?1:i<2.5?2:i<4?3:i<7?5:10:i<1?1:i<2?2:i<3?3:i<5?5:10)*r,ec(e,-n)}function mc(e){e.sort(function(e,t){return s(e,t,0)?-1:1});for(var t=-1/0,n=1,r=0;r0?e.length:0),this.item=null,this.key=NaN,this},e.prototype.next=function(){return(this._step>0?this._idx=this._end)&&(this.item=this._list[this._idx],this.key=this._idx+=this._step,!0)},e})();function ul(){return[1/0,-1/0]}function dl(e,t){hl(t)&&(te[1]&&(e[1]=t))}function fl(e,t){hl(t)&&te[1]&&(e[1]=t)}function ml(e,t){gl(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function hl(e){return e!=null&&isFinite(e)}function gl(e,t){return hl(e)&&hl(t)&&e<=t}function _l(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function vl(e){gl(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function yl(){var e=`__ec_once_`+bl++;return function(t,n){Z(t,e)||(t[e]=1,n())}}var bl=_c();function xl(e,t,n){var r=Es(),i=0;G(e,function(a){var o=t(a),s=r.get(o)||0;n&&n(a,s),!s&&!n&&(e[i++]=a),r.set(o,s+1)}),n||(e.length=i)}function Sl(e){return e.value+``}function Cl(e){return e+``}function wl(e,t){return X(t,!0)?e.seriesIndex+2:0}function Tl(e,t,n){var r=e.getData().count();return{progressiveRender:n.progressiveEnabled&&t.incrementalPrepareRender&&r>=n.threshold,large:e.get(`large`)&&r>=e.get(`largeThreshold`),modDataCount:e.get(`progressiveChunkMode`)===`mod`?e.getData().count():null}}function El(e){return{overallReset:e}}var Dl=`.`,Ol=`___EC__COMPONENT__CONTAINER___`,kl=`___EC__EXTENDED_CLASS___`;function Al(e){var t={main:``,sub:``};if(e){var n=e.split(Dl);t.main=n[0]||``,t.sub=n[1]||``}return t}function jl(e){_s(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),`componentType "`+e+`" illegal`)}function Ml(e){return!!(e&&e[kl])}function Nl(e,t){e.$constructor=e,e.extend=function(e){var t=this,n;return Pl(t)?n=function(e){U(t,e);function t(){return e.apply(this,arguments)||this}return t}(t):(n=function(){(e.$constructor||t).apply(this,arguments)},Jo(n,this)),W(n.prototype,e),n[kl]=!0,n.extend=this.extend,n.superCall=Rl,n.superApply=zl,n.superClass=t,n}}function Pl(e){return rs(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function Fl(e,t){e.extend=t.extend}var Il=Math.round(Math.random()*10);function Ll(e){var t=[`__\0is_clz`,Il++].join(`_`);e.prototype[t]=!0,e.isInstance=function(e){return!!(e&&e[t])}}function Rl(e,t){var n=[...arguments].slice(2);return this.superClass.prototype[t].apply(e,n)}function zl(e,t,n){return this.superClass.prototype[t].apply(e,n)}function Bl(e){var t={};e.registerClass=function(e){var r=e.type||e.prototype.type;if(r){jl(r),e.prototype.type=r;var i=Al(r);if(!i.sub)t[i.main]=e;else if(i.sub!==Ol){var a=n(i);a[i.sub]=e}}return e},e.getClass=function(e,n,r){var i=t[e];if(i&&i[Ol]&&(i=n?i[n]:null),r&&!i)throw Error(n?`Component `+e+`.`+(n||``)+` is used but not imported.`:e+`.type should be specified.`);return i},e.getClassesByMainType=function(e){var n=Al(e),r=[],i=t[n.main];return i&&i[Ol]?G(i,function(e,t){t!==Ol&&r.push(e)}):r.push(i),r},e.hasClass=function(e){return!!t[Al(e).main]},e.getAllClassMainTypes=function(){var e=[];return G(t,function(t,n){e.push(n)}),e},e.hasSubTypes=function(e){var n=t[Al(e).main];return n&&n[Ol]};function n(e){var n=t[e.main];return(!n||!n[Ol])&&(n=t[e.main]={},n[Ol]=!0),n}}function Vl(e,t){for(var n=0;n=0||i&&qo(i,s)<0)){var c=n.getShallow(s,t);c!=null&&(a[e[o][0]]=c)}}return a}}var Hl=Vl([[`fill`,`color`],[`shadowBlur`],[`shadowOffsetX`],[`shadowOffsetY`],[`opacity`],[`shadowColor`]]),Ul=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return Hl(this,e,t)},e}(),Wl=function(){function e(e){this.value=e}return e}(),Gl=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new Wl(e);return this.insertEntry(t),t},e.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},e.prototype.remove=function(e){var t=e.prev,n=e.next;t?t.next=n:this.head=n,n?n.prev=t:this.tail=t,e.next=e.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),Kl=function(){function e(e){this._list=new Gl,this._maxSize=10,this._map={},this._maxSize=e}return e.prototype.put=function(e,t){var n=this._list,r=this._map,i=null;if(r[e]==null){var a=n.len(),o=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=n.head;n.remove(s),delete r[s.key],i=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new Wl(t),o.key=e,n.insertEntry(o),r[e]=o}return i},e.prototype.get=function(e){var t=this._map[e],n=this._list;if(t!=null)return t!==n.tail&&(n.remove(t),n.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),ql=new Kl(50);function Jl(e){if(typeof e==`string`){var t=ql.get(e);return t&&t.image}return e}function Yl(e,t,n,r,i){if(!e)return t;if(typeof e==`string`){if(t&&t.__zrImageSrc===e||!n)return t;var a=ql.get(e),o={hostEl:n,cb:r,cbPayload:i};return a?(t=a.image,!Zl(t)&&a.pending.push(o)):(t=Eo.loadImage(e,Xl,Xl),t.__zrImageSrc=e,ql.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}return e}function Xl(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;tu||d>f||p>m||h>g)return!1;var _=!(u=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height},e.prototype.contain=function(t,n){return e.contain(this,t,n)},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(e){Vu(this,e)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t?t.x:0,t?t.y:0,t?t.width:0,t?t.height:0)},e.copy=function(e,t){return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e},e.applyTransform=function(e,t,n){if(!n){e!==t&&Vu(e,t);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var r=n[0],i=n[3],a=n[4],o=n[5];e.x=t.x*r+a,e.y=t.y*i+o,e.width=t.width*r,e.height=t.height*i,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}Au.x=Mu.x=t.x,Au.y=Nu.y=t.y,ju.x=Nu.x=t.x+t.width,ju.y=Mu.y=t.y+t.height,Au.transform(n),Nu.transform(n),ju.transform(n),Mu.transform(n),e.x=Tu(Au.x,ju.x,Mu.x,Nu.x),e.y=Tu(Au.y,ju.y,Mu.y,Nu.y);var s=Eu(Au.x,ju.x,Mu.x,Nu.x),c=Eu(Au.y,ju.y,Mu.y,Nu.y);e.width=s-e.x,e.height=c-e.y},e.calculateTransform=function(e,t,n){var r=n.width/t.width,i=n.height/t.height;return e=$l(e||[]),nu(e,e,lu(qu,-t.x,-t.y)),iu(e,e,lu(qu,r,i)),nu(e,e,lu(qu,n.x,n.y)),e},e}(),zu=Ru.create,Bu=Ru.set,Vu=Ru.copy,Hu=Ru.calculateTransform,Uu=Ru.applyTransform,Wu=Ru.contain,Gu=new Ru(0,0,0,0),Ku=new Ru(0,0,0,0),qu=[];function Ju(e,t,n,r,i,a,o,s){var c=Du(t-n),l=Du(r-e),u=Tu(c,l),d=Ou[i],f=Ou[1-i],p=ku[i];t=l||!Pu.bidirectional)&&(Fu[d]=-l,Fu[f]=0,Pu.useDir&&Pu.calcDirMTV())))}function Yu(){var e=0,t=new wu,n=new wu,r={minTv:new wu,maxTv:new wu,useDir:!1,dirMinTv:new wu,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(i,a){r.touchThreshold=0,i&&i.touchThreshold!=null&&(r.touchThreshold=Eu(0,i.touchThreshold)),r.negativeSize=!1,a&&(r.minTv.set(1/0,1/0),r.maxTv.set(0,0),r.useDir=!1,i&&i.direction!=null&&(r.useDir=!0,r.dirMinTv.copy(r.minTv),n.copy(r.minTv),e=i.direction,r.bidirectional=i.bidirectional==null||!!i.bidirectional,r.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var a=r.minTv,o=r.dirMinTv,s=a.y*a.y+a.x*a.x,c=Math.sin(e),l=Math.cos(e),u=c*a.y+l*a.x;if(i(u)){i(a.x)&&i(a.y)&&o.set(0,0);return}if(n.x=s*l/u,n.y=s*c/u,i(n.x)&&i(n.y)){o.set(0,0);return}(r.bidirectional||t.dot(n)>0)&&n.len()=ed)){e||=`12px sans-serif`;for(var t=[],n=+new Date,r=0;r<=127;r++)t[r]=Eo.measureText(String.fromCharCode(r),e).width;var i=+new Date-n;return i>16?$u=ed:i>2&&$u++,t}}var $u=0,ed=5;function td(e,t){return e.asciiWidthMapTried||=(e.asciiWidthMap=Qu(e.font),!0),0<=t&&t<=127?e.asciiWidthMap==null?e.asciiCharWidth:e.asciiWidthMap[t]:e.stWideCharWidth}function nd(e,t){var n=e.strWidthCache,r=n.get(t);return r??(r=Eo.measureText(t,e.font).width,n.put(t,r)),r}function rd(e,t,n,r){var i=nd(Xu(t),e),a=sd(t);return new Ru(ad(0,i,n),od(0,a,r),i,a)}function id(e,t,n,r){var i=((e||``)+``).split(` `);if(i.length===1)return rd(i[0],t,n,r);for(var a=new Ru(0,0,0,0),o=0;o=0?parseFloat(e)/100*t:parseFloat(e):e}function ld(e,t,n){var r=t.position||`inside`,i=t.distance==null?5:t.distance,a=n.height,o=n.width,s=a/2,c=n.x,l=n.y,u=`left`,d=`top`;if(r instanceof Array)c+=cd(r[0],n.width),l+=cd(r[1],n.height),u=null,d=null;else switch(r){case`left`:c-=i,l+=s,u=`right`,d=`middle`;break;case`right`:c+=i+o,l+=s,d=`middle`;break;case`top`:c+=o/2,l-=i,u=`center`,d=`bottom`;break;case`bottom`:c+=o/2,l+=a+i,u=`center`;break;case`inside`:c+=o/2,l+=s,u=`center`,d=`middle`;break;case`insideLeft`:c+=i,l+=s,d=`middle`;break;case`insideRight`:c+=o-i,l+=s,u=`right`,d=`middle`;break;case`insideTop`:c+=o/2,l+=i,u=`center`;break;case`insideBottom`:c+=o/2,l+=a-i,u=`center`,d=`bottom`;break;case`insideTopLeft`:c+=i,l+=i;break;case`insideTopRight`:c+=o-i,l+=i,u=`right`;break;case`insideBottomLeft`:c+=i,l+=a-i,d=`bottom`;break;case`insideBottomRight`:c+=o-i,l+=a-i,u=`right`,d=`bottom`}return e||={},e.x=c,e.y=l,e.align=u,e.verticalAlign=d,e}var ud=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function dd(e,t,n,r,i,a){if(!n){e.text=``,e.isTruncated=!1;return}var o=(t+``).split(` `);a=fd(n,r,i,a);for(var s=!1,c={},l=0,u=o.length;l=s;l++)c-=s;var u=nd(o,n);return u>c&&(n=``,u=0),c=e-u,i.ellipsis=n,i.ellipsisWidth=u,i.contentWidth=c,i.containerWidth=e,i}function pd(e,t,n){var r=n.containerWidth,i=n.contentWidth,a=n.fontMeasureInfo;if(!r){e.textLine=``,e.isTruncated=!1;return}var o=nd(a,t);if(o<=r){e.textLine=t,e.isTruncated=!1;return}for(var s=0;;s++){if(o<=i||s>=n.maxIterations){t+=n.ellipsis;break}var c=s===0?md(t,i,a):o>0?Math.floor(t.length*i/o):0;t=t.substr(0,c),o=nd(a,t)}t===``&&(t=n.placeholder),e.textLine=t,e.isTruncated=!0}function md(e,t,n){for(var r=0,i=0,a=e.length;i{A6(e)}):A6(e)}function A6(e){if(e)try{e.body&&M6(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function j6(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function M6(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function N6(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:B6(r);let i=V6(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+a6(s.paddingLeft)+a6(o.marginLeft),top:-i.offsetTop+a6(s.paddingTop)+a6(o.marginTop),right:b6(a)-v6(i)-i.offsetLeft+a6(s.paddingRight)-a6(o.marginRight),bottom:y6(a)-_6(i)-i.offsetTop+a6(s.paddingBottom)-a6(o.marginBottom)}}return i6(r.right)&&(t=Math.min(t,r.right)),i6(r.bottom)&&(n=Math.min(n,r.bottom)),i6(r.left)&&(t=Math.max(t,r.left)),i6(r.top)&&(n=Math.max(n,r.top)),[t,n]}function P6(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function F6(e){return e.props.axis===`both`||e.props.axis===`x`}function I6(e){return e.props.axis===`both`||e.props.axis===`y`}function L6(e,t,n){let r=typeof t==`number`?T6(e,t):null;if(typeof t==`number`&&!r)return null;let i=V6(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return x6(r||e,a,n.props.scale)}function R6(e,t,n){let r=!i6(e.lastX),i=V6(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function z6(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function B6(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function V6(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var H6=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},U6={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},W6=U6.mouse,G6=class extends V.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(` not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!m6(e.target,this.props.handle,t)||this.props.cancel&&m6(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=E6(e);this.touchIdentifier=r;let i=L6(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=R6(this,a,o);H6(`DraggableCore: handleDragStart: %j`,s),H6(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&O6(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,h6(n,W6.move,this.handleDrag),h6(n,W6.stop,this.handleDragStop))},this.handleDrag=e=>{let t=L6(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=P6(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=R6(this,n,r);if(H6(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=L6(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=P6(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=R6(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&k6(a.ownerDocument),H6(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(H6(`DraggableCore: Removing handlers`),g6(a.ownerDocument,W6.move,this.handleDrag),g6(a.ownerDocument,W6.stop,this.handleDragStop))},this.onMouseDown=e=>(W6=U6.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(W6=U6.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(W6=U6.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(W6=U6.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&h6(e,U6.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;g6(t,U6.mouse.move,this.handleDrag),g6(t,U6.touch.move,this.handleDrag),g6(t,U6.mouse.stop,this.handleDragStop),g6(t,U6.touch.stop,this.handleDragStop),g6(e,U6.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&k6(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Ki.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(H6(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return V.cloneElement(V.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};G6.displayName=`DraggableCore`,G6.propTypes={allowAnyClick:t6.default.bool,allowMobileScroll:t6.default.bool,children:t6.default.node.isRequired,disabled:t6.default.bool,enableUserSelectHack:t6.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:t6.default.arrayOf(t6.default.number),handle:t6.default.string,cancel:t6.default.string,nodeRef:t6.default.object,nonce:t6.default.string,onStart:t6.default.func,onDrag:t6.default.func,onStop:t6.default.func,onMouseDown:t6.default.func,scale:t6.default.number,className:o6,style:o6,transform:o6},G6.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var K6=class extends V.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(H6(`Draggable: onDragStart: %j`,t),this.props.onStart(e,z6(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;H6(`Draggable: onDrag: %j`,t);let n=z6(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=N6(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,z6(this,t))===!1)return!1;H6(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(H6(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=Ki.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,m=s||r,h={x:F6(this)&&p?this.state.x:m.x,y:I6(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=C6(h,c):d=S6(h,c);let g=V.Children.only(n),v=_(g.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return V.createElement(G6,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},V.cloneElement(g,{className:v,style:{...g.props.style,...d},transform:f}))}};K6.displayName=`Draggable`,K6.propTypes={...G6.propTypes,axis:t6.default.oneOf([`both`,`x`,`y`,`none`]),bounds:t6.default.oneOfType([t6.default.shape({left:t6.default.number,right:t6.default.number,top:t6.default.number,bottom:t6.default.number}),t6.default.string,t6.default.oneOf([!1])]),defaultClassName:t6.default.string,defaultClassNameDragging:t6.default.string,defaultClassNameDragged:t6.default.string,defaultPosition:t6.default.shape({x:t6.default.number,y:t6.default.number}),positionOffset:t6.default.shape({x:t6.default.oneOfType([t6.default.number,t6.default.string]),y:t6.default.oneOfType([t6.default.number,t6.default.string])}),position:t6.default.shape({x:t6.default.number,y:t6.default.number}),className:o6,style:o6,transform:o6},K6.defaultProps={...G6.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var q6=e(((e,t)=>{function n(e){var t,r,i=``;if(typeof e==`string`||typeof e==`number`)i+=e;else if(typeof e==`object`){if(Array.isArray(e)){var a=e.length;for(t=0;t{var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),f=e=>u(i({},`__esModule`,{value:!0}),e),p={};l(p,{DraggableCore:()=>we,default:()=>Te}),n.exports=f(p);var m=d(t()),h=d(e6()),g=d(b()),_=q6();function v(e,t){for(let n=0,r=e.length;n`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;nt===e.identifier)||e.changedTouches&&v(e.changedTouches,e=>t===e.identifier)}function ie(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function z(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function ae(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??z();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} `,n.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;} -`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&se(e.body,`react-draggable-transparent-selection`)}function B(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{oe(e)}):oe(e)}function oe(e){if(e)try{e.body&&ce(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function se(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function ce(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function le(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:ge(r);let i=_e(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+S(s.paddingLeft)+S(o.marginLeft),top:-i.offsetTop+S(s.paddingTop)+S(o.marginTop),right:L(a)-F(i)-i.offsetLeft+S(s.paddingRight)-S(o.marginRight),bottom:I(a)-P(i)-i.offsetTop+S(s.paddingBottom)-S(o.marginBottom)}}return x(r.right)&&(t=Math.min(t,r.right)),x(r.bottom)&&(n=Math.min(n,r.bottom)),x(r.left)&&(t=Math.max(t,r.left)),x(r.top)&&(n=Math.max(n,r.top)),[t,n]}function ue(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function de(e){return e.props.axis===`both`||e.props.axis===`x`}function fe(e){return e.props.axis===`both`||e.props.axis===`y`}function pe(e,t,n){let r=typeof t==`number`?re(e,t):null;if(typeof t==`number`&&!r)return null;let i=_e(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return ee(r||e,a,n.props.scale)}function me(e,t,n){let r=!x(e.lastX),i=_e(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function he(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function ge(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function _e(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var ve=d(t()),ye=d(e6()),be=d(b()),xe=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},Se={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},Ce=Se.mouse,we=class extends ve.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(` not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!j(e.target,this.props.handle,t)||this.props.cancel&&j(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=ie(e);this.touchIdentifier=r;let i=pe(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=me(this,a,o);xe(`DraggableCore: handleDragStart: %j`,s),xe(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&ae(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,M(n,Ce.move,this.handleDrag),M(n,Ce.stop,this.handleDragStop))},this.handleDrag=e=>{let t=pe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=ue(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=me(this,n,r);if(xe(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=pe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=ue(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=me(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&B(a.ownerDocument),xe(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(xe(`DraggableCore: Removing handlers`),N(a.ownerDocument,Ce.move,this.handleDrag),N(a.ownerDocument,Ce.stop,this.handleDragStop))},this.onMouseDown=e=>(Ce=Se.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Ce=Se.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Ce=Se.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Ce=Se.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&M(e,Se.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;N(t,Se.mouse.move,this.handleDrag),N(t,Se.touch.move,this.handleDrag),N(t,Se.mouse.stop,this.handleDragStop),N(t,Se.touch.stop,this.handleDragStop),N(e,Se.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&B(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=be.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(xe(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return ve.cloneElement(ve.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};we.displayName=`DraggableCore`,we.propTypes={allowAnyClick:ye.default.bool,allowMobileScroll:ye.default.bool,children:ye.default.node.isRequired,disabled:ye.default.bool,enableUserSelectHack:ye.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:ye.default.arrayOf(ye.default.number),handle:ye.default.string,cancel:ye.default.string,nodeRef:ye.default.object,nonce:ye.default.string,onStart:ye.default.func,onDrag:ye.default.func,onStop:ye.default.func,onMouseDown:ye.default.func,scale:ye.default.number,className:C,style:C,transform:C},we.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var Te=class extends m.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(xe(`Draggable: onDragStart: %j`,t),this.props.onStart(e,he(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;xe(`Draggable: onDrag: %j`,t);let n=he(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=le(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,he(this,t))===!1)return!1;xe(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(xe(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=g.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,h=s||r,g={x:de(this)&&p?this.state.x:h.x,y:fe(this)&&p?this.state.y:h.y};this.state.isElementSVG?f=te(g,c):d=R(g,c);let v=m.Children.only(n),y=(0,_.clsx)(v.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return m.createElement(we,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},m.cloneElement(v,{className:y,style:{...v.props.style,...d},transform:f}))}};Te.displayName=`Draggable`,Te.propTypes={...we.propTypes,axis:h.default.oneOf([`both`,`x`,`y`,`none`]),bounds:h.default.oneOfType([h.default.shape({left:h.default.number,right:h.default.number,top:h.default.number,bottom:h.default.number}),h.default.string,h.default.oneOf([!1])]),defaultClassName:h.default.string,defaultClassNameDragging:h.default.string,defaultClassNameDragged:h.default.string,defaultPosition:h.default.shape({x:h.default.number,y:h.default.number}),positionOffset:h.default.shape({x:h.default.oneOfType([h.default.number,h.default.string]),y:h.default.oneOfType([h.default.number,h.default.string])}),position:h.default.shape({x:h.default.number,y:h.default.number}),className:C,style:C,transform:C},Te.defaultProps={...we.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1},0&&(n.exports={DraggableCore:we})})),Y6=e(((e,t)=>{var n=J6(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),X6=e((e=>{e.__esModule=!0,e.cloneElement=l;var n=r(t());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t{e.__esModule=!0,e.resizableProps=void 0;var t=n(e6());Y6();function n(e){return e&&e.__esModule?e:{default:e}}e.resizableProps={axis:t.default.oneOf([`both`,`x`,`y`,`none`]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:typeof Element<`u`?t.default.instanceOf(Element):t.default.any,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`y`?t.default.number.isRequired(...e):t.default.number(...e)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf([`s`,`w`,`e`,`n`,`sw`,`nw`,`se`,`ne`])),transformScale:t.default.number,width:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`x`?t.default.number.isRequired(...e):t.default.number(...e)}}})),Q6=e((e=>{e.__esModule=!0,e.default=void 0;var n=s(t()),r=Y6(),i=X6(),a=Z6(),o=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function s(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;tMath.abs(i*n)?t=e/n:e=t*n}let o=e,s=t,c=this.slack||[0,0],l=c[0],u=c[1];return e+=l,t+=u,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),i&&(e=Math.min(i[0],e),t=Math.min(i[1],t)),this.slack=[l+(o-e),u+(s-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let i=r.node,a=r.deltaX,o=r.deltaY;e===`onResizeStart`&&this.resetData();let s=(this.props.axis===`both`||this.props.axis===`x`)&&t!==`n`&&t!==`s`,c=(this.props.axis===`both`||this.props.axis===`y`)&&t!==`e`&&t!==`w`;if(!s&&!c)return;let l=t[0],u=t[t.length-1],d=i.getBoundingClientRect();if(this.lastHandleRect!=null){if(u===`w`){let e=d.left-this.lastHandleRect.left;a+=e}if(l===`n`){let e=d.top-this.lastHandleRect.top;o+=e}}this.lastHandleRect=d,u===`w`&&(a=-a),l===`n`&&(o=-o);let f=this.lastSize?.width??this.props.width,p=this.lastSize?.height??this.props.height,m=f+(s?a/this.props.transformScale:0),h=p+(c?o/this.props.transformScale:0);var g=this.runConstraints(m,h);if(m=g[0],h=g[1],e===`onResizeStop`&&this.lastSize){var _=this.lastSize;m=_.width,h=_.height}let v=m!==f||h!==p;e!==`onResizeStop`&&(this.lastSize={width:m,height:h});let y=typeof this.props[e]==`function`?this.props[e]:null;y&&(e!==`onResize`||v)&&(n.persist==null||n.persist(),y(n,{node:i,size:{width:m,height:h},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,t){let r=this.props.handle;if(!r)return n.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-`+e,ref:t});if(typeof r==`function`)return r(e,t);let i=typeof r.type==`string`,a=d({ref:t},i?{}:{handleAxis:e});return n.cloneElement(r,a)}render(){let e=this.props,t=e.children,a=e.className,s=e.draggableOpts;e.width,e.height,e.handle,e.handleSize,e.lockAspectRatio,e.axis,e.minConstraints,e.maxConstraints,e.onResize,e.onResizeStop,e.onResizeStart;let u=e.resizeHandles;e.transformScale;let f=l(e,o);return(0,i.cloneElement)(t,d(d({},f),{},{className:(a?a+` `:``)+`react-resizable`,children:[...n.Children.toArray(t.props.children),...u.map(e=>{let t=this.handleRefs[e]??(this.handleRefs[e]=n.createRef());return n.createElement(r.DraggableCore,c({},s,{nodeRef:t,key:`resizableHandle-`+e,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,t))})]}))}};e.default=h,h.propTypes=a.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),$6=e((e=>{e.__esModule=!0,e.default=void 0;var n=c(t()),r=s(e6()),i=s(Q6()),a=Z6(),o=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(c=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let n=t.size;this.props.onResize?(e.persist==null||e.persist(),this.setState(n,()=>this.props.onResize&&this.props.onResize(e,t))):this.setState(n)}}static getDerivedStateFromProps(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null}render(){let e=this.props,t=e.handle,r=e.handleSize;e.onResize;let a=e.onResizeStart,s=e.onResizeStop,c=e.draggableOpts,u=e.minConstraints,f=e.maxConstraints,p=e.lockAspectRatio,m=e.axis;e.width,e.height;let g=e.resizeHandles,_=e.style,v=e.transformScale,y=h(e,o);return n.createElement(i.default,{axis:m,draggableOpts:c,handle:t,handleSize:r,height:this.state.height,lockAspectRatio:p,maxConstraints:f,minConstraints:u,onResizeStart:a,onResize:this.onResize,onResizeStop:s,resizeHandles:g,transformScale:v,width:this.state.width},n.createElement(`div`,l({},y,{style:d(d({},_),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=d(d({},a.resizableProps),{},{children:r.default.element})})),e8=e(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Q6().default,t.exports.ResizableBox=$6().default}))(),t8=Z3(),n8=50,r8=12;function i8(e){let t=e;for(;t;){let e=window.getComputedStyle(t).overflowY;if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function a8(e){let t=i8(e),n=null,r=0,i=0,a=!1;function o(){let e=t;if(!e)return;let s=e.getBoundingClientRect(),{clientHeight:c,scrollTop:l,scrollHeight:u}=e,{scrollLeft:d,scrollWidth:f,clientWidth:p}=e,m=0,h=0;i0?m=-r8:i>s.bottom-n8&&l+c0?h=-r8:r>s.right-n8&&d+p({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),ye=(0,V.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),be=(0,V.useCallback)(e=>({...ye,containerHeight:e??ye.containerHeight,layout:de.current}),[ye]),xe=(0,V.useMemo)(()=>I??{i:M,x:w,y:T,w:E,h:D,minW:O,maxW:k,minH:A,maxH:j},[I,M,w,T,E,D,O,k,A,j]),Se=(0,V.useCallback)(e=>{if(g?.calcStyle)return g.calcStyle(e);if(p)return v3(e);let t=y3(e);return m?{...t,left:b3(e.left/r),width:b3(e.width/r)}:t},[g,p,m,r]),Ce=(0,V.useCallback)((e,{node:t})=>{if(!ee)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/h,o=r.left/h,s=i.top/h,c=r.top/h,l;if(g?.calcDragPosition){let t=e;l=g.calcDragPosition(t.clientX,t.clientY,t.clientX-i.left,t.clientY-i.top)}else l={left:a-o+n.scrollLeft,top:s-c+n.scrollTop};if(ce.current=l,_e.current||=a8(t instanceof HTMLElement?t:null),v>0){let t=e;he.current={x:t.clientX,y:t.clientY},me.current=!0,ge.current=!1,ae(!0);return}ae(!0);let u=Y4(ve,l.top,l.left),{x:d,y:f}=g3(F,xe,u.x,u.y,be());ee(M,d,f,{e,node:t,newPosition:l})},[ee,h,ve,g,v,F,xe,be,M]),we=(0,V.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!R||!z)return;let s=e;if(me.current&&!ge.current){let n=s.clientX-he.current.x,r=s.clientY-he.current.y;if(Math.hypot(n,r){if(!te||!z)return;_e.current?.stop(),_e.current=null;let n=me.current;if(me.current=!1,ge.current=!1,he.current={x:0,y:0},n){ae(!1),ce.current={left:0,top:0};return}let{left:r,top:i}=ce.current,a={top:i,left:r};ae(!1),ce.current={left:0,top:0};let o=Y4(ve,i,r),{x:s,y:c}=g3(F,xe,o.x,o.y,be());te(M,s,c,{e,node:t,newPosition:a})},[te,z,ve,F,xe,be,M]);fe.current=Ce,pe.current=we;let Ee=(0,V.useCallback)((e,{node:t,size:n,handle:i},a,o)=>{let s=o===`onResizeStart`?ne:o===`onResize`?re:ie;if(!s)return;let c;c=t?A3(i,a,n,r):{...n,top:a.top,left:a.left},le.current=c;let l=t?.offsetParent?.clientHeight??0,u=X4(ve,c.width,c.height),{w:d,h:f}=_3(F,xe,u.w,u.h,i,be(l));s(M,d,f,{e:e.nativeEvent??e,node:t,size:c,handle:i})},[ne,re,ie,r,ve,M,F,xe,be]),De=(0,V.useCallback)((e,t)=>{oe(!0);let n=q4(ve,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResizeStart`)},[Ee,ve,w,T,E,D]),Oe=(0,V.useCallback)((e,t)=>{let n=q4(ve,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResize`)},[Ee,ve,w,T,E,D]),ke=(0,V.useCallback)((e,t)=>{oe(!1),le.current={top:0,left:0,width:0,height:0};let n=q4(ve,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResizeStop`)},[Ee,ve,w,T,E,D]);(0,V.useEffect)(()=>{if(!y)return;let e=se.current;if(!e)return;let t=ue.current||{left:0,top:0},n=z&&(y.left!==t.left||y.top!==t.top);if(!z){let t={node:e,deltaX:y.left,deltaY:y.top,lastX:0,lastY:0,x:y.left,y:y.top};fe.current?.(y.e,t)}else if(n){let t={node:e,deltaX:y.left-ce.current.left,deltaY:y.top-ce.current.top,lastX:ce.current.left,lastY:ce.current.top,x:y.left,y:y.top};pe.current?.(y.e,t)}ue.current=y},[y,z,M]);let Ae=q4(ve,w,T,E,D,z?ce.current:null,B?le.current:null),je=V.Children.only(t),Me=G4(ve),Ne=[K4(O,Me,i[0]),K4(A,o,i[1])],Pe=[K4(k,Me,i[0]),K4(j,o,i[1])],Fe=je.props,Ie=Fe.className,Le=Fe.style,Re=V.cloneElement(je,{ref:se,className:_(`react-grid-item`,Ie,b,{static:f,resizing:B,"react-draggable":c,"react-draggable-dragging":z,dropping:!!y,cssTransforms:p}),style:{...x,...Le,...Se(Ae)}}),ze=P;return Re=(0,H.jsx)(e8.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:Ae.width,height:Ae.height,minConstraints:Ne,maxConstraints:Pe,onResizeStart:De,onResize:Oe,onResizeStop:ke,transformScale:h,resizeHandles:N,handle:ze,children:Re}),Re=(0,H.jsx)(G6,{disabled:!c,onStart:Ce,onDrag:we,onStop:Te,handle:S,cancel:`.react-resizable-handle`+(C?`,`+C:``),scale:h,allowMobileScroll:d,nodeRef:se,children:Re}),Re}var s8=V.memo(o8,(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h&&e.minW===t.minW&&e.maxW===t.maxW&&e.minH===t.minH&&e.maxH===t.maxH&&e.cols===t.cols&&e.containerWidth===t.containerWidth&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.margin===t.margin&&e.containerPadding===t.containerPadding&&e.transformScale===t.transformScale&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.isBounded===t.isBounded&&e.allowMobileScroll===t.allowMobileScroll&&e.useCSSTransforms===t.useCSSTransforms&&e.usePercentages===t.usePercentages&&e.children===t.children&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.droppingPosition===t.droppingPosition);s8.displayName=`GridItem`;function c8(e){let{clientX:t,clientY:n,gridElement:r,droppingItem:i,event:a,dragOffsetX:o=0,dragOffsetY:s=0,transformScale:c,cols:l,margin:u,maxRows:d,rowHeight:f,width:p,containerPadding:m}=e,h=r.getBoundingClientRect(),g={cols:l,margin:u,maxRows:d,rowHeight:f,containerWidth:p,containerPadding:m},_=G4(g),v=K4(i.w,_,u[0]),y=K4(i.h,f,u[1]),b=v/2,x=y/2,S=r.scrollLeft??0,C=r.scrollTop??0,w=t-h.left+S+o-b,T=n-h.top+C+s-x,E=Math.max(0,w),D=Math.max(0,T);return{newDroppingPosition:{left:E/c,top:D/c,e:a},calculatedXY:J4(g,D,E,i.w,i.h)}}var l8=()=>{},u8=`react-grid-layout`,d8=!1;try{d8=/firefox/i.test(navigator.userAgent)}catch{}function f8(e,t){let n=V.Children.toArray(e),r=V.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e{if(!V.isValidElement(t)||t.key===null)return;let n=String(t.key);a.add(n);let r=e.find(e=>e.i===n);if(r)i.push(s3(r));else{let e=t.props[`data-grid`];e?i.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):i.push({i:n,x:0,y:i3(i),w:1,h:1})}});let o=d3(i,{cols:n});return r.compact(o,n)}function m8(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=j3,compactor:c,constraints:l=h3,layout:u=[],droppingItem:d,autoSize:f=!0,className:p=``,style:m={},innerRef:h,onLayoutChange:g=l8,onDragStart:v=l8,onDrag:y=l8,onDragStop:b=l8,onResizeStart:x=l8,onResize:S=l8,onResizeStop:C=l8,onDrop:w=l8,onDropDragOver:T=l8}=e,E=(0,V.useMemo)(()=>({...M3,...r}),[r]),D=(0,V.useMemo)(()=>({...N3,...i}),[i]),O=(0,V.useMemo)(()=>({...P3,...a}),[a]),k=(0,V.useMemo)(()=>({...F3,...o}),[o]),{cols:A,rowHeight:j,maxRows:M,margin:N,containerPadding:P}=E,{enabled:F,bounded:I,handle:L,cancel:ee,threshold:R,allowMobileScroll:te}=D,{enabled:ne,handles:re,handleComponent:ie}=O,{enabled:z,defaultItem:ae,onDragOver:B,touchEnabled:oe=!0,touchDragSource:se=`[data-rgl-draggable]`}=k,ce=c??G3(`vertical`),le=ce.type,ue=ce.allowOverlap,de=ce.preventCollision??!1,fe=(0,V.useMemo)(()=>d??{i:`__dropping-elem__`,...ae},[d,ae]),pe=s.type===`transform`,me=s.scale,he=P??N,[ge,_e]=(0,V.useState)(!1),[ve,ye]=(0,V.useState)(()=>p8(u,t,A,ce)),[be,xe]=(0,V.useState)(null),[Se,Ce]=(0,V.useState)(!1),[we,Te]=(0,V.useState)(null),[Ee,De]=(0,V.useState)(),Oe=(0,V.useRef)(void 0);Oe.current=Ee;let ke=(0,V.useRef)(null),Ae=(0,V.useRef)(null),je=(0,V.useRef)(null),Me=(0,V.useRef)(0),Ne=(0,V.useRef)(ve),Pe=(0,V.useRef)(u),Fe=(0,V.useRef)(t),Ie=(0,V.useRef)(le),Le=(0,V.useRef)(null),Re=(0,V.useRef)(!1),ze=(0,V.useRef)(null),Be=(0,V.useRef)(null);Be.current=we;let Ve=(0,V.useRef)(w);(0,V.useLayoutEffect)(()=>{Ve.current=w});let He=(0,V.useRef)(ve);He.current=ve,(0,V.useEffect)(()=>{_e(!0),(0,t8.deepEqual)(ve,u)||g(ve)},[]),(0,V.useEffect)(()=>{if(be||we)return;let e=!(0,t8.deepEqual)(u,Pe.current),n=!f8(t,Fe.current),r=le!==Ie.current;if(e||n||r){let n=p8(e?u:ve,t,A,ce);(0,t8.deepEqual)(n,ve)||ye(n)}Pe.current=u,Fe.current=t,Ie.current=le},[u,t,A,le,ce,be,we,ve]),(0,V.useEffect)(()=>{if(!be&&!we&&!(0,t8.deepEqual)(ve,Ne.current)){Ne.current=ve;let e=ve.filter(e=>e.i!==fe.i);g(e)}},[ve,be,we,g,fe.i]);let Ue=(0,V.useMemo)(()=>{if(!f)return;let e=i3(ve),t=he[1];return e*j+(e-1)*N[1]+t*2+`px`},[f,ve,j,N,he]),We=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=a3(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};ke.current=s3(a),je.current=i,xe(o),v(i,a,a,null,r.e,r.node)},[v]),Ge=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=ke.current,o=a3(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=f3(i,o,t,n,!0,de,le,A,ue);y(c,a,o,s,r.e,r.node),ye(ce.compact(c,A)),xe(s)},[de,le,A,ue,ce,y]),Ke=(0,V.useCallback)((e,t,n,r)=>{if(!ke.current)return;let i=He.current,a=ke.current,o=a3(i,e);if(!o)return;let s=f3(i,o,t,n,!0,de,le,A,ue),c=ce.compact(s,A);b(c,a,o,null,r.e,r.node);let l=je.current;ke.current=null,je.current=null,xe(null),ye(c),l&&!(0,t8.deepEqual)(l,c)&&g(c)},[de,le,A,ue,ce,b,g]),qe=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=a3(i,e);a&&(Ae.current=s3(a),je.current=i,Ce(!0),x(i,a,a,null,r.e,r.node))},[x]),Je=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=Ae.current,{handle:o}=r,s=!1,c,l,[u,d]=u3(i,e,e=>(c=e.x,l=e.y,[`sw`,`w`,`nw`,`n`,`ne`].includes(o)&&([`sw`,`nw`,`w`].includes(o)&&(c=e.x+(e.w-t),t=e.x!==c&&c<0?e.w:t,c=c<0?0:c),[`ne`,`n`,`nw`].includes(o)&&(l=e.y+(e.h-n),n=e.y!==l&&l<0?e.h:n,l=l<0?0:l),s=!0),de&&!ue&&e3(i,{...e,w:t,h:n,x:c??e.x,y:l??e.y}).filter(t=>t.i!==e.i).length>0&&(l=e.y,n=e.h,c=e.x,t=e.w,s=!1),e.w=t,e.h=n,(o===`n`||o===`nw`||o===`ne`)&&(e.y=l??e.y),e));if(!d)return;let f=u;s&&c!==void 0&&l!==void 0&&(f=f3(u,d,c,l,!0,de,le,A,ue));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};S(f,a,d,p,r.e,r.node);let m=ce.compact(f,A);if(o===`n`||o===`nw`||o===`ne`){let t=m.find(t=>t.i===e);t&&(t.y=d.y)}ye(m),xe(p)},[de,le,A,ue,ce,S]),Ye=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=Ae.current,o=a3(i,e),s=ce.compact(i,A);C(s,a,o??null,null,r.e,r.node);let c=je.current;Ae.current=null,je.current=null,xe(null),Ce(!1),ye(s),c&&!(0,t8.deepEqual)(c,s)&&g(s)},[A,ce,C,g]),Xe=(0,V.useCallback)((e,t,n,r)=>{if(r)Oe.current&&(Oe.current.left!==t.left||Oe.current.top!==t.top)&&(De(t),ye(t=>t.map(t=>t.i===e.i&&(t.x!==n.x||t.y!==n.y)?{...t,x:n.x,y:n.y}:t)));else{Te((0,H.jsx)(`div`,{},e.i)),De(t);let r=He.current.filter(t=>t.i!==e.i);ye([...r,{...e,x:n.x,y:n.y,static:!1,isDraggable:!0}])}},[]),Ze=(0,V.useCallback)((e,t,r)=>{let i=Le.current;if(!i)return;let{newDroppingPosition:a,calculatedXY:o}=c8({clientX:e,clientY:t,gridElement:i,droppingItem:fe,event:r,transformScale:me,cols:A,margin:N,maxRows:M,rowHeight:j,width:n,containerPadding:he});Xe(fe,a,o,!!Be.current)},[fe,me,A,N,M,j,n,he,Xe]),Qe=(0,V.useCallback)(()=>{let e=He.current;if(!e.some(e=>e.i===fe.i)){Te(null),xe(null),De(void 0);return}let t=ce.compact(e.filter(e=>e.i!==fe.i),A);ye(t),Te(null),xe(null),De(void 0)},[fe.i,A,ce]),$e=(0,V.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),d8&&!e.nativeEvent.target?.classList.contains(u8))return!1;let t=B?B(e.nativeEvent):T(e);if(t===!1)return we&&Qe(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...fe,...a},{newDroppingPosition:s,calculatedXY:c}=c8({clientX:e.clientX,clientY:e.clientY,gridElement:e.currentTarget,droppingItem:o,event:e.nativeEvent,dragOffsetX:r,dragOffsetY:i,transformScale:me,cols:A,margin:N,maxRows:M,rowHeight:j,width:n,containerPadding:he});Xe(o,s,c,!!we)},[we,fe,B,T,Qe,Xe,me,A,N,M,j,n,he]),et=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current--,Me.current<0&&(Me.current=0),Me.current===0&&Qe()},[Qe]),tt=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current++},[]),nt=(0,V.useCallback)(e=>{let t=He.current,n=t.find(e=>e.i===fe.i);Qe(),Ve.current(t,n,e)},[fe.i,Qe]),rt=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current=0,nt(e.nativeEvent)},[nt]);(0,V.useEffect)(()=>{if(!z||!oe)return;let e=Le.current;if(!e)return;let t=(t,n)=>{let r=document.elementFromPoint(t,n);return r?e.contains(r):!1},n=e=>e instanceof HTMLElement&&e.closest(se)!==null,r=e=>{let t=e.changedTouches;if(!t||t.length===0)return;let n=ze.current;if(n===null)return t[0];for(let e=0;e{if(!n(e.target)||ze.current!==null)return;e.preventDefault();let t=e.changedTouches?.[0];t&&(ze.current=t.identifier,Re.current=!0)},a=e=>{if(!Re.current)return;e.preventDefault();let n=r(e);if(n){if(!t(n.clientX,n.clientY)){Be.current&&Qe();return}Ze(n.clientX,n.clientY,e)}},o=e=>{if(!Re.current)return;e.preventDefault();let n=r(e);if(Re.current=!1,ze.current=null,n){if(!t(n.clientX,n.clientY)){Qe();return}nt(e)}},s=()=>{Re.current&&(Re.current=!1,ze.current=null,Qe())},c={passive:!1};return document.addEventListener(`touchstart`,i,c),document.addEventListener(`touchmove`,a,c),document.addEventListener(`touchend`,o,c),document.addEventListener(`touchcancel`,s,c),()=>{document.removeEventListener(`touchstart`,i,c),document.removeEventListener(`touchmove`,a,c),document.removeEventListener(`touchend`,o,c),document.removeEventListener(`touchcancel`,s,c)}},[z,oe,se,Ze,Qe,nt,fe.i]);let it=(0,V.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=a3(ve,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&F,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&ne,o=r.resizeHandles||[...re],c=i&&I&&r.isBounded!==!1,u=ie;return(0,H.jsx)(s8,{containerWidth:n,cols:A,margin:N,containerPadding:he,maxRows:M,rowHeight:j,cancel:ee,handle:L,onDragStart:We,onDrag:Ge,onDragStop:Ke,onResizeStart:qe,onResize:Je,onResizeStop:Ye,isDraggable:i,isResizable:a,isBounded:c,allowMobileScroll:te,useCSSTransforms:pe&&ge,usePercentages:!ge,transformScale:me,positionStrategy:s,dragThreshold:R,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:t?Ee:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:ve,children:e},r.i)},[ve,n,A,N,he,M,j,ee,L,We,Ge,Ke,qe,Je,Ye,F,ne,I,pe,ge,me,s,R,Ee,re,ie,l]),at=()=>be?(0,H.jsx)(s8,{w:be.w,h:be.h,x:be.x,y:be.y,i:be.i,className:`react-grid-placeholder ${Se?`placeholder-resizing`:``}`,containerWidth:n,cols:A,margin:N,containerPadding:he,maxRows:M,rowHeight:j,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:pe,transformScale:me,constraints:l,layout:ve,children:(0,H.jsx)(`div`,{})}):null,ot=(0,V.useCallback)(e=>{Le.current=e,typeof h==`function`?h(e):h&&`current`in h&&(h.current=e)},[h]),st=_(u8,p),ct={height:Ue,...m};return(0,H.jsxs)(`div`,{ref:ot,className:st,style:ct,onDrop:z?rt:void 0,onDragLeave:z?et:void 0,onDragEnter:z?tt:void 0,onDragOver:z?$e:void 0,children:[V.Children.map(t,e=>V.isValidElement(e)?it(e):null),z&&we&&it(we,!0),at()]})}var h8={lg:1200,md:996,sm:768,xs:480,xxs:0},g8={lg:12,md:10,sm:6,xs:4,xxs:2},_8=()=>{};function v8(e,t,n,r,i=!1){let a=[];V.Children.forEach(t,t=>{if(!V.isValidElement(t)||t.key===null)return;let n=String(t.key),r=t.props[`data-grid`],o=e.find(e=>e.i===n);o?i&&r?a.push({...o,i:n,w:r.w??o.w,h:r.h??o.h,minW:r.minW??o.minW,maxW:r.maxW??o.maxW,minH:r.minH??o.minH,maxH:r.maxH??o.maxH}):a.push({...o,i:n}):r?a.push({i:n,x:r.x??0,y:r.y??0,w:r.w??1,h:r.h??1,minW:r.minW,maxW:r.maxW,minH:r.minH,maxH:r.maxH,static:r.static,isDraggable:r.isDraggable,isResizable:r.isResizable,resizeHandles:r.resizeHandles,isBounded:r.isBounded}):a.push({i:n,x:0,y:i3(a),w:1,h:1})});let o=d3(a,{cols:n});return r.compact(o,n)}function y8(e){let{children:t,width:n,breakpoint:r,breakpoints:i=h8,cols:a=g8,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=_8,onLayoutChange:p=_8,onWidthChange:m=_8,...h}=e,g=d??G3(`vertical`),_=g.type,v=g.allowOverlap,y=(0,V.useMemo)(()=>r??q3(i,n),[]),b=(0,V.useMemo)(()=>J3(y,a),[y,a]),x=(0,V.useMemo)(()=>Y3(o,i,y,y,b,_),[]),[S,C]=(0,V.useState)(y),[w,T]=(0,V.useState)(b),[E,D]=(0,V.useState)(x),[O,k]=(0,V.useState)(o),A=(0,V.useRef)(n),j=(0,V.useRef)(r),M=(0,V.useRef)(i),N=(0,V.useRef)(a),P=(0,V.useRef)(o),F=(0,V.useRef)(_),I=(0,V.useRef)(O);(0,V.useEffect)(()=>{I.current=O},[O]);let L=(0,V.useMemo)(()=>(0,t8.deepEqual)(o,P.current)?null:Y3(o,i,S,S,w,g),[o,i,S,w,g]),ee=L??E;(0,V.useEffect)(()=>{L!==null&&(D(L),k(o),I.current=o,P.current=o)},[L,o]),(0,V.useEffect)(()=>{if(_!==F.current){let e=g.compact(c3(ee),w),t={...I.current,[S]:e};D(e),k(t),I.current=t,p(e,t),F.current=_}},[_,g,ee,w,v,S,p]),(0,V.useEffect)(()=>{let e=n!==A.current,o=r!==j.current,s=!(0,t8.deepEqual)(i,M.current),c=!(0,t8.deepEqual)(a,N.current);if(e||o||s||c){let e=r??q3(i,n),o=J3(e,a),d=S;if(d!==e||s||c){let n={...I.current};n[d]||(n[d]=c3(E));let r=Y3(n,i,e,d,o,g),a=!n[e];r=v8(r,t,o,g,a),n[e]=r,C(e),T(o),D(r),k(n),I.current=n,f(e,o),p(r,n)}let h=X3(l,e),_=u?X3(u,e):null;m(n,h,o,_),A.current=n,j.current=r,M.current=i,N.current=a}},[n,r,i,a,S,w,E,t,g,_,v,l,u,f,p,m]);let R=(0,V.useCallback)(e=>{let t={...I.current,[S]:e};D(e),k(t),I.current=t,p(e,t)},[S,p]),te=(0,V.useMemo)(()=>X3(l,S),[l,S]),ne=(0,V.useMemo)(()=>u===null?null:X3(u,S),[u,S]),re=(0,V.useMemo)(()=>({cols:w,rowHeight:s,maxRows:c,margin:te,containerPadding:ne}),[w,s,c,te,ne]);return(0,H.jsx)(m8,{...h,width:n,gridConfig:re,compactor:g,onLayoutChange:R,layout:ee,children:t})}var b8=V.forwardRef(function(e,t){let{innerRef:n,...r}=e,i=n??t;return(0,H.jsx)(y8,{...r,innerRef:i})});b8.displayName=`ResponsiveGridLayout`;function x8(e,t,n,r){let i=e=>t?.frame?.columns.some((n,r)=>n.name===e&&t.frame.values[r]?.some(e=>typeof e==`string`&&e!==``));return{onSelect:e.click&&(e.viz===`service_map`||!(e.drill&&r))?t=>n(e.click.set_variable,t):void 0,onPoint:r&&(e.viz===`service_map`||e.click||e.drill||i(`trace_id`)||e.options?.columns?.some(e=>e.format===`trace_link`&&i(e.field)))?r:void 0}}function S8(e,t,n,r){if(!t)return;let i=pt(e,t,n);if(!i)return;let a=Object.values(n.dimensions)[0],o=e.click?.set_variable;return{target:i,vars:o&&a!==void 0?{...r,[o]:a}:r}}function C8(e){return`Explain the panel “${e.title}”`}function w8(e){return`Fix the panel “${e.title}”`}function T8(e){return[{description:`Observed panel diagnostics`,value:JSON.stringify(e)}]}var E8=e=>e*40+(e-1)*12,D8={s:3,m:6,l:10},O8={stat:4},k8=e=>Math.max(O8[e.viz]??0,D8[e.height??(e.viz===`service_map`?`l`:e.viz===`stat`?`s`:`m`)]),A8=(0,V.lazy)(()=>le(()=>import(`./panel-sql-editor-DQvDThY1.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),j8=0;function M8(e){let t;do t=`p_${Date.now().toString(36)}_${(++j8).toString(36)}_${Math.random().toString(36).slice(2,10)}`;while(e.some(e=>e.id===t));return t}function N8({dashboardId:e,version:t,spec:n,vars:r,results:i,fetching:a,annotations:o,fetchingIds:s=[],staleAt:c=new Map,time:l=n.time,onEditExit:u,editing:d,view:f,agentAvailable:p,canManage:m=!1,onOpenChat:h,onVariable:g,onRetry:_,onPoint:v,onZoom:b,onZoomReset:x,zoomed:S,onView:w,onVisible:E,onRangePending:D,shortcutScope:O,onShortcuts:k,overlayOpen:A,returnViewFocus:j}){let M=et(),[N,P]=(0,V.useState)(),[F,I]=(0,V.useState)(()=>n.panels.map(e=>({i:e.id,x:e.grid?.x??0,y:e.grid?.y??0,w:e.grid?.w??6,h:e.grid?.h??k8(e)})));(0,V.useEffect)(()=>{I(n.panels.map(e=>({i:e.id,x:e.grid?.x??0,y:e.grid?.y??0,w:e.grid?.w??6,h:e.grid?.h??k8(e)})))},[n]);let[L,R]=(0,V.useState)(()=>window.innerHeight),[te,ne]=(0,V.useState)();(0,V.useEffect)(()=>{let e=()=>R(window.innerHeight);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let re=(0,V.useRef)(null),ie=(0,V.useRef)(new Map),z=(0,V.useRef)(null),ae=(0,V.useRef)(null),B=()=>{let e=N?.panel.id;P(void 0),requestAnimationFrame(()=>(ae.current?.isConnected?ae.current:ie.current.get(e??``))?.focus())},se=(0,V.useRef)(f);f&&(se.current=f);let[ce,le]=(0,V.useState)(0),ue=ce>0,de=d&&(ce>=1100?`lg`:ce>=800?`md`:`sm`)==`lg`;(0,V.useLayoutEffect)(()=>{if(!re.current)return;le(Math.max(0,Math.round(re.current.getBoundingClientRect().width)));let e=new ResizeObserver(([e])=>{e&&le(Math.max(0,Math.round(e.contentRect.width)))});return e.observe(re.current),()=>e.disconnect()},[]);let fe=(0,V.useRef)(E);fe.current=E,(0,V.useEffect)(()=>{if(!ue||!re.current||typeof IntersectionObserver>`u`)return;let e=new Set(n.panels.map(e=>e.id)),t=new IntersectionObserver(t=>{for(let n of t){let t=n.target.dataset.panel;t&&(n.isIntersecting?e.add(t):e.delete(t))}f&&n.panels.some(e=>e.id===f)&&e.add(f),fe.current([...e])},{rootMargin:`200px`});return re.current.querySelectorAll(`.react-grid-item[data-panel]`).forEach(e=>t.observe(e)),()=>t.disconnect()},[n,f,ue]);let pe=(0,V.useMemo)(()=>n.panels.some(e=>{let t=F.find(t=>t.i===e.id);return t&&(t.x!==e.grid?.x||t.y!==e.grid?.y||t.w!==e.grid?.w||t.h!==e.grid?.h)}),[F,n]),me=e=>({...n,panels:e.map(e=>{let t=F.find(t=>t.i===e.id);return t?{...e,grid:{x:t.x,y:t.y,w:t.w,h:t.h}}:e})}),he=De({mutationFn:()=>Qe(e,me(n.panels),t,`Edited layout`),onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}}),ge=De({mutationFn:r=>pe?Qe(e,me(n.panels.filter(e=>e.id!==r)),t,`Removed a panel and saved layout`):Ae(e,[{op:`remove_panel`,id:r}],t,`Removed a panel`),onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}}),_e=De({mutationFn:r=>{let i={...r,id:M8(n.panels),title:`${Array.from(r.title).slice(0,73).join(``)} (copy)`,grid:void 0};if(pe){let a=[...n.panels];return a.splice(a.findIndex(e=>e.id===r.id)+1,0,i),Qe(e,me(a),t,`Duplicated a panel and saved layout`)}return Ae(e,[{op:`add_panel`,after:r.id,panel:i}],t,`Duplicated a panel`)},onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}});(0,V.useEffect)(()=>{d||(he.reset(),ge.reset(),_e.reset())},[d]);let ve=()=>{he.reset(),ge.reset(),_e.reset(),u?.(),M.invalidateQueries({queryKey:[`dashboard`,e]})},ye=async e=>{let t=new URL(window.location.href);t.searchParams.set(`view`,e),t.searchParams.delete(`edit`);try{await navigator.clipboard.writeText(t.toString()),ne(`Link copied`)}catch{ne(`Copy this URL: ${t.toString()}`)}},be=`dashboard-${e}`,xe=n=>({dashboard_id:e,version:t,panel_id:n.id,title:Yi(n.title,r),from_ms:i.get(n.id)?.from_ms,to_ms:i.get(n.id)?.to_ms,vars:r,error:i.get(n.id)?.error,status:i.get(n.id)?.status,diagnosis:i.get(n.id)?.diagnosis,stale_since:c.get(n.id),truncated:i.has(n.id)?!!(i.get(n.id)?.frame?.truncated||i.get(n.id)?.previous?.truncated):void 0,note:i.get(n.id)?.frame?.note,spec:{...n,dashboard_time:l}}),Se=(u,d,y=!1)=>(0,H.jsx)(V4,{panel:u,title:Yi(u.title,r),result:i.get(u.id),loading:a&&s.includes(u.id),height:d,group:be,editing:de&&!y,agentAvailable:p,suspended:!y&&u.id===f,menuRef:y?z:e=>{e?ie.current.set(u.id,e):ie.current.delete(u.id)},compare:l.compare===`previous_period`,range:u.time?.range??l.range,annotations:o,vars:r,onVariable:g,...x8(u,i.get(u.id),g,v?e=>v(u,e):void 0),onRangePending:e=>D?.(u.id,e),onZoom:b,zoomed:S,onZoomReset:x,onRetry:_?()=>_(u.id):void 0,onView:()=>w(u.id),onCopyLink:()=>{ye(u.id)},onEditSQL:m&&typeof u.sql==`string`?()=>{ae.current=y?z.current:ie.current.get(u.id)??null,P({panel:u,spec:n,version:t})}:void 0,onExplain:e?()=>h(C8(xe(u)),{answer_only:!0,context:T8(xe(u))}):void 0,onFix:e&&m?()=>h(w8(xe(u)),{context:T8(xe(u))}):void 0,staleAt:c.get(u.id),onDuplicate:de&&!y?()=>_e.mutate(u):void 0,onRemove:de&&!y?()=>ge.mutate(u.id):void 0}),Ce=n.panels.find(e=>e.id===f),we=d?he.error??ge.error??_e.error:null,Te=we instanceof Me&&we.code===`dashboard_version_conflict`,Ee=e=>{de&&I(e.map(({i:e,x:t,y:n,w:r,h:i})=>({i:e,x:t,y:n,w:r,h:i})))};return(0,H.jsxs)(`div`,{ref:re,style:{minWidth:0},children:[d&&(0,H.jsxs)(y,{justify:`space-between`,mb:`sm`,p:`xs`,style:{border:`1px dashed var(--mantine-color-default-border)`,borderRadius:8},children:[(0,H.jsx)(T,{size:`sm`,c:`dimmed`,children:de?`Drag a panel by its title and resize it from the corner. Changes are saved as a new version.`:`The layout can be edited only on a wider screen.`}),(0,H.jsx)(C,{size:`compact-sm`,disabled:!pe||!de,loading:he.isPending,onClick:()=>he.mutate(),children:`Save layout`})]}),Te&&(0,H.jsxs)(ee,{color:`warn`,mb:`sm`,children:[`Someone saved this dashboard since you opened it. Load the latest version, then redo your change. `,(0,H.jsx)(C,{size:`compact-sm`,onClick:ve,children:`Load latest`})]}),we&&!Te&&(0,H.jsx)(ee,{color:`bad`,mb:`sm`,children:we.message}),te&&(0,H.jsx)(ee,{role:`status`,mb:`sm`,children:te}),!ue&&(0,H.jsx)(`div`,{"data-grid-placeholder":!0,style:{height:E8(Math.max(1,...F.map(e=>e.y+e.h)))}}),ue&&(0,H.jsx)(b8,{width:ce,className:`dashboard-grid${de?` dashboard-grid-editing`:``}`,layouts:{lg:F,md:F,sm:F.map(e=>({...e,x:0,w:12}))},breakpoints:{lg:1100,md:800,sm:0},cols:{lg:12,md:12,sm:12},rowHeight:40,margin:[12,12],containerPadding:[0,0],compactor:z3,dragConfig:{enabled:de,handle:`.panel-drag`,cancel:`button`},resizeConfig:{enabled:de},onDragStop:Ee,onResizeStop:Ee,children:n.panels.map(e=>{let t=F.find(t=>t.i===e.id);return(0,H.jsx)(`div`,{"data-panel":e.id,children:Se(e,E8(t?.h??6))},e.id)})}),(0,H.jsx)(B4,{shortcutScope:O,onShortcuts:k,escapeEnabled:!A&&!N,opened:!!f,onClose:()=>w(void 0),title:Ce?Yi(Ce.title,r):`Missing panel`,returnFocusTo:()=>j?.(se.current)??ie.current.get(se.current??``)??ie.current.values().next().value,children:Ce?(0,H.jsx)(`div`,{style:{height:`calc(100vh - 120px)`},children:Se(Ce,Math.max(40,L-140),!0)}):(0,H.jsx)(ee,{color:`warn`,children:`This panel is missing from the dashboard. The shared link may be out of date.`})}),N&&(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(yt,{opened:!0,onClose:B,title:`Loading SQL editor`,children:(0,H.jsx)(oe,{size:`sm`,"aria-label":`Loading SQL editor`})}),children:(0,H.jsx)(A8,{dashboardId:e,version:N.version,spec:N.spec,panel:N.panel,time:l,vars:r,onClose:B})})]})}function P8(e,t=1,n=8){let r=(t-1)*n;return e.slice(r,r+n)}function F8({icon:e,title:t,children:n,tall:r=!1}){return(0,H.jsx)(ie,{mih:r?220:130,p:`xl`,children:(0,H.jsxs)(y,{wrap:`nowrap`,children:[(0,H.jsx)(te,{variant:`light`,size:`xl`,radius:`md`,children:e}),(0,H.jsxs)(o,{children:[(0,H.jsx)(T,{fw:700,size:`sm`,children:t}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,mt:3,children:n})]})]})})}function I8(e,t=8){let[n,r]=(0,V.useState)(1),i=Math.max(1,Math.ceil(e.length/t));(0,V.useEffect)(()=>{n>i&&r(i)},[n,i]);let a=(n-1)*t;return{page:n,setPage:r,totalPages:i,pageItems:P8(e,n,t),from:e.length?a+1:0,to:Math.min(a+t,e.length),total:e.length}}function L8({page:e,totalPages:t,from:n,to:r,total:i,onChange:a}){return t<=1?null:(0,H.jsxs)(y,{justify:`space-between`,mt:`xs`,children:[(0,H.jsxs)(T,{c:`dimmed`,size:`xs`,children:[n,`–`,r,` of `,i]}),(0,H.jsx)(y,{gap:4,children:[{label:`First page`,page:1,disabled:e===1},{label:`Previous page`,page:e-1,disabled:e===1},{label:`Next page`,page:e+1,disabled:e===t},{label:`Last page`,page:t,disabled:e===t}].map(e=>(0,H.jsx)(C,{size:`compact-xs`,variant:`subtle`,"aria-label":e.label,disabled:e.disabled,onClick:()=>a(e.page),children:e.label},e.label))})]})}function R8({spans:e,dark:t,onSpan:n}){let r=Math.min(...e.map(e=>new Date(e.start).valueOf())),i=Math.max(...e.map(e=>new Date(e.start).valueOf()+e.duration_ms)),a=Math.max(i-r,1),s=[...new Set(e.map(e=>e.service))],c=I8(e);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(be.ScrollContainer,{minWidth:680,children:(0,H.jsxs)(be,{highlightOnHover:!!n,verticalSpacing:`sm`,children:[(0,H.jsx)(be.Thead,{children:(0,H.jsxs)(be.Tr,{children:[(0,H.jsx)(be.Th,{w:230,children:`Operation`}),(0,H.jsx)(be.Th,{children:`Timeline`}),(0,H.jsx)(be.Th,{w:90,ta:`right`,children:`Duration`})]})}),(0,H.jsx)(be.Tbody,{children:c.pageItems.map(e=>{let i=(new Date(e.start).valueOf()-r)/a*100,c=Math.max(e.duration_ms/a*100,.6),l=e.status===`STATUS_CODE_ERROR`;return(0,H.jsxs)(be.Tr,{tabIndex:n?0:void 0,onClick:n?()=>n(e):void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))}:void 0,style:{cursor:n?`pointer`:void 0},children:[(0,H.jsx)(be.Td,{children:(0,H.jsxs)(y,{gap:`xs`,wrap:`nowrap`,children:[(0,H.jsx)(o,{w:8,h:8,bg:Ua(s.indexOf(e.service),t),style:{borderRadius:`50%`,flex:`0 0 auto`}}),(0,H.jsxs)(o,{miw:0,children:[(0,H.jsx)(T,{fw:600,size:`sm`,truncate:!0,children:e.operation}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,truncate:!0,children:e.service})]})]})}),(0,H.jsx)(be.Td,{children:(0,H.jsx)(me,{label:`${e.service} · ${e.operation} · ${ye(e.duration_ms)}`,withArrow:!0,children:(0,H.jsx)(o,{pos:`relative`,h:14,bg:`var(--mantine-color-default-hover)`,role:`img`,"aria-label":`${e.operation} on ${e.service} took ${ye(e.duration_ms)}`,style:{borderRadius:`var(--mantine-radius-sm)`},children:(0,H.jsx)(o,{pos:`absolute`,left:`${i}%`,w:`${Math.min(c,100-i)}%`,h:`100%`,bg:l?`bad`:Ua(s.indexOf(e.service),t),style:{borderRadius:`var(--mantine-radius-sm)`,minWidth:3}})})})}),(0,H.jsx)(be.Td,{ta:`right`,children:(0,H.jsx)(T,{size:`sm`,ff:`monospace`,children:ye(e.duration_ms)})})]},e.span_id)})})]})}),(0,H.jsx)(L8,{...c,onChange:c.setPage})]})}function z8({result:e,dark:t,onSpan:n}){let[r,i]=(0,V.useState)(`waterfall`),a=e.data,s=(0,V.useMemo)(()=>({id:`correlated_logs`,status:a.logs.length?`ok`:`empty`,elapsed_ms:0,frame:{columns:[{name:`time`,type:`time`,role:`time`},...[`severity`,`service`,`body`].map(e=>({name:e,type:`string`,role:`dimension`}))],rows:a.logs.length,values:[a.logs.map(e=>Date.parse(e.time)),a.logs.map(e=>e.severity),a.logs.map(e=>e.service),a.logs.map(e=>e.body)]}}),[a.logs]);return(0,H.jsxs)(S,{gap:`sm`,children:[(0,H.jsxs)(y,{children:[(0,H.jsx)(T,{fw:600,children:a.trace_id}),(0,H.jsx)(T,{c:a.has_error?`bad`:`dimmed`,children:a.has_error?`■ Error`:`● OK`})]}),a.spans.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(y,{role:`group`,"aria-label":`Trace view`,children:[(0,H.jsx)(C,{"aria-pressed":r===`waterfall`,variant:r===`waterfall`?`light`:`subtle`,onClick:()=>i(`waterfall`),children:`Waterfall`}),(0,H.jsx)(C,{"aria-pressed":r===`flame`,variant:r===`flame`?`light`:`subtle`,onClick:()=>i(`flame`),children:`Flame graph`})]}),r===`waterfall`?(0,H.jsx)(R8,{spans:a.spans,dark:t,onSpan:n}):(0,H.jsx)(B8,{spans:a.spans,dark:t,onSpan:n})]}):(0,H.jsx)(T,{c:`dimmed`,children:`No spans were found for this trace.`}),(0,H.jsx)(T,{fw:600,children:`Correlated logs`}),a.logs.length?(0,H.jsx)(o,{style:{overflow:`auto`,minWidth:0},children:(0,H.jsx)(P4,{foldConstants:!1,panel:{id:`correlated_logs`,title:`Correlated logs`,viz:`logs`},result:s,dark:t,height:320})}):(0,H.jsx)(F8,{tall:!0,icon:(0,H.jsx)(zi,{size:20,weight:`duotone`}),title:`No correlated logs`,children:`No logs in this window carry the selected trace ID.`}),a.truncated&&(0,H.jsxs)(ee,{color:`warn`,children:[`This trace is truncated: `,a.spans.length,` of `,a.span_count,` spans, `,a.services.length,` of `,a.service_count,` services.`]})]})}function B8({spans:e,dark:t,onSpan:n}){let r=(0,V.useMemo)(()=>V8(e),[e]),i=[...new Set(e.map(e=>e.service))];return(0,H.jsxs)(S,{px:{base:`md`,sm:`lg`},pb:`md`,gap:`xs`,children:[(0,H.jsxs)(y,{justify:`space-between`,children:[(0,H.jsx)(y,{gap:`md`,children:i.map(e=>(0,H.jsxs)(y,{gap:5,children:[(0,H.jsx)(o,{w:8,h:8,bg:Ua(i.indexOf(e),t),style:{borderRadius:`50%`}}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,children:e})]},e))}),(0,H.jsx)(Ue,{variant:`light`,children:ye(r.total)})]}),(0,H.jsx)(B,{withBorder:!0,radius:`md`,p:`sm`,children:(0,H.jsx)(pe,{type:`auto`,offsetScrollbars:!0,children:(0,H.jsxs)(o,{miw:760,children:[(0,H.jsx)(o,{pos:`relative`,h:22,mb:4,children:[0,25,50,75,100].map(e=>(0,H.jsx)(T,{pos:`absolute`,left:`${e}%`,c:`dimmed`,size:`xs`,style:{transform:e===100?`translateX(-100%)`:e?`translateX(-50%)`:void 0},children:ye(r.total*e/100)},e))}),(0,H.jsxs)(o,{pos:`relative`,h:Math.max(150,r.laneCount*36+12),bg:`var(--mantine-color-default-hover)`,style:{overflow:`hidden`,borderRadius:`var(--mantine-radius-md)`},children:[[0,25,50,75,100].map(e=>(0,H.jsx)(o,{pos:`absolute`,left:`${e}%`,top:0,bottom:0,style:{borderLeft:`1px solid var(--mantine-color-default-border)`}},e)),r.frames.map(({span:e,lane:r,left:a,width:s})=>{let c=e.status===`STATUS_CODE_ERROR`,l=s<7,u=c?Ha(t).bad:Ua(i.indexOf(e.service),t),d=`${e.operation} · ${ye(e.duration_ms)} · ${e.service}`,f=(0,H.jsxs)(T,{component:`span`,size:`xs`,fw:700,truncate:!0,children:[l?``:e.operation,s>=12?` · ${ye(e.duration_ms)}`:``]}),p={position:`absolute`,left:`${a}%`,top:r*36+6,width:`${Math.max(s,.35)}%`,height:30,overflow:`hidden`,minWidth:3};return(0,H.jsx)(me,{label:`${e.service} · ${e.operation} · ${ye(e.duration_ms)}`,withArrow:!0,events:{hover:!0,focus:!0,touch:!1},children:n?(0,H.jsx)(C,{variant:`filled`,color:u,"aria-label":d,px:l?2:`xs`,size:`compact-xs`,onClick:()=>n(e),style:p,children:f}):(0,H.jsx)(o,{role:`img`,tabIndex:0,"aria-label":d,style:{...p,display:`flex`,alignItems:`center`,paddingInline:l?2:8,borderRadius:`var(--mantine-radius-sm)`,background:u,color:Ot(u)},children:f})},e.span_id)})]})]})})}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,children:`Width represents wall-clock duration; lanes preserve span hierarchy without overlap.`})]})}function V8(e){let t=Math.min(...e.map(e=>new Date(e.start).valueOf())),n=Math.max(...e.map(e=>new Date(e.start).valueOf()+e.duration_ms)),r=Math.max(n-t,1),i=new Map(e.map(e=>[e.span_id,e])),a=(e,t=new Set)=>{if(!e.parent_span_id||t.has(e.span_id))return 0;let n=i.get(e.parent_span_id);return n?(t.add(e.span_id),1+a(n,t)):0},o=e.map(e=>{let n=new Date(e.start).valueOf();return{span:e,depth:a(e),start:n,end:n+e.duration_ms,left:(n-t)/r*100,width:e.duration_ms/r*100}}).sort((e,t)=>e.depth-t.depth||e.start-t.start||t.span.duration_ms-e.span.duration_ms),s=[],c=0;for(let e of[...new Set(o.map(e=>e.depth))].sort((e,t)=>e-t)){let t=[];for(let n of o.filter(t=>t.depth===e)){let e=t.findIndex(e=>e<=n.start);e===-1&&(e=t.length),t[e]=n.end,s.push({...n,lane:c+e})}c+=Math.max(t.length,1)}return{frames:s,laneCount:c,total:r}}function H8({client:e,spec:t,time:n,vars:r,target:i,onChange:a}){let o=it(`light`)===`dark`,s=t.panels.find(e=>e.id===i?.panel_id),c=i?.kind===`logs`&&s?.query?.from===`logs`,l=ot({queryKey:[`exemplars`,t,i,r],queryFn:({signal:n})=>e.exemplars({dashboard:t,panel_id:i.panel_id,kind:c?`logs`:`traces`,time:{from:i.window_from,to:i.window_to,refresh:`off`},from:i.from,to:i.to,dimensions:i.dimensions,bucket:i.bucket,vars:r},n),enabled:!!(i&&s&&!i.trace_id),retry:!1}),u=ot({queryKey:[`drill-trace`,i],queryFn:({signal:t})=>e.trace(i,t),enabled:!!i?.trace_id,retry:!1});return(0,H.jsxs)($e,{opened:!!i,onClose:()=>a(void 0),title:s?`${s.title} · ${i?.kind}`:`Panel selection unavailable`,position:`right`,size:`xl`,children:[i?.trace_id&&(0,H.jsx)(C,{variant:`subtle`,mb:`sm`,onClick:()=>{let{trace_id:e,namespace:t,...n}=i;a(n)},children:`Back to traces`}),!s&&(0,H.jsx)(ee,{color:`bad`,children:`This panel is no longer in the dashboard.`}),(l.isFetching||u.isFetching)&&(0,H.jsx)(oe,{role:`status`,"aria-label":`Loading drill data`,size:`sm`}),(l.error||u.error)&&(0,H.jsx)(ee,{color:`bad`,children:(l.error??u.error)?.message}),c&&l.data?.logs&&s&&(0,H.jsx)(P4,{panel:{...s,viz:`logs`},result:{id:s.id,status:l.data.logs.rows?`ok`:`empty`,frame:l.data.logs,elapsed_ms:0,from_ms:Date.parse(i.from),to_ms:Date.parse(i.to)},dark:o,height:500}),c&&l.data?.logs?.rows===0&&(0,H.jsx)(T,{c:`dimmed`,children:`No logs match this selection.`}),!c&&!i?.trace_id&&l.data&&(0,H.jsxs)(S,{gap:`xs`,children:[l.data.traces.length===0&&(0,H.jsx)(T,{c:`dimmed`,children:`No exemplar traces match this selection.`}),l.data.traces.map(e=>(0,H.jsxs)(C,{variant:`default`,justify:`space-between`,onClick:()=>a({...i,trace_id:e.trace_id,namespace:e.namespace}),children:[e.service,` · `,e.operation,` · `,e.duration_ms.toFixed(1),` ms`]},`${e.namespace}/${e.trace_id}`)),l.data.truncated&&(0,H.jsx)(T,{size:`xs`,c:`dimmed`,children:`Showing at most 20 exemplar traces.`})]}),u.data&&(0,H.jsx)(z8,{result:u.data,dark:o})]})}var U8={"5m":`Last 5 minutes`,"15m":`Last 15 minutes`,"1h":`Last hour`,"3h":`Last 3 hours`,"6h":`Last 6 hours`,"12h":`Last 12 hours`,"24h":`Last 24 hours`,"2d":`Last 2 days`,"7d":`Last 7 days`,"30d":`Last 30 days`};function W8(e){return e.from&&e.to?`${ge(e.from)} – ${ge(e.to)}`:U8[e.range??`1h`]??e.range??`Last hour`}function G8({time:e,refresh:t,compare:n,editing:r,fetching:i,updatedAt:a,onRange:o,onAbsolute:s,onZoomOut:c,onRefresh:l,onRefreshNow:u,onCompare:d,onEdit:f,onHistory:p,onShortcuts:m,selecting:h=!1}){let[g,_]=(0,V.useState)(``),[v,b]=(0,V.useState)(``),[x,S]=(0,V.useState)(!1);return(0,H.jsxs)(y,{gap:`xs`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard controls`,children:[(0,H.jsxs)(Je,{position:`bottom-end`,withinPortal:!0,opened:x,onChange:S,children:[(0,H.jsx)(Je.Target,{children:(0,H.jsx)(C,{variant:`default`,size:`sm`,leftSection:(0,H.jsx)(ji,{size:15}),rightSection:(0,H.jsx)(_e,{size:12,weight:`bold`}),children:W8(e)})}),(0,H.jsxs)(Je.Dropdown,{miw:260,children:[(0,H.jsx)(Je.Label,{children:`Relative`}),dt.map(t=>(0,H.jsx)(Je.Item,{onClick:()=>o(t),fw:e.range===t?600:void 0,children:U8[t]},t)),(0,H.jsx)(Je.Divider,{}),(0,H.jsx)(Je.Label,{children:`Absolute (your time zone)`}),(0,H.jsxs)(y,{gap:6,px:`xs`,pb:`xs`,wrap:`nowrap`,children:[(0,H.jsx)(je,{type:`datetime-local`,size:`xs`,"aria-label":`From`,value:g,onChange:e=>_(e.currentTarget.value)}),(0,H.jsx)(je,{type:`datetime-local`,size:`xs`,"aria-label":`To`,value:v,onChange:e=>b(e.currentTarget.value)})]}),(0,H.jsx)(y,{px:`xs`,pb:`xs`,justify:`flex-end`,children:(0,H.jsx)(C,{size:`compact-sm`,disabled:!g||!v||g>=v,onClick:()=>{s(new Date(g).toISOString(),new Date(v).toISOString()),S(!1)},children:`Apply range`})})]})]}),(0,H.jsx)(me,{label:`Zoom out`,children:(0,H.jsx)(C,{variant:`default`,size:`sm`,px:10,"aria-label":`Zoom out`,onClick:c,children:(0,H.jsx)(Ui,{size:15})})}),(0,H.jsxs)(y,{"data-refresh-controls":!0,gap:4,wrap:`nowrap`,children:[(0,H.jsx)(me,{label:a?`Updated ${ge(a)}`:`Refresh now`,children:(0,H.jsx)(C,{variant:`default`,size:`sm`,px:10,"aria-label":`Refresh now`,loading:i,onClick:u,children:(0,H.jsx)(xi,{size:15})})}),(0,H.jsx)(Hr,{size:`xs`,"aria-label":`Auto refresh`,value:t,onChange:l,data:At.map(e=>({value:e,label:e===`off`?`Off`:e}))})]}),(0,H.jsx)(oi,{size:`sm`,label:`Compare with previous period`,checked:n,onChange:e=>d(e.currentTarget.checked)}),(0,H.jsx)(C,{variant:r?`filled`:`default`,size:`sm`,leftSection:(0,H.jsx)(Be,{size:15}),onClick:f,children:r?`Done`:`Edit layout`}),(0,H.jsx)(C,{variant:`default`,size:`sm`,leftSection:(0,H.jsx)(Ni,{size:15}),onClick:p,children:`History`}),m&&(0,H.jsx)(R4,{onClick:m}),a&&(0,H.jsxs)(T,{size:`xs`,c:`dimmed`,visibleFrom:`md`,children:[`Updated `,new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`,second:`2-digit`}).format(a)]}),h&&(0,H.jsx)(T,{"data-range-paused":!0,size:`xs`,c:`dimmed`,role:`status`,children:`Paused while selecting`})]})}var K8=(e,t)=>!(t instanceof Me&&t.status<500)&&e<2,q8=(e,t)=>!(t instanceof Me&&t.code===`timeout`)&&K8(e,t),J8=e=>({panels:e.panels.map(({grid:e,...t})=>t),variables:e.variables,time:e.time,annotations:e.annotations});function Y8(e,t,n,r,i){return[`panels`,JSON.stringify([e,J8(t),n,r,i])]}function X8(e,t,n,r){return[`variables`,e,J8(t),n,r]}async function Z8(e,t){let n=await Ye(e,t),r=new Set(e.dashboard.panels.filter(e=>[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz)).map(e=>e.id)),i=n.filter(e=>r.has(e.id)&&e.from_ms!==void 0&&e.to_ms!==void 0&&e.from_mse.from_ms)),o=Math.max(...i.map(e=>e.to_ms));try{return{results:n,annotations:await vt({from:new Date(a).toISOString(),to:new Date(o).toISOString()},t)}}catch(e){if(t?.aborted)throw e;return{results:n,annotation_error:e instanceof Error?e.message:`Annotations unavailable`}}}var Q8={off:!1,"10s":1e4,"30s":3e4,"1m":6e4,"5m":3e5},$8=0;function e5(e,t){let[n,r]=e.queryKey;if(n!==`panels`||typeof r!=`string`)return!1;try{return JSON.parse(r)[0]===t}catch{return!1}}function t5({dashboardId:e,spec:t,time:n,vars:r,compare:i,widths:a,visible:o,refresh:s,enabled:c=!0}){let l=(0,V.useMemo)(()=>Object.fromEntries(Object.entries(a).map(([e,t])=>[e,Math.max(100,Math.round(t/100)*100)])),[a]),u=Y8(e,t,n,r,i),d=u[1],f=o.filter(e=>t.panels.some(t=>t.id===e)),p=(0,V.useRef)([]),m=(0,V.useRef)(void 0),h=(0,V.useRef)(null),g=(0,V.useRef)(!1),_=(0,V.useRef)(null),v=(0,V.useRef)({key:d,ids:new Set}),[y,b]=(0,V.useState)({key:d}),[x,S]=(0,V.useState)({key:d,results:new Map,updated:new Map,stale:new Set,receivedAt:0}),C=f.length===0&&x.key===d&&x.receivedAt>0,w=c&&t.panels.some(e=>e.viz!==`text`),T=ot({queryKey:u,queryFn:({signal:e})=>{if(C&&h.current?.key!==d)return p.current=[],Promise.resolve({results:[],hasTimePanels:!1,batch:++$8});let a=h.current?.key===d?h.current.ids:f;p.current=(a.length?[...a]:t.panels.map(e=>e.id)).sort(),v.current.key!==d&&(v.current={key:d,ids:new Set});for(let e of p.current)v.current.ids.add(e);let o=[...p.current];return Z8({dashboard:t,panels:o,time:n,vars:r,widths:l,compare:i},e).then(e=>{let n=new Set(e.results.map(e=>e.id)),r=o.filter(e=>!n.has(e)&&t.panels.find(t=>t.id===e)?.viz!==`text`).map(e=>({id:e,status:`error`,elapsed_ms:0,error:`No result was returned for this panel; refresh to retry.`,request_error:o}));return{...e,batch:++$8,results:[...e.results.map(e=>W4(e,o)),...r],hasTimePanels:t.panels.some(e=>o.includes(e.id)&&[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz))}}).catch(n=>{throw e.aborted||(m.current={key:d,ids:o.filter(e=>t.panels.find(t=>t.id===e)?.viz!==`text`),error:n instanceof Error?n.message:String(n),retryable:!(n instanceof Me)||n.status===408||n.status===429||n.status>=500}),n})},retry:q8,enabled:w,refetchInterval:C?!1:Q8[s]??3e4,staleTime:5e3,placeholderData:e=>e}),E=T.error&&m.current?.key===d?m.current:void 0,D=(0,V.useMemo)(()=>n5(x,d,T.isPlaceholderData?void 0:T.data?.results,T.dataUpdatedAt,T.data?.batch,E),[x,d,T.data,T.dataUpdatedAt,T.isPlaceholderData,T.error,T.errorUpdatedAt]),O=D.results,k=T.isPlaceholderData?void 0:T.data?.hasTimePanels?T.data:y.key===d?y:void 0;(0,V.useEffect)(()=>{!T.isPlaceholderData&&T.data?.hasTimePanels&&b({key:d,annotations:T.data.annotations,annotation_error:T.data.annotation_error})},[d,T.data,T.isPlaceholderData]),(0,V.useEffect)(()=>{T.isPlaceholderData||S(e=>n5(e,d,T.data?.results,T.dataUpdatedAt,T.data?.batch,E))},[d,T.data,T.dataUpdatedAt,T.isPlaceholderData,T.error,T.errorUpdatedAt]);let A=new Map([...D.stale].flatMap(e=>{let t=D.updated.get(e);return t?[[e,t]]:[]})),j=(T.data?.results??[]).find(e=>e.status===`error`&&D.stale.has(e.id));(0,V.useEffect)(()=>{if(!w||T.isFetching||g.current||_.current?.key===d||h.current?.key===d)return;let e=v.current.key===d?v.current.ids:new Set,n=[...new Set(f.filter(n=>!O.has(n)&&!e.has(n)&&t.panels.find(e=>e.id===n)?.viz!==`text`))].sort();if(!n.length)return;let r={key:d,ids:n};h.current=r,T.refetch({cancelRefetch:!1}).finally(()=>{h.current===r&&(h.current=null)})},[o,w,d,T.isFetching,T.error,T.refetch,O,t.panels]),(0,V.useEffect)(()=>{!T.isFetching&&_.current?.key!==d&&g.current&&(g.current=!1,h.current=null,w&&!C&&T.refetch({cancelRefetch:!1}))},[T.isFetching,d,w,C,T.refetch]);let M=e=>{let t={key:d,ids:e};h.current=t,T.refetch({cancelRefetch:!1}).finally(()=>{h.current===t&&(h.current=null)})};return(0,V.useEffect)(()=>{if(T.isFetching||!_.current)return;let e=_.current;if(_.current=null,e.key!==d||!w)return;let n=[...e.ids].filter(e=>t.panels.some(t=>t.id===e&&t.viz!==`text`)&&O.get(e)?.request_error).sort();n.length&&M(n)},[T.isFetching,d,w,O,t.panels]),{retry:e=>{if(!w)return;let n=e?O.get(e)?.request_error??[]:[...O.values()].flatMap(e=>e.request_error??[]),r=[...new Set(n)].filter(e=>t.panels.some(t=>t.id===e&&t.viz!==`text`)&&O.get(e)?.request_error).sort();if(r.length){if(T.isFetching){_.current?.key!==d&&(_.current={key:d,ids:new Set});for(let e of r)_.current.ids.add(e);return}M(r)}},results:O,staleAt:A,annotations:k?.annotations,annotationError:k?.annotation_error,fetchingIds:T.isFetching?p.current:[],fetching:T.isFetching,error:T.error??(j?Error(j.error??`Panel refresh failed`):null),updatedAt:T.isPlaceholderData?null:T.dataUpdatedAt||null,refetch:()=>{if(w&&!C){if(T.isFetching){h.current?.key===d&&(g.current=!0);return}T.refetch({cancelRefetch:!1})}}}}function n5(e,t,n,r,i,a){let o=e.key===t?{key:t,results:new Map(e.results),updated:new Map(e.updated),stale:new Set(e.stale),receivedAt:e.receivedAt,receivedBatch:e.receivedBatch}:{key:t,results:new Map,updated:new Map,stale:new Set,receivedAt:0};for(let e of n&&i!==o.receivedBatch?n:[])e.status===`error`&&o.results.get(e.id)?.frame?(o.stale.add(e.id),o.results.set(e.id,{...o.results.get(e.id),error:e.error,request_error:e.request_error})):(o.results.set(e.id,e),o.updated.set(e.id,r),o.stale.delete(e.id));n&&(o.receivedAt=r,o.receivedBatch=i);for(let e of a?.ids??[]){let t=o.results.get(e);t?.frame?(o.stale.add(e),o.results.set(e,{...t,error:a.error,request_error:a.retryable?a.ids:void 0})):o.results.set(e,{id:e,status:`error`,elapsed_ms:0,error:a.error,request_error:a.retryable?a.ids:void 0})}return o}function r5(e,t){return e.queryKey[0]===`variables`&&e.queryKey[1]===t}function i5(e,t,n,r,i,a=!1){let o=!!t.variables?.some(e=>e.kind===`query`),s=ot({queryKey:X8(e,t,n,r),queryFn:async({signal:e})=>{let a=await i({dashboard:t,time:n,vars:r},e);return Object.fromEntries((t.variables??[]).map(e=>[e.name,a[e.name]??(e.kind===`custom`?e.options?.map(e=>({value:e})):void 0)??[]]))},enabled:o,retry:a,staleTime:6e4,placeholderData:e=>e}),c=s.isPlaceholderData?void 0:s.data,l=s.isError||(t.variables??[]).every(e=>e.kind!==`query`||r[e.name]!==void 0&&r[e.name]!==`$__all`&&(e.multi||!Array.isArray(r[e.name])||r[e.name].length>0)||!!e.default||e.include_all||c?.[e.name]!==void 0);return{...s,currentData:c,ready:l}}function a5(e){return t=>e5(t,e)||r5(t,`dashboard-${e}`)}function o5({id:e,currentVersion:t,opened:n,onClose:r,onRestored:i}){let a=et(),[o,s]=(0,V.useState)(),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(n),m=(0,V.useRef)(0),h=(0,V.useRef)(n);h.current=n;let g=(0,V.useRef)(!1),_=(0,V.useRef)(!1),v=(0,V.useRef)(i);v.current=i,(0,V.useEffect)(()=>(_.current=!0,()=>{_.current=!1}),[]);let y=De({mutationFn:({version:t})=>He(e,t),retry:!1,onSuccess:(t,{version:n,generation:r})=>{a.cancelQueries({queryKey:[`dashboard`,e],exact:!0}),a.cancelQueries({predicate:a5(e)}),a.cancelQueries({queryKey:[`exemplars`]}),a.cancelQueries({queryKey:[`drill-trace`]}),a.setQueryData([`dashboard`,e],t),a.invalidateQueries({predicate:a5(e),refetchType:`none`}),_.current&&(h.current&&r===m.current&&l(`Restored v${n} as v${t.version}`),v.current(t)),a.invalidateQueries({queryKey:Pe}),a.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}),a.invalidateQueries({queryKey:[`exemplars`],refetchType:`none`}),a.invalidateQueries({queryKey:[`drill-trace`],refetchType:`none`})},onError:t=>{t instanceof Me&&t.code===`dashboard_version_not_found`&&a.invalidateQueries({queryKey:[`dashboard-versions`,e]})},onSettled:()=>{g.current=!1,_.current&&d(!1)}}),b=()=>{m.current++,y.reset(),l(``)};(0,V.useEffect)(()=>{if(n){p(!0);return}m.current++,y.reset(),l(``),a.cancelQueries({queryKey:[`dashboard-versions`,e]}),a.cancelQueries({queryKey:[`dashboard-version`,e]})},[n,e,a,y.reset]);let x=(0,V.useRef)(t);return(0,V.useEffect)(()=>{x.current!==t&&(x.current=t,a.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}))},[t,e,a]),(0,H.jsx)($e,{opened:n,onClose:()=>{b(),r()},onExitTransitionEnd:()=>p(!1),title:`Version history`,position:`right`,size:`xl`,children:(n||f)&&(0,H.jsx)(s5,{id:e,opened:n,currentVersion:t,selected:o,onSelect:e=>{b(),s(e)},pending:u,error:y.error,failedVersion:y.variables?.version,success:c,onRestore:e=>{g.current||(g.current=!0,d(!0),l(``),y.mutate({version:e,generation:m.current}))}})})}function s5({id:e,opened:t,currentVersion:n,selected:r,onSelect:i,pending:a,error:s,failedVersion:c,success:l,onRestore:u}){let d=ot({queryKey:[`dashboard-versions`,e],queryFn:({signal:t})=>bt(e,t),enabled:t,retry:!1}),f=r??d.data?.[0]?.version,p=ot({queryKey:[`dashboard-version`,e,f],queryFn:({signal:t})=>Fe(e,f,t),enabled:t&&f!==void 0,retry:!1});return(0,H.jsxs)(S,{gap:`md`,"data-version-history":!0,children:[(0,H.jsx)(T,{size:`sm`,c:`dimmed`,children:`Inspect saved specs and changes. Restoring adds a new version.`}),l&&(0,H.jsx)(ee,{color:`ok`,role:`status`,children:l}),s&&c===f&&(0,H.jsx)(d5,{error:s,version:f}),(0,H.jsxs)(o,{mih:160,children:[d.isPending&&(0,H.jsxs)(y,{gap:`xs`,role:`status`,children:[(0,H.jsx)(oe,{size:`sm`}),(0,H.jsx)(T,{size:`sm`,children:`Loading history…`})]}),d.error&&(0,H.jsxs)(ee,{color:`bad`,title:`History unavailable`,children:[d.error.message,(0,H.jsx)(C,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void d.refetch(),children:`Retry history`})]}),d.data?.length===0&&(0,H.jsx)(T,{c:`dimmed`,children:`No versions available.`}),!!d.data?.length&&(0,H.jsx)(pe,{h:200,type:`auto`,children:(0,H.jsx)(S,{gap:`xs`,pr:`sm`,role:`list`,"aria-label":`Saved versions`,children:d.data.map(e=>(0,H.jsxs)(B,{role:`listitem`,withBorder:!0,p:`xs`,radius:`sm`,style:{borderColor:f===e.version?`var(--mantine-color-brand-filled)`:void 0},children:[(0,H.jsxs)(y,{justify:`space-between`,gap:`xs`,children:[(0,H.jsxs)(C,{variant:f===e.version?`light`:`subtle`,size:`compact-sm`,"aria-pressed":f===e.version,onClick:()=>i(e.version),children:[`Version `,e.version]}),e.version===n&&(0,H.jsx)(Ue,{color:`gray`,variant:`light`,tt:`none`,children:`Current`}),(0,H.jsx)(l5,{at:e.created_at})]}),(0,H.jsxs)(T,{size:`xs`,c:`dimmed`,mt:4,children:[c5(e),` · `,e.message||`No edit message`]})]},e.version))})})]}),(0,H.jsx)(Ve,{role:`status`,"aria-live":`polite`,children:f===void 0?`Select a version.`:p.isFetching?`Loading version ${f}…`:p.error?`Version ${f} unavailable.`:`Version ${f} ready.`}),(0,H.jsxs)(o,{mih:280,"aria-busy":p.isFetching,children:[f!==void 0&&p.isPending&&(0,H.jsxs)(y,{gap:`xs`,role:`status`,children:[(0,H.jsx)(oe,{size:`sm`}),(0,H.jsx)(T,{size:`sm`,children:`Loading version…`})]}),p.error&&(0,H.jsxs)(ee,{color:`bad`,title:p.error instanceof Me&&p.error.code===`dashboard_version_not_found`?`This version is no longer available`:`Version unavailable`,children:[p.error.message,(0,H.jsx)(C,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void p.refetch(),children:`Retry version`})]}),p.data&&!p.error&&(0,H.jsx)(u5,{record:p.data,currentVersion:n,pending:a,onRestore:()=>u(p.data.dashboard.version)})]})]})}function c5(e){return e.author_kind===`agent`?`Agent`:e.author_kind===`user`?`You`:`System`}function l5({at:e}){let t=(Date.parse(e)-Date.now())/1e3,[n,r]=Math.abs(t)<60?[1,`second`]:Math.abs(t)<3600?[60,`minute`]:Math.abs(t)<86400?[3600,`hour`]:[86400,`day`];return(0,H.jsx)(T,{component:`time`,dateTime:e,title:ge(e),size:`xs`,c:`dimmed`,children:new Intl.RelativeTimeFormat(void 0,{numeric:`auto`}).format(Math.round(t/n),r)})}function u5({record:e,currentVersion:t,pending:n,onRestore:r}){let{dashboard:i}=e,a=ce(e);return(0,H.jsxs)(S,{gap:`sm`,"data-history-version":i.version,children:[(0,H.jsxs)(y,{justify:`space-between`,align:`flex-start`,children:[(0,H.jsxs)(o,{miw:0,children:[(0,H.jsxs)(I,{order:2,fz:`lg`,children:[i.name,` · v`,i.version]}),(0,H.jsxs)(T,{size:`sm`,c:`dimmed`,children:[c5(e),` · `,e.message||`No edit message`]}),(0,H.jsx)(l5,{at:e.created_at})]}),i.version===t?(0,H.jsx)(C,{size:`sm`,variant:`default`,disabled:!0,children:`Current version`}):(0,H.jsxs)(C,{size:`sm`,disabled:n,loading:n,onClick:r,children:[`Restore version `,i.version]})]}),i.description&&(0,H.jsx)(T,{size:`sm`,children:i.description}),e.changes_available?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Te,{labels:a}),!a.length&&!e.layout_changed&&(0,H.jsx)(T,{size:`sm`,c:`dimmed`,children:`No authored changes.`})]}):(0,H.jsx)(ee,{color:`warn`,title:`Changes unavailable`,children:`The preceding version is no longer retained. This saved spec is still available.`}),(0,H.jsxs)(T,{size:`sm`,c:`dimmed`,children:[`Read-only · `,i.spec.panels.length,` panels. Historical data is not queried.`]}),(0,H.jsxs)(pn,{variant:`contained`,children:[(0,H.jsxs)(pn.Item,{value:`spec`,children:[(0,H.jsx)(pn.Control,{children:`Spec`}),(0,H.jsx)(pn.Panel,{children:(0,H.jsx)(Re,{block:!0,tabIndex:0,style:{maxHeight:320,overflow:`auto`},children:JSON.stringify(i.spec,null,2)})})]}),(0,H.jsxs)(pn.Item,{value:`data`,children:[(0,H.jsx)(pn.Control,{children:`Data`}),(0,H.jsx)(pn.Panel,{children:(0,H.jsx)(S,{gap:`xs`,children:i.spec.panels.map(e=>(0,H.jsxs)(o,{children:[(0,H.jsxs)(T,{size:`sm`,fw:500,children:[e.title,` · `,e.viz]}),(0,H.jsx)(Re,{block:!0,tabIndex:0,children:e.content??e.sql??JSON.stringify(e.query??{},null,2)})]},e.id))})})]})]})]})}function d5({error:e,version:t}){let n=e instanceof Me?e.code:void 0,r=!(e instanceof Me)||e.status>=500?`Try again with the restore button.`:n===`invalid_spec`?`This saved spec is invalid. Review the fields below and choose another version.`:n===`dashboard_version_not_found`?`Reload history and choose a retained version.`:[`already_current`,`dashboard_version_conflict`,`conflict`].includes(n??``)?`This dashboard changed or its name conflicts. Reload history and choose another version.`:`Check your access and reload history.`;return(0,H.jsxs)(ee,{color:`bad`,title:`Restore of version ${t} failed`,children:[(0,H.jsx)(T,{size:`sm`,children:e.message}),e instanceof Me&&e.problems.length>0&&(0,H.jsx)(`ul`,{children:e.problems.map((e,t)=>(0,H.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))}),(0,H.jsx)(T,{size:`sm`,mt:`xs`,children:r})]})}function f5(e,t){let n=JSON.stringify([e.range,e.from,e.to]),r=(0,V.useRef)({search:e,onSearch:t,scope:n}),i=(0,V.useRef)(``),a=(0,V.useRef)(void 0),[o,s]=(0,V.useState)(!1);r.current.scope!==n&&(i.current!==`${e.from}/${e.to}`&&(a.current=void 0,o&&s(!1)),i.current=``),r.current={search:e,onSearch:t,scope:n};let c=(0,V.useCallback)(()=>{i.current=``,a.current=void 0,s(!1)},[]),l=(0,V.useCallback)(()=>{if(!a.current)return;let e=a.current;c(),r.current.onSearch({...r.current.search,...e},!1)},[c]);return{zoom:(0,V.useCallback)((e,t)=>{let n=la(e,t);if(!n)return;let o=r.current,c=`${n.from}/${n.to}`;o.search.from===n.from&&o.search.to===n.to||i.current===c||(a.current??={range:o.search.range,from:o.search.from,to:o.search.to},s(!0),i.current=c,o.onSearch({...o.search,range:void 0,...n},!1))},[]),reset:c,resetZoom:l,zoomed:o}}function p5({variables:e,vars:t,options:n,onChange:r}){return e.length===0?null:(0,H.jsx)(y,{gap:`sm`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard variables`,children:e.map(e=>{let i=Ji(e,t,n[e.name]),a=[...e.include_all?[{value:qi,label:`All`}]:[],...(n[e.name]??e.options?.map(e=>({value:e}))??[]).map(e=>({value:e.value,label:e.value}))],o=(0,H.jsxs)(T,{size:`xs`,c:`dimmed`,ff:`monospace`,children:[`$`,e.name]});return e.kind===`constant`?(0,H.jsx)(je,{label:o,size:`xs`,value:e.value,readOnly:!0,w:160},e.name):e.kind===`text`?(0,H.jsx)(je,{label:o,size:`xs`,w:200,defaultValue:typeof i==`string`?i:``,onBlur:t=>r(e.name,t.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}},`${e.name}:${JSON.stringify(i)}`):e.multi?(0,H.jsx)(kr,{label:o,size:`xs`,w:260,searchable:!0,clearable:!0,data:a.filter(e=>e.value!==qi),value:Array.isArray(i)?i:i&&i!==`$__all`?[i]:[],placeholder:e.include_all?`All`:`None`,onChange:t=>r(e.name,t.length?t:e.include_all?qi:[])},e.name):(0,H.jsx)(Wr,{label:o,size:`xs`,w:220,searchable:!0,allowDeselect:!1,data:a,value:Array.isArray(i)?i[0]??null:i||null,onChange:t=>t!==null&&r(e.name,t)},e.name)})})}function m5(e,t,n=!1){let r=e.target;return t||e.defaultPrevented||e.repeat||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey&&e.key!==`?`||r instanceof Element&&r.closest(`input,textarea,select,[contenteditable]:not([contenteditable="false"]),[role="textbox"],[role="menu"]`)||r instanceof Element&&r.closest(`[role="dialog"]`)&&!(n&&r.closest(`[data-panel-fullscreen]`))?null:[`r`,`e`,`h`,`f`,`?`].includes(e.key)?e.key:null}function h5(e,t,n={}){let r=(0,V.useRef)({actions:t,options:n});r.current={actions:t,options:n},(0,V.useEffect)(()=>{let t=t=>{let n=e.current,i=t.target,{actions:a,options:o}=r.current;if(!n||!(i instanceof Element)||o.enabled===!1)return;let s=o.fullscreenScope?[...document.querySelectorAll(`[data-shortcut-scope]`)].find(e=>e.dataset.shortcutScope===o.fullscreenScope&&e.hasAttribute(`data-panel-fullscreen`)):void 0,c=n.contains(i)&&n.contains(document.activeElement),l=i===document.body&&document.activeElement===document.body,u=s?.contains(i)&&s.contains(document.activeElement);if(!c&&!l&&!u)return;let d=m5(t,!!(o.modalOpen||[...document.querySelectorAll(`[role="dialog"]`)].some(e=>e!==s)),!!s);if(!d||s&&![`r`,`f`,`?`].includes(d))return;let f=a[d];f&&(t.preventDefault(),f(i))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e])}function g5({opened:e,onClose:t,fullscreen:n=!1,enabled:r,onEnabled:i}){let a=[[`r`,`Refresh now`],...n?[]:[[`e`,`Toggle layout mode`],[`h`,`Open history`]],[`f`,n?`Exit full-screen`:`Open the focused panel in full-screen`],[`?`,`Open keyboard shortcuts`],[`Escape`,`Cancel a range, then leave the chart or close full-screen`]];return(0,H.jsx)(yt,{opened:e,onClose:t,title:`Keyboard shortcuts`,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,children:(0,H.jsxs)(S,{gap:`xs`,children:[(0,H.jsx)(oi,{label:`Single-key shortcuts`,checked:r,onChange:e=>i(e.currentTarget.checked)}),a.map(([e,t])=>(0,H.jsxs)(y,{gap:`sm`,children:[(0,H.jsx)(Xe,{children:e}),(0,H.jsx)(T,{size:`sm`,children:t})]},e)),!n&&(0,H.jsx)(T,{size:`sm`,children:`Focus a chart or a panel control before pressing f. Without a focused panel, f does nothing.`}),(0,H.jsx)(T,{size:`sm`,children:`Tab directly to a chart. Left/Right moves between points; Up/Down changes series at the same time or category. Home/End jumps to the first/last point. Enter drills or applies the panel filter. Comparison and Other values can be read even when selection is unavailable.`}),(0,H.jsx)(T,{size:`sm`,children:`On time charts, Shift+Left/Right extends a range and pauses auto-refresh. Review the shaded range and compact UTC label, then choose Zoom to range. Use the time picker after zooming for precise edits. Escape or Cancel cancels it and resumes refresh. The next Escape leaves the chart or closes full-screen. Reset zoom, Zoom out and browser Back preserve comparison and filters.`}),(0,H.jsxs)(T,{size:`sm`,children:[n?`In full-screen, r refreshes, f exits and ? opens help; e and h are inactive.`:`Shortcuts work in the dashboard.`,` Typing, menus and other dialogs or drawers pause shortcuts. Modifier shortcuts keep their browser behavior. Turning off single-key shortcuts keeps chart navigation and visible controls available.`]}),(0,H.jsx)(T,{size:`sm`,children:`The global / shortcut focuses the chat composer.`})]})})}function _5(e){let t=`fanout:single-key-shortcuts:`+e,n=()=>{try{return localStorage.getItem(t)!==`off`}catch{return!0}},[r,i]=(0,V.useState)(n);return(0,V.useEffect)(()=>{i(n())},[t]),(0,V.useEffect)(()=>{let e=e=>{e.key===t&&i(n())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[t]),{enabled:r,change:e=>{i(e);try{localStorage.setItem(t,e?`on`:`off`)}catch{}}}}function v5(e){let t=(0,V.useRef)(void 0),n=t=>[...e.current?.querySelectorAll(`[data-panel]`)??[]].find(e=>e.dataset.panel===t&&!e.closest(`[data-panel-fullscreen],[data-fragment-fullscreen]`));return(0,V.useEffect)(()=>{t.current&&!n(t.current.panel)&&(t.current=void 0)}),{remember(n){t.current=void 0;let r=document.activeElement;if(!(r instanceof HTMLElement)||!e.current?.contains(r)||r.closest(`[data-panel]`)?.dataset.panel!==n)return;let i=r.getAttribute(`data-panel-view`),a=r.getAttribute(`aria-label`),o=r.hasAttribute(`data-chart-plot`)?`[data-chart-plot]`:i?`[data-panel-view=${JSON.stringify(i)}]`:a?`[aria-label=${JSON.stringify(a)}]`:void 0;t.current={element:r,panel:n,selector:o}},restore(e){let r=t.current;if(t.current=void 0,r&&(e===void 0||r.panel===e)&&n(r.panel))return r.element.isConnected&&!r.element.closest(`[hidden]`)?r.element:r.selector?n(r.panel)?.querySelector(r.selector)??void 0:void 0}}}var y5={exemplars:qe,trace:Ie},b5={"5m":`15m`,"15m":`1h`,"1h":`3h`,"3h":`6h`,"6h":`12h`,"12h":`24h`,"24h":`2d`,"2d":`7d`,"7d":`30d`,"30d":`30d`};function x5({dashboardId:e,search:t,onSearch:n,onOpen:r}){let{agentAvailable:i,openChat:a}=se(),o=ot({queryKey:Pe,queryFn:Ze,staleTime:15e3});(0,V.useEffect)(()=>{!e&&o.data?.length&&r((o.data.find(e=>e.is_default)??o.data[0]).id,!0)},[e,o.data]);let s=ot({queryKey:[`dashboard`,e],queryFn:({signal:t})=>jt(e,t),enabled:!!e,retry:(e,t)=>!(t instanceof Me&&t.code===`not_found`)&&e<2});return!e&&o.error?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsx)(ee,{color:`bad`,title:`Dashboards could not be loaded`,children:o.error.message})}):!e&&o.data?.length===0?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsxs)(S,{align:`center`,gap:`xs`,children:[(0,H.jsx)(I,{order:1,fz:24,children:`No dashboards yet`}),(0,H.jsx)(T,{c:`dimmed`,size:`sm`,ta:`center`,children:`Create a dashboard to explore your services.`}),i&&(0,H.jsx)(C,{mt:`sm`,size:`sm`,onClick:()=>a(`Build me a dashboard for my services, showing request volume, latency, and errors. Ask me which services to monitor first.`),children:`Create with AI`})]})}):!e||s.isLoading?(0,H.jsxs)(ie,{mih:`50vh`,children:[(0,H.jsx)(oe,{size:`sm`}),(0,H.jsx)(T,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading your dashboard…`})]}):s.error instanceof Me&&s.error.code===`not_found`?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsxs)(S,{align:`center`,gap:`xs`,children:[(0,H.jsx)(I,{order:1,fz:24,children:`This dashboard isn't here`}),(0,H.jsx)(T,{c:`dimmed`,size:`sm`,ta:`center`,children:`The link may be out of date, or the dashboard may have been deleted.`}),o.data?.length?(0,H.jsx)(C,{mt:`sm`,variant:`default`,size:`sm`,onClick:()=>r((o.data.find(e=>e.is_default)??o.data[0]).id,!0),children:`Open your default dashboard`}):null]})}):s.error||!s.data?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsx)(T,{c:`dimmed`,size:`sm`,children:`Your dashboard is unavailable. Try refreshing.`})}):(0,H.jsx)(S5,{id:s.data.id,version:s.data.version,spec:s.data.spec,search:t,onSearch:n,agentAvailable:i,openChat:a},s.data.id)}function S5({id:e,version:t,spec:n,search:r,onSearch:i,agentAvailable:a,openChat:s}){let[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(!1),f=(0,V.useRef)(null),p=(0,V.useId)(),m=_5(tt().id),h=v5(f),[g,_]=(0,V.useState)(()=>new Set),v=(0,V.useCallback)((e,t)=>_(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r}),[]),b=et(),[x,w]=(0,V.useState)(),{zoom:E,reset:D,resetZoom:O,zoomed:k}=f5(r,i),A=gt(n,r),[j,M]=(0,V.useState)(A.refresh??`30s`),N=r.compare?r.compare===`1`:n.time.compare===`previous_period`,P=r.vars??{},F=i5(`dashboard-${e}`,n,A,P,Le,K8),L=(0,V.useMemo)(()=>Xi(n.variables,P,F.currentData),[n.variables,P,F.currentData]),[R,te]=(0,V.useState)(()=>window.innerWidth);(0,V.useEffect)(()=>{let e=0,t=()=>{window.clearTimeout(e),e=window.setTimeout(()=>te(window.innerWidth),300)};return window.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t),window.clearTimeout(e)}},[]);let ne=(0,V.useMemo)(()=>{let e=Math.max(320,Math.min(R-64,1600));return Object.fromEntries(n.panels.map(t=>[t.id,e/12*(t.grid?.w??t.width??6)]))},[R,n]),[re,ie]=(0,V.useState)(()=>n.panels.map(e=>e.id)),z=t5({dashboardId:e,version:t,spec:n,time:A,vars:L,compare:N,widths:ne,visible:(0,V.useMemo)(()=>re.filter(e=>n.panels.some(t=>t.id===e)),[re,n.panels]),refresh:g.size?`off`:j,enabled:F.ready});(0,V.useEffect)(()=>{x===t&&b.refetchQueries({predicate:a5(e),type:`active`,stale:!0},{cancelRefetch:!1})},[x,t,e,b]);let ae=(0,V.useMemo)(()=>z.annotations?{...z.annotations,deploys:n.annotations?.deploys===!1?[]:z.annotations.deploys,anomalies:n.annotations?.anomalies===!1?[]:z.annotations.anomalies}:void 0,[z.annotations,n.annotations?.deploys,n.annotations?.anomalies]),B=F.error??z.error,oe=(e,t)=>{let n={...P};t===void 0?delete n[e]:n[e]=t,i({...r,vars:n},!0)},se=()=>i({...r,edit:r.edit===`1`?void 0:`1`}),ce=e=>{e&&h.remember(e),i({...r,view:e},e===void 0)};return h5(f,{r:()=>z.refetch(),e:se,h:()=>l(!0),"?":()=>d(!0),f:e=>{if(r.view){ce();return}let t=e.closest(`[data-panel]`)?.dataset.panel;t&&n.panels.some(e=>e.id===t)&&ce(t)}},{modalOpen:c||u||!!r.drill,fullscreenScope:r.view?p:void 0,enabled:m.enabled}),(0,H.jsxs)(o,{component:`main`,ref:f,"aria-label":`Dashboard`,maw:1600,mx:`auto`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,children:[(0,H.jsxs)(S,{gap:`sm`,mb:`md`,children:[(0,H.jsxs)(y,{justify:`space-between`,align:`flex-start`,wrap:`wrap`,gap:`sm`,children:[(0,H.jsxs)(o,{miw:0,children:[(0,H.jsx)(I,{order:1,fz:28,lts:`-0.02em`,children:n.name}),n.description&&(0,H.jsx)(T,{c:`dimmed`,size:`sm`,mt:2,children:n.description})]}),(0,H.jsx)(G8,{selecting:g.size>0,time:A,refresh:j,compare:N,editing:r.edit===`1`,fetching:z.fetching,updatedAt:z.updatedAt,onRange:e=>{D(),i({...r,range:e,from:void 0,to:void 0})},onAbsolute:(e,t)=>{D(),i({...r,range:void 0,from:e,to:t})},onZoomOut:()=>{if(A.from&&A.to){let e=Date.parse(A.from),t=Date.parse(A.to),n=(t-e)/2;i({...r,range:void 0,from:new Date(e-n).toISOString(),to:new Date(t+n).toISOString()})}else i({...r,range:b5[A.range??`1h`]??`1h`,from:void 0,to:void 0})},onRefresh:M,onRefreshNow:z.refetch,onCompare:e=>i({...r,compare:e?`1`:`0`},!0),onEdit:se,onHistory:()=>l(!0),onShortcuts:()=>d(!0)})]}),(0,H.jsx)(p5,{variables:n.variables??[],vars:P,options:F.data??{},onChange:oe}),Object.entries(P).filter(([,e])=>e!==`$__all`).length>0&&(0,H.jsx)(y,{gap:6,children:Object.entries(P).filter(([,e])=>e!==`$__all`).map(([e,t])=>(0,H.jsxs)(C,{size:`compact-xs`,variant:`light`,"aria-label":`$${e} = ${Array.isArray(t)?t.join(`, `):t} ×: remove filter`,onClick:()=>oe(e,void 0),children:[`$`,e,` = `,Array.isArray(t)?t.join(`, `):t,` ×`]},e))}),z.annotationError&&(0,H.jsx)(ee,{color:`warn`,title:`Annotations unavailable`,children:z.annotationError}),z.annotations?.truncated&&(0,H.jsx)(T,{size:`xs`,c:`warn`,role:`status`,children:`Annotation history is limited.`})]}),B&&(0,H.jsxs)(ee,{color:`bad`,icon:(0,H.jsx)(ke,{size:18,weight:`fill`}),mb:`md`,title:F.error?`Variables could not be loaded`:`Panels could not be loaded`,children:[B.message,B instanceof Me&&(0,H.jsx)(`ul`,{children:B.problems.map((e,t)=>(0,H.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))})]}),(0,H.jsx)(N8,{dashboardId:e,version:t,spec:n,vars:L,results:z.results,annotations:ae,fetching:z.fetching,fetchingIds:z.fetchingIds,staleAt:z.staleAt,time:{...A,compare:N?`previous_period`:void 0},onEditExit:()=>i({...r,edit:void 0}),editing:r.edit===`1`,view:r.view,canManage:!0,agentAvailable:a,onOpenChat:s,onRetry:z.retry,onVariable:oe,onZoom:E,zoomed:k,onZoomReset:O,onView:ce,onRangePending:v,shortcutScope:p,onShortcuts:()=>d(!0),overlayOpen:c||u||!!r.drill,returnViewFocus:h.restore,onVisible:ie,onPoint:(e,t)=>{let n=S8(e,z.results.get(e.id),t,P);n&&i({...r,vars:n.vars,drill:JSON.stringify(n.target)},!1)}}),(0,H.jsx)(H8,{client:y5,spec:n,time:A,vars:L,target:Mt(r.drill),onChange:e=>i({...r,drill:e?JSON.stringify(e):void 0},!1)}),(0,H.jsx)(o5,{id:e,currentVersion:t,opened:c,onClose:()=>l(!1),onRestored:e=>{w(e.version);let t=new Set(e.spec.panels.map(e=>e.id)),n=Mt(r.drill),a=r.view&&!t.has(r.view)?void 0:r.view,o=n&&!t.has(n.panel_id)?void 0:r.drill;(a!==r.view||o!==r.drill)&&i({...r,view:a,drill:o},!0)}}),(0,H.jsx)(g5,{opened:u,onClose:()=>d(!1),fullscreen:!!r.view,enabled:m.enabled,onEnabled:m.change})]})}export{Yi as i,W4 as n,V4 as r,x5 as t}; \ No newline at end of file +`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&se(e.body,`react-draggable-transparent-selection`)}function B(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{oe(e)}):oe(e)}function oe(e){if(e)try{e.body&&ce(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function se(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function ce(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function le(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:ge(r);let i=_e(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+S(s.paddingLeft)+S(o.marginLeft),top:-i.offsetTop+S(s.paddingTop)+S(o.marginTop),right:L(a)-F(i)-i.offsetLeft+S(s.paddingRight)-S(o.marginRight),bottom:I(a)-P(i)-i.offsetTop+S(s.paddingBottom)-S(o.marginBottom)}}return x(r.right)&&(t=Math.min(t,r.right)),x(r.bottom)&&(n=Math.min(n,r.bottom)),x(r.left)&&(t=Math.max(t,r.left)),x(r.top)&&(n=Math.max(n,r.top)),[t,n]}function ue(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function de(e){return e.props.axis===`both`||e.props.axis===`x`}function fe(e){return e.props.axis===`both`||e.props.axis===`y`}function pe(e,t,n){let r=typeof t==`number`?re(e,t):null;if(typeof t==`number`&&!r)return null;let i=_e(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return ee(r||e,a,n.props.scale)}function me(e,t,n){let r=!x(e.lastX),i=_e(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function he(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function ge(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function _e(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var ve=d(t()),ye=d(e6()),be=d(b()),xe=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},Se={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},Ce=Se.mouse,we=class extends ve.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(` not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!j(e.target,this.props.handle,t)||this.props.cancel&&j(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=ie(e);this.touchIdentifier=r;let i=pe(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=me(this,a,o);xe(`DraggableCore: handleDragStart: %j`,s),xe(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&ae(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,M(n,Ce.move,this.handleDrag),M(n,Ce.stop,this.handleDragStop))},this.handleDrag=e=>{let t=pe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=ue(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=me(this,n,r);if(xe(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=pe(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=ue(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=me(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&B(a.ownerDocument),xe(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(xe(`DraggableCore: Removing handlers`),N(a.ownerDocument,Ce.move,this.handleDrag),N(a.ownerDocument,Ce.stop,this.handleDragStop))},this.onMouseDown=e=>(Ce=Se.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Ce=Se.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Ce=Se.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Ce=Se.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&M(e,Se.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;N(t,Se.mouse.move,this.handleDrag),N(t,Se.touch.move,this.handleDrag),N(t,Se.mouse.stop,this.handleDragStop),N(t,Se.touch.stop,this.handleDragStop),N(e,Se.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&B(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=be.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(xe(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return ve.cloneElement(ve.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};we.displayName=`DraggableCore`,we.propTypes={allowAnyClick:ye.default.bool,allowMobileScroll:ye.default.bool,children:ye.default.node.isRequired,disabled:ye.default.bool,enableUserSelectHack:ye.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:ye.default.arrayOf(ye.default.number),handle:ye.default.string,cancel:ye.default.string,nodeRef:ye.default.object,nonce:ye.default.string,onStart:ye.default.func,onDrag:ye.default.func,onStop:ye.default.func,onMouseDown:ye.default.func,scale:ye.default.number,className:C,style:C,transform:C},we.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var Te=class extends m.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(xe(`Draggable: onDragStart: %j`,t),this.props.onStart(e,he(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;xe(`Draggable: onDrag: %j`,t);let n=he(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=le(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,he(this,t))===!1)return!1;xe(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(xe(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=g.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,h=s||r,g={x:de(this)&&p?this.state.x:h.x,y:fe(this)&&p?this.state.y:h.y};this.state.isElementSVG?f=te(g,c):d=R(g,c);let v=m.Children.only(n),y=(0,_.clsx)(v.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return m.createElement(we,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},m.cloneElement(v,{className:y,style:{...v.props.style,...d},transform:f}))}};Te.displayName=`Draggable`,Te.propTypes={...we.propTypes,axis:h.default.oneOf([`both`,`x`,`y`,`none`]),bounds:h.default.oneOfType([h.default.shape({left:h.default.number,right:h.default.number,top:h.default.number,bottom:h.default.number}),h.default.string,h.default.oneOf([!1])]),defaultClassName:h.default.string,defaultClassNameDragging:h.default.string,defaultClassNameDragged:h.default.string,defaultPosition:h.default.shape({x:h.default.number,y:h.default.number}),positionOffset:h.default.shape({x:h.default.oneOfType([h.default.number,h.default.string]),y:h.default.oneOfType([h.default.number,h.default.string])}),position:h.default.shape({x:h.default.number,y:h.default.number}),className:C,style:C,transform:C},Te.defaultProps={...we.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1},0&&(n.exports={DraggableCore:we})})),Y6=e(((e,t)=>{var n=J6(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),X6=e((e=>{e.__esModule=!0,e.cloneElement=l;var n=r(t());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t{e.__esModule=!0,e.resizableProps=void 0;var t=n(e6());Y6();function n(e){return e&&e.__esModule?e:{default:e}}e.resizableProps={axis:t.default.oneOf([`both`,`x`,`y`,`none`]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:typeof Element<`u`?t.default.instanceOf(Element):t.default.any,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`y`?t.default.number.isRequired(...e):t.default.number(...e)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf([`s`,`w`,`e`,`n`,`sw`,`nw`,`se`,`ne`])),transformScale:t.default.number,width:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`x`?t.default.number.isRequired(...e):t.default.number(...e)}}})),Q6=e((e=>{e.__esModule=!0,e.default=void 0;var n=s(t()),r=Y6(),i=X6(),a=Z6(),o=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function s(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;tMath.abs(i*n)?t=e/n:e=t*n}let o=e,s=t,c=this.slack||[0,0],l=c[0],u=c[1];return e+=l,t+=u,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),i&&(e=Math.min(i[0],e),t=Math.min(i[1],t)),this.slack=[l+(o-e),u+(s-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let i=r.node,a=r.deltaX,o=r.deltaY;e===`onResizeStart`&&this.resetData();let s=(this.props.axis===`both`||this.props.axis===`x`)&&t!==`n`&&t!==`s`,c=(this.props.axis===`both`||this.props.axis===`y`)&&t!==`e`&&t!==`w`;if(!s&&!c)return;let l=t[0],u=t[t.length-1],d=i.getBoundingClientRect();if(this.lastHandleRect!=null){if(u===`w`){let e=d.left-this.lastHandleRect.left;a+=e}if(l===`n`){let e=d.top-this.lastHandleRect.top;o+=e}}this.lastHandleRect=d,u===`w`&&(a=-a),l===`n`&&(o=-o);let f=this.lastSize?.width??this.props.width,p=this.lastSize?.height??this.props.height,m=f+(s?a/this.props.transformScale:0),h=p+(c?o/this.props.transformScale:0);var g=this.runConstraints(m,h);if(m=g[0],h=g[1],e===`onResizeStop`&&this.lastSize){var _=this.lastSize;m=_.width,h=_.height}let v=m!==f||h!==p;e!==`onResizeStop`&&(this.lastSize={width:m,height:h});let y=typeof this.props[e]==`function`?this.props[e]:null;y&&(e!==`onResize`||v)&&(n.persist==null||n.persist(),y(n,{node:i,size:{width:m,height:h},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,t){let r=this.props.handle;if(!r)return n.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-`+e,ref:t});if(typeof r==`function`)return r(e,t);let i=typeof r.type==`string`,a=d({ref:t},i?{}:{handleAxis:e});return n.cloneElement(r,a)}render(){let e=this.props,t=e.children,a=e.className,s=e.draggableOpts;e.width,e.height,e.handle,e.handleSize,e.lockAspectRatio,e.axis,e.minConstraints,e.maxConstraints,e.onResize,e.onResizeStop,e.onResizeStart;let u=e.resizeHandles;e.transformScale;let f=l(e,o);return(0,i.cloneElement)(t,d(d({},f),{},{className:(a?a+` `:``)+`react-resizable`,children:[...n.Children.toArray(t.props.children),...u.map(e=>{let t=this.handleRefs[e]??(this.handleRefs[e]=n.createRef());return n.createElement(r.DraggableCore,c({},s,{nodeRef:t,key:`resizableHandle-`+e,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,t))})]}))}};e.default=h,h.propTypes=a.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),$6=e((e=>{e.__esModule=!0,e.default=void 0;var n=c(t()),r=s(e6()),i=s(Q6()),a=Z6(),o=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(c=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let n=t.size;this.props.onResize?(e.persist==null||e.persist(),this.setState(n,()=>this.props.onResize&&this.props.onResize(e,t))):this.setState(n)}}static getDerivedStateFromProps(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null}render(){let e=this.props,t=e.handle,r=e.handleSize;e.onResize;let a=e.onResizeStart,s=e.onResizeStop,c=e.draggableOpts,u=e.minConstraints,f=e.maxConstraints,p=e.lockAspectRatio,m=e.axis;e.width,e.height;let g=e.resizeHandles,_=e.style,v=e.transformScale,y=h(e,o);return n.createElement(i.default,{axis:m,draggableOpts:c,handle:t,handleSize:r,height:this.state.height,lockAspectRatio:p,maxConstraints:f,minConstraints:u,onResizeStart:a,onResize:this.onResize,onResizeStop:s,resizeHandles:g,transformScale:v,width:this.state.width},n.createElement(`div`,l({},y,{style:d(d({},_),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=d(d({},a.resizableProps),{},{children:r.default.element})})),e8=e(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=Q6().default,t.exports.ResizableBox=$6().default}))(),t8=Z3(),n8=50,r8=12;function i8(e){let t=e;for(;t;){let e=window.getComputedStyle(t).overflowY;if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function a8(e){let t=i8(e),n=null,r=0,i=0,a=!1;function o(){let e=t;if(!e)return;let s=e.getBoundingClientRect(),{clientHeight:c,scrollTop:l,scrollHeight:u}=e,{scrollLeft:d,scrollWidth:f,clientWidth:p}=e,m=0,h=0;i0?m=-r8:i>s.bottom-n8&&l+c0?h=-r8:r>s.right-n8&&d+p({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),ye=(0,V.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),be=(0,V.useCallback)(e=>({...ye,containerHeight:e??ye.containerHeight,layout:de.current}),[ye]),xe=(0,V.useMemo)(()=>I??{i:M,x:w,y:T,w:E,h:D,minW:O,maxW:k,minH:A,maxH:j},[I,M,w,T,E,D,O,k,A,j]),Se=(0,V.useCallback)(e=>{if(g?.calcStyle)return g.calcStyle(e);if(p)return v3(e);let t=y3(e);return m?{...t,left:b3(e.left/r),width:b3(e.width/r)}:t},[g,p,m,r]),Ce=(0,V.useCallback)((e,{node:t})=>{if(!ee)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/h,o=r.left/h,s=i.top/h,c=r.top/h,l;if(g?.calcDragPosition){let t=e;l=g.calcDragPosition(t.clientX,t.clientY,t.clientX-i.left,t.clientY-i.top)}else l={left:a-o+n.scrollLeft,top:s-c+n.scrollTop};if(ce.current=l,_e.current||=a8(t instanceof HTMLElement?t:null),v>0){let t=e;he.current={x:t.clientX,y:t.clientY},me.current=!0,ge.current=!1,ae(!0);return}ae(!0);let u=Y4(ve,l.top,l.left),{x:d,y:f}=g3(F,xe,u.x,u.y,be());ee(M,d,f,{e,node:t,newPosition:l})},[ee,h,ve,g,v,F,xe,be,M]),we=(0,V.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!R||!z)return;let s=e;if(me.current&&!ge.current){let n=s.clientX-he.current.x,r=s.clientY-he.current.y;if(Math.hypot(n,r){if(!te||!z)return;_e.current?.stop(),_e.current=null;let n=me.current;if(me.current=!1,ge.current=!1,he.current={x:0,y:0},n){ae(!1),ce.current={left:0,top:0};return}let{left:r,top:i}=ce.current,a={top:i,left:r};ae(!1),ce.current={left:0,top:0};let o=Y4(ve,i,r),{x:s,y:c}=g3(F,xe,o.x,o.y,be());te(M,s,c,{e,node:t,newPosition:a})},[te,z,ve,F,xe,be,M]);fe.current=Ce,pe.current=we;let Ee=(0,V.useCallback)((e,{node:t,size:n,handle:i},a,o)=>{let s=o===`onResizeStart`?ne:o===`onResize`?re:ie;if(!s)return;let c;c=t?A3(i,a,n,r):{...n,top:a.top,left:a.left},le.current=c;let l=t?.offsetParent?.clientHeight??0,u=X4(ve,c.width,c.height),{w:d,h:f}=_3(F,xe,u.w,u.h,i,be(l));s(M,d,f,{e:e.nativeEvent??e,node:t,size:c,handle:i})},[ne,re,ie,r,ve,M,F,xe,be]),De=(0,V.useCallback)((e,t)=>{oe(!0);let n=q4(ve,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResizeStart`)},[Ee,ve,w,T,E,D]),Oe=(0,V.useCallback)((e,t)=>{let n=q4(ve,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResize`)},[Ee,ve,w,T,E,D]),ke=(0,V.useCallback)((e,t)=>{oe(!1),le.current={top:0,left:0,width:0,height:0};let n=q4(ve,w,T,E,D),r={...t,handle:t.handle};Ee(e,r,n,`onResizeStop`)},[Ee,ve,w,T,E,D]);(0,V.useEffect)(()=>{if(!y)return;let e=se.current;if(!e)return;let t=ue.current||{left:0,top:0},n=z&&(y.left!==t.left||y.top!==t.top);if(!z){let t={node:e,deltaX:y.left,deltaY:y.top,lastX:0,lastY:0,x:y.left,y:y.top};fe.current?.(y.e,t)}else if(n){let t={node:e,deltaX:y.left-ce.current.left,deltaY:y.top-ce.current.top,lastX:ce.current.left,lastY:ce.current.top,x:y.left,y:y.top};pe.current?.(y.e,t)}ue.current=y},[y,z,M]);let Ae=q4(ve,w,T,E,D,z?ce.current:null,B?le.current:null),je=V.Children.only(t),Me=G4(ve),Ne=[K4(O,Me,i[0]),K4(A,o,i[1])],Pe=[K4(k,Me,i[0]),K4(j,o,i[1])],Fe=je.props,Ie=Fe.className,Le=Fe.style,Re=V.cloneElement(je,{ref:se,className:_(`react-grid-item`,Ie,b,{static:f,resizing:B,"react-draggable":c,"react-draggable-dragging":z,dropping:!!y,cssTransforms:p}),style:{...x,...Le,...Se(Ae)}}),ze=P;return Re=(0,H.jsx)(e8.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:Ae.width,height:Ae.height,minConstraints:Ne,maxConstraints:Pe,onResizeStart:De,onResize:Oe,onResizeStop:ke,transformScale:h,resizeHandles:N,handle:ze,children:Re}),Re=(0,H.jsx)(G6,{disabled:!c,onStart:Ce,onDrag:we,onStop:Te,handle:S,cancel:`.react-resizable-handle`+(C?`,`+C:``),scale:h,allowMobileScroll:d,nodeRef:se,children:Re}),Re}var s8=V.memo(o8,(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h&&e.minW===t.minW&&e.maxW===t.maxW&&e.minH===t.minH&&e.maxH===t.maxH&&e.cols===t.cols&&e.containerWidth===t.containerWidth&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.margin===t.margin&&e.containerPadding===t.containerPadding&&e.transformScale===t.transformScale&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.isBounded===t.isBounded&&e.allowMobileScroll===t.allowMobileScroll&&e.useCSSTransforms===t.useCSSTransforms&&e.usePercentages===t.usePercentages&&e.children===t.children&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.droppingPosition===t.droppingPosition);s8.displayName=`GridItem`;function c8(e){let{clientX:t,clientY:n,gridElement:r,droppingItem:i,event:a,dragOffsetX:o=0,dragOffsetY:s=0,transformScale:c,cols:l,margin:u,maxRows:d,rowHeight:f,width:p,containerPadding:m}=e,h=r.getBoundingClientRect(),g={cols:l,margin:u,maxRows:d,rowHeight:f,containerWidth:p,containerPadding:m},_=G4(g),v=K4(i.w,_,u[0]),y=K4(i.h,f,u[1]),b=v/2,x=y/2,S=r.scrollLeft??0,C=r.scrollTop??0,w=t-h.left+S+o-b,T=n-h.top+C+s-x,E=Math.max(0,w),D=Math.max(0,T);return{newDroppingPosition:{left:E/c,top:D/c,e:a},calculatedXY:J4(g,D,E,i.w,i.h)}}var l8=()=>{},u8=`react-grid-layout`,d8=!1;try{d8=/firefox/i.test(navigator.userAgent)}catch{}function f8(e,t){let n=V.Children.toArray(e),r=V.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e{if(!V.isValidElement(t)||t.key===null)return;let n=String(t.key);a.add(n);let r=e.find(e=>e.i===n);if(r)i.push(s3(r));else{let e=t.props[`data-grid`];e?i.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):i.push({i:n,x:0,y:i3(i),w:1,h:1})}});let o=d3(i,{cols:n});return r.compact(o,n)}function m8(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=j3,compactor:c,constraints:l=h3,layout:u=[],droppingItem:d,autoSize:f=!0,className:p=``,style:m={},innerRef:h,onLayoutChange:g=l8,onDragStart:v=l8,onDrag:y=l8,onDragStop:b=l8,onResizeStart:x=l8,onResize:S=l8,onResizeStop:C=l8,onDrop:w=l8,onDropDragOver:T=l8}=e,E=(0,V.useMemo)(()=>({...M3,...r}),[r]),D=(0,V.useMemo)(()=>({...N3,...i}),[i]),O=(0,V.useMemo)(()=>({...P3,...a}),[a]),k=(0,V.useMemo)(()=>({...F3,...o}),[o]),{cols:A,rowHeight:j,maxRows:M,margin:N,containerPadding:P}=E,{enabled:F,bounded:I,handle:L,cancel:ee,threshold:R,allowMobileScroll:te}=D,{enabled:ne,handles:re,handleComponent:ie}=O,{enabled:z,defaultItem:ae,onDragOver:B,touchEnabled:oe=!0,touchDragSource:se=`[data-rgl-draggable]`}=k,ce=c??G3(`vertical`),le=ce.type,ue=ce.allowOverlap,de=ce.preventCollision??!1,fe=(0,V.useMemo)(()=>d??{i:`__dropping-elem__`,...ae},[d,ae]),pe=s.type===`transform`,me=s.scale,he=P??N,[ge,_e]=(0,V.useState)(!1),[ve,ye]=(0,V.useState)(()=>p8(u,t,A,ce)),[be,xe]=(0,V.useState)(null),[Se,Ce]=(0,V.useState)(!1),[we,Te]=(0,V.useState)(null),[Ee,De]=(0,V.useState)(),Oe=(0,V.useRef)(void 0);Oe.current=Ee;let ke=(0,V.useRef)(null),Ae=(0,V.useRef)(null),je=(0,V.useRef)(null),Me=(0,V.useRef)(0),Ne=(0,V.useRef)(ve),Pe=(0,V.useRef)(u),Fe=(0,V.useRef)(t),Ie=(0,V.useRef)(le),Le=(0,V.useRef)(null),Re=(0,V.useRef)(!1),ze=(0,V.useRef)(null),Be=(0,V.useRef)(null);Be.current=we;let Ve=(0,V.useRef)(w);(0,V.useLayoutEffect)(()=>{Ve.current=w});let He=(0,V.useRef)(ve);He.current=ve,(0,V.useEffect)(()=>{_e(!0),(0,t8.deepEqual)(ve,u)||g(ve)},[]),(0,V.useEffect)(()=>{if(be||we)return;let e=!(0,t8.deepEqual)(u,Pe.current),n=!f8(t,Fe.current),r=le!==Ie.current;if(e||n||r){let n=p8(e?u:ve,t,A,ce);(0,t8.deepEqual)(n,ve)||ye(n)}Pe.current=u,Fe.current=t,Ie.current=le},[u,t,A,le,ce,be,we,ve]),(0,V.useEffect)(()=>{if(!be&&!we&&!(0,t8.deepEqual)(ve,Ne.current)){Ne.current=ve;let e=ve.filter(e=>e.i!==fe.i);g(e)}},[ve,be,we,g,fe.i]);let Ue=(0,V.useMemo)(()=>{if(!f)return;let e=i3(ve),t=he[1];return e*j+(e-1)*N[1]+t*2+`px`},[f,ve,j,N,he]),We=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=a3(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};ke.current=s3(a),je.current=i,xe(o),v(i,a,a,null,r.e,r.node)},[v]),Ge=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=ke.current,o=a3(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=f3(i,o,t,n,!0,de,le,A,ue);y(c,a,o,s,r.e,r.node),ye(ce.compact(c,A)),xe(s)},[de,le,A,ue,ce,y]),Ke=(0,V.useCallback)((e,t,n,r)=>{if(!ke.current)return;let i=He.current,a=ke.current,o=a3(i,e);if(!o)return;let s=f3(i,o,t,n,!0,de,le,A,ue),c=ce.compact(s,A);b(c,a,o,null,r.e,r.node);let l=je.current;ke.current=null,je.current=null,xe(null),ye(c),l&&!(0,t8.deepEqual)(l,c)&&g(c)},[de,le,A,ue,ce,b,g]),qe=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=a3(i,e);a&&(Ae.current=s3(a),je.current=i,Ce(!0),x(i,a,a,null,r.e,r.node))},[x]),Je=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=Ae.current,{handle:o}=r,s=!1,c,l,[u,d]=u3(i,e,e=>(c=e.x,l=e.y,[`sw`,`w`,`nw`,`n`,`ne`].includes(o)&&([`sw`,`nw`,`w`].includes(o)&&(c=e.x+(e.w-t),t=e.x!==c&&c<0?e.w:t,c=c<0?0:c),[`ne`,`n`,`nw`].includes(o)&&(l=e.y+(e.h-n),n=e.y!==l&&l<0?e.h:n,l=l<0?0:l),s=!0),de&&!ue&&e3(i,{...e,w:t,h:n,x:c??e.x,y:l??e.y}).filter(t=>t.i!==e.i).length>0&&(l=e.y,n=e.h,c=e.x,t=e.w,s=!1),e.w=t,e.h=n,(o===`n`||o===`nw`||o===`ne`)&&(e.y=l??e.y),e));if(!d)return;let f=u;s&&c!==void 0&&l!==void 0&&(f=f3(u,d,c,l,!0,de,le,A,ue));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};S(f,a,d,p,r.e,r.node);let m=ce.compact(f,A);if(o===`n`||o===`nw`||o===`ne`){let t=m.find(t=>t.i===e);t&&(t.y=d.y)}ye(m),xe(p)},[de,le,A,ue,ce,S]),Ye=(0,V.useCallback)((e,t,n,r)=>{let i=He.current,a=Ae.current,o=a3(i,e),s=ce.compact(i,A);C(s,a,o??null,null,r.e,r.node);let c=je.current;Ae.current=null,je.current=null,xe(null),Ce(!1),ye(s),c&&!(0,t8.deepEqual)(c,s)&&g(s)},[A,ce,C,g]),Xe=(0,V.useCallback)((e,t,n,r)=>{if(r)Oe.current&&(Oe.current.left!==t.left||Oe.current.top!==t.top)&&(De(t),ye(t=>t.map(t=>t.i===e.i&&(t.x!==n.x||t.y!==n.y)?{...t,x:n.x,y:n.y}:t)));else{Te((0,H.jsx)(`div`,{},e.i)),De(t);let r=He.current.filter(t=>t.i!==e.i);ye([...r,{...e,x:n.x,y:n.y,static:!1,isDraggable:!0}])}},[]),Ze=(0,V.useCallback)((e,t,r)=>{let i=Le.current;if(!i)return;let{newDroppingPosition:a,calculatedXY:o}=c8({clientX:e,clientY:t,gridElement:i,droppingItem:fe,event:r,transformScale:me,cols:A,margin:N,maxRows:M,rowHeight:j,width:n,containerPadding:he});Xe(fe,a,o,!!Be.current)},[fe,me,A,N,M,j,n,he,Xe]),Qe=(0,V.useCallback)(()=>{let e=He.current;if(!e.some(e=>e.i===fe.i)){Te(null),xe(null),De(void 0);return}let t=ce.compact(e.filter(e=>e.i!==fe.i),A);ye(t),Te(null),xe(null),De(void 0)},[fe.i,A,ce]),$e=(0,V.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),d8&&!e.nativeEvent.target?.classList.contains(u8))return!1;let t=B?B(e.nativeEvent):T(e);if(t===!1)return we&&Qe(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...fe,...a},{newDroppingPosition:s,calculatedXY:c}=c8({clientX:e.clientX,clientY:e.clientY,gridElement:e.currentTarget,droppingItem:o,event:e.nativeEvent,dragOffsetX:r,dragOffsetY:i,transformScale:me,cols:A,margin:N,maxRows:M,rowHeight:j,width:n,containerPadding:he});Xe(o,s,c,!!we)},[we,fe,B,T,Qe,Xe,me,A,N,M,j,n,he]),et=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current--,Me.current<0&&(Me.current=0),Me.current===0&&Qe()},[Qe]),tt=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current++},[]),nt=(0,V.useCallback)(e=>{let t=He.current,n=t.find(e=>e.i===fe.i);Qe(),Ve.current(t,n,e)},[fe.i,Qe]),rt=(0,V.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Me.current=0,nt(e.nativeEvent)},[nt]);(0,V.useEffect)(()=>{if(!z||!oe)return;let e=Le.current;if(!e)return;let t=(t,n)=>{let r=document.elementFromPoint(t,n);return r?e.contains(r):!1},n=e=>e instanceof HTMLElement&&e.closest(se)!==null,r=e=>{let t=e.changedTouches;if(!t||t.length===0)return;let n=ze.current;if(n===null)return t[0];for(let e=0;e{if(!n(e.target)||ze.current!==null)return;e.preventDefault();let t=e.changedTouches?.[0];t&&(ze.current=t.identifier,Re.current=!0)},a=e=>{if(!Re.current)return;e.preventDefault();let n=r(e);if(n){if(!t(n.clientX,n.clientY)){Be.current&&Qe();return}Ze(n.clientX,n.clientY,e)}},o=e=>{if(!Re.current)return;e.preventDefault();let n=r(e);if(Re.current=!1,ze.current=null,n){if(!t(n.clientX,n.clientY)){Qe();return}nt(e)}},s=()=>{Re.current&&(Re.current=!1,ze.current=null,Qe())},c={passive:!1};return document.addEventListener(`touchstart`,i,c),document.addEventListener(`touchmove`,a,c),document.addEventListener(`touchend`,o,c),document.addEventListener(`touchcancel`,s,c),()=>{document.removeEventListener(`touchstart`,i,c),document.removeEventListener(`touchmove`,a,c),document.removeEventListener(`touchend`,o,c),document.removeEventListener(`touchcancel`,s,c)}},[z,oe,se,Ze,Qe,nt,fe.i]);let it=(0,V.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=a3(ve,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&F,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&ne,o=r.resizeHandles||[...re],c=i&&I&&r.isBounded!==!1,u=ie;return(0,H.jsx)(s8,{containerWidth:n,cols:A,margin:N,containerPadding:he,maxRows:M,rowHeight:j,cancel:ee,handle:L,onDragStart:We,onDrag:Ge,onDragStop:Ke,onResizeStart:qe,onResize:Je,onResizeStop:Ye,isDraggable:i,isResizable:a,isBounded:c,allowMobileScroll:te,useCSSTransforms:pe&&ge,usePercentages:!ge,transformScale:me,positionStrategy:s,dragThreshold:R,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:t?Ee:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:ve,children:e},r.i)},[ve,n,A,N,he,M,j,ee,L,We,Ge,Ke,qe,Je,Ye,F,ne,I,pe,ge,me,s,R,Ee,re,ie,l]),at=()=>be?(0,H.jsx)(s8,{w:be.w,h:be.h,x:be.x,y:be.y,i:be.i,className:`react-grid-placeholder ${Se?`placeholder-resizing`:``}`,containerWidth:n,cols:A,margin:N,containerPadding:he,maxRows:M,rowHeight:j,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:pe,transformScale:me,constraints:l,layout:ve,children:(0,H.jsx)(`div`,{})}):null,ot=(0,V.useCallback)(e=>{Le.current=e,typeof h==`function`?h(e):h&&`current`in h&&(h.current=e)},[h]),st=_(u8,p),ct={height:Ue,...m};return(0,H.jsxs)(`div`,{ref:ot,className:st,style:ct,onDrop:z?rt:void 0,onDragLeave:z?et:void 0,onDragEnter:z?tt:void 0,onDragOver:z?$e:void 0,children:[V.Children.map(t,e=>V.isValidElement(e)?it(e):null),z&&we&&it(we,!0),at()]})}var h8={lg:1200,md:996,sm:768,xs:480,xxs:0},g8={lg:12,md:10,sm:6,xs:4,xxs:2},_8=()=>{};function v8(e,t,n,r,i=!1){let a=[];V.Children.forEach(t,t=>{if(!V.isValidElement(t)||t.key===null)return;let n=String(t.key),r=t.props[`data-grid`],o=e.find(e=>e.i===n);o?i&&r?a.push({...o,i:n,w:r.w??o.w,h:r.h??o.h,minW:r.minW??o.minW,maxW:r.maxW??o.maxW,minH:r.minH??o.minH,maxH:r.maxH??o.maxH}):a.push({...o,i:n}):r?a.push({i:n,x:r.x??0,y:r.y??0,w:r.w??1,h:r.h??1,minW:r.minW,maxW:r.maxW,minH:r.minH,maxH:r.maxH,static:r.static,isDraggable:r.isDraggable,isResizable:r.isResizable,resizeHandles:r.resizeHandles,isBounded:r.isBounded}):a.push({i:n,x:0,y:i3(a),w:1,h:1})});let o=d3(a,{cols:n});return r.compact(o,n)}function y8(e){let{children:t,width:n,breakpoint:r,breakpoints:i=h8,cols:a=g8,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=_8,onLayoutChange:p=_8,onWidthChange:m=_8,...h}=e,g=d??G3(`vertical`),_=g.type,v=g.allowOverlap,y=(0,V.useMemo)(()=>r??q3(i,n),[]),b=(0,V.useMemo)(()=>J3(y,a),[y,a]),x=(0,V.useMemo)(()=>Y3(o,i,y,y,b,_),[]),[S,C]=(0,V.useState)(y),[w,T]=(0,V.useState)(b),[E,D]=(0,V.useState)(x),[O,k]=(0,V.useState)(o),A=(0,V.useRef)(n),j=(0,V.useRef)(r),M=(0,V.useRef)(i),N=(0,V.useRef)(a),P=(0,V.useRef)(o),F=(0,V.useRef)(_),I=(0,V.useRef)(O);(0,V.useEffect)(()=>{I.current=O},[O]);let L=(0,V.useMemo)(()=>(0,t8.deepEqual)(o,P.current)?null:Y3(o,i,S,S,w,g),[o,i,S,w,g]),ee=L??E;(0,V.useEffect)(()=>{L!==null&&(D(L),k(o),I.current=o,P.current=o)},[L,o]),(0,V.useEffect)(()=>{if(_!==F.current){let e=g.compact(c3(ee),w),t={...I.current,[S]:e};D(e),k(t),I.current=t,p(e,t),F.current=_}},[_,g,ee,w,v,S,p]),(0,V.useEffect)(()=>{let e=n!==A.current,o=r!==j.current,s=!(0,t8.deepEqual)(i,M.current),c=!(0,t8.deepEqual)(a,N.current);if(e||o||s||c){let e=r??q3(i,n),o=J3(e,a),d=S;if(d!==e||s||c){let n={...I.current};n[d]||(n[d]=c3(E));let r=Y3(n,i,e,d,o,g),a=!n[e];r=v8(r,t,o,g,a),n[e]=r,C(e),T(o),D(r),k(n),I.current=n,f(e,o),p(r,n)}let h=X3(l,e),_=u?X3(u,e):null;m(n,h,o,_),A.current=n,j.current=r,M.current=i,N.current=a}},[n,r,i,a,S,w,E,t,g,_,v,l,u,f,p,m]);let R=(0,V.useCallback)(e=>{let t={...I.current,[S]:e};D(e),k(t),I.current=t,p(e,t)},[S,p]),te=(0,V.useMemo)(()=>X3(l,S),[l,S]),ne=(0,V.useMemo)(()=>u===null?null:X3(u,S),[u,S]),re=(0,V.useMemo)(()=>({cols:w,rowHeight:s,maxRows:c,margin:te,containerPadding:ne}),[w,s,c,te,ne]);return(0,H.jsx)(m8,{...h,width:n,gridConfig:re,compactor:g,onLayoutChange:R,layout:ee,children:t})}var b8=V.forwardRef(function(e,t){let{innerRef:n,...r}=e,i=n??t;return(0,H.jsx)(y8,{...r,innerRef:i})});b8.displayName=`ResponsiveGridLayout`;function x8(e,t,n,r){let i=e=>t?.frame?.columns.some((n,r)=>n.name===e&&t.frame.values[r]?.some(e=>typeof e==`string`&&e!==``));return{onSelect:e.click&&(e.viz===`service_map`||!(e.drill&&r))?t=>n(e.click.set_variable,t):void 0,onPoint:r&&(e.viz===`service_map`||e.click||e.drill||i(`trace_id`)||e.options?.columns?.some(e=>e.format===`trace_link`&&i(e.field)))?r:void 0}}function S8(e,t,n,r){if(!t)return;let i=pt(e,t,n);if(!i)return;let a=Object.values(n.dimensions)[0],o=e.click?.set_variable;return{target:i,vars:o&&a!==void 0?{...r,[o]:a}:r}}function C8(e){return`Explain the panel “${e.title}”`}function w8(e){return`Fix the panel “${e.title}”`}function T8(e){return[{description:`Observed panel diagnostics`,value:JSON.stringify(e)}]}var E8=e=>e*40+(e-1)*12,D8={s:3,m:6,l:10},O8={stat:4},k8=e=>Math.max(O8[e.viz]??0,D8[e.height??(e.viz===`service_map`?`l`:e.viz===`stat`?`s`:`m`)]),A8=(0,V.lazy)(()=>le(()=>import(`./panel-sql-editor-BFXSBGw8.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),j8=0;function M8(e){let t;do t=`p_${Date.now().toString(36)}_${(++j8).toString(36)}_${Math.random().toString(36).slice(2,10)}`;while(e.some(e=>e.id===t));return t}function N8({dashboardId:e,version:t,spec:n,vars:r,results:i,fetching:a,annotations:o,fetchingIds:s=[],staleAt:c=new Map,time:l=n.time,onEditExit:u,editing:d,view:f,agentAvailable:p,canManage:m=!1,onOpenChat:h,onVariable:g,onRetry:_,onPoint:v,onZoom:b,onZoomReset:x,zoomed:S,onView:w,onVisible:E,onRangePending:D,shortcutScope:O,onShortcuts:k,overlayOpen:A,returnViewFocus:j}){let M=et(),[N,P]=(0,V.useState)(),[F,I]=(0,V.useState)(()=>n.panels.map(e=>({i:e.id,x:e.grid?.x??0,y:e.grid?.y??0,w:e.grid?.w??6,h:e.grid?.h??k8(e)})));(0,V.useEffect)(()=>{I(n.panels.map(e=>({i:e.id,x:e.grid?.x??0,y:e.grid?.y??0,w:e.grid?.w??6,h:e.grid?.h??k8(e)})))},[n]);let[L,R]=(0,V.useState)(()=>window.innerHeight),[te,ne]=(0,V.useState)();(0,V.useEffect)(()=>{let e=()=>R(window.innerHeight);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let re=(0,V.useRef)(null),ie=(0,V.useRef)(new Map),z=(0,V.useRef)(null),ae=(0,V.useRef)(null),B=()=>{let e=N?.panel.id;P(void 0),requestAnimationFrame(()=>(ae.current?.isConnected?ae.current:ie.current.get(e??``))?.focus())},se=(0,V.useRef)(f);f&&(se.current=f);let[ce,le]=(0,V.useState)(0),ue=ce>0,de=d&&(ce>=1100?`lg`:ce>=800?`md`:`sm`)==`lg`;(0,V.useLayoutEffect)(()=>{if(!re.current)return;le(Math.max(0,Math.round(re.current.getBoundingClientRect().width)));let e=new ResizeObserver(([e])=>{e&&le(Math.max(0,Math.round(e.contentRect.width)))});return e.observe(re.current),()=>e.disconnect()},[]);let fe=(0,V.useRef)(E);fe.current=E,(0,V.useEffect)(()=>{if(!ue||!re.current||typeof IntersectionObserver>`u`)return;let e=new Set(n.panels.map(e=>e.id)),t=new IntersectionObserver(t=>{for(let n of t){let t=n.target.dataset.panel;t&&(n.isIntersecting?e.add(t):e.delete(t))}f&&n.panels.some(e=>e.id===f)&&e.add(f),fe.current([...e])},{rootMargin:`200px`});return re.current.querySelectorAll(`.react-grid-item[data-panel]`).forEach(e=>t.observe(e)),()=>t.disconnect()},[n,f,ue]);let pe=(0,V.useMemo)(()=>n.panels.some(e=>{let t=F.find(t=>t.i===e.id);return t&&(t.x!==e.grid?.x||t.y!==e.grid?.y||t.w!==e.grid?.w||t.h!==e.grid?.h)}),[F,n]),me=e=>({...n,panels:e.map(e=>{let t=F.find(t=>t.i===e.id);return t?{...e,grid:{x:t.x,y:t.y,w:t.w,h:t.h}}:e})}),he=De({mutationFn:()=>Qe(e,me(n.panels),t,`Edited layout`),onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}}),ge=De({mutationFn:r=>pe?Qe(e,me(n.panels.filter(e=>e.id!==r)),t,`Removed a panel and saved layout`):Ae(e,[{op:`remove_panel`,id:r}],t,`Removed a panel`),onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}}),_e=De({mutationFn:r=>{let i={...r,id:M8(n.panels),title:`${Array.from(r.title).slice(0,73).join(``)} (copy)`,grid:void 0};if(pe){let a=[...n.panels];return a.splice(a.findIndex(e=>e.id===r.id)+1,0,i),Qe(e,me(a),t,`Duplicated a panel and saved layout`)}return Ae(e,[{op:`add_panel`,after:r.id,panel:i}],t,`Duplicated a panel`)},onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}});(0,V.useEffect)(()=>{d||(he.reset(),ge.reset(),_e.reset())},[d]);let ve=()=>{he.reset(),ge.reset(),_e.reset(),u?.(),M.invalidateQueries({queryKey:[`dashboard`,e]})},ye=async e=>{let t=new URL(window.location.href);t.searchParams.set(`view`,e),t.searchParams.delete(`edit`);try{await navigator.clipboard.writeText(t.toString()),ne(`Link copied`)}catch{ne(`Copy this URL: ${t.toString()}`)}},be=`dashboard-${e}`,xe=n=>({dashboard_id:e,version:t,panel_id:n.id,title:Yi(n.title,r),from_ms:i.get(n.id)?.from_ms,to_ms:i.get(n.id)?.to_ms,vars:r,error:i.get(n.id)?.error,status:i.get(n.id)?.status,diagnosis:i.get(n.id)?.diagnosis,stale_since:c.get(n.id),truncated:i.has(n.id)?!!(i.get(n.id)?.frame?.truncated||i.get(n.id)?.previous?.truncated):void 0,note:i.get(n.id)?.frame?.note,spec:{...n,dashboard_time:l}}),Se=(u,d,y=!1)=>(0,H.jsx)(V4,{panel:u,title:Yi(u.title,r),result:i.get(u.id),loading:a&&s.includes(u.id),height:d,group:be,editing:de&&!y,agentAvailable:p,suspended:!y&&u.id===f,menuRef:y?z:e=>{e?ie.current.set(u.id,e):ie.current.delete(u.id)},compare:l.compare===`previous_period`,range:u.time?.range??l.range,annotations:o,vars:r,onVariable:g,...x8(u,i.get(u.id),g,v?e=>v(u,e):void 0),onRangePending:e=>D?.(u.id,e),onZoom:b,zoomed:S,onZoomReset:x,onRetry:_?()=>_(u.id):void 0,onView:()=>w(u.id),onCopyLink:()=>{ye(u.id)},onEditSQL:m&&typeof u.sql==`string`?()=>{ae.current=y?z.current:ie.current.get(u.id)??null,P({panel:u,spec:n,version:t})}:void 0,onExplain:e?()=>h(C8(xe(u)),{answer_only:!0,context:T8(xe(u))}):void 0,onFix:e&&m?()=>h(w8(xe(u)),{context:T8(xe(u))}):void 0,staleAt:c.get(u.id),onDuplicate:de&&!y?()=>_e.mutate(u):void 0,onRemove:de&&!y?()=>ge.mutate(u.id):void 0}),Ce=n.panels.find(e=>e.id===f),we=d?he.error??ge.error??_e.error:null,Te=we instanceof Me&&we.code===`dashboard_version_conflict`,Ee=e=>{de&&I(e.map(({i:e,x:t,y:n,w:r,h:i})=>({i:e,x:t,y:n,w:r,h:i})))};return(0,H.jsxs)(`div`,{ref:re,style:{minWidth:0},children:[d&&(0,H.jsxs)(y,{justify:`space-between`,mb:`sm`,p:`xs`,style:{border:`1px dashed var(--mantine-color-default-border)`,borderRadius:8},children:[(0,H.jsx)(T,{size:`sm`,c:`dimmed`,children:de?`Drag a panel by its title and resize it from the corner. Changes are saved as a new version.`:`The layout can be edited only on a wider screen.`}),(0,H.jsx)(C,{size:`compact-sm`,disabled:!pe||!de,loading:he.isPending,onClick:()=>he.mutate(),children:`Save layout`})]}),Te&&(0,H.jsxs)(ee,{color:`warn`,mb:`sm`,children:[`Someone saved this dashboard since you opened it. Load the latest version, then redo your change. `,(0,H.jsx)(C,{size:`compact-sm`,onClick:ve,children:`Load latest`})]}),we&&!Te&&(0,H.jsx)(ee,{color:`bad`,mb:`sm`,children:we.message}),te&&(0,H.jsx)(ee,{role:`status`,mb:`sm`,children:te}),!ue&&(0,H.jsx)(`div`,{"data-grid-placeholder":!0,style:{height:E8(Math.max(1,...F.map(e=>e.y+e.h)))}}),ue&&(0,H.jsx)(b8,{width:ce,className:`dashboard-grid${de?` dashboard-grid-editing`:``}`,layouts:{lg:F,md:F,sm:F.map(e=>({...e,x:0,w:12}))},breakpoints:{lg:1100,md:800,sm:0},cols:{lg:12,md:12,sm:12},rowHeight:40,margin:[12,12],containerPadding:[0,0],compactor:z3,dragConfig:{enabled:de,handle:`.panel-drag`,cancel:`button`},resizeConfig:{enabled:de},onDragStop:Ee,onResizeStop:Ee,children:n.panels.map(e=>{let t=F.find(t=>t.i===e.id);return(0,H.jsx)(`div`,{"data-panel":e.id,children:Se(e,E8(t?.h??6))},e.id)})}),(0,H.jsx)(B4,{shortcutScope:O,onShortcuts:k,escapeEnabled:!A&&!N,opened:!!f,onClose:()=>w(void 0),title:Ce?Yi(Ce.title,r):`Missing panel`,returnFocusTo:()=>j?.(se.current)??ie.current.get(se.current??``)??ie.current.values().next().value,children:Ce?(0,H.jsx)(`div`,{style:{height:`calc(100vh - 120px)`},children:Se(Ce,Math.max(40,L-140),!0)}):(0,H.jsx)(ee,{color:`warn`,children:`This panel is missing from the dashboard. The shared link may be out of date.`})}),N&&(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(yt,{opened:!0,onClose:B,title:`Loading SQL editor`,children:(0,H.jsx)(oe,{size:`sm`,"aria-label":`Loading SQL editor`})}),children:(0,H.jsx)(A8,{dashboardId:e,version:N.version,spec:N.spec,panel:N.panel,time:l,vars:r,onClose:B})})]})}function P8(e,t=1,n=8){let r=(t-1)*n;return e.slice(r,r+n)}function F8({icon:e,title:t,children:n,tall:r=!1}){return(0,H.jsx)(ie,{mih:r?220:130,p:`xl`,children:(0,H.jsxs)(y,{wrap:`nowrap`,children:[(0,H.jsx)(te,{variant:`light`,size:`xl`,radius:`md`,children:e}),(0,H.jsxs)(o,{children:[(0,H.jsx)(T,{fw:700,size:`sm`,children:t}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,mt:3,children:n})]})]})})}function I8(e,t=8){let[n,r]=(0,V.useState)(1),i=Math.max(1,Math.ceil(e.length/t));(0,V.useEffect)(()=>{n>i&&r(i)},[n,i]);let a=(n-1)*t;return{page:n,setPage:r,totalPages:i,pageItems:P8(e,n,t),from:e.length?a+1:0,to:Math.min(a+t,e.length),total:e.length}}function L8({page:e,totalPages:t,from:n,to:r,total:i,onChange:a}){return t<=1?null:(0,H.jsxs)(y,{justify:`space-between`,mt:`xs`,children:[(0,H.jsxs)(T,{c:`dimmed`,size:`xs`,children:[n,`–`,r,` of `,i]}),(0,H.jsx)(y,{gap:4,children:[{label:`First page`,page:1,disabled:e===1},{label:`Previous page`,page:e-1,disabled:e===1},{label:`Next page`,page:e+1,disabled:e===t},{label:`Last page`,page:t,disabled:e===t}].map(e=>(0,H.jsx)(C,{size:`compact-xs`,variant:`subtle`,"aria-label":e.label,disabled:e.disabled,onClick:()=>a(e.page),children:e.label},e.label))})]})}function R8({spans:e,dark:t,onSpan:n}){let r=Math.min(...e.map(e=>new Date(e.start).valueOf())),i=Math.max(...e.map(e=>new Date(e.start).valueOf()+e.duration_ms)),a=Math.max(i-r,1),s=[...new Set(e.map(e=>e.service))],c=I8(e);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(be.ScrollContainer,{minWidth:680,children:(0,H.jsxs)(be,{highlightOnHover:!!n,verticalSpacing:`sm`,children:[(0,H.jsx)(be.Thead,{children:(0,H.jsxs)(be.Tr,{children:[(0,H.jsx)(be.Th,{w:230,children:`Operation`}),(0,H.jsx)(be.Th,{children:`Timeline`}),(0,H.jsx)(be.Th,{w:90,ta:`right`,children:`Duration`})]})}),(0,H.jsx)(be.Tbody,{children:c.pageItems.map(e=>{let i=(new Date(e.start).valueOf()-r)/a*100,c=Math.max(e.duration_ms/a*100,.6),l=e.status===`STATUS_CODE_ERROR`;return(0,H.jsxs)(be.Tr,{tabIndex:n?0:void 0,onClick:n?()=>n(e):void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))}:void 0,style:{cursor:n?`pointer`:void 0},children:[(0,H.jsx)(be.Td,{children:(0,H.jsxs)(y,{gap:`xs`,wrap:`nowrap`,children:[(0,H.jsx)(o,{w:8,h:8,bg:Ua(s.indexOf(e.service),t),style:{borderRadius:`50%`,flex:`0 0 auto`}}),(0,H.jsxs)(o,{miw:0,children:[(0,H.jsx)(T,{fw:600,size:`sm`,truncate:!0,children:e.operation}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,truncate:!0,children:e.service})]})]})}),(0,H.jsx)(be.Td,{children:(0,H.jsx)(me,{label:`${e.service} · ${e.operation} · ${ye(e.duration_ms)}`,withArrow:!0,children:(0,H.jsx)(o,{pos:`relative`,h:14,bg:`var(--mantine-color-default-hover)`,role:`img`,"aria-label":`${e.operation} on ${e.service} took ${ye(e.duration_ms)}`,style:{borderRadius:`var(--mantine-radius-sm)`},children:(0,H.jsx)(o,{pos:`absolute`,left:`${i}%`,w:`${Math.min(c,100-i)}%`,h:`100%`,bg:l?`bad`:Ua(s.indexOf(e.service),t),style:{borderRadius:`var(--mantine-radius-sm)`,minWidth:3}})})})}),(0,H.jsx)(be.Td,{ta:`right`,children:(0,H.jsx)(T,{size:`sm`,ff:`monospace`,children:ye(e.duration_ms)})})]},e.span_id)})})]})}),(0,H.jsx)(L8,{...c,onChange:c.setPage})]})}function z8({result:e,dark:t,onSpan:n}){let[r,i]=(0,V.useState)(`waterfall`),a=e.data,s=(0,V.useMemo)(()=>({id:`correlated_logs`,status:a.logs.length?`ok`:`empty`,elapsed_ms:0,frame:{columns:[{name:`time`,type:`time`,role:`time`},...[`severity`,`service`,`body`].map(e=>({name:e,type:`string`,role:`dimension`}))],rows:a.logs.length,values:[a.logs.map(e=>Date.parse(e.time)),a.logs.map(e=>e.severity),a.logs.map(e=>e.service),a.logs.map(e=>e.body)]}}),[a.logs]);return(0,H.jsxs)(S,{gap:`sm`,children:[(0,H.jsxs)(y,{children:[(0,H.jsx)(T,{fw:600,children:a.trace_id}),(0,H.jsx)(T,{c:a.has_error?`bad`:`dimmed`,children:a.has_error?`■ Error`:`● OK`})]}),a.spans.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(y,{role:`group`,"aria-label":`Trace view`,children:[(0,H.jsx)(C,{"aria-pressed":r===`waterfall`,variant:r===`waterfall`?`light`:`subtle`,onClick:()=>i(`waterfall`),children:`Waterfall`}),(0,H.jsx)(C,{"aria-pressed":r===`flame`,variant:r===`flame`?`light`:`subtle`,onClick:()=>i(`flame`),children:`Flame graph`})]}),r===`waterfall`?(0,H.jsx)(R8,{spans:a.spans,dark:t,onSpan:n}):(0,H.jsx)(B8,{spans:a.spans,dark:t,onSpan:n})]}):(0,H.jsx)(T,{c:`dimmed`,children:`No spans were found for this trace.`}),(0,H.jsx)(T,{fw:600,children:`Correlated logs`}),a.logs.length?(0,H.jsx)(o,{style:{overflow:`auto`,minWidth:0},children:(0,H.jsx)(P4,{foldConstants:!1,panel:{id:`correlated_logs`,title:`Correlated logs`,viz:`logs`},result:s,dark:t,height:320})}):(0,H.jsx)(F8,{tall:!0,icon:(0,H.jsx)(zi,{size:20,weight:`duotone`}),title:`No correlated logs`,children:`No logs in this window carry the selected trace ID.`}),a.truncated&&(0,H.jsxs)(ee,{color:`warn`,children:[`This trace is truncated: `,a.spans.length,` of `,a.span_count,` spans, `,a.services.length,` of `,a.service_count,` services.`]})]})}function B8({spans:e,dark:t,onSpan:n}){let r=(0,V.useMemo)(()=>V8(e),[e]),i=[...new Set(e.map(e=>e.service))];return(0,H.jsxs)(S,{px:{base:`md`,sm:`lg`},pb:`md`,gap:`xs`,children:[(0,H.jsxs)(y,{justify:`space-between`,children:[(0,H.jsx)(y,{gap:`md`,children:i.map(e=>(0,H.jsxs)(y,{gap:5,children:[(0,H.jsx)(o,{w:8,h:8,bg:Ua(i.indexOf(e),t),style:{borderRadius:`50%`}}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,children:e})]},e))}),(0,H.jsx)(Ue,{variant:`light`,children:ye(r.total)})]}),(0,H.jsx)(B,{withBorder:!0,radius:`md`,p:`sm`,children:(0,H.jsx)(pe,{type:`auto`,offsetScrollbars:!0,children:(0,H.jsxs)(o,{miw:760,children:[(0,H.jsx)(o,{pos:`relative`,h:22,mb:4,children:[0,25,50,75,100].map(e=>(0,H.jsx)(T,{pos:`absolute`,left:`${e}%`,c:`dimmed`,size:`xs`,style:{transform:e===100?`translateX(-100%)`:e?`translateX(-50%)`:void 0},children:ye(r.total*e/100)},e))}),(0,H.jsxs)(o,{pos:`relative`,h:Math.max(150,r.laneCount*36+12),bg:`var(--mantine-color-default-hover)`,style:{overflow:`hidden`,borderRadius:`var(--mantine-radius-md)`},children:[[0,25,50,75,100].map(e=>(0,H.jsx)(o,{pos:`absolute`,left:`${e}%`,top:0,bottom:0,style:{borderLeft:`1px solid var(--mantine-color-default-border)`}},e)),r.frames.map(({span:e,lane:r,left:a,width:s})=>{let c=e.status===`STATUS_CODE_ERROR`,l=s<7,u=c?Ha(t).bad:Ua(i.indexOf(e.service),t),d=`${e.operation} · ${ye(e.duration_ms)} · ${e.service}`,f=(0,H.jsxs)(T,{component:`span`,size:`xs`,fw:700,truncate:!0,children:[l?``:e.operation,s>=12?` · ${ye(e.duration_ms)}`:``]}),p={position:`absolute`,left:`${a}%`,top:r*36+6,width:`${Math.max(s,.35)}%`,height:30,overflow:`hidden`,minWidth:3};return(0,H.jsx)(me,{label:`${e.service} · ${e.operation} · ${ye(e.duration_ms)}`,withArrow:!0,events:{hover:!0,focus:!0,touch:!1},children:n?(0,H.jsx)(C,{variant:`filled`,color:u,"aria-label":d,px:l?2:`xs`,size:`compact-xs`,onClick:()=>n(e),style:p,children:f}):(0,H.jsx)(o,{role:`img`,tabIndex:0,"aria-label":d,style:{...p,display:`flex`,alignItems:`center`,paddingInline:l?2:8,borderRadius:`var(--mantine-radius-sm)`,background:u,color:Ot(u)},children:f})},e.span_id)})]})]})})}),(0,H.jsx)(T,{c:`dimmed`,size:`xs`,children:`Width represents wall-clock duration; lanes preserve span hierarchy without overlap.`})]})}function V8(e){let t=Math.min(...e.map(e=>new Date(e.start).valueOf())),n=Math.max(...e.map(e=>new Date(e.start).valueOf()+e.duration_ms)),r=Math.max(n-t,1),i=new Map(e.map(e=>[e.span_id,e])),a=(e,t=new Set)=>{if(!e.parent_span_id||t.has(e.span_id))return 0;let n=i.get(e.parent_span_id);return n?(t.add(e.span_id),1+a(n,t)):0},o=e.map(e=>{let n=new Date(e.start).valueOf();return{span:e,depth:a(e),start:n,end:n+e.duration_ms,left:(n-t)/r*100,width:e.duration_ms/r*100}}).sort((e,t)=>e.depth-t.depth||e.start-t.start||t.span.duration_ms-e.span.duration_ms),s=[],c=0;for(let e of[...new Set(o.map(e=>e.depth))].sort((e,t)=>e-t)){let t=[];for(let n of o.filter(t=>t.depth===e)){let e=t.findIndex(e=>e<=n.start);e===-1&&(e=t.length),t[e]=n.end,s.push({...n,lane:c+e})}c+=Math.max(t.length,1)}return{frames:s,laneCount:c,total:r}}function H8({client:e,spec:t,time:n,vars:r,target:i,onChange:a}){let o=it(`light`)===`dark`,s=t.panels.find(e=>e.id===i?.panel_id),c=i?.kind===`logs`&&s?.query?.from===`logs`,l=ot({queryKey:[`exemplars`,t,i,r],queryFn:({signal:n})=>e.exemplars({dashboard:t,panel_id:i.panel_id,kind:c?`logs`:`traces`,time:{from:i.window_from,to:i.window_to,refresh:`off`},from:i.from,to:i.to,dimensions:i.dimensions,bucket:i.bucket,vars:r},n),enabled:!!(i&&s&&!i.trace_id),retry:!1}),u=ot({queryKey:[`drill-trace`,i],queryFn:({signal:t})=>e.trace(i,t),enabled:!!i?.trace_id,retry:!1});return(0,H.jsxs)($e,{opened:!!i,onClose:()=>a(void 0),title:s?`${s.title} · ${i?.kind}`:`Panel selection unavailable`,position:`right`,size:`xl`,children:[i?.trace_id&&(0,H.jsx)(C,{variant:`subtle`,mb:`sm`,onClick:()=>{let{trace_id:e,namespace:t,...n}=i;a(n)},children:`Back to traces`}),!s&&(0,H.jsx)(ee,{color:`bad`,children:`This panel is no longer in the dashboard.`}),(l.isFetching||u.isFetching)&&(0,H.jsx)(oe,{role:`status`,"aria-label":`Loading drill data`,size:`sm`}),(l.error||u.error)&&(0,H.jsx)(ee,{color:`bad`,children:(l.error??u.error)?.message}),c&&l.data?.logs&&s&&(0,H.jsx)(P4,{panel:{...s,viz:`logs`},result:{id:s.id,status:l.data.logs.rows?`ok`:`empty`,frame:l.data.logs,elapsed_ms:0,from_ms:Date.parse(i.from),to_ms:Date.parse(i.to)},dark:o,height:500}),c&&l.data?.logs?.rows===0&&(0,H.jsx)(T,{c:`dimmed`,children:`No logs match this selection.`}),!c&&!i?.trace_id&&l.data&&(0,H.jsxs)(S,{gap:`xs`,children:[l.data.traces.length===0&&(0,H.jsx)(T,{c:`dimmed`,children:`No exemplar traces match this selection.`}),l.data.traces.map(e=>(0,H.jsxs)(C,{variant:`default`,justify:`space-between`,onClick:()=>a({...i,trace_id:e.trace_id,namespace:e.namespace}),children:[e.service,` · `,e.operation,` · `,e.duration_ms.toFixed(1),` ms`]},`${e.namespace}/${e.trace_id}`)),l.data.truncated&&(0,H.jsx)(T,{size:`xs`,c:`dimmed`,children:`Showing at most 20 exemplar traces.`})]}),u.data&&(0,H.jsx)(z8,{result:u.data,dark:o})]})}var U8={"5m":`Last 5 minutes`,"15m":`Last 15 minutes`,"1h":`Last hour`,"3h":`Last 3 hours`,"6h":`Last 6 hours`,"12h":`Last 12 hours`,"24h":`Last 24 hours`,"2d":`Last 2 days`,"7d":`Last 7 days`,"30d":`Last 30 days`};function W8(e){return e.from&&e.to?`${ge(e.from)} – ${ge(e.to)}`:U8[e.range??`1h`]??e.range??`Last hour`}function G8({time:e,refresh:t,compare:n,editing:r,fetching:i,updatedAt:a,onRange:o,onAbsolute:s,onZoomOut:c,onRefresh:l,onRefreshNow:u,onCompare:d,onEdit:f,onHistory:p,onShortcuts:m,selecting:h=!1}){let[g,_]=(0,V.useState)(``),[v,b]=(0,V.useState)(``),[x,S]=(0,V.useState)(!1);return(0,H.jsxs)(y,{gap:`xs`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard controls`,children:[(0,H.jsxs)(Je,{position:`bottom-end`,withinPortal:!0,opened:x,onChange:S,children:[(0,H.jsx)(Je.Target,{children:(0,H.jsx)(C,{variant:`default`,size:`sm`,leftSection:(0,H.jsx)(ji,{size:15}),rightSection:(0,H.jsx)(_e,{size:12,weight:`bold`}),children:W8(e)})}),(0,H.jsxs)(Je.Dropdown,{miw:260,children:[(0,H.jsx)(Je.Label,{children:`Relative`}),dt.map(t=>(0,H.jsx)(Je.Item,{onClick:()=>o(t),fw:e.range===t?600:void 0,children:U8[t]},t)),(0,H.jsx)(Je.Divider,{}),(0,H.jsx)(Je.Label,{children:`Absolute (your time zone)`}),(0,H.jsxs)(y,{gap:6,px:`xs`,pb:`xs`,wrap:`nowrap`,children:[(0,H.jsx)(je,{type:`datetime-local`,size:`xs`,"aria-label":`From`,value:g,onChange:e=>_(e.currentTarget.value)}),(0,H.jsx)(je,{type:`datetime-local`,size:`xs`,"aria-label":`To`,value:v,onChange:e=>b(e.currentTarget.value)})]}),(0,H.jsx)(y,{px:`xs`,pb:`xs`,justify:`flex-end`,children:(0,H.jsx)(C,{size:`compact-sm`,disabled:!g||!v||g>=v,onClick:()=>{s(new Date(g).toISOString(),new Date(v).toISOString()),S(!1)},children:`Apply range`})})]})]}),(0,H.jsx)(me,{label:`Zoom out`,children:(0,H.jsx)(C,{variant:`default`,size:`sm`,px:10,"aria-label":`Zoom out`,onClick:c,children:(0,H.jsx)(Ui,{size:15})})}),(0,H.jsxs)(y,{"data-refresh-controls":!0,gap:4,wrap:`nowrap`,children:[(0,H.jsx)(me,{label:a?`Updated ${ge(a)}`:`Refresh now`,children:(0,H.jsx)(C,{variant:`default`,size:`sm`,px:10,"aria-label":`Refresh now`,loading:i,onClick:u,children:(0,H.jsx)(xi,{size:15})})}),(0,H.jsx)(Hr,{size:`xs`,"aria-label":`Auto refresh`,value:t,onChange:l,data:At.map(e=>({value:e,label:e===`off`?`Off`:e}))})]}),(0,H.jsx)(oi,{size:`sm`,label:`Compare with previous period`,checked:n,onChange:e=>d(e.currentTarget.checked)}),(0,H.jsx)(C,{variant:r?`filled`:`default`,size:`sm`,leftSection:(0,H.jsx)(Be,{size:15}),onClick:f,children:r?`Done`:`Edit layout`}),(0,H.jsx)(C,{variant:`default`,size:`sm`,leftSection:(0,H.jsx)(Ni,{size:15}),onClick:p,children:`History`}),m&&(0,H.jsx)(R4,{onClick:m}),a&&(0,H.jsxs)(T,{size:`xs`,c:`dimmed`,visibleFrom:`md`,children:[`Updated `,new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`,second:`2-digit`}).format(a)]}),h&&(0,H.jsx)(T,{"data-range-paused":!0,size:`xs`,c:`dimmed`,role:`status`,children:`Paused while selecting`})]})}var K8=(e,t)=>!(t instanceof Me&&t.status<500)&&e<2,q8=(e,t)=>!(t instanceof Me&&t.code===`timeout`)&&K8(e,t),J8=e=>({panels:e.panels.map(({grid:e,...t})=>t),variables:e.variables,time:e.time,annotations:e.annotations});function Y8(e,t,n,r,i){return[`panels`,JSON.stringify([e,J8(t),n,r,i])]}function X8(e,t,n,r){return[`variables`,e,J8(t),n,r]}async function Z8(e,t){let n=await Ye(e,t),r=new Set(e.dashboard.panels.filter(e=>[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz)).map(e=>e.id)),i=n.filter(e=>r.has(e.id)&&e.from_ms!==void 0&&e.to_ms!==void 0&&e.from_mse.from_ms)),o=Math.max(...i.map(e=>e.to_ms));try{return{results:n,annotations:await vt({from:new Date(a).toISOString(),to:new Date(o).toISOString()},t)}}catch(e){if(t?.aborted)throw e;return{results:n,annotation_error:e instanceof Error?e.message:`Annotations unavailable`}}}var Q8={off:!1,"10s":1e4,"30s":3e4,"1m":6e4,"5m":3e5},$8=0;function e5(e,t){let[n,r]=e.queryKey;if(n!==`panels`||typeof r!=`string`)return!1;try{return JSON.parse(r)[0]===t}catch{return!1}}function t5({dashboardId:e,spec:t,time:n,vars:r,compare:i,widths:a,visible:o,refresh:s,enabled:c=!0}){let l=(0,V.useMemo)(()=>Object.fromEntries(Object.entries(a).map(([e,t])=>[e,Math.max(100,Math.round(t/100)*100)])),[a]),u=Y8(e,t,n,r,i),d=u[1],f=o.filter(e=>t.panels.some(t=>t.id===e)),p=(0,V.useRef)([]),m=(0,V.useRef)(void 0),h=(0,V.useRef)(null),g=(0,V.useRef)(!1),_=(0,V.useRef)(null),v=(0,V.useRef)({key:d,ids:new Set}),[y,b]=(0,V.useState)({key:d}),[x,S]=(0,V.useState)({key:d,results:new Map,updated:new Map,stale:new Set,receivedAt:0}),C=f.length===0&&x.key===d&&x.receivedAt>0,w=c&&t.panels.some(e=>e.viz!==`text`),T=ot({queryKey:u,queryFn:({signal:e})=>{if(C&&h.current?.key!==d)return p.current=[],Promise.resolve({results:[],hasTimePanels:!1,batch:++$8});let a=h.current?.key===d?h.current.ids:f;p.current=(a.length?[...a]:t.panels.map(e=>e.id)).sort(),v.current.key!==d&&(v.current={key:d,ids:new Set});for(let e of p.current)v.current.ids.add(e);let o=[...p.current];return Z8({dashboard:t,panels:o,time:n,vars:r,widths:l,compare:i},e).then(e=>{let n=new Set(e.results.map(e=>e.id)),r=o.filter(e=>!n.has(e)&&t.panels.find(t=>t.id===e)?.viz!==`text`).map(e=>({id:e,status:`error`,elapsed_ms:0,error:`No result was returned for this panel; refresh to retry.`,request_error:o}));return{...e,batch:++$8,results:[...e.results.map(e=>W4(e,o)),...r],hasTimePanels:t.panels.some(e=>o.includes(e.id)&&[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz))}}).catch(n=>{throw e.aborted||(m.current={key:d,ids:o.filter(e=>t.panels.find(t=>t.id===e)?.viz!==`text`),error:n instanceof Error?n.message:String(n),retryable:!(n instanceof Me)||n.status===408||n.status===429||n.status>=500}),n})},retry:q8,enabled:w,refetchInterval:C?!1:Q8[s]??3e4,staleTime:5e3,placeholderData:e=>e}),E=T.error&&m.current?.key===d?m.current:void 0,D=(0,V.useMemo)(()=>n5(x,d,T.isPlaceholderData?void 0:T.data?.results,T.dataUpdatedAt,T.data?.batch,E),[x,d,T.data,T.dataUpdatedAt,T.isPlaceholderData,T.error,T.errorUpdatedAt]),O=D.results,k=T.isPlaceholderData?void 0:T.data?.hasTimePanels?T.data:y.key===d?y:void 0;(0,V.useEffect)(()=>{!T.isPlaceholderData&&T.data?.hasTimePanels&&b({key:d,annotations:T.data.annotations,annotation_error:T.data.annotation_error})},[d,T.data,T.isPlaceholderData]),(0,V.useEffect)(()=>{T.isPlaceholderData||S(e=>n5(e,d,T.data?.results,T.dataUpdatedAt,T.data?.batch,E))},[d,T.data,T.dataUpdatedAt,T.isPlaceholderData,T.error,T.errorUpdatedAt]);let A=new Map([...D.stale].flatMap(e=>{let t=D.updated.get(e);return t?[[e,t]]:[]})),j=(T.data?.results??[]).find(e=>e.status===`error`&&D.stale.has(e.id));(0,V.useEffect)(()=>{if(!w||T.isFetching||g.current||_.current?.key===d||h.current?.key===d)return;let e=v.current.key===d?v.current.ids:new Set,n=[...new Set(f.filter(n=>!O.has(n)&&!e.has(n)&&t.panels.find(e=>e.id===n)?.viz!==`text`))].sort();if(!n.length)return;let r={key:d,ids:n};h.current=r,T.refetch({cancelRefetch:!1}).finally(()=>{h.current===r&&(h.current=null)})},[o,w,d,T.isFetching,T.error,T.refetch,O,t.panels]),(0,V.useEffect)(()=>{!T.isFetching&&_.current?.key!==d&&g.current&&(g.current=!1,h.current=null,w&&!C&&T.refetch({cancelRefetch:!1}))},[T.isFetching,d,w,C,T.refetch]);let M=e=>{let t={key:d,ids:e};h.current=t,T.refetch({cancelRefetch:!1}).finally(()=>{h.current===t&&(h.current=null)})};return(0,V.useEffect)(()=>{if(T.isFetching||!_.current)return;let e=_.current;if(_.current=null,e.key!==d||!w)return;let n=[...e.ids].filter(e=>t.panels.some(t=>t.id===e&&t.viz!==`text`)&&O.get(e)?.request_error).sort();n.length&&M(n)},[T.isFetching,d,w,O,t.panels]),{retry:e=>{if(!w)return;let n=e?O.get(e)?.request_error??[]:[...O.values()].flatMap(e=>e.request_error??[]),r=[...new Set(n)].filter(e=>t.panels.some(t=>t.id===e&&t.viz!==`text`)&&O.get(e)?.request_error).sort();if(r.length){if(T.isFetching){_.current?.key!==d&&(_.current={key:d,ids:new Set});for(let e of r)_.current.ids.add(e);return}M(r)}},results:O,staleAt:A,annotations:k?.annotations,annotationError:k?.annotation_error,fetchingIds:T.isFetching?p.current:[],fetching:T.isFetching,error:T.error??(j?Error(j.error??`Panel refresh failed`):null),updatedAt:T.isPlaceholderData?null:T.dataUpdatedAt||null,refetch:()=>{if(w&&!C){if(T.isFetching){h.current?.key===d&&(g.current=!0);return}T.refetch({cancelRefetch:!1})}}}}function n5(e,t,n,r,i,a){let o=e.key===t?{key:t,results:new Map(e.results),updated:new Map(e.updated),stale:new Set(e.stale),receivedAt:e.receivedAt,receivedBatch:e.receivedBatch}:{key:t,results:new Map,updated:new Map,stale:new Set,receivedAt:0};for(let e of n&&i!==o.receivedBatch?n:[])e.status===`error`&&o.results.get(e.id)?.frame?(o.stale.add(e.id),o.results.set(e.id,{...o.results.get(e.id),error:e.error,request_error:e.request_error})):(o.results.set(e.id,e),o.updated.set(e.id,r),o.stale.delete(e.id));n&&(o.receivedAt=r,o.receivedBatch=i);for(let e of a?.ids??[]){let t=o.results.get(e);t?.frame?(o.stale.add(e),o.results.set(e,{...t,error:a.error,request_error:a.retryable?a.ids:void 0})):o.results.set(e,{id:e,status:`error`,elapsed_ms:0,error:a.error,request_error:a.retryable?a.ids:void 0})}return o}function r5(e,t){return e.queryKey[0]===`variables`&&e.queryKey[1]===t}function i5(e,t,n,r,i,a=!1){let o=!!t.variables?.some(e=>e.kind===`query`),s=ot({queryKey:X8(e,t,n,r),queryFn:async({signal:e})=>{let a=await i({dashboard:t,time:n,vars:r},e);return Object.fromEntries((t.variables??[]).map(e=>[e.name,a[e.name]??(e.kind===`custom`?e.options?.map(e=>({value:e})):void 0)??[]]))},enabled:o,retry:a,staleTime:6e4,placeholderData:e=>e}),c=s.isPlaceholderData?void 0:s.data,l=s.isError||(t.variables??[]).every(e=>e.kind!==`query`||r[e.name]!==void 0&&r[e.name]!==`$__all`&&(e.multi||!Array.isArray(r[e.name])||r[e.name].length>0)||!!e.default||e.include_all||c?.[e.name]!==void 0);return{...s,currentData:c,ready:l}}function a5(e){return t=>e5(t,e)||r5(t,`dashboard-${e}`)}function o5({id:e,currentVersion:t,opened:n,onClose:r,onRestored:i}){let a=et(),[o,s]=(0,V.useState)(),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(n),m=(0,V.useRef)(0),h=(0,V.useRef)(n);h.current=n;let g=(0,V.useRef)(!1),_=(0,V.useRef)(!1),v=(0,V.useRef)(i);v.current=i,(0,V.useEffect)(()=>(_.current=!0,()=>{_.current=!1}),[]);let y=De({mutationFn:({version:t})=>He(e,t),retry:!1,onSuccess:(t,{version:n,generation:r})=>{a.cancelQueries({queryKey:[`dashboard`,e],exact:!0}),a.cancelQueries({predicate:a5(e)}),a.cancelQueries({queryKey:[`exemplars`]}),a.cancelQueries({queryKey:[`drill-trace`]}),a.setQueryData([`dashboard`,e],t),a.invalidateQueries({predicate:a5(e),refetchType:`none`}),_.current&&(h.current&&r===m.current&&l(`Restored v${n} as v${t.version}`),v.current(t)),a.invalidateQueries({queryKey:Pe}),a.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}),a.invalidateQueries({queryKey:[`exemplars`],refetchType:`none`}),a.invalidateQueries({queryKey:[`drill-trace`],refetchType:`none`})},onError:t=>{t instanceof Me&&t.code===`dashboard_version_not_found`&&a.invalidateQueries({queryKey:[`dashboard-versions`,e]})},onSettled:()=>{g.current=!1,_.current&&d(!1)}}),b=()=>{m.current++,y.reset(),l(``)};(0,V.useEffect)(()=>{if(n){p(!0);return}m.current++,y.reset(),l(``),a.cancelQueries({queryKey:[`dashboard-versions`,e]}),a.cancelQueries({queryKey:[`dashboard-version`,e]})},[n,e,a,y.reset]);let x=(0,V.useRef)(t);return(0,V.useEffect)(()=>{x.current!==t&&(x.current=t,a.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}))},[t,e,a]),(0,H.jsx)($e,{opened:n,onClose:()=>{b(),r()},onExitTransitionEnd:()=>p(!1),title:`Version history`,position:`right`,size:`xl`,children:(n||f)&&(0,H.jsx)(s5,{id:e,opened:n,currentVersion:t,selected:o,onSelect:e=>{b(),s(e)},pending:u,error:y.error,failedVersion:y.variables?.version,success:c,onRestore:e=>{g.current||(g.current=!0,d(!0),l(``),y.mutate({version:e,generation:m.current}))}})})}function s5({id:e,opened:t,currentVersion:n,selected:r,onSelect:i,pending:a,error:s,failedVersion:c,success:l,onRestore:u}){let d=ot({queryKey:[`dashboard-versions`,e],queryFn:({signal:t})=>bt(e,t),enabled:t,retry:!1}),f=r??d.data?.[0]?.version,p=ot({queryKey:[`dashboard-version`,e,f],queryFn:({signal:t})=>Fe(e,f,t),enabled:t&&f!==void 0,retry:!1});return(0,H.jsxs)(S,{gap:`md`,"data-version-history":!0,children:[(0,H.jsx)(T,{size:`sm`,c:`dimmed`,children:`Inspect saved specs and changes. Restoring adds a new version.`}),l&&(0,H.jsx)(ee,{color:`ok`,role:`status`,children:l}),s&&c===f&&(0,H.jsx)(d5,{error:s,version:f}),(0,H.jsxs)(o,{mih:160,children:[d.isPending&&(0,H.jsxs)(y,{gap:`xs`,role:`status`,children:[(0,H.jsx)(oe,{size:`sm`}),(0,H.jsx)(T,{size:`sm`,children:`Loading history…`})]}),d.error&&(0,H.jsxs)(ee,{color:`bad`,title:`History unavailable`,children:[d.error.message,(0,H.jsx)(C,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void d.refetch(),children:`Retry history`})]}),d.data?.length===0&&(0,H.jsx)(T,{c:`dimmed`,children:`No versions available.`}),!!d.data?.length&&(0,H.jsx)(pe,{h:200,type:`auto`,children:(0,H.jsx)(S,{gap:`xs`,pr:`sm`,role:`list`,"aria-label":`Saved versions`,children:d.data.map(e=>(0,H.jsxs)(B,{role:`listitem`,withBorder:!0,p:`xs`,radius:`sm`,style:{borderColor:f===e.version?`var(--mantine-color-brand-filled)`:void 0},children:[(0,H.jsxs)(y,{justify:`space-between`,gap:`xs`,children:[(0,H.jsxs)(C,{variant:f===e.version?`light`:`subtle`,size:`compact-sm`,"aria-pressed":f===e.version,onClick:()=>i(e.version),children:[`Version `,e.version]}),e.version===n&&(0,H.jsx)(Ue,{color:`gray`,variant:`light`,tt:`none`,children:`Current`}),(0,H.jsx)(l5,{at:e.created_at})]}),(0,H.jsxs)(T,{size:`xs`,c:`dimmed`,mt:4,children:[c5(e),` · `,e.message||`No edit message`]})]},e.version))})})]}),(0,H.jsx)(Ve,{role:`status`,"aria-live":`polite`,children:f===void 0?`Select a version.`:p.isFetching?`Loading version ${f}…`:p.error?`Version ${f} unavailable.`:`Version ${f} ready.`}),(0,H.jsxs)(o,{mih:280,"aria-busy":p.isFetching,children:[f!==void 0&&p.isPending&&(0,H.jsxs)(y,{gap:`xs`,role:`status`,children:[(0,H.jsx)(oe,{size:`sm`}),(0,H.jsx)(T,{size:`sm`,children:`Loading version…`})]}),p.error&&(0,H.jsxs)(ee,{color:`bad`,title:p.error instanceof Me&&p.error.code===`dashboard_version_not_found`?`This version is no longer available`:`Version unavailable`,children:[p.error.message,(0,H.jsx)(C,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void p.refetch(),children:`Retry version`})]}),p.data&&!p.error&&(0,H.jsx)(u5,{record:p.data,currentVersion:n,pending:a,onRestore:()=>u(p.data.dashboard.version)})]})]})}function c5(e){return e.author_kind===`agent`?`Agent`:e.author_kind===`user`?`You`:`System`}function l5({at:e}){let t=(Date.parse(e)-Date.now())/1e3,[n,r]=Math.abs(t)<60?[1,`second`]:Math.abs(t)<3600?[60,`minute`]:Math.abs(t)<86400?[3600,`hour`]:[86400,`day`];return(0,H.jsx)(T,{component:`time`,dateTime:e,title:ge(e),size:`xs`,c:`dimmed`,children:new Intl.RelativeTimeFormat(void 0,{numeric:`auto`}).format(Math.round(t/n),r)})}function u5({record:e,currentVersion:t,pending:n,onRestore:r}){let{dashboard:i}=e,a=ce(e);return(0,H.jsxs)(S,{gap:`sm`,"data-history-version":i.version,children:[(0,H.jsxs)(y,{justify:`space-between`,align:`flex-start`,children:[(0,H.jsxs)(o,{miw:0,children:[(0,H.jsxs)(I,{order:2,fz:`lg`,children:[i.name,` · v`,i.version]}),(0,H.jsxs)(T,{size:`sm`,c:`dimmed`,children:[c5(e),` · `,e.message||`No edit message`]}),(0,H.jsx)(l5,{at:e.created_at})]}),i.version===t?(0,H.jsx)(C,{size:`sm`,variant:`default`,disabled:!0,children:`Current version`}):(0,H.jsxs)(C,{size:`sm`,disabled:n,loading:n,onClick:r,children:[`Restore version `,i.version]})]}),i.description&&(0,H.jsx)(T,{size:`sm`,children:i.description}),e.changes_available?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Te,{labels:a}),!a.length&&!e.layout_changed&&(0,H.jsx)(T,{size:`sm`,c:`dimmed`,children:`No authored changes.`})]}):(0,H.jsx)(ee,{color:`warn`,title:`Changes unavailable`,children:`The preceding version is no longer retained. This saved spec is still available.`}),(0,H.jsxs)(T,{size:`sm`,c:`dimmed`,children:[`Read-only · `,i.spec.panels.length,` panels. Historical data is not queried.`]}),(0,H.jsxs)(pn,{variant:`contained`,children:[(0,H.jsxs)(pn.Item,{value:`spec`,children:[(0,H.jsx)(pn.Control,{children:`Spec`}),(0,H.jsx)(pn.Panel,{children:(0,H.jsx)(Re,{block:!0,tabIndex:0,style:{maxHeight:320,overflow:`auto`},children:JSON.stringify(i.spec,null,2)})})]}),(0,H.jsxs)(pn.Item,{value:`data`,children:[(0,H.jsx)(pn.Control,{children:`Data`}),(0,H.jsx)(pn.Panel,{children:(0,H.jsx)(S,{gap:`xs`,children:i.spec.panels.map(e=>(0,H.jsxs)(o,{children:[(0,H.jsxs)(T,{size:`sm`,fw:500,children:[e.title,` · `,e.viz]}),(0,H.jsx)(Re,{block:!0,tabIndex:0,children:e.content??e.sql??JSON.stringify(e.query??{},null,2)})]},e.id))})})]})]})]})}function d5({error:e,version:t}){let n=e instanceof Me?e.code:void 0,r=!(e instanceof Me)||e.status>=500?`Try again with the restore button.`:n===`invalid_spec`?`This saved spec is invalid. Review the fields below and choose another version.`:n===`dashboard_version_not_found`?`Reload history and choose a retained version.`:[`already_current`,`dashboard_version_conflict`,`conflict`].includes(n??``)?`This dashboard changed or its name conflicts. Reload history and choose another version.`:`Check your access and reload history.`;return(0,H.jsxs)(ee,{color:`bad`,title:`Restore of version ${t} failed`,children:[(0,H.jsx)(T,{size:`sm`,children:e.message}),e instanceof Me&&e.problems.length>0&&(0,H.jsx)(`ul`,{children:e.problems.map((e,t)=>(0,H.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))}),(0,H.jsx)(T,{size:`sm`,mt:`xs`,children:r})]})}function f5(e,t){let n=JSON.stringify([e.range,e.from,e.to]),r=(0,V.useRef)({search:e,onSearch:t,scope:n}),i=(0,V.useRef)(``),a=(0,V.useRef)(void 0),[o,s]=(0,V.useState)(!1);r.current.scope!==n&&(i.current!==`${e.from}/${e.to}`&&(a.current=void 0,o&&s(!1)),i.current=``),r.current={search:e,onSearch:t,scope:n};let c=(0,V.useCallback)(()=>{i.current=``,a.current=void 0,s(!1)},[]),l=(0,V.useCallback)(()=>{if(!a.current)return;let e=a.current;c(),r.current.onSearch({...r.current.search,...e},!1)},[c]);return{zoom:(0,V.useCallback)((e,t)=>{let n=la(e,t);if(!n)return;let o=r.current,c=`${n.from}/${n.to}`;o.search.from===n.from&&o.search.to===n.to||i.current===c||(a.current??={range:o.search.range,from:o.search.from,to:o.search.to},s(!0),i.current=c,o.onSearch({...o.search,range:void 0,...n},!1))},[]),reset:c,resetZoom:l,zoomed:o}}function p5({variables:e,vars:t,options:n,onChange:r}){return e.length===0?null:(0,H.jsx)(y,{gap:`sm`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard variables`,children:e.map(e=>{let i=Ji(e,t,n[e.name]),a=[...e.include_all?[{value:qi,label:`All`}]:[],...(n[e.name]??e.options?.map(e=>({value:e}))??[]).map(e=>({value:e.value,label:e.value}))],o=(0,H.jsxs)(T,{size:`xs`,c:`dimmed`,ff:`monospace`,children:[`$`,e.name]});return e.kind===`constant`?(0,H.jsx)(je,{label:o,size:`xs`,value:e.value,readOnly:!0,w:160},e.name):e.kind===`text`?(0,H.jsx)(je,{label:o,size:`xs`,w:200,defaultValue:typeof i==`string`?i:``,onBlur:t=>r(e.name,t.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}},`${e.name}:${JSON.stringify(i)}`):e.multi?(0,H.jsx)(kr,{label:o,size:`xs`,w:260,searchable:!0,clearable:!0,data:a.filter(e=>e.value!==qi),value:Array.isArray(i)?i:i&&i!==`$__all`?[i]:[],placeholder:e.include_all?`All`:`None`,onChange:t=>r(e.name,t.length?t:e.include_all?qi:[])},e.name):(0,H.jsx)(Wr,{label:o,size:`xs`,w:220,searchable:!0,allowDeselect:!1,data:a,value:Array.isArray(i)?i[0]??null:i||null,onChange:t=>t!==null&&r(e.name,t)},e.name)})})}function m5(e,t,n=!1){let r=e.target;return t||e.defaultPrevented||e.repeat||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey&&e.key!==`?`||r instanceof Element&&r.closest(`input,textarea,select,[contenteditable]:not([contenteditable="false"]),[role="textbox"],[role="menu"]`)||r instanceof Element&&r.closest(`[role="dialog"]`)&&!(n&&r.closest(`[data-panel-fullscreen]`))?null:[`r`,`e`,`h`,`f`,`?`].includes(e.key)?e.key:null}function h5(e,t,n={}){let r=(0,V.useRef)({actions:t,options:n});r.current={actions:t,options:n},(0,V.useEffect)(()=>{let t=t=>{let n=e.current,i=t.target,{actions:a,options:o}=r.current;if(!n||!(i instanceof Element)||o.enabled===!1)return;let s=o.fullscreenScope?[...document.querySelectorAll(`[data-shortcut-scope]`)].find(e=>e.dataset.shortcutScope===o.fullscreenScope&&e.hasAttribute(`data-panel-fullscreen`)):void 0,c=n.contains(i)&&n.contains(document.activeElement),l=i===document.body&&document.activeElement===document.body,u=s?.contains(i)&&s.contains(document.activeElement);if(!c&&!l&&!u)return;let d=m5(t,!!(o.modalOpen||[...document.querySelectorAll(`[role="dialog"]`)].some(e=>e!==s)),!!s);if(!d||s&&![`r`,`f`,`?`].includes(d))return;let f=a[d];f&&(t.preventDefault(),f(i))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e])}function g5({opened:e,onClose:t,fullscreen:n=!1,enabled:r,onEnabled:i}){let a=[[`r`,`Refresh now`],...n?[]:[[`e`,`Toggle layout mode`],[`h`,`Open history`]],[`f`,n?`Exit full-screen`:`Open the focused panel in full-screen`],[`?`,`Open keyboard shortcuts`],[`Escape`,`Cancel a range, then leave the chart or close full-screen`]];return(0,H.jsx)(yt,{opened:e,onClose:t,title:`Keyboard shortcuts`,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,children:(0,H.jsxs)(S,{gap:`xs`,children:[(0,H.jsx)(oi,{label:`Single-key shortcuts`,checked:r,onChange:e=>i(e.currentTarget.checked)}),a.map(([e,t])=>(0,H.jsxs)(y,{gap:`sm`,children:[(0,H.jsx)(Xe,{children:e}),(0,H.jsx)(T,{size:`sm`,children:t})]},e)),!n&&(0,H.jsx)(T,{size:`sm`,children:`Focus a chart or a panel control before pressing f. Without a focused panel, f does nothing.`}),(0,H.jsx)(T,{size:`sm`,children:`Tab directly to a chart. Left/Right moves between points; Up/Down changes series at the same time or category. Home/End jumps to the first/last point. Enter drills or applies the panel filter. Comparison and Other values can be read even when selection is unavailable.`}),(0,H.jsx)(T,{size:`sm`,children:`On time charts, Shift+Left/Right extends a range and pauses auto-refresh. Review the shaded range and compact UTC label, then choose Zoom to range. Use the time picker after zooming for precise edits. Escape or Cancel cancels it and resumes refresh. The next Escape leaves the chart or closes full-screen. Reset zoom, Zoom out and browser Back preserve comparison and filters.`}),(0,H.jsxs)(T,{size:`sm`,children:[n?`In full-screen, r refreshes, f exits and ? opens help; e and h are inactive.`:`Shortcuts work in the dashboard.`,` Typing, menus and other dialogs or drawers pause shortcuts. Modifier shortcuts keep their browser behavior. Turning off single-key shortcuts keeps chart navigation and visible controls available.`]}),(0,H.jsx)(T,{size:`sm`,children:`The global / shortcut focuses the chat composer.`})]})})}function _5(e){let t=`fanout:single-key-shortcuts:`+e,n=()=>{try{return localStorage.getItem(t)!==`off`}catch{return!0}},[r,i]=(0,V.useState)(n);return(0,V.useEffect)(()=>{i(n())},[t]),(0,V.useEffect)(()=>{let e=e=>{e.key===t&&i(n())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[t]),{enabled:r,change:e=>{i(e);try{localStorage.setItem(t,e?`on`:`off`)}catch{}}}}function v5(e){let t=(0,V.useRef)(void 0),n=t=>[...e.current?.querySelectorAll(`[data-panel]`)??[]].find(e=>e.dataset.panel===t&&!e.closest(`[data-panel-fullscreen],[data-fragment-fullscreen]`));return(0,V.useEffect)(()=>{t.current&&!n(t.current.panel)&&(t.current=void 0)}),{remember(n){t.current=void 0;let r=document.activeElement;if(!(r instanceof HTMLElement)||!e.current?.contains(r)||r.closest(`[data-panel]`)?.dataset.panel!==n)return;let i=r.getAttribute(`data-panel-view`),a=r.getAttribute(`aria-label`),o=r.hasAttribute(`data-chart-plot`)?`[data-chart-plot]`:i?`[data-panel-view=${JSON.stringify(i)}]`:a?`[aria-label=${JSON.stringify(a)}]`:void 0;t.current={element:r,panel:n,selector:o}},restore(e){let r=t.current;if(t.current=void 0,r&&(e===void 0||r.panel===e)&&n(r.panel))return r.element.isConnected&&!r.element.closest(`[hidden]`)?r.element:r.selector?n(r.panel)?.querySelector(r.selector)??void 0:void 0}}}var y5={exemplars:qe,trace:Ie},b5={"5m":`15m`,"15m":`1h`,"1h":`3h`,"3h":`6h`,"6h":`12h`,"12h":`24h`,"24h":`2d`,"2d":`7d`,"7d":`30d`,"30d":`30d`};function x5({dashboardId:e,search:t,onSearch:n,onOpen:r}){let{agentAvailable:i,openChat:a}=se(),o=ot({queryKey:Pe,queryFn:Ze,staleTime:15e3});(0,V.useEffect)(()=>{!e&&o.data?.length&&r((o.data.find(e=>e.is_default)??o.data[0]).id,!0)},[e,o.data]);let s=ot({queryKey:[`dashboard`,e],queryFn:({signal:t})=>jt(e,t),enabled:!!e,retry:(e,t)=>!(t instanceof Me&&t.code===`not_found`)&&e<2});return!e&&o.error?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsx)(ee,{color:`bad`,title:`Dashboards could not be loaded`,children:o.error.message})}):!e&&o.data?.length===0?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsxs)(S,{align:`center`,gap:`xs`,children:[(0,H.jsx)(I,{order:1,fz:24,children:`No dashboards yet`}),(0,H.jsx)(T,{c:`dimmed`,size:`sm`,ta:`center`,children:`Create a dashboard to explore your services.`}),i&&(0,H.jsx)(C,{mt:`sm`,size:`sm`,onClick:()=>a(`Build me a dashboard for my services, showing request volume, latency, and errors. Ask me which services to monitor first.`),children:`Create with AI`})]})}):!e||s.isLoading?(0,H.jsxs)(ie,{mih:`50vh`,children:[(0,H.jsx)(oe,{size:`sm`}),(0,H.jsx)(T,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading your dashboard…`})]}):s.error instanceof Me&&s.error.code===`not_found`?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsxs)(S,{align:`center`,gap:`xs`,children:[(0,H.jsx)(I,{order:1,fz:24,children:`This dashboard isn't here`}),(0,H.jsx)(T,{c:`dimmed`,size:`sm`,ta:`center`,children:`The link may be out of date, or the dashboard may have been deleted.`}),o.data?.length?(0,H.jsx)(C,{mt:`sm`,variant:`default`,size:`sm`,onClick:()=>r((o.data.find(e=>e.is_default)??o.data[0]).id,!0),children:`Open your default dashboard`}):null]})}):s.error||!s.data?(0,H.jsx)(ie,{mih:`50vh`,children:(0,H.jsx)(T,{c:`dimmed`,size:`sm`,children:`Your dashboard is unavailable. Try refreshing.`})}):(0,H.jsx)(S5,{id:s.data.id,version:s.data.version,spec:s.data.spec,search:t,onSearch:n,agentAvailable:i,openChat:a},s.data.id)}function S5({id:e,version:t,spec:n,search:r,onSearch:i,agentAvailable:a,openChat:s}){let[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(!1),f=(0,V.useRef)(null),p=(0,V.useId)(),m=_5(tt().id),h=v5(f),[g,_]=(0,V.useState)(()=>new Set),v=(0,V.useCallback)((e,t)=>_(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r}),[]),b=et(),[x,w]=(0,V.useState)(),{zoom:E,reset:D,resetZoom:O,zoomed:k}=f5(r,i),A=gt(n,r),[j,M]=(0,V.useState)(A.refresh??`30s`),N=r.compare?r.compare===`1`:n.time.compare===`previous_period`,P=r.vars??{},F=i5(`dashboard-${e}`,n,A,P,Le,K8),L=(0,V.useMemo)(()=>Xi(n.variables,P,F.currentData),[n.variables,P,F.currentData]),[R,te]=(0,V.useState)(()=>window.innerWidth);(0,V.useEffect)(()=>{let e=0,t=()=>{window.clearTimeout(e),e=window.setTimeout(()=>te(window.innerWidth),300)};return window.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t),window.clearTimeout(e)}},[]);let ne=(0,V.useMemo)(()=>{let e=Math.max(320,Math.min(R-64,1600));return Object.fromEntries(n.panels.map(t=>[t.id,e/12*(t.grid?.w??t.width??6)]))},[R,n]),[re,ie]=(0,V.useState)(()=>n.panels.map(e=>e.id)),z=t5({dashboardId:e,version:t,spec:n,time:A,vars:L,compare:N,widths:ne,visible:(0,V.useMemo)(()=>re.filter(e=>n.panels.some(t=>t.id===e)),[re,n.panels]),refresh:g.size?`off`:j,enabled:F.ready});(0,V.useEffect)(()=>{x===t&&b.refetchQueries({predicate:a5(e),type:`active`,stale:!0},{cancelRefetch:!1})},[x,t,e,b]);let ae=(0,V.useMemo)(()=>z.annotations?{...z.annotations,deploys:n.annotations?.deploys===!1?[]:z.annotations.deploys,anomalies:n.annotations?.anomalies===!1?[]:z.annotations.anomalies}:void 0,[z.annotations,n.annotations?.deploys,n.annotations?.anomalies]),B=F.error??z.error,oe=(e,t)=>{let n={...P};t===void 0?delete n[e]:n[e]=t,i({...r,vars:n},!0)},se=()=>i({...r,edit:r.edit===`1`?void 0:`1`}),ce=e=>{e&&h.remember(e),i({...r,view:e},e===void 0)};return h5(f,{r:()=>z.refetch(),e:se,h:()=>l(!0),"?":()=>d(!0),f:e=>{if(r.view){ce();return}let t=e.closest(`[data-panel]`)?.dataset.panel;t&&n.panels.some(e=>e.id===t)&&ce(t)}},{modalOpen:c||u||!!r.drill,fullscreenScope:r.view?p:void 0,enabled:m.enabled}),(0,H.jsxs)(o,{component:`main`,ref:f,"aria-label":`Dashboard`,maw:1600,mx:`auto`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,children:[(0,H.jsxs)(S,{gap:`sm`,mb:`md`,children:[(0,H.jsxs)(y,{justify:`space-between`,align:`flex-start`,wrap:`wrap`,gap:`sm`,children:[(0,H.jsxs)(o,{miw:0,children:[(0,H.jsx)(I,{order:1,fz:28,lts:`-0.02em`,children:n.name}),n.description&&(0,H.jsx)(T,{c:`dimmed`,size:`sm`,mt:2,children:n.description})]}),(0,H.jsx)(G8,{selecting:g.size>0,time:A,refresh:j,compare:N,editing:r.edit===`1`,fetching:z.fetching,updatedAt:z.updatedAt,onRange:e=>{D(),i({...r,range:e,from:void 0,to:void 0})},onAbsolute:(e,t)=>{D(),i({...r,range:void 0,from:e,to:t})},onZoomOut:()=>{if(A.from&&A.to){let e=Date.parse(A.from),t=Date.parse(A.to),n=(t-e)/2;i({...r,range:void 0,from:new Date(e-n).toISOString(),to:new Date(t+n).toISOString()})}else i({...r,range:b5[A.range??`1h`]??`1h`,from:void 0,to:void 0})},onRefresh:M,onRefreshNow:z.refetch,onCompare:e=>i({...r,compare:e?`1`:`0`},!0),onEdit:se,onHistory:()=>l(!0),onShortcuts:()=>d(!0)})]}),(0,H.jsx)(p5,{variables:n.variables??[],vars:P,options:F.data??{},onChange:oe}),Object.entries(P).filter(([,e])=>e!==`$__all`).length>0&&(0,H.jsx)(y,{gap:6,children:Object.entries(P).filter(([,e])=>e!==`$__all`).map(([e,t])=>(0,H.jsxs)(C,{size:`compact-xs`,variant:`light`,"aria-label":`$${e} = ${Array.isArray(t)?t.join(`, `):t} ×: remove filter`,onClick:()=>oe(e,void 0),children:[`$`,e,` = `,Array.isArray(t)?t.join(`, `):t,` ×`]},e))}),z.annotationError&&(0,H.jsx)(ee,{color:`warn`,title:`Annotations unavailable`,children:z.annotationError}),z.annotations?.truncated&&(0,H.jsx)(T,{size:`xs`,c:`warn`,role:`status`,children:`Annotation history is limited.`})]}),B&&(0,H.jsxs)(ee,{color:`bad`,icon:(0,H.jsx)(ke,{size:18,weight:`fill`}),mb:`md`,title:F.error?`Variables could not be loaded`:`Panels could not be loaded`,children:[B.message,B instanceof Me&&(0,H.jsx)(`ul`,{children:B.problems.map((e,t)=>(0,H.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))})]}),(0,H.jsx)(N8,{dashboardId:e,version:t,spec:n,vars:L,results:z.results,annotations:ae,fetching:z.fetching,fetchingIds:z.fetchingIds,staleAt:z.staleAt,time:{...A,compare:N?`previous_period`:void 0},onEditExit:()=>i({...r,edit:void 0}),editing:r.edit===`1`,view:r.view,canManage:!0,agentAvailable:a,onOpenChat:s,onRetry:z.retry,onVariable:oe,onZoom:E,zoomed:k,onZoomReset:O,onView:ce,onRangePending:v,shortcutScope:p,onShortcuts:()=>d(!0),overlayOpen:c||u||!!r.drill,returnViewFocus:h.restore,onVisible:ie,onPoint:(e,t)=>{let n=S8(e,z.results.get(e.id),t,P);n&&i({...r,vars:n.vars,drill:JSON.stringify(n.target)},!1)}}),(0,H.jsx)(H8,{client:y5,spec:n,time:A,vars:L,target:Mt(r.drill),onChange:e=>i({...r,drill:e?JSON.stringify(e):void 0},!1)}),(0,H.jsx)(o5,{id:e,currentVersion:t,opened:c,onClose:()=>l(!1),onRestored:e=>{w(e.version);let t=new Set(e.spec.panels.map(e=>e.id)),n=Mt(r.drill),a=r.view&&!t.has(r.view)?void 0:r.view,o=n&&!t.has(n.panel_id)?void 0:r.drill;(a!==r.view||o!==r.drill)&&i({...r,view:a,drill:o},!0)}}),(0,H.jsx)(g5,{opened:u,onClose:()=>d(!1),fullscreen:!!r.view,enabled:m.enabled,onEnabled:m.change})]})}export{Yi as i,W4 as n,V4 as r,x5 as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/panel-sql-editor-DQvDThY1.js b/internal/ui/dist/assets/panel-sql-editor-BFXSBGw8.js similarity index 99% rename from internal/ui/dist/assets/panel-sql-editor-DQvDThY1.js rename to internal/ui/dist/assets/panel-sql-editor-BFXSBGw8.js index cae00600..4ef63a64 100644 --- a/internal/ui/dist/assets/panel-sql-editor-DQvDThY1.js +++ b/internal/ui/dist/assets/panel-sql-editor-BFXSBGw8.js @@ -1,4 +1,4 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,_ as i,c as a,d as o,f as s,p as c}from"./brand-DUaZkIz1.js";import{i as l,n as u,r as d}from"./page-BsR2kcwd.js";import{A as f,B as p,C as m,N as h,Q as g,T as _,W as v,jt as y,o as b}from"./index-BBEH7zHj.js";var x=n(e(),1),S=[],ee=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t>1;if(e=ee[r])t=r+1;else return!0;if(t==n)return!1}}function ne(e){return e>=127462&&e<=127487}var re=8205;function ie(e,t,n=!0,r=!0){return(n?ae:oe)(e,t,r)}function ae(e,t,n){if(t==e.length)return t;t&&ce(e.charCodeAt(t))&&le(e.charCodeAt(t-1))&&t--;let r=se(e,t);for(t+=ue(r);t=0&&ne(se(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function oe(e,t,n){for(;t>1;){let r=ae(e,t-2,n);if(r=56320&&e<57344}function le(e){return e>=55296&&e<56320}function ue(e){return e<65536?1:2}var C=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=w(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),fe.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=w(this,e,t);let n=[];return this.decompose(e,t,n,0),fe.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new ge(this),i=new ge(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new ge(this,e)}iterRange(e,t=this.length){return new _e(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ve(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new de(t):fe.from(de.split(t,[]))}},de=class e extends C{constructor(e,t=pe(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new ye(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(he(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=me(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=w(this,t,n);let i=me(this.text,me(r.text,he(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):fe.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=` +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,_ as i,c as a,d as o,f as s,p as c}from"./brand-DUaZkIz1.js";import{i as l,n as u,r as d}from"./page-CFdV4uPH.js";import{A as f,B as p,C as m,N as h,Q as g,T as _,W as v,jt as y,o as b}from"./index-CEp3GmPL.js";var x=n(e(),1),S=[],ee=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t>1;if(e=ee[r])t=r+1;else return!0;if(t==n)return!1}}function ne(e){return e>=127462&&e<=127487}var re=8205;function ie(e,t,n=!0,r=!0){return(n?ae:oe)(e,t,r)}function ae(e,t,n){if(t==e.length)return t;t&&ce(e.charCodeAt(t))&&le(e.charCodeAt(t-1))&&t--;let r=se(e,t);for(t+=ue(r);t=0&&ne(se(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function oe(e,t,n){for(;t>1;){let r=ae(e,t-2,n);if(r=56320&&e<57344}function le(e){return e>=55296&&e<56320}function ue(e){return e<65536?1:2}var C=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=w(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),fe.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=w(this,e,t);let n=[];return this.decompose(e,t,n,0),fe.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new ge(this),i=new ge(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new ge(this,e)}iterRange(e,t=this.length){return new _e(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ve(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new de(t):fe.from(de.split(t,[]))}},de=class e extends C{constructor(e,t=pe(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new ye(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(he(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=me(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=w(this,t,n);let i=me(this.text,me(r.text,he(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):fe.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=` `){[e,t]=w(this,e,t);let r=``;for(let i=0,a=0;i<=t&&ae&&a&&(r+=n),ei&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},fe=class e extends C{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=w(this,t,n),r.lines=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=` `){[e,t]=w(this,e,t);let r=``;for(let i=0,a=0;ie&&i&&(r+=n),ea&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new de(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof de&&c&&(n=u[u.length-1])instanceof de&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new de(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};C.empty=new de([``],0);function pe(e){let t=-1;for(let n of e)t+=n.length+1;return t}function me(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a=n&&(c>r&&(s=s.slice(0,r-i)),i0?1:(e instanceof de?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof de?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(r instanceof de){let i=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=e==0?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[a+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof de?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},_e=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new ge(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value=``,this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=``}},ve=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value=``,this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value=``,this.afterBreak=!1):t?(this.done=!0,this.value=``):n?this.afterBreak?this.value=``:(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<`u`&&(C.prototype[Symbol.iterator]=function(){return this.iter()},ge.prototype[Symbol.iterator]=_e.prototype[Symbol.iterator]=ve.prototype[Symbol.iterator]=function(){return this});var ye=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function w(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function T(e,t,n=!0,r=!0){return ie(e,t,n,r)}function be(e){return e>=56320&&e<57344}function xe(e){return e>=55296&&e<56320}function Se(e,t){let n=e.charCodeAt(t);if(!xe(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return be(r)?(n-55296<<10)+(r-56320)+65536:n}function Ce(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function we(e){return e<65536?1:2}var Te=/\r\n?|\n/,E=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(E||={}),Ee=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return i+(e-r);i+=o}else{if(n!=E.Simple&&c>=e&&(n==E.TrackDel&&re||n==E.TrackBefore&&re))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n=0&&r<=t&&o>=e)return rt?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t=0?`:`+r:``)}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=`number`))throw RangeError(`Invalid JSON representation of ChangeDesc`);return new e(t)}static create(t){return new e(t)}},De=class e extends Ee{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError(`Applying change set to a document with the wrong length`);return ke(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return Ae(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length0&&Oe(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o>1].toJSON()))}return e}static of(t,n,r){let i=[],a=[],o=0,s=null;function c(t=!1){if(!t&&!i.length)return;os||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?C.of(l.split(r||Te)):l:C.empty,d=u.length;if(e==s&&d==0)return;eo&&D(i,e-o,-1),D(i,s-e,d),Oe(a,i,u),o=s}}return l(t),c(!s),s}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError(`Invalid JSON representation of ChangeSet`);let n=[],r=[];for(let e=0;et&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function Oe(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)s=e.sections[o++],c=e.sections[o++];t(i,l,a,u,d),i=l,a=u}}}function Ae(e,t,n,r=!1){let i=[],a=r?[]:null,o=new Me(e),s=new Me(t);for(let e=-1;;)if(o.done&&s.len||s.done&&o.len)throw Error(`Mismatched change set lengths`);else if(o.ins==-1&&s.ins==-1){let e=Math.min(o.len,s.len);D(i,e,-1),o.forward(e),s.forward(e)}else if(s.ins>=0&&(o.ins<0||e==o.i||o.off==0&&(s.len=0&&e=0){let t=0,n=o.len;for(;n;)if(s.ins==-1){let e=Math.min(n,s.len);t+=e,n-=e,s.forward(e)}else if(s.ins==0&&s.lent||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var Me=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?C.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?C.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Ne=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return O.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return O.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!=`number`||typeof e.head!=`number`)throw RangeError(`Invalid JSON representation for SelectionRange`);return O.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},O=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,n=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,n)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=`number`||t.main>=t.ranges.length)throw RangeError(`Invalid JSON representation for EditorSelection`);return new e(t.ranges.map(e=>Ne.fromJSON(e)),t.main)}static single(t,n=t){return new e([e.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw RangeError(`A selection needs at least one range`);for(let r=0,i=0;ie.from-t.from),n=t.indexOf(r);for(let r=1;ri.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function Pe(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var Fe=0,k=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=Fe++,this.default=e([]),this.extensions=typeof i==`function`?i(this):i}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:Ie),!!t.static,t.enables)}of(e){return new Le([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Le(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Le(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function Ie(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var Le=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=Fe++}dynamicSlot(e){let t=this.value,n=this.facet.compareInput,r=this.id,i=e[r]>>1,a=this.type==2,o=!1,s=!1,c=[];for(let t of this.dependencies)t==`doc`?o=!0:t==`selection`?s=!0:(e[t.id]??1)&1||c.push(e[t.id]);return{create(e){return e.values[i]=t(e),1},update(e,r){if(o&&r.docChanged||s&&(r.docChanged||r.selection)||ze(e,c)){let r=t(e);if(a?!Re(r,e.values[i],n):!n(r,e.values[i]))return e.values[i]=r,1}return 0},reconfigure:(e,o)=>{let s,c=o.config.address[r];if(c!=null){let r=Qe(o,c);if(this.dependencies.every(t=>t instanceof k?o.facet(t)===e.facet(t):t instanceof He?o.field(t,!1)==e.field(t,!1):!0)||(a?Re(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}get extension(){return this}};function Re(e,t,n){if(e.length!=t.length)return!1;for(let r=0;re[t.id]),i=n.map(e=>e.type),a=r.filter(e=>!(e&1)),o=e[t.id]>>1;function s(e){let n=[];for(let t=0;te===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet(Ve).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(Ve),i=n.facet(Ve),a;return(a=r.find(e=>e.field==this))&&a!=i.find(e=>e.field==this)?(e.values[t]=a.create(e),1):n.config.address[this.id]==null?(e.values[t]=this.create(e),1):(e.values[t]=n.field(this),0)}}}init(e){return[this,Ve.of({field:this,create:e})]}get extension(){return this}},Ue={lowest:4,low:3,default:2,high:1,highest:0};function We(e){return t=>new Ke(t,e)}var Ge={highest:We(Ue.highest),high:We(Ue.high),default:We(Ue.default),low:We(Ue.low),lowest:We(Ue.lowest)},Ke=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},qe=class e{of(e){return new Je(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},Je=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},Ye=class e{constructor(e,t,n,r,i,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of Xe(t,n,o))e instanceof He?i.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let s=Object.create(null),c=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let u=r?.config.facets;for(let e in a){let t=a[e],n=t[0].facet,i=u&&u[e]||[];if(t.every(e=>e.type==0)){if(s[n.id]=c.length<<1|1,Ie(i,t))c.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));c.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}}else{for(let e of t)e.type==0?(s[e.id]=c.length<<1|1,c.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[n.id]=l.length<<1,l.push(e=>Be(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function Xe(e,t,n){let r=[[],[],[],[],[]],i=new Map;function a(e,o){let s=i.get(e);if(s!=null){if(s<=o)return;let t=r[s].indexOf(e);t>-1&&r[s].splice(t,1),e instanceof Je&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof Je){if(n.has(e.compartment))throw RangeError(`Duplicate use of compartment in extensions`);let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),a(r,o)}else if(e instanceof Ke)a(e.inner,e.prec);else if(e instanceof He)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof Le)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,Ue.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}).`);if(t==e)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,Ue.default),r.reduce((e,t)=>e.concat(t))}function Ze(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw Error(`Cyclic dependency between fields and/or facets`);if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function Qe(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var $e=k.define(),et=k.define({combine:e=>e.some(e=>e),static:!0}),tt=k.define({combine:e=>e.length?e[0]:void 0,static:!0}),nt=k.define(),rt=k.define(),it=k.define(),at=k.define({combine:e=>e.length?e[0]:!1}),ot=class{constructor(e,t){this.type=e,this.value=t}static define(){return new st}},st=class{of(e){return new ot(this,e)}},ct=class{constructor(e){this.map=e}of(e){return new A(this,e)}},A=class e{constructor(e,t){this.type=e,this.value=t}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new e(this.type,n)}is(e){return this.type==e}static define(e={}){return new ct(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}};A.reconfigure=A.define(),A.appendConfig=A.define();var lt=class e{constructor(t,n,r,i,a,o){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Pe(r,n.newLength),a.some(t=>t.type==e.time)||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}get newDoc(){return this._doc||=this.changes.apply(this.startState.doc)}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(e.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]==`.`))}};lt.time=ot.define(),lt.userEvent=ot.define(),lt.addToHistory=ot.define(),lt.remote=ot.define();function ut(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r=e[r]))a=e[r++],o=e[r++];else if(i=0;n--){let i=r[n](e);e=i instanceof lt?i:Array.isArray(i)&&i.length==1&&i[0]instanceof lt?i[0]:pt(t,_t(i),!1)}return e}function ht(e){let t=e.startState,n=t.facet(it),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=dt(r,ft(t,a,e.changes.newLength),!0))}return r==e?e:lt.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var gt=[];function _t(e){return e==null?gt:Array.isArray(e)?e:[e]}var vt=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(vt||={}),yt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,bt;try{bt=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function xt(e){if(bt)return bt.test(e);for(let t=0;t`€`&&(n.toUpperCase()!=n.toLowerCase()||yt.test(n)))return!0}return!1}function St(e){return t=>{if(!/\S/.test(t))return vt.Space;if(xt(t))return vt.Word;for(let n=0;n-1)return vt.Word;return vt.Other}}var j=class e{constructor(e,t,n,r,i,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let e=0;ei.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(A.reconfigure)?(n=null,r=e.value):e.is(A.appendConfig)&&(n=null,r=_t(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=Ye.resolve(r,i,this),a=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=t.startState.facet(et)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,o,a,(e,n)=>n.update(e,t),t)}replaceSelection(e){return typeof e==`string`&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:O.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=_t(n.effects);for(let n=1;nn.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:O.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=Ye.resolve(t.extensions||[],new Map),r=t.doc instanceof C?t.doc:C.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||Te)),i=t.selection?t.selection instanceof O?t.selection:O.single(t.selection.anchor,t.selection.head):O.single(0);return Pe(i,r.length),n.staticFacet(et)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||` diff --git a/internal/ui/dist/assets/settings-sUA_tcIn.js b/internal/ui/dist/assets/settings-NQwuPzSG.js similarity index 58% rename from internal/ui/dist/assets/settings-sUA_tcIn.js rename to internal/ui/dist/assets/settings-NQwuPzSG.js index 9d092f7c..4fdfefc1 100644 --- a/internal/ui/dist/assets/settings-sUA_tcIn.js +++ b/internal/ui/dist/assets/settings-NQwuPzSG.js @@ -1,4 +1,4 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,M as i,_ as a,a as o,c as s,d as c,f as l,i as u,o as d,p as f,r as p,x as m,y as h}from"./brand-DUaZkIz1.js";import{t as g}from"./Tooltip-B3r3s_B9.js";import{n as _,r as v,t as y}from"./WarningCircle.es-BgWO6KzZ.js";import{At as b,Ft as x,L as S,Q as C,R as w,S as T,W as E,jt as D,z as O}from"./index-BBEH7zHj.js";var k=n(e(),1);function A(e={}){let t=e.timeout??2e3,[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),o=(0,k.useRef)(null);(0,k.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var j=t(),M={timeout:1e3};function N(e){let{children:t,timeout:n,value:r,...a}=i(`CopyButton`,M,e),o=A({timeout:n});return(0,j.jsx)(j.Fragment,{children:t({copy:()=>o.copy(r),copied:o.copied,...a})})}N.displayName=`@mantine/core/CopyButton`;var P=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),F=k.forwardRef((e,t)=>k.createElement(o,{ref:t,...e,weights:P}));F.displayName=`ArrowsClockwiseIcon`;var I=F,L=[`settings`,`ingest`];function R(e,t){let n=e.trim();return t||/^https:\/\//i.test(n)||/:443$/.test(n)}function z(e,t,n){if(/^https?:\/\//i.test(e.trim()))try{let t=new URL(e);e=`${t.protocol}//${t.hostname}:${t.port||(t.protocol===`https:`?`443`:`80`)}`}catch{}let r=R(e,n)?``:` +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,M as i,_ as a,a as o,c as s,d as c,f as l,i as u,o as d,p as f,r as p,x as m,y as h}from"./brand-DUaZkIz1.js";import{t as g}from"./Tooltip-B3r3s_B9.js";import{n as _,r as v,t as y}from"./WarningCircle.es-DWFLwubM.js";import{At as b,Ft as x,L as S,Q as C,R as w,S as T,W as E,jt as D,z as O}from"./index-CEp3GmPL.js";var k=n(e(),1);function A(e={}){let t=e.timeout??2e3,[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),o=(0,k.useRef)(null);(0,k.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var j=t(),M={timeout:1e3};function N(e){let{children:t,timeout:n,value:r,...a}=i(`CopyButton`,M,e),o=A({timeout:n});return(0,j.jsx)(j.Fragment,{children:t({copy:()=>o.copy(r),copied:o.copied,...a})})}N.displayName=`@mantine/core/CopyButton`;var P=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),F=k.forwardRef((e,t)=>k.createElement(o,{ref:t,...e,weights:P}));F.displayName=`ArrowsClockwiseIcon`;var I=F,L=[`settings`,`ingest`],R=[`settings`,`oauth`,`connections`];function z(){let e=C(),t=E({queryKey:R,queryFn:()=>S(`/api/auth/oauth/connections`)}),[n,i]=(0,k.useState)(null),[o,u]=(0,k.useState)(``),p=_({onMutate:async()=>{u(``),await e.cancelQueries({queryKey:R})},mutationFn:async e=>{if(!(await O(`/api/auth/oauth/connections/${encodeURIComponent(e.client_id)}/revoke`,{method:`POST`})).ok)throw Error(`Fanout could not disconnect this agent. Try again.`)},onSuccess:(t,n)=>{e.setQueryData(R,e=>e&&{connections:e.connections.filter(e=>e.client_id!==n.client_id)}),i(null),u(`${n.client_name} disconnected.`)}});return(0,j.jsxs)(s,{gap:`sm`,children:[(0,j.jsxs)(r,{children:[(0,j.jsx)(d,{order:2,fz:22,lts:`-0.02em`,children:`Connected agents`}),(0,j.jsx)(l,{c:`dimmed`,size:`sm`,mt:2,children:`Agents you have authorized to access Fanout through MCP.`})]}),(0,j.jsx)(m,{withBorder:!0,radius:`lg`,p:`lg`,children:t.data?t.data.connections.length===0?(0,j.jsxs)(l,{c:`dimmed`,size:`sm`,children:[`No agents connected. `,(0,j.jsx)(v,{href:T.connect,target:`_blank`,rel:`noopener noreferrer`,inherit:!0,children:`Connect an agent over MCP`}),` to get started.`]}):(0,j.jsx)(s,{gap:`md`,children:t.data.connections.map(e=>(0,j.jsxs)(a,{justify:`space-between`,align:`center`,children:[(0,j.jsxs)(r,{style:{minWidth:0,overflowWrap:`anywhere`},children:[(0,j.jsx)(l,{size:`sm`,fw:600,children:e.client_name}),(0,j.jsxs)(l,{size:`xs`,c:`dimmed`,children:[`Connected `,(0,j.jsx)(`time`,{dateTime:e.connected_at,children:new Date(e.connected_at).toLocaleDateString()})]})]}),(0,j.jsx)(c,{variant:`default`,size:`sm`,onClick:()=>{p.reset(),i(e)},disabled:p.isPending,children:`Disconnect`})]},e.client_id))}):t.isLoading?(0,j.jsx)(l,{c:`dimmed`,size:`sm`,role:`status`,children:`Loading connected agents…`}):(0,j.jsxs)(s,{gap:`sm`,align:`flex-start`,children:[(0,j.jsx)(f,{color:`bad`,radius:`md`,icon:(0,j.jsx)(y,{size:18,weight:`fill`}),children:`Fanout could not load your connected agents.`}),(0,j.jsx)(c,{size:`compact-sm`,variant:`light`,onClick:()=>void t.refetch(),children:`Try again`})]})}),(0,j.jsx)(l,{size:`sm`,c:`dimmed`,role:`status`,"aria-live":`polite`,children:o}),(0,j.jsx)(D,{opened:n!==null,onClose:()=>!p.isPending&&i(null),title:`Disconnect ${n?.client_name??`agent`}?`,centered:!0,radius:`md`,children:(0,j.jsxs)(s,{gap:`md`,children:[(0,j.jsx)(l,{size:`sm`,c:`dimmed`,children:`This agent loses access immediately. Your other agents and browser session stay connected. You can authorize the agent again to reconnect.`}),p.isError&&(0,j.jsx)(f,{color:`bad`,radius:`md`,icon:(0,j.jsx)(y,{size:18,weight:`fill`}),children:`Fanout could not disconnect this agent. Try again.`}),(0,j.jsxs)(a,{justify:`flex-end`,gap:`sm`,children:[(0,j.jsx)(c,{variant:`default`,size:`sm`,onClick:()=>{p.reset(),i(null)},disabled:p.isPending,children:`Cancel`}),(0,j.jsx)(c,{color:`bad`,size:`sm`,loading:p.isPending,onClick:()=>n&&p.mutate(n),children:`Disconnect`})]})]})})]})}function B(e,t){let n=e.trim();return t||/^https:\/\//i.test(n)||/:443$/.test(n)}function V(e,t,n){if(/^https?:\/\//i.test(e.trim()))try{let t=new URL(e);e=`${t.protocol}//${t.hostname}:${t.port||(t.protocol===`https:`?`443`:`80`)}`}catch{}let r=B(e,n)?``:` tls: insecure: true`;return`exporters: otlp/fanout: @@ -13,4 +13,4 @@ service: logs: exporters: [otlp/fanout] metrics: - exporters: [otlp/fanout]`}function B({label:e,value:t,hint:n}){return(0,j.jsxs)(s,{gap:4,children:[(0,j.jsx)(l,{size:`sm`,fw:600,children:e}),(0,j.jsxs)(a,{gap:`xs`,wrap:`nowrap`,align:`center`,children:[(0,j.jsx)(x,{style:{flex:1,overflowX:`auto`},children:t}),(0,j.jsx)(N,{value:t,timeout:1500,children:({copied:t,copy:n})=>(0,j.jsx)(g,{label:t?`Copied`:`Copy ${e.toLowerCase()}`,withArrow:!0,children:(0,j.jsx)(c,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:n,"aria-label":`Copy ${e.toLowerCase()}`,children:t?(0,j.jsx)(u,{size:15,weight:`bold`}):(0,j.jsx)(p,{size:15})})})})]}),n&&(0,j.jsx)(l,{c:`dimmed`,size:`xs`,children:n})]})}function V(){let e=w(),t=C(),n=E({queryKey:L,queryFn:()=>S(`/api/settings/ingest`)}),[i,o]=(0,k.useState)(!1),[h,A]=(0,k.useState)(null),[M,P]=(0,k.useState)(null),F=_({gcTime:0,onMutate:()=>t.cancelQueries({queryKey:L}),mutationFn:async()=>{let e=await O(`/api/settings/ingest/token/rotate`,{method:`POST`}).catch(()=>{throw Error(`Fanout could not be reached. A token may still have been issued — reload this page before trying again.`)});if(!e.ok)throw Error(`Fanout could not issue a new token. Try again.`);return e.json()},onSuccess:e=>{o(!1),A(e.ingest_token??null),t.setQueryData(L,{token_required:e.token_required,suggested_endpoint:e.suggested_endpoint,tls_configured:e.tls_configured,header_name:e.header_name})}});function V(){A(null),F.reset()}if(!n.data)return n.isLoading?(0,j.jsx)(H,{}):(0,j.jsx)(U,{onRetry:()=>void n.refetch()});let{suggested_endpoint:W,header_name:G,tls_configured:K,token_required:q}=n.data,J=M??W,Y=J.trim()||W,X=e.role===`admin`,Z=`${G}: Bearer `;return(0,j.jsxs)(r,{component:`main`,maw:760,mx:`auto`,px:{base:`md`,sm:`xl`},pt:{base:`lg`,sm:`xl`},pb:`xl`,children:[(0,j.jsxs)(s,{gap:`xl`,children:[(0,j.jsxs)(r,{children:[(0,j.jsx)(d,{order:1,fz:32,lts:`-0.03em`,children:`Connect telemetry`}),(0,j.jsx)(l,{c:`dimmed`,mt:2,children:`Point an OpenTelemetry collector or SDK at this workspace.`})]}),(0,j.jsx)(m,{withBorder:!0,radius:`lg`,p:`lg`,children:(0,j.jsxs)(s,{gap:`lg`,children:[(0,j.jsxs)(s,{gap:4,children:[(0,j.jsx)(l,{size:`sm`,fw:600,children:`Endpoint`}),(0,j.jsxs)(a,{gap:`xs`,wrap:`nowrap`,align:`center`,children:[(0,j.jsx)(b,{"aria-label":`Endpoint`,value:J,onChange:e=>P(e.currentTarget.value),style:{flex:1},styles:{input:{fontFamily:`var(--mantine-font-family-monospace)`}}}),(0,j.jsx)(N,{value:Y,timeout:1500,children:({copied:e,copy:t})=>(0,j.jsx)(g,{label:e?`Copied`:`Copy endpoint`,withArrow:!0,children:(0,j.jsx)(c,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:t,"aria-label":`Copy endpoint`,children:e?(0,j.jsx)(u,{size:15,weight:`bold`}):(0,j.jsx)(p,{size:15})})})})]}),(0,j.jsxs)(l,{c:`dimmed`,size:`xs`,children:[R(Y,K)?`OTLP over gRPC, secured with TLS.`:`OTLP over gRPC. Fanout serves this endpoint in plaintext, so an exporter needs tls.insecure unless a proxy in front of it terminates TLS.`,` Edit this when collectors reach Fanout through another hostname.`]})]}),(0,j.jsx)(B,{label:`Authorization`,value:Z,hint:`Send the token your workspace issued. Fanout stores only its hash, so it cannot show you an existing one.`})]})}),(0,j.jsxs)(s,{gap:`sm`,children:[(0,j.jsxs)(r,{children:[(0,j.jsx)(d,{order:2,fz:22,lts:`-0.02em`,children:`Collector configuration`}),(0,j.jsx)(l,{c:`dimmed`,size:`sm`,mt:2,children:`Merge these blocks into your collector configuration, alongside the receivers it already has, and set INGEST_TOKEN in its environment.`})]}),(0,j.jsx)(m,{withBorder:!0,radius:`lg`,p:`md`,children:(0,j.jsxs)(s,{gap:`sm`,children:[(0,j.jsx)(x,{block:!0,style:{fontSize:12},children:z(Y,G,K)}),(0,j.jsx)(a,{justify:`flex-end`,children:(0,j.jsx)(N,{value:z(Y,G,K),timeout:1500,children:({copied:e,copy:t})=>(0,j.jsx)(c,{variant:`light`,size:`compact-sm`,leftSection:e?(0,j.jsx)(u,{size:15,weight:`bold`}):(0,j.jsx)(p,{size:15}),onClick:t,children:e?`Copied`:`Copy configuration`})})})]})})]}),(0,j.jsxs)(s,{gap:`sm`,children:[(0,j.jsxs)(r,{children:[(0,j.jsx)(d,{order:2,fz:22,lts:`-0.02em`,children:`Ingest token`}),(0,j.jsx)(l,{c:`dimmed`,size:`sm`,mt:2,children:q?`This workspace has a token. Rotating issues a new one and stops the current one working immediately.`:`This workspace has no token yet, so it is rejecting telemetry. Issue one to start accepting data.`})]}),(0,j.jsx)(m,{withBorder:!0,radius:`lg`,p:`lg`,children:h?(0,j.jsxs)(s,{gap:`sm`,children:[(0,j.jsx)(l,{size:`sm`,fw:600,children:`Your new token`}),(0,j.jsx)(x,{block:!0,children:`${G}: Bearer ${h}`}),(0,j.jsx)(l,{c:`dimmed`,size:`xs`,children:`Fanout shows this once and keeps only its hash. Store it with your collector secrets before closing this, then update any collector still using the old token. Lose it and the only way back is another rotation.`}),(0,j.jsxs)(a,{children:[(0,j.jsx)(N,{value:`${G}: Bearer ${h}`,timeout:1500,children:({copied:e,copy:t})=>(0,j.jsx)(c,{variant:`light`,size:`compact-sm`,leftSection:e?(0,j.jsx)(u,{size:15,weight:`bold`}):(0,j.jsx)(p,{size:15}),onClick:t,children:e?`Copied`:`Copy header`})}),(0,j.jsx)(c,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:V,children:`Done`})]})]}):X?(0,j.jsxs)(a,{justify:`space-between`,align:`center`,children:[(0,j.jsx)(l,{size:`sm`,c:`dimmed`,children:q?`Rotate when a token may have been exposed.`:`No token issued yet.`}),(0,j.jsx)(c,{variant:q?`default`:`filled`,leftSection:(0,j.jsx)(I,{size:15,weight:`bold`}),onClick:()=>{F.reset(),o(!0)},children:q?`Rotate token`:`Issue token`})]}):(0,j.jsx)(l,{size:`sm`,c:`dimmed`,children:`An administrator issues and rotates the ingest token.`})})]}),(0,j.jsxs)(l,{c:`dimmed`,size:`xs`,children:[(0,j.jsx)(v,{href:T.ingest,target:`_blank`,rel:`noopener noreferrer`,inherit:!0,children:`Sending telemetry`}),` covers SDK setup, the collector, and the OTLP/HTTP endpoint.`]})]}),(0,j.jsx)(D,{opened:i,onClose:()=>!F.isPending&&o(!1),title:q?`Rotate the ingest token?`:`Issue an ingest token?`,centered:!0,radius:`md`,children:(0,j.jsxs)(s,{gap:`md`,children:[(0,j.jsx)(l,{size:`sm`,c:`dimmed`,children:q?`The current token stops working the moment the new one is issued. Any collector still sending with it will be rejected until you update it. Fanout shows the new token once and stores only its hash.`:`Fanout will show the new token once, and store only its hash.`}),F.isError&&(0,j.jsx)(f,{color:`bad`,radius:`md`,icon:(0,j.jsx)(y,{size:18,weight:`fill`}),children:F.error instanceof Error?F.error.message:`Fanout could not issue a new token.`}),(0,j.jsxs)(a,{justify:`flex-end`,gap:`sm`,children:[(0,j.jsx)(c,{variant:`default`,size:`sm`,onClick:()=>{F.reset(),o(!1)},disabled:F.isPending,children:`Cancel`}),(0,j.jsx)(c,{color:q?`bad`:void 0,size:`sm`,loading:F.isPending,onClick:()=>F.mutate(),children:q?`Rotate token`:`Issue token`})]})]})})]})}function H(){return(0,j.jsxs)(a,{justify:`center`,mih:`50vh`,gap:`sm`,children:[(0,j.jsx)(h,{size:`sm`}),(0,j.jsx)(l,{c:`dimmed`,size:`sm`,children:`Loading connection details…`})]})}function U({onRetry:e}){return(0,j.jsx)(a,{justify:`center`,mih:`50vh`,children:(0,j.jsx)(f,{color:`bad`,radius:`md`,icon:(0,j.jsx)(y,{size:18,weight:`fill`}),maw:420,children:(0,j.jsxs)(s,{gap:`sm`,align:`flex-start`,children:[(0,j.jsx)(l,{size:`sm`,children:`Fanout could not load this workspace's connection details.`}),(0,j.jsx)(c,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:e,children:`Try again`})]})})})}var W=V;export{W as component}; \ No newline at end of file + exporters: [otlp/fanout]`}function H({label:e,value:t,hint:n}){return(0,j.jsxs)(s,{gap:4,children:[(0,j.jsx)(l,{size:`sm`,fw:600,children:e}),(0,j.jsxs)(a,{gap:`xs`,wrap:`nowrap`,align:`center`,children:[(0,j.jsx)(x,{style:{flex:1,overflowX:`auto`},children:t}),(0,j.jsx)(N,{value:t,timeout:1500,children:({copied:t,copy:n})=>(0,j.jsx)(g,{label:t?`Copied`:`Copy ${e.toLowerCase()}`,withArrow:!0,children:(0,j.jsx)(c,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:n,"aria-label":`Copy ${e.toLowerCase()}`,children:t?(0,j.jsx)(u,{size:15,weight:`bold`}):(0,j.jsx)(p,{size:15})})})})]}),n&&(0,j.jsx)(l,{c:`dimmed`,size:`xs`,children:n})]})}function U(){let e=w(),t=C(),n=E({queryKey:L,queryFn:()=>S(`/api/settings/ingest`)}),[i,o]=(0,k.useState)(!1),[h,A]=(0,k.useState)(null),[M,P]=(0,k.useState)(null),F=_({gcTime:0,onMutate:()=>t.cancelQueries({queryKey:L}),mutationFn:async()=>{let e=await O(`/api/settings/ingest/token/rotate`,{method:`POST`}).catch(()=>{throw Error(`Fanout could not be reached. A token may still have been issued — reload this page before trying again.`)});if(!e.ok)throw Error(`Fanout could not issue a new token. Try again.`);return e.json()},onSuccess:e=>{o(!1),A(e.ingest_token??null),t.setQueryData(L,{token_required:e.token_required,suggested_endpoint:e.suggested_endpoint,tls_configured:e.tls_configured,header_name:e.header_name})}});function R(){A(null),F.reset()}if(!n.data)return n.isLoading?(0,j.jsx)(W,{}):(0,j.jsx)(G,{onRetry:()=>void n.refetch()});let{suggested_endpoint:U,header_name:K,tls_configured:q,token_required:J}=n.data,Y=M??U,X=Y.trim()||U,Z=e.role===`admin`,Q=`${K}: Bearer `;return(0,j.jsxs)(r,{component:`main`,maw:760,mx:`auto`,px:{base:`md`,sm:`xl`},pt:{base:`lg`,sm:`xl`},pb:`xl`,children:[(0,j.jsxs)(s,{gap:`xl`,children:[(0,j.jsxs)(r,{children:[(0,j.jsx)(d,{order:1,fz:32,lts:`-0.03em`,children:`Connect telemetry`}),(0,j.jsx)(l,{c:`dimmed`,mt:2,children:`Point an OpenTelemetry collector or SDK at this workspace.`})]}),(0,j.jsx)(m,{withBorder:!0,radius:`lg`,p:`lg`,children:(0,j.jsxs)(s,{gap:`lg`,children:[(0,j.jsxs)(s,{gap:4,children:[(0,j.jsx)(l,{size:`sm`,fw:600,children:`Endpoint`}),(0,j.jsxs)(a,{gap:`xs`,wrap:`nowrap`,align:`center`,children:[(0,j.jsx)(b,{"aria-label":`Endpoint`,value:Y,onChange:e=>P(e.currentTarget.value),style:{flex:1},styles:{input:{fontFamily:`var(--mantine-font-family-monospace)`}}}),(0,j.jsx)(N,{value:X,timeout:1500,children:({copied:e,copy:t})=>(0,j.jsx)(g,{label:e?`Copied`:`Copy endpoint`,withArrow:!0,children:(0,j.jsx)(c,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:t,"aria-label":`Copy endpoint`,children:e?(0,j.jsx)(u,{size:15,weight:`bold`}):(0,j.jsx)(p,{size:15})})})})]}),(0,j.jsxs)(l,{c:`dimmed`,size:`xs`,children:[B(X,q)?`OTLP over gRPC, secured with TLS.`:`OTLP over gRPC. Fanout serves this endpoint in plaintext, so an exporter needs tls.insecure unless a proxy in front of it terminates TLS.`,` Edit this when collectors reach Fanout through another hostname.`]})]}),(0,j.jsx)(H,{label:`Authorization`,value:Q,hint:`Send the token your workspace issued. Fanout stores only its hash, so it cannot show you an existing one.`})]})}),(0,j.jsxs)(s,{gap:`sm`,children:[(0,j.jsxs)(r,{children:[(0,j.jsx)(d,{order:2,fz:22,lts:`-0.02em`,children:`Collector configuration`}),(0,j.jsx)(l,{c:`dimmed`,size:`sm`,mt:2,children:`Merge these blocks into your collector configuration, alongside the receivers it already has, and set INGEST_TOKEN in its environment.`})]}),(0,j.jsx)(m,{withBorder:!0,radius:`lg`,p:`md`,children:(0,j.jsxs)(s,{gap:`sm`,children:[(0,j.jsx)(x,{block:!0,style:{fontSize:12},children:V(X,K,q)}),(0,j.jsx)(a,{justify:`flex-end`,children:(0,j.jsx)(N,{value:V(X,K,q),timeout:1500,children:({copied:e,copy:t})=>(0,j.jsx)(c,{variant:`light`,size:`compact-sm`,leftSection:e?(0,j.jsx)(u,{size:15,weight:`bold`}):(0,j.jsx)(p,{size:15}),onClick:t,children:e?`Copied`:`Copy configuration`})})})]})})]}),(0,j.jsxs)(s,{gap:`sm`,children:[(0,j.jsxs)(r,{children:[(0,j.jsx)(d,{order:2,fz:22,lts:`-0.02em`,children:`Ingest token`}),(0,j.jsx)(l,{c:`dimmed`,size:`sm`,mt:2,children:J?`This workspace has a token. Rotating issues a new one and stops the current one working immediately.`:`This workspace has no token yet, so it is rejecting telemetry. Issue one to start accepting data.`})]}),(0,j.jsx)(m,{withBorder:!0,radius:`lg`,p:`lg`,children:h?(0,j.jsxs)(s,{gap:`sm`,children:[(0,j.jsx)(l,{size:`sm`,fw:600,children:`Your new token`}),(0,j.jsx)(x,{block:!0,children:`${K}: Bearer ${h}`}),(0,j.jsx)(l,{c:`dimmed`,size:`xs`,children:`Fanout shows this once and keeps only its hash. Store it with your collector secrets before closing this, then update any collector still using the old token. Lose it and the only way back is another rotation.`}),(0,j.jsxs)(a,{children:[(0,j.jsx)(N,{value:`${K}: Bearer ${h}`,timeout:1500,children:({copied:e,copy:t})=>(0,j.jsx)(c,{variant:`light`,size:`compact-sm`,leftSection:e?(0,j.jsx)(u,{size:15,weight:`bold`}):(0,j.jsx)(p,{size:15}),onClick:t,children:e?`Copied`:`Copy header`})}),(0,j.jsx)(c,{variant:`subtle`,color:`gray`,size:`compact-sm`,onClick:R,children:`Done`})]})]}):Z?(0,j.jsxs)(a,{justify:`space-between`,align:`center`,children:[(0,j.jsx)(l,{size:`sm`,c:`dimmed`,children:J?`Rotate when a token may have been exposed.`:`No token issued yet.`}),(0,j.jsx)(c,{variant:J?`default`:`filled`,leftSection:(0,j.jsx)(I,{size:15,weight:`bold`}),onClick:()=>{F.reset(),o(!0)},children:J?`Rotate token`:`Issue token`})]}):(0,j.jsx)(l,{size:`sm`,c:`dimmed`,children:`An administrator issues and rotates the ingest token.`})})]}),(0,j.jsxs)(l,{c:`dimmed`,size:`xs`,children:[(0,j.jsx)(v,{href:T.ingest,target:`_blank`,rel:`noopener noreferrer`,inherit:!0,children:`Sending telemetry`}),` covers SDK setup, the collector, and the OTLP/HTTP endpoint.`]}),(0,j.jsx)(z,{})]}),(0,j.jsx)(D,{opened:i,onClose:()=>!F.isPending&&o(!1),title:J?`Rotate the ingest token?`:`Issue an ingest token?`,centered:!0,radius:`md`,children:(0,j.jsxs)(s,{gap:`md`,children:[(0,j.jsx)(l,{size:`sm`,c:`dimmed`,children:J?`The current token stops working the moment the new one is issued. Any collector still sending with it will be rejected until you update it. Fanout shows the new token once and stores only its hash.`:`Fanout will show the new token once, and store only its hash.`}),F.isError&&(0,j.jsx)(f,{color:`bad`,radius:`md`,icon:(0,j.jsx)(y,{size:18,weight:`fill`}),children:F.error instanceof Error?F.error.message:`Fanout could not issue a new token.`}),(0,j.jsxs)(a,{justify:`flex-end`,gap:`sm`,children:[(0,j.jsx)(c,{variant:`default`,size:`sm`,onClick:()=>{F.reset(),o(!1)},disabled:F.isPending,children:`Cancel`}),(0,j.jsx)(c,{color:J?`bad`:void 0,size:`sm`,loading:F.isPending,onClick:()=>F.mutate(),children:J?`Rotate token`:`Issue token`})]})]})})]})}function W(){return(0,j.jsxs)(a,{justify:`center`,mih:`50vh`,gap:`sm`,children:[(0,j.jsx)(h,{size:`sm`}),(0,j.jsx)(l,{c:`dimmed`,size:`sm`,children:`Loading connection details…`})]})}function G({onRetry:e}){return(0,j.jsx)(a,{justify:`center`,mih:`50vh`,children:(0,j.jsx)(f,{color:`bad`,radius:`md`,icon:(0,j.jsx)(y,{size:18,weight:`fill`}),maw:420,children:(0,j.jsxs)(s,{gap:`sm`,align:`flex-start`,children:[(0,j.jsx)(l,{size:`sm`,children:`Fanout could not load this workspace's connection details.`}),(0,j.jsx)(c,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:e,children:`Try again`})]})})})}var K=U;export{K as component}; \ No newline at end of file diff --git a/internal/ui/dist/index.html b/internal/ui/dist/index.html index 6c5d4981..1d36f71d 100644 --- a/internal/ui/dist/index.html +++ b/internal/ui/dist/index.html @@ -21,7 +21,7 @@ document.documentElement.setAttribute("data-mantine-color-scheme", computed); } catch (e) {} - + diff --git a/site/src/content/docs/guides/connect-over-mcp.mdx b/site/src/content/docs/guides/connect-over-mcp.mdx index 399b26ea..d1f457d1 100644 --- a/site/src/content/docs/guides/connect-over-mcp.mdx +++ b/site/src/content/docs/guides/connect-over-mcp.mdx @@ -62,6 +62,15 @@ claude mcp add --transport http fanout https://fanout.example.com/mcp Use your instance's public URL, then authorize the connection in your browser. +### Disconnect an agent + +Open **Settings → Connected agents**, find the agent, and choose **Disconnect**. +Confirm to revoke its access immediately. Your other agents and browser session +stay connected. To reconnect, authorize that agent again in your browser. + +Administrators can still revoke all of a user's access, including browser +sessions and OAuth tokens. + ## Protocol Fanout serves modern and legacy MCP clients concurrently over Streamable HTTP diff --git a/site/src/content/docs/reference/http-routes.mdx b/site/src/content/docs/reference/http-routes.mdx index 143c3e34..bd8e717b 100644 --- a/site/src/content/docs/reference/http-routes.mdx +++ b/site/src/content/docs/reference/http-routes.mdx @@ -23,7 +23,7 @@ configuration: - `/debug/pprof/*` — only when `FANOUT_PPROF_ENABLED` is true, which is **not** the default. Enabling it also turns on mutex and block sampling. -- `/mcp`, `/api/mcp`, `/oauth/*` and `/.well-known/*` — only when +- `/mcp`, `/api/mcp`, `/api/auth/oauth/*`, `/oauth/*` and `/.well-known/*` — only when `FANOUT_MCP_ENABLED` is true, which **is** the default. - `/api/agent/*` — only when `FANOUT_AI_PROVIDER` selects `anthropic` or `openai`, with that provider's required key. An empty provider disables chat. @@ -110,6 +110,8 @@ and path. [Roles](/reference/roles) maps capabilities to roles. | `GET` | `/api/auth/me` | any signed-in user | | `GET` | `/api/auth/oauth/authorize` | any signed-in user | | `POST` | `/api/auth/oauth/authorize` | any signed-in user | +| `GET` | `/api/auth/oauth/connections` | any signed-in user | +| `POST` | `/api/auth/oauth/connections/:id/revoke` | any signed-in user | | `GET` | `/api/auth/oidc/callback` | none | | `GET` | `/api/auth/oidc/start` | none | | `POST` | `/api/auth/setup` | none | diff --git a/ui/host/src/settings.test.tsx b/ui/host/src/settings.test.tsx index 64b4cefd..1d6df79f 100644 --- a/ui/host/src/settings.test.tsx +++ b/ui/host/src/settings.test.tsx @@ -6,11 +6,12 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import Settings from "./settings"; const fetchMock = vi.fn(); +const agentsFetchMock = vi.fn(); let role = "admin"; vi.mock("./auth", () => ({ useViewer: () => ({ id: "u1", email: "v@labstack.com", display_name: "V", status: "active" as const, role }), - authorizedFetch: (url: string, init?: RequestInit) => fetchMock(url, init), + authorizedFetch: (url: string, init?: RequestInit) => url.startsWith("/api/auth/oauth/connections") ? agentsFetchMock(url, init) : fetchMock(url, init), })); function json(body: unknown, status = 200) { @@ -43,6 +44,8 @@ describe("connect telemetry", () => { role = "admin"; vi.stubGlobal("fetch", fetchMock); fetchMock.mockReset(); + agentsFetchMock.mockReset(); + agentsFetchMock.mockImplementation(async () => json({ connections: [] })); fetchMock.mockImplementation(async () => json(connection)); }); afterEach(() => { vi.unstubAllGlobals(); document.body.innerHTML = ""; }); @@ -214,3 +217,121 @@ describe("connect telemetry", () => { await act(async () => root.unmount()); }); }); + + +describe("connected agents", () => { + const codex = { client_id: "codex-id", client_name: "Codex", connected_at: "2026-10-01T12:00:00Z", refreshed_at: "2026-10-02T12:00:00Z", scope: "telemetry:read" }; + const claude = { ...codex, client_id: "claude-id", client_name: "Claude Code" }; + + beforeEach(() => { + role = "viewer"; + vi.stubGlobal("fetch", fetchMock); + fetchMock.mockReset(); + agentsFetchMock.mockReset(); + fetchMock.mockImplementation(async () => json(connection)); + agentsFetchMock.mockImplementation(async () => json({ connections: [codex, claude] })); + }); + afterEach(() => { vi.unstubAllGlobals(); document.body.innerHTML = ""; }); + + function disconnectButton(scope: ParentNode = document) { + const button = [...scope.querySelectorAll("button")].find((button) => button.textContent?.trim() === "Disconnect"); + if (!button) throw new Error("disconnect button not found"); + return button; + } + + async function openDisconnect() { + await vi.waitFor(() => expect(document.body.textContent).toContain("Claude Code")); + await act(async () => disconnectButton().click()); + await vi.waitFor(() => expect(document.querySelector('[role="dialog"]')).not.toBeNull()); + const dialog = document.querySelector('[role="dialog"]'); + if (!dialog) throw new Error("confirmation dialog not found"); + return dialog; + } + + it("lists names and connection dates for a viewer", async () => { + const root = await mount(); + await vi.waitFor(() => expect(document.body.textContent).toContain("Claude Code")); + expect(document.body.textContent).toContain("Connected agents"); + expect(document.body.textContent).toContain("Codex"); + expect(document.body.textContent).toContain(`Connected ${new Date(codex.connected_at).toLocaleDateString()}`); + expect(document.querySelector("time")?.getAttribute("datetime")).toBe(codex.connected_at); + expect(document.querySelectorAll("time")).toHaveLength(2); + await act(async () => root.unmount()); + }); + + it("links the empty state to the MCP connect guide", async () => { + agentsFetchMock.mockImplementation(async () => json({ connections: [] })); + const root = await mount(); + await vi.waitFor(() => expect(document.body.textContent).toContain("No agents connected")); + expect(document.querySelector('a[href="https://fanout.run/guides/connect-over-mcp"]')?.textContent).toBe("Connect an agent over MCP"); + await act(async () => root.unmount()); + }); + + it("confirms before disconnecting and allows cancellation", async () => { + const root = await mount(); + const dialog = await openDisconnect(); + expect(dialog.textContent).toContain("Disconnect Codex?"); + expect(agentsFetchMock.mock.calls.some(([, init]) => init?.method === "POST")).toBe(false); + const cancel = [...dialog.querySelectorAll("button")].find((button) => button.textContent?.trim() === "Cancel"); + if (!cancel) throw new Error("cancel button not found"); + await act(async () => cancel.click()); + expect(agentsFetchMock.mock.calls.some(([, init]) => init?.method === "POST")).toBe(false); + expect(document.querySelectorAll("time")).toHaveLength(2); + await act(async () => root.unmount()); + }); + + it("removes only the disconnected row and announces the result", async () => { + agentsFetchMock.mockImplementation(async (_url, init) => json(init?.method === "POST" ? { ok: true } : { connections: [codex, claude] })); + const root = await mount(); + const dialog = await openDisconnect(); + await act(async () => disconnectButton(dialog).click()); + await vi.waitFor(() => expect([...document.querySelectorAll('[role="status"]')].some((status) => status.textContent === "Codex disconnected.")).toBe(true)); + expect(agentsFetchMock).toHaveBeenCalledWith("/api/auth/oauth/connections/codex-id/revoke", { method: "POST" }); + expect(document.querySelectorAll("time")).toHaveLength(1); + expect(document.body.textContent).toContain("Claude Code"); + const cached = client.getQueryData<{ connections: typeof codex[] }>(["settings", "oauth", "connections"]); + expect(cached?.connections.map((agent) => agent.client_id)).toEqual(["claude-id"]); + await act(async () => root.unmount()); + }); + + it("keeps the row and shows a failed disconnect so it can be retried", async () => { + agentsFetchMock.mockImplementation(async (_url, init) => init?.method === "POST" ? json({ code: "internal", message: "failed" }, 500) : json({ connections: [codex, claude] })); + const root = await mount(); + const dialog = await openDisconnect(); + await act(async () => disconnectButton(dialog).click()); + await vi.waitFor(() => expect(dialog.textContent).toContain("could not disconnect this agent")); + expect(document.querySelectorAll("time")).toHaveLength(2); + expect(document.querySelector('[role="alert"]')?.textContent).toContain("Try again"); + expect(document.body.textContent).not.toContain("Codex disconnected."); + agentsFetchMock.mockImplementation(async () => json({ ok: true })); + await act(async () => disconnectButton(dialog).click()); + await vi.waitFor(() => expect(document.querySelectorAll("time")).toHaveLength(1)); + await act(async () => root.unmount()); + }); + + it("shows a network failure without removing the agent", async () => { + agentsFetchMock.mockImplementation(async (_url, init) => { + if (init?.method === "POST") throw new Error("Failed to fetch"); + return json({ connections: [codex, claude] }); + }); + const root = await mount(); + const dialog = await openDisconnect(); + await act(async () => disconnectButton(dialog).click()); + await vi.waitFor(() => expect(dialog.textContent).toContain("could not disconnect this agent")); + expect(document.querySelectorAll("time")).toHaveLength(2); + await act(async () => root.unmount()); + }); + + it("offers a retry when agents cannot be loaded", async () => { + agentsFetchMock.mockImplementation(async () => json({ code: "internal", message: "failed" }, 500)); + const root = await mount(); + await vi.waitFor(() => expect(document.body.textContent).toContain("could not load your connected agents")); + expect(document.body.textContent).not.toContain("No agents connected"); + agentsFetchMock.mockImplementation(async () => json({ connections: [codex] })); + const retry = [...document.querySelectorAll("button")].find((button) => button.textContent?.trim() === "Try again"); + if (!retry) throw new Error("retry button not found"); + await act(async () => retry.click()); + await vi.waitFor(() => expect(document.querySelectorAll("time")).toHaveLength(1)); + await act(async () => root.unmount()); + }); +}); diff --git a/ui/host/src/settings.tsx b/ui/host/src/settings.tsx index 14b705c6..4cbbec65 100644 --- a/ui/host/src/settings.tsx +++ b/ui/host/src/settings.tsx @@ -15,6 +15,76 @@ type IngestSettings = { const ingestQueryKey = ["settings", "ingest"] as const; +type OAuthConnection = { + client_id: string; + client_name: string; + connected_at: string; + refreshed_at: string; + scope: string; +}; + +const agentsQueryKey = ["settings", "oauth", "connections"] as const; + +function ConnectedAgents() { + const queryClient = useQueryClient(); + const agents = useQuery({ queryKey: agentsQueryKey, queryFn: () => getJSON<{ connections: OAuthConnection[] }>("/api/auth/oauth/connections") }); + const [selected, setSelected] = useState(null); + const [announcement, setAnnouncement] = useState(""); + const disconnect = useMutation({ + onMutate: async () => { + setAnnouncement(""); + await queryClient.cancelQueries({ queryKey: agentsQueryKey }); + }, + mutationFn: async (agent: OAuthConnection) => { + const response = await authorizedFetch(`/api/auth/oauth/connections/${encodeURIComponent(agent.client_id)}/revoke`, { method: "POST" }); + if (!response.ok) throw new Error("Fanout could not disconnect this agent. Try again."); + }, + onSuccess: (_, agent) => { + queryClient.setQueryData<{ connections: OAuthConnection[] }>(agentsQueryKey, (data) => data && ({ connections: data.connections.filter((connection) => connection.client_id !== agent.client_id) })); + setSelected(null); + setAnnouncement(`${agent.client_name} disconnected.`); + }, + }); + + return + + Connected agents + Agents you have authorized to access Fanout through MCP. + + + {!agents.data + ? agents.isLoading + ? Loading connected agents… + : + }>Fanout could not load your connected agents. + + + : agents.data.connections.length === 0 + ? No agents connected. Connect an agent over MCP to get started. + : + {agents.data.connections.map((agent) => + + {agent.client_name} + Connected + + + )} + } + + {announcement} + !disconnect.isPending && setSelected(null)} title={`Disconnect ${selected?.client_name ?? "agent"}?`} centered radius="md"> + + This agent loses access immediately. Your other agents and browser session stay connected. You can authorize the agent again to reconnect. + {disconnect.isError && }>Fanout could not disconnect this agent. Try again.} + + + + + + + ; +} + /** Whether the exporter reaches this instance over TLS. * * Three things can say so: the process holds the certificate itself, the @@ -225,6 +295,7 @@ export default function Settings() { Sending telemetry covers SDK setup, the collector, and the OTLP/HTTP endpoint. + !rotate.isPending && setConfirming(false)} title={hasToken ? "Rotate the ingest token?" : "Issue an ingest token?"} centered radius="md"> diff --git a/ui/links.ts b/ui/links.ts index 7a0d483a..27110637 100644 --- a/ui/links.ts +++ b/ui/links.ts @@ -12,4 +12,5 @@ export const docs = { home: "https://fanout.run/start/what-fanout-is", /** Sending telemetry: endpoint, authentication, collector and SDK setup. */ ingest: "https://fanout.run/start/send-telemetry", + connect: "https://fanout.run/guides/connect-over-mcp", } as const;